======== Methods_ ======== -------------- Public Methods -------------- +-----------------------+-----------------------+-----------------------+ | getModel_ | newModel_ | openFile_ | +-----------------------+-----------------------+-----------------------+ | importFile_ | getTutorialFilePath_ | openTutorialFile_ | +-----------------------+-----------------------+-----------------------+ | importTutorialFile_ | getUnits_ | usingUnits_ | +-----------------------+-----------------------+-----------------------+ | getActiveProject_ | getMaterials_ | getSystemDirectory_ | +-----------------------+-----------------------+-----------------------+ | getSetting_ | setSetting_ | ishole_ | +-----------------------+-----------------------+-----------------------+ | runningInBatch_ | enableDebugMessaging_ | runInParallel_ | +-----------------------+-----------------------+-----------------------+ | resultsFormatOptions_ | | +-----------------------+-----------------------------------------------+ .. _getModel: .. method:: getModel() The root of the Inspire data model tree. Its not explicitly created. It exists as a singleton for the lifetime of the application. Multiple models may be supported in future releases. Use model.getChildren(...) to access all the descendent entities. Most types are stored as direct children of the model but Parts & Assemblies form a hierarchy. Use model.save(file) and inspire.openFile(file) to save/load the model contents. :returns: Model .. _newModel: .. method:: newModel() Clear the model resetting it back to its initial/empty state. :returns: Model .. _openFile: .. method:: openFile(file) Replace the current model with the saved one. :param file: Path to the file. :type file: str :returns: Model .. _importFile: .. method:: importFile(file) Imports and merges a saved model with the current model. The imported model is inserted as an assembly under the top-level folder in the Model Browser. :param file: Path to the file. :type file: str .. _getTutorialFilePath: .. method:: getTutorialFilePath(file) Returns the absolute path to a tutorial model give a relative path. :param file: Path relative to the tutorial_models directory. :type file: str :returns: pathlib.Path .. _openTutorialFile: .. method:: openTutorialFile(file) Opens the given input model from tutorial directory. :param file: Path relative to the tutorial_models directory. :type file: str :returns: Model .. _importTutorialFile: .. method:: importTutorialFile(file) Opens the model from the tutorials folder and add it to the active model. :param file: Path relative to the tutorial_models directory. :type file: str .. _getUnits: .. method:: getUnits() Returns the units manager that manage various unit systems used throughout the application. For internal use... Use `with inspire.usingUnits(...)` to get/set values in a certain unit system. :returns: UnitsManager .. _usingUnits: .. method:: usingUnits(system) Get or set data model values in specified unit system. :param system: Name of unit system: base: The default units when none is specified (MKS). gui: User selected units for display in the gui. solver: Used for converting numbers when exporting to a solver. Comes from: inspire.getSetting("Inspire/Units/Units/Model units") MKS, CGS, IPS,...: Name of system. See inspire.getUnits().gui.getSystemNames() for all options. :type system: str :returns: contextmanager .. _getActiveProject: .. method:: getActiveProject() .. _getMaterials: .. method:: getMaterials() Return a dictionary of defined material keys to the material name. :returns: dict[str, Material] .. _getSystemDirectory: .. method:: getSystemDirectory() Returns the path to the installation directory. :returns: pathlib.Path .. _getSetting: .. method:: getSetting(setting=None, mustExist=False) Returns the user preference value for a given setting. :param setting: The preference option path with '/'. :type setting: str :param mustExist: Raise exception if setting does not exist. :type mustExist: bool :returns: bool | int | float | str | None .. _setSetting: .. method:: setSetting(setting, value) Sets the user preference value for a given setting. :param setting: Path to preference option. :type setting: str :param value: :type value: bool | int | float | str .. _ishole: .. method:: ishole(f) Check if passed object is a round or partially round hole. Only applicable for FeatureCircular and FeatureCylindrical. False otherwise. :param feature: Part feature with type FeatureCylindrical, FeatureCircular..etc. :type feature: Feature :returns: bool .. _runningInBatch: .. method:: runningInBatch() Return True if the application runs in batch mode, False otherwise. :returns: Returns True in batch mode, else False. :rtype: bool .. _enableDebugMessaging: .. method:: enableDebugMessaging(level='ALL') Prints internal inspire messaging to command window. :param level: level defines the lowest level of messaging that should be seen. Defaults to ALL. Level can be, ERROR - prints internal inspire error messaging to command window. WARN - prints internal inspire warning messaging to command window. INFO - prints internal inspire error, warning and info messaging to command window. False - passed as boolean and disables all messaging. :type level: str .. _runInParallel: .. method:: runInParallel(raiseOnError=True) A context manager to use for running multiple analysis in paralell. Note: This can be used only for OptiStruct Analysis. :param raiseOnError: If True, raise error on any failed run. :type raiseOnError: bool .. _resultsFormatOptions: .. method:: resultsFormatOptions(**kwargs) Params: formatType = format type: default, legacy, fixed, scientific, mixed or custom formatStr = a printf-like format string, e.g. '%.2f', the format type will set to 'custom' if formatStr is provided formula = a formula to be used to convert the value, by default there will be used the formula related to the result type units = the units to be used for the output, by default the current units will be used convertValue = whether the value should be converted with the given/default formula/units showUnits = whether to show the units unitsDisplayName = the units to be shown, by default the current units will be used width = output width (excluding units) - except legacy and custom format types precision = precision - except legacy and custom format types stripSpaces = whether to remove leading and tailing spaces from the output removeTrailingZeros = whether to remove trailing zeroes fixedMinMax = (min, max) values for the mixed format, to be considered to switch to scientific format