======== Methods_ ======== -------------- Public Methods -------------- +-----------------------+-----------------------+-----------------------+ | getModel_ | newModel_ | openFile_ | +-----------------------+-----------------------+-----------------------+ | importFile_ | getTutorialFilePath_ | openTutorialFile_ | +-----------------------+-----------------------+-----------------------+ | importTutorialFile_ | getUnits_ | usingUnits_ | +-----------------------+-----------------------+-----------------------+ | getActiveProject_ | getMaterials_ | getSystemDirectory_ | +-----------------------+-----------------------+-----------------------+ | getSetting_ | setSetting_ | ishole_ | +-----------------------+-----------------------+-----------------------+ | runningInBatch_ | enableDebugMessaging_ | | +-----------------------+-----------------------+-----------------------+ .. _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