System (hwx.inspire)#
- class System(**kwds)#
Bases:
BaseSystem
System defines an orthonormal, right-handed coordinate system.
A part can be associated to the system.
Attribute Table# Name
Type
solverVariables
tuple
property
Position
history
namespace
str
property
project
hwfdmProject
property
units
variable_name
property
Method Table# Name
Description
destroy
(self)Delete the object removing it from the model.
getAllChildren
(self, type=None, **kwds)Returns a list of all children that matches the specified type.
Returns the child of the object which matches the specified unique name.
getChildren
(self, type=None, recursive=False, sorted=False, **kwds)Returns a list of children that is of the specified type.
getClass
(className)Get class by name.
getDependents
(self, recursive=False, **kwds)Get objects that reference this object through a Reference attribute.
getReferences
(self, recursive=False, **kwds)Get objects this object references through a Reference attribute.
getVariable
(self, propName)Get associated variable for the given property.
isa
(self, type=None, filter=None, name=None, wildcard=None, **kwds)Determines if the object matches the specified settings or not.
modelPositions
(self)Forces all objects to return the original model positions instead of the
move
(self, delta)Called when object moved by move tool.
rotate
(self, angle, axis=’X’)Rotate system along given axis at given angle.
setVariable
(self, propName, varName)Associate property to variable for named object.
Example
from hwx import inspire model = inspire.newModel() block = model.createSolidBlock(location=(0, 0, 0)) # create a system my_system = inspire.System() # system has no part print("Created one system and one block not associated") print("My system part: " + str(my_system.part)) # block is at position (0,0,0) print("Block position: " + str(block.location)) # attach system to block my_system.part = block print("") print("System and block associated") print("My system part: " + str(my_system.part)) # Do not move system with block my_system.moveWithPart = False print("") print("Move system with part: " + str(my_system.moveWithPart)) print("Block position: " + str(block.location)) print("My system location: " + str(my_system.location)) print("Moving block...") block.location = (1, 1, 1) print("Block position: " + str(block.location)) print("My system location: " + str(my_system.location)) # Move system with block my_system.moveWithPart = True print("") print("Move system with part: " + str(my_system.moveWithPart)) print("Block position: " + str(block.location)) print("My system location: " + str(my_system.location)) print("Moving block...") block.location = (3, 3, 3) print("Block position: " + str(block.location)) print("My system location: " + str(my_system.location)) inspire.fitView()
- rotate(angle, axis='X')#
Rotate system along given axis at given angle.
- Parameters:
angle (float) – Angle at which system is rotated.
axis (str) – Axis of rotation. - X - Y - Z
- class SystemType(value)#
Bases:
Enum
An enumeration.
Attribute Table# Name
Type
Axis
SystemType
Plane
SystemType
Point
SystemType
SystemType
- property active#
Returns or sets the object activeness.
Setting this on or off sets all children. Setting to True sets all the parents active too.
- destroy()#
Delete the object removing it from the model.
The object may come back due to an undo/redo.
- getAllChildren(type=None, **kwds)#
Returns a list of all children that matches the specified type.
- Parameters:
type (list[Named]) – Filter to use to get the children based on object type.
**kwds – Additional keyword arguments to match other attributes of the object.
- Returns:
The list of children that satisfy the supplied filters.
- Return type:
list[Union[Part, Motor, BoundaryCondition, …]]
- getAttribute(name)#
Returns the Attribute off the class, not the value.
- Parameters:
name (str) – Attribute name to find its class.
- getBrowserFolder(flatView) str | None #
Group objects by folder under getBrowserParent().
Use None for no folder.
Always specify a folder if flatView.
- getBrowserListenTo()#
Specify objects that gui attribute values depend on.
To make sure the Property Editor refreshes when they are modified.
- getBrowserName()#
Name shown in the Model Browser.
- getBrowserNameAddon()#
Specifies extra information about the object appended to its name in the Model Browser.
- getBrowserNameWithAddon()#
Name shown in the Model Browser with addon.
- getChild(name=None, recursive=False, **kwds)#
Returns the child of the object which matches the specified unique name.
- Parameters:
name (str) – The name of the child object.
recursive (bool) – Search all descendents.
**kwds – Additional keyword arguments to match attributes of the object.
- Returns:
The child object which satisfies the specified filters.
- Return type:
- getChildren(type=None, recursive=False, sorted=False, **kwds)#
Returns a list of children that is of the specified type.
- getContextMenu()#
Returns list of MenuItem objects to populate the context menu.
Also supports shorthand:
‘action name’
(text, callable),
(text, [sub menu])
‘-’ for section/separator line
- getDependents(recursive=False, **kwds)#
Get objects that reference this object through a Reference attribute.
- Parameters:
recursive (bool) –
**kwds – Filter objects using isa.
- Returns:
set[Named]
- getGuiValue(attr, **kwds)#
Get value formatted to be shown in the gui
- Parameters:
attr (str) – Attribute name to gets its gui value.
- Returns:
Returns a string of the value with its gui units, like “5 mm/s”.
- Return type:
str
- getIcon()#
Overload to specify different icons depending on the object.
- getReferences(recursive=False, **kwds)#
Get objects this object references through a Reference attribute.
- Parameters:
recursive (bool) –
**kwds – Filter objects using isa.
- Returns:
set[Named]
- getSecondaryIcon()#
Show a second icon next to primary icon in Model Browser tree. Commonly used to show warning icon widgetTaskWarning-12.png.
- getToolTip()#
Specifies the tooltip when object is hovered
- getValue(attr)#
Return the attribute value for passed attribute name.
- Parameters:
attr (String) – Attribute name to gets its value.
- Returns:
Returns the attribute value
- Return type:
str
- getVariable(propName)#
Get associated variable for the given property.
- Parameters:
propName (str) – Property name to get the associated variable.
- isBrowserNameModified(attr)#
Do we need to refresh the name in the Model Browser due to an onObjectModified?
- isa(type=None, filter=None, name=None, wildcard=None, **kwds)#
Determines if the object matches the specified settings or not.
- Parameters:
type (Union[Part, Assembly, Contact..]) – The type of the object.
filter (method) – Return value of specified callback method.
name (str) – Name that matches exactly with object name.
wildcard (str) – A pattern to match exactly with the object name.
**kwds – Additional keyword arguments to match other attributes.
- Returns:
True, if a match is found, otherwise False.
- Return type:
bool
- property location#
Origin of this system position as a Point.
- modelPositions()#
Forces all objects to return the original model positions instead of the current analysis positions.
Useful when defining draw methods on GeneralObjects where behaviour is different while animating.
- move(delta)#
Called when object moved by move tool.
- Parameters:
delta (math.Matrix44) –
- property moveWithPart#
Whether the system is moving with the associated part or not.
- property name#
Returns or sets the name of the object.
It can be any text string, including spaces, although it’s best to avoid using the following characters: “ ‘ * ? and $.
While these characters are allowed, they could create difficulties when you export the model to other applications.
- property origin#
The origin of this system in local coordinate system.
- property part#
The part associated with this system.
- property position#
The global transform as a Matrix44.
- setValue(attr, value)#
Alias for setattr (attr, value) :param attr: Attribute name to sets its value. :type attr: str :param value: Attribute value to set . :type value: str
- setValues(**kwds)#
Sets passed name/value pairs.
Values are set in a standard order (the order the attribute is defined on the class) which is required in certain cases when an attribute’s setter expects another attribute to have already been set. For example, setting a reference before a location that is wrt it.
- Parameters:
**kwds – Set attributes in one go.
- setVariable(propName, varName)#
Associate property to variable for named object.
- Parameters:
propName (str) – Property name to associate with variable.
varName (str) – The name of the variable to associate the attribute with.
- property suppress#
Returns True if the object is suppressed.
- Type:
bool
- property suppressible#
(bool) Show option to suppress object in the context menu.
Suppressed objects are deactivated (obj.active == False) so they don’t contribute to analyses.
The suppressed object will remain in the Model Browser (in a disabled state) so the user can unsuppress it.
Defaults to True
- property type#
The type of the system.
- property visible#
Determines whether the object is visible in the graphics window.
Setting this on or off sets all children. Setting to True sets all the parents visible too.
- wasValueSet(attr)#
Check if attribute was set
- Parameters:
attr (str) – Attribute name to check it value set or not
- Returns:
True, if value was set else false.
- Return type:
bool