Methods

Public Methods

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()

Clear the model resetting it back to its initial/empty state.

returns

Model

openFile(file)

Replace the current model with the saved one.

param file

Path to the file.

type file

str

returns

Model

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(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(file)

Opens the given input model from tutorial directory.

param file

Path relative to the tutorial_models directory.

type file

str

returns

Model

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()

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(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()
getMaterials()

Return a dictionary of defined material keys to the material name.

returns

dict[str, Material]

getSystemDirectory()

Returns the path to the installation directory.

returns

pathlib.Path

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(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(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()

Return True if the application runs in batch mode, False otherwise.

returns

Returns True in batch mode, else False.

rtype

bool

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