Model (hwx.inspire)#
- class Model(parent=None, **kwds)#
Bases:
Assembly
The active Inspire model. Model is a subclass of Assembly class.
It can be retrieved from and saved to a file. Is contains all the parts, joints, fasteners, load cases, and any other information required for its analysis.
# Name
Type
actuators
property
angularInitialConditions
property
property
property
property
property
property
coilSprings
property
construction
property
couplers
property
property
property
property
property
initialConditions
property
joints
property
property
property
property
motionAnalysisSettings
property
motionContacts
property
motionReviewSettings
property
motors
property
proximities
property
property
shapeVariables
property
property
property
torsionSprings
property
translationalInitialConditions
property
property
# Name
Description
getFilePath
(self)Returns absolute path of the model.
getSkinMesh
(self, parts, local=False)Returns a dictionary of parts to the skin mesh (nodes and faces).
save
(self, file, selected=[])Save the active model to the path specified in file.
switchToDesignParts
(self)Change all part alternatives to the design space
switchToOptimizedParts
(self, name)Change part alternatives to an optimized result.
updateContacts
(self, solver=’OptiStruct’, parts=None, searchDistance=None, visibleOnly=True, ignoreGroups=’rigid ground’, useExistingSearchDistances=True, penetrationTolerance=None, useExistingPenetrationTolerance=True, resolution=’Low’, useExistingResolution=True)Create or update contacts in model to account for part creation or
Example
from hwx import inspire model = inspire.openTutorialFile("Structures/baseline_oilpan.stmod") # show some model propeties print("Model name is: " + model.name) print("Model has " + str(len(model.parts)) + " parts") print("Model has " + str(len(model.joints)) + " joints") print("Model has " + str(len(model.loads)) + " load cases") print("Model mass is :" + str(model.mass)) # Add a part to the model cyl = model.createSolidCylinder(radius=0.01,height=0.1) # Check that model has a new part print("Model now has " + str(len(model.parts)) + " parts") inspire.fitView() # Demo for autoColor on file load. model.onFileLoadComplete.connect(model.autoColorParts) inspire.openTutorialFile('Motion/M01_FourBar.stmod') # To disconnect the signal. model.onFileLoadComplete.disconnect(model.autoColorParts)
- property limitNumberOfElements#
If True, limits the mesh size by number of elements.
- property numberOfElements#
Specifies the number of elements in the mesh.
- save(file, selected=[])#
Save the active model to the path specified in file. If selected only these get saved, similar to save selected in the Inspire application.
- property variables#
Variables used in sketching and geometry operations.
- property fasteners#
List of Fasteners in the model.
- property spotWelds#
List of SpotWelds in the model.
- property contacts#
List of Structures Contacts in the model.
- property loadCases#
List of LoadCases in the model.
- property systems#
List of Systems in the model.
- property measures#
List of Measures in the model.
- property rigidGroups#
List of RigidGroups in the model.
- property boundaryConditions#
List of BoundaryConditions in the model.
- property bushings#
List of Bushings in the model.
- property loads#
List of BoundaryConditions in the model.
- property holes#
A list of all the holes in the model.
- property cavities#
A list of all the cavities in the model.
- property currentLoadCase#
The LoadCase in which new loads will be added.
- property gravityComponents#
Returns gravity acceleration vector.
- property gravityMagnitude#
Returns or sets gravity acceleration scalar.
- property gravityDirection#
Returns or sets unitless gravity direction. May not be normalized.
- property contactSearchDistance#
The default searchDistance when calling updateContacts. Set to None to reset back to the auto-calculated default.
- property contactPenetrationTolerance#
The default penetration tolerance when calling updateContacts. Set to None to reset back to the auto-calculated default.
- property contactResolution#
The default Resolution when calling updateContacts. Set to None to reset back to Low.
- updateContacts(solver='OptiStruct', parts=None, searchDistance=None, visibleOnly=True, ignoreGroups='rigid ground', useExistingSearchDistances=True, penetrationTolerance=None, useExistingPenetrationTolerance=True, resolution='Low', useExistingResolution=True)#
Create or update contacts in model to account for part creation or movement.
Always call before querying Contact objects.
Note that this may also delete contacts, for example between grounded parts.
- Parameters:
solver (str | None) – OptiStruct, SimSolid None uses preference: Run Options -> Analysis solver.
parts (list[Part]) – Limit contact finding to specified parts.
searchDistance (float) – Contact gap tolerance. Use ‘auto’ for auto calculated default. Defaults to model.contactSearchDistance.
visibleOnly (bool) – Search only visible parts.
ignoreGroups (rigid ground) – Ignores the group parts during contact updates.
useExistingSearchDistances (bool) – Don’t update already existing contacts.
- Only relevant for SimSolid contacts:
- penetrationTolerance (float)Penetration gap tolerance.
Use ‘auto’ for auto calculated default. Defaults to model.contactPenetrationTolerance.
- useExistingPenetrationTolerance(bool)Don’t update already existing penetration
tolerance.
resolution (str) : Contacts density. It can be Low, Medium, High. useExistingResolution (bool) : Don’t update already existing resolution.
- Returns:
True, if contacts where updated successfully else False.
- Return type:
bool
- getSkinMesh(parts, local=False)#
Returns a dictionary of parts to the skin mesh (nodes and faces).
- Parameters:
parts (list[Part]) – Specify the parts to skin mesh.
local (bool) – If True, uses the local part collection, else occurrence collection. Recommended to use as defaults.
- Returns:
Dictionary of parts to the skin mesh (nodes and faces).
- Return type:
dict
- switchToDesignParts()#
Change all part alternatives to the design space
- switchToOptimizedParts(name)#
Change part alternatives to an optimized result.
- Parameters:
name (str) – The name of the optimization to switch to.
- property animating#
Set to true before setting part animationPositions.
- Type:
bool
- property animationCache#
Dict to cache in for the duration of the animation.
- Type:
dict
- getFilePath()#
Returns absolute path of the model.