LoadCase (hwx.inspire)#
- class LoadCase(loads=[], name='', type='LINEAR_STATIC', linkedLoadCase=None, **kwds)#
Bases:
Named
A collection of BoundaryConditions/Grounded PartsConnectors (Fastener, Joint).
The same BoundaryConditions/Grounded PartsConnectors can appear in multiple LoadCases, while duplicates are not allowed.
Attribute Table# Name
Type
property
property
property
property
property
property
property
property
Method Table# Name
Description
add
(self, items)Adds one or more BoundaryConditions/Grounded PartsConnectors to this load case.
addPretensionGroup
(self, pretensionGroup)Adds a pretension group to this load case.
getPretensionForce
(self, fastener)Get/Set the pretension force to the fastener group.
remove
(self, items)Removes one or more BoundaryConditions/Grounded PartsConnectors to this load case.
removePretensionGroup
(self, pretensionGroup)Removes a pretension group from this load case.
setPretensionForce
(self, fastener, value)Set the pretension force to the fastener group.
- class Type(value)#
Bases:
Enum
An enumeration.
Attribute Table# Name
Type
BUCKLING_LINEAR
Type
LINEAR_STATIC
Type
MODAL
Type
PRESTRESS_MODAL
Type
- property solutionSettings#
The solution settings for the load case.
Example
from hwx import inspire from hwx.inspire.demo import openDemoFile, getDemoFilePath # Use the getDemoFilePath function to get the absoulte path to the demo file named "dangler_with_holes.stmod" filepath = getDemoFilePath(file="dangler_with_holes.stmod") model = inspire.openFile(file = filepath) lc = model.getChild(type='LoadCase', name ='Load Case 1') #get the solution settings of the load case ss= lc.solutionSettings print(f"Solution Settings of {lc.name} has follow properties:") print(f"Method: {ss.method}") print(f"Solution Adaption: {ss.solutionAdaption}") print(f"Number of Groups: {ss.getNoOfGroups()}") inspire.orientView(direction="isometric")
- property type#
Get the type of the load case
This property retrieves the type of the load case, which determines the analysis method used (e.g., LINEAR_STATIC, BUCKLING_LINEAR, MODAL, PRESTRESS_MODAL ).
- Returns:
The type of the load case.
- Return type:
str
Example
from hwx import inspire from hwx.inspire.demo import openDemoFile, getDemoFilePath # Use the getDemoFilePath function to get the absoulte path to the demo file named "dangler_with_holes.stmod" filepath = getDemoFilePath(file="dangler_with_holes.stmod") model = inspire.openFile(file = filepath) lc = model.getChild(type='LoadCase', name ='Load Case 1') #get the type of the load case print(f"The type of the load case {lc.name} is: {lc.type}.") inspire.orientView(direction="isometric")
- property modes#
Get/Sets the number of modes included in the analysis.
It is only valid for BUCKLING_LINEAR, MODAL, PRESTRESS_MODAL load case types.
Example
# Get/Sets the number of modes included in the analysis. # It is only valid for BUCKLING_LINEAR, MODAL, PRESTRESS_MODAL load case types. from hwx import inspire from hwx.inspire.demo import openDemoFile, getDemoFilePath # Use the getDemoFilePath function to get the absoulte path to the demo file named "dangler_with_holes.stmod" filepath = getDemoFilePath(file="dangler_with_holes.stmod") model = inspire.openFile(file = filepath) lc = model.getChild(type='LoadCase', name ='Load Case 1') # get the type of the load case print(f"The type of the load case {lc.name} is: {lc.type}.") # To create a BUCKLING LINEAR load case, you can compulsory have a linked LINEAR_STATIC load case. lc1 = inspire.LoadCase(type='BUCKLING_LINEAR',linkedLoadCase=lc, name='Buckling 1') # Alternatively, you can get an existing load case by its name lc1 = model.getChild(type='LoadCase', name='Buckling 1') # Set the number of modes to be included in the analysis lc1.modes = 5 # get the number of modes in the load case print(f"The number of modes in the load case {lc1.name} is: {lc1.modes}.") #similar to the above example, you can set the number of modes for the load case # of type MODAL or PRESTRESS_MODAL # To create a Modal Prestress load case, you can compulsory have a linked LINEAR_STATIC load case. lc2 = inspire.LoadCase(type='PRESTRESS_MODAL',linkedLoadCase=lc, name='Modal Prestress 1') # Alternatively, you can get an existing load case by its name lc2 = model.getChild(type='LoadCase', name='Modal Prestress 1') # Set the number of modes to be included in the analysis lc2.modes = 4 # get the number of modes in the load case print(f"The number of modes in the load case {lc2.name} is: {lc2.modes}.") #similar to the above example, you can set the number of modes for the load case # of type 'MODAL' # To create a modal load case, you can either have a linked LINEAR_STATIC load case # or not to have a linked load case. lc3 = inspire.LoadCase(type='MODAL',linkedLoadCase=lc, name='Modal 1') # Alternatively, you can get an existing load case by its name lc3 = model.getChild(type='LoadCase', name='Modal 1') # Set the number of modes to be included in the analysis lc3.modes = 6 # get the number of modes in the load case print(f"The number of modes in the load case {lc3.name} is: {lc3.modes}.") inspire.orientView(direction="isometric")
- property scaleFactor#
Get/set the scaling factor for the load case.
The scale factor is used to scale the applied loads in the load case. This property is only applicable for certain load case types.
- Returns:
The scale factor value.
- Return type:
float
Example
from hwx import inspire # Strar t with an empty model model = inspire.newModel() # Alternatively, you can get an existing model #model = inspire.getModel() # create a solid block part box = model.createSolidBlock(x=0.1, y=0.1, z=0.1) # create a load case of type 'LINEAR_STATIC' to hold loads/constraints lc = inspire.LoadCase(type='LINEAR_STATIC',name = 'Linear Static 1') # alternatively you get existing load case by its name lc = model.getChild(type='LoadCase', name='Linear Static 1') if lc is None: raise ValueError("Load case 'Linear Static 1' does not exist. Please create it before accessing.") # FeatureArea index order (isometric view) 0: top, 1: right, 2: front, 3: left, 4: bottom, 5: back # Query the bottom face (index 4) of the box part. feat1 = box.getFeatures(type='FeatureArea')[4] support = inspire.Constraint(features=feat1,loadCase=lc) #query zeroth index feature area (top face) from the box part feat2 = box.getFeatures(type='FeatureArea')[0] # create a force of magnitude 100 N on the first feature area # and add it to the load case force = inspire.Force(features=feat2, magnitude=100.0, loadCase=lc) # Set the scale factor to a float value # This is useful when you want to scale the loads in the load case # Loads can be Force, Torque, Pressure, EnforcedDisplacement, Rotation, # GLoad, Temperature. lc.scaleFactor = 10 # Now the force in the load case will realize as 1000 N (100 N * 10) # while running the analysis or optimization. print(f"The current scale factor of the load case 'Linear Static 1' is: {lc.scaleFactor}") # Create a torque with 50 Nmon a front face (index 2) of the box part feat3 = box.getFeatures(type='FeatureArea')[2] torque = inspire.Torque(features=feat3, magnitude=50, loadCase=lc) #create a pressure with 200 Pa on the left face (index 3) of the box part feat4 = box.getFeatures(type='FeatureArea')[3] pressure = inspire.Pressure(features=feat4, magnitude=200, loadCase=lc) # With the scale factor of 10, the torque will realize as 500 Nm (50 Nm * 10) # and the pressure will realize as 2000 Pa (200 Pa * 10). # Set the view direction to isometric for better visualization of the load case inspire.orientView(direction='isometric')
- property inertiaRelief#
Get/Set the inertia relief setting for the load case.
Inertia relief is used for runs with no supports. It allows the model to simulate free-body motion by balancing the applied loads with inertial forces.
- Returns:
True if inertia relief is enabled, False otherwise.
- Return type:
bool
Example
# Get/Sets the inertia Relief to a LINEAR_STATIC loadcase type. # It is not applicable for BUCKLING_LINEAR, MODAL, PRESTRESS_MODAL load case types. from hwx import inspire from hwx.inspire.demo import openDemoFile, getDemoFilePath # Use the getDemoFilePath function to get the absoulte path to the demo file named "dangler_with_holes.stmod" filepath = getDemoFilePath(file="dangler_with_holes.stmod") model = inspire.openFile(file = filepath) lc = model.getChild(type='LoadCase', name ='Load Case 1') # get the type of the load case print(f"The type of the load case {lc.name} is: {lc.type}.") # Set the inertia relief to False lc.inertiaRelief = False print(f"The inertia relief of the load case {lc.name} is set to: {lc.inertiaRelief}.") lc.inertiaRelief = True # Set the inertia relief to True print(f"The inertia relief of the load case {lc.name} is set to: {lc.inertiaRelief}.") # Inertia relief is not applicable for BUCKLING_LINEAR, MODAL, PRESTRESS_MODAL load case types. inspire.orientView(direction="isometric")
- property linkedLoadCase#
Get/set the linked load case for the current load case.
Applicable for BUCKLING_LINEAR and PRESTRESS_MODAL load case types.
Example
from hwx import inspire from hwx.inspire.demo import openDemoFile, getDemoFilePath # Use the getDemoFilePath function to get the absoulte path to the demo file named "dangler_with_holes.stmod" filepath = getDemoFilePath(file="dangler_with_holes.stmod") model = inspire.openFile(file = filepath) lc = model.getChild(type='LoadCase', name ='Load Case 1') # get the type of the load case print(f"The type of the load case {lc.name} is: {lc.type}.") # linkedLoadCase is used to link a load case to another load case. # It is only applicable for BUCKLING_LINEAR, MODAL, PRESTRESS_MODAL load case types. # To create a BUCKLING_LINEAR load case, you can compulsory have a linked LINEAR_STATIC load case. lc1 = inspire.LoadCase(linkedLoadCase=lc, type='BUCKLING_LINEAR', name='Buckling 1') # Alternatively, you can get an existing load case by its name lc1 = model.getChild(type='LoadCase', name='Buckling 1') print(f"{lc1.name} load case is linked to {lc1.linkedLoadCase}") # To create a Modal Prestress load case, you can compulsory have a linked LINEAR_STATIC load case. lc2 = inspire.LoadCase(linkedLoadCase=lc, type='PRESTRESS_MODAL', name='Modal Prestress 1') # Alternatively, you can get an existing load case by its name lc2 = model.getChild(type='LoadCase', name='Modal Prestress 1') print(f"{lc2.name} load case is linked to {lc2.linkedLoadCase}") # To create a modal load case, you can either have a linked LINEAR_STATIC load case # or not to have a linked load case. it not mandatory to have a linked load case. lc3 = inspire.LoadCase(linkedLoadCase=lc, type='MODAL', name='Modal 1') # Alternatively, you can get an existing load case by its name lc3 = model.getChild(type='LoadCase', name='Modal 1') print(f"{lc3.name} load case is linked to {lc3.linkedLoadCase}") lc4 = inspire.LoadCase(type='LINEAR_STATIC', name='Linear Static 2') # Alternatively, you can get an existing load case by its name lc4 = model.getChild(type='LoadCase', name='Linear Static 2') # How to change the linked load case of a load case type BUCKLING_LINEAR, MODAL, PRESTRESS_MODAL # you can set only the load case type 'LIEAR_STATIC' as a linkedLoadCase. lc2.linkedLoadCase = lc4 print(f"Now, {lc2.name} load case is linked to {lc2.linkedLoadCase}") inspire.orientView(direction="isometric")
- property loads#
The list of BoundaryConditions/Grounded PartsConnectors of this loadcase.
Example
from hwx import inspire from hwx.inspire.demo import openDemoFile, getDemoFilePath # Use the getDemoFilePath function to get the absoulte path to the demo file named "dangler_with_holes.stmod" filepath = getDemoFilePath(file="dangler_with_holes.stmod") model = inspire.openFile(file = filepath) lc = model.getChild(type='LoadCase', name ='Load Case 1') # get the type of the load case print(f"The type of the load case {lc.name} is: {lc.type}.") print(f"The type of the load case {lc.name} is: {lc.loads}.") inspire.orientView(direction="isometric")
- add(items)#
Adds one or more BoundaryConditions/Grounded PartsConnectors to this load case.
- Parameters:
items (Union[Union[BoundaryCondition, PartsConnector], list[Union[BoundaryCondition, PartsConnector]]]) – List of entities to add to loadcase.
- Returns:
Returns True, if added to load case, else False.
- Return type:
bool
Example
from hwx import inspire # Strar t with an empty model model = inspire.newModel() # Alternatively, you can get an existing model #model = inspire.getModel() # create a solid block part box = model.createSolidBlock(x=0.1, y=0.1, z=0.1) # create a load case of type 'LINEAR_STATIC' to hold loads/constraints lc = inspire.LoadCase(type='LINEAR_STATIC',name = 'Linear Static 1') # alternatively you get existing load case by its name lc = model.getChild(type='LoadCase', name='Linear Static 1') if lc is None: raise ValueError("Load case 'Linear Static 1' does not exist. Please create it before accessing.") # FeatureArea index order (isometric view) 0: top, 1: right, 2: front, 3: left, 4: bottom, 5: back # Query the bottom face (index 4) of the box part. feat1 = box.getFeatures(type='FeatureArea')[4] support = inspire.Constraint(features=feat1) # Add the support to the load case lc.add(items=support) # Alternatively, you can add the load case while creating the constraint # support = inspire.Constraint(features=feat1, loadCase=lc) # Either way works. but adding loads and constraints to the load case is strictly mandatary. #query zeroth index feature area (top face) from the box part feat2 = box.getFeatures(type='FeatureArea')[0] # create a force of magnitude 100 N on the first feature area # and add it to the load case force = inspire.Force(features=feat2, magnitude=100.0, loadCase=lc) # Add the force to the load case lc.add(items =force) inspire.orientView(direction='isometric')
- remove(items)#
Removes one or more BoundaryConditions/Grounded PartsConnectors to this load case.
- Parameters:
items (Union[Union[BoundaryCondition, PartsConnector], list[Union[BoundaryCondition, PartsConnector]]]) – List of entities to add to loadcase.
- Returns:
Returns True, if removed from load case, else False.
- Return type:
bool
Example
from hwx import inspire # Strar t with an empty model model = inspire.newModel() # Alternatively, you can get an existing model #model = inspire.getModel() # create a solid block part box = model.createSolidBlock(x=0.1, y=0.1, z=0.1) # create a load case of type 'LINEAR_STATIC' to hold loads/constraints lc = inspire.LoadCase(type='LINEAR_STATIC',name = 'Linear Static 1') lc1 = inspire.LoadCase(type='LINEAR_STATIC',name = 'Linear Static 2') # alternatively you get existing load case by its name lc = model.getChild(type='LoadCase', name='Linear Static 1') if lc is None: raise ValueError("Load case 'Linear Static 1' does not exist. Please create it before accessing.") # FeatureArea index order (isometric view) 0: top, 1: right, 2: front, 3: left, 4: bottom, 5: back # Query the bottom face (index 4) of the box part. feat1 = box.getFeatures(type='FeatureArea')[4] support = inspire.Constraint(features=feat1) #query zeroth index feature area (top face) from the box part feat2 = box.getFeatures(type='FeatureArea')[0] # create a force of magnitude 100 N on the first feature area # and add it to the load case force = inspire.Force(features=feat2, magnitude=100.0) # adding the support and force to the Linear Static 1 lc1.add(items=[force,support]) # adding the support and force to the Linear Static 2 # removing the force and support from the Linear Static 1 lc.remove(items=[support,support]) # removing the force from the Linear Static 2 lc1.remove(items=[force]) inspire.orientView(direction='isometric')
- addPretensionGroup(pretensionGroup)#
Adds a pretension group to this load case.
- Parameters:
pretensionGroup (PretensionGroup) – Pretension group to be added to load case.
Example
#Pretension # Applying pretension to fasteners (bolted and screwed connections) allows a more complete # understanding of the behavior of a structure. # Altair Inspire with OptiStruct does not support frequency response with pretension. # Altair Inspire with SimSolid does not support sequential loading with pretension. from hwx import inspire from hwx.inspire.demo import openDemoFile model = openDemoFile("dangler_with_holes.stmod") # to query the the holes in the model holes = model.holes # Creating fasteners for pretension group. fasteners =[] for aligned_holes in holes.aligned: bolt = inspire.Fastener(connection=aligned_holes, color="green") fasteners.append(bolt) # Alternatively, you can get all existing fasteners from the model fasteners = model.getChildren(type='Fastener') # Creating Pretension Group # A pretension group is a collection of fasteners. # Each fastener in the group can have a different pretension force. pretensionGroup = inspire.PretensionGroup(fasteners=fasteners, name = 'Pretension Group 1') # Alternatively, you can get an existing pretension group by its name pretensionGroup = model.getChild(type='PretensionGroup', name='Pretension Group 1') # how to get fastensers in the pretension group fasteners_in_group = pretensionGroup.fasteners # How to get the pretension force magnidute for each fastener in the pretension group for fastener in fasteners_in_group: print(f"{fastener.name} in {pretensionGroup.name} has pretension magnitude of {pretensionGroup.getPretensionForce(fastener)}.") # How to set the pretension force magnitude for each fastener in the pretension group for fastener in fasteners_in_group: pretensionGroup.setPretensionForce(fastener,1000) print(f"{fastener.name} in {pretensionGroup.name}'s pretension magnitude is set to {pretensionGroup.getPretensionForce(fastener)}.") # Adding the pretension group to the Load Case 1 lc = model.getChild(type='LoadCase', name='Load Case 1') # Adding the pretension group to the load case # Now the pretension group will be added to the load case and the fasteners will have the specified pretension force lc.addPretensionGroup(pretensionGroup) # Alternatively, you can create a new load case named 'Linear Static 2' and add the pretension group to it lc2 = inspire.LoadCase(name='Linear Static 2') lc2.addPretensionGroup(pretensionGroup) inspire.orientView(direction="isometric")
- removePretensionGroup(pretensionGroup)#
Removes a pretension group from this load case.
- Parameters:
pretensionGroup (PretensionGroup) – Pretension group to be removed from load case.
Example
#Pretension # Applying pretension to fasteners (bolted and screwed connections) allows a more complete # understanding of the behavior of a structure. # Altair Inspire with OptiStruct does not support frequency response with pretension. # Altair Inspire with SimSolid does not support sequential loading with pretension. from hwx import inspire from hwx.inspire.demo import openDemoFile model = openDemoFile("dangler_with_holes.stmod") # to query the the holes in the model holes = model.holes # Creating fasteners for pretension group. fasteners =[] for aligned_holes in holes.aligned: bolt = inspire.Fastener(connection=aligned_holes, color="green") fasteners.append(bolt) # Alternatively, you can get all existing fasteners from the model fasteners = model.getChildren(type='Fastener') # Creating Pretension Group # A pretension group is a collection of fasteners. # Each fastener in the group can have a different pretension force. pretensionGroup = inspire.PretensionGroup(fasteners=fasteners, name = 'Pretension Group 1') # Alternatively, you can get an existing pretension group by its name pretensionGroup = model.getChild(type='PretensionGroup', name='Pretension Group 1') # how to get fastensers in the pretension group fasteners_in_group = pretensionGroup.fasteners # How to get the pretension force magnidute for each fastener in the pretension group for fastener in fasteners_in_group: print(f"{fastener.name} in {pretensionGroup.name} has pretension magnitude of {pretensionGroup.getPretensionForce(fastener)}.") # How to set the pretension force magnitude for each fastener in the pretension group for fastener in fasteners_in_group: pretensionGroup.setPretensionForce(fastener,1000) print(f"{fastener.name} in {pretensionGroup.name}'s pretension magnitude is set to {pretensionGroup.getPretensionForce(fastener)}.") # Adding the pretension group to the Load Case 1 lc = model.getChild(type='LoadCase', name='Load Case 1') # Adding the pretension group to the load case # Now the pretension group will be added to the load case and the fasteners will have the specified pretension force lc.addPretensionGroup(pretensionGroup) # Alternatively, you can create a new load case named 'Linear Static 2' and add the pretension group to it lc2 = inspire.LoadCase(name='Linear Static 2') lc2.addPretensionGroup(pretensionGroup) inspire.orientView(direction="isometric")
- getPretensionForce(fastener)#
Get/Set the pretension force to the fastener group.
- Parameters:
fastener (Fastener) – Fastener to get the force.
- Returns:
Pretension force of the fastener group.
- Return type:
float
Example
#Pretension # Applying pretension to fasteners (bolted and screwed connections) allows a more complete # understanding of the behavior of a structure. # Altair Inspire with OptiStruct does not support frequency response with pretension. # Altair Inspire with SimSolid does not support sequential loading with pretension. from hwx import inspire from hwx.inspire.demo import openDemoFile model = openDemoFile("dangler_with_holes.stmod") # to query the the holes in the model holes = model.holes # Creating fasteners for pretension group. fasteners =[] for aligned_holes in holes.aligned: bolt = inspire.Fastener(connection=aligned_holes, color="green") fasteners.append(bolt) # Alternatively, you can get all existing fasteners from the model fasteners = model.getChildren(type='Fastener') # Creating Pretension Group # A pretension group is a collection of fasteners. # Each fastener in the group can have a different pretension force. pretensionGroup = inspire.PretensionGroup(fasteners=fasteners, name = 'Pretension Group 1') # Alternatively, you can get an existing pretension group by its name pretensionGroup = model.getChild(type='PretensionGroup', name='Pretension Group 1') # how to get fastensers in the pretension group fasteners_in_group = pretensionGroup.fasteners # How to get the pretension force magnidute for each fastener in the pretension group for fastener in fasteners_in_group: print(f"{fastener.name} in {pretensionGroup.name} has pretension magnitude of {pretensionGroup.getPretensionForce(fastener)}.") inspire.orientView(direction="isometric")
- setPretensionForce(fastener, value)#
Set the pretension force to the fastener group.
- Parameters:
fastener (Fastener) – Fastener to set the force.
value (float) – Pretension force to be set.
Example
#Pretension # Applying pretension to fasteners (bolted and screwed connections) allows a more complete # understanding of the behavior of a structure. # Altair Inspire with OptiStruct does not support frequency response with pretension. # Altair Inspire with SimSolid does not support sequential loading with pretension. from hwx import inspire from hwx.inspire.demo import openDemoFile, demoFilePath # Use the demoFilePath function to get the absoulte path to the demo file named "dangler_with_holes.stmod" filepath = demoFilePath("dangler_with_holes.stmod") model = inspire.openFile(file = filepath) # to query the the holes in the model holes = model.holes # Creating fasteners for pretension group. fasteners =[] for aligned_holes in holes.aligned: bolt = inspire.Fastener(connection=aligned_holes, color="green") fasteners.append(bolt) # Alternatively, you can get all existing fasteners from the model fasteners = model.getChildren(type='Fastener') # Creating Pretension Group # A pretension group is a collection of fasteners. # Each fastener in the group can have a different pretension force. pretensionGroup = inspire.PretensionGroup(fasteners=fasteners, name = 'Pretension Group 1') # Alternatively, you can get an existing pretension group by its name pretensionGroup = model.getChild(type='PretensionGroup', name='Pretension Group 1') # how to get fastensers in the pretension group fasteners_in_group = pretensionGroup.fasteners # How to get the pretension force magnidute for each fastener in the pretension group for fastener in fasteners_in_group: print(f"{fastener.name} in {pretensionGroup.name} has pretension magnitude of {pretensionGroup.getPretensionForce(fastener)}.") # How to set the pretension force magnitude for each fastener in the pretension group for fastener in fasteners_in_group: pretensionGroup.setPretensionForce(fastener,1000) print(f"{fastener.name} in {pretensionGroup.name}'s pretension magnitude is set to {pretensionGroup.getPretensionForce(fastener)}.") inspire.orientView(direction="isometric")
- property pretensionEnabled#
Get if the pretension is enabled for the load case.
Example
#Pretension # Applying pretension to fasteners (bolted and screwed connections) allows a more complete # understanding of the behavior of a structure. # Altair Inspire with OptiStruct does not support frequency response with pretension. # Altair Inspire with SimSolid does not support sequential loading with pretension. # pretensionEnabled is read-only property that indicates whether the pretension is enabled for the load case. from hwx import inspire from hwx.inspire.demo import openDemoFile model = openDemoFile("dangler_with_holes.stmod") # to query the the holes in the model holes = model.holes # Creating fasteners for pretension group. fasteners =[] for aligned_holes in holes.aligned: bolt = inspire.Fastener(connection=aligned_holes, color="green") fasteners.append(bolt) # Alternatively, you can get all existing fasteners from the model fasteners = model.getChildren(type='Fastener') # Creating Pretension Group # A pretension group is a collection of fasteners. # Each fastener in the group can have a different pretension force. pretensionGroup = inspire.PretensionGroup(fasteners=fasteners, name = 'Pretension Group 1') # Alternatively, you can get an existing pretension group by its name pretensionGroup = model.getChild(type='PretensionGroup', name='Pretension Group 1') # how to get fastensers in the pretension group fasteners_in_group = pretensionGroup.fasteners # How to get the pretension force magnidute for each fastener in the pretension group for fastener in fasteners_in_group: print(f"{fastener.name} in {pretensionGroup.name} has pretension magnitude of {pretensionGroup.getPretensionForce(fastener)}.") # How to set the pretension force magnitude for each fastener in the pretension group for fastener in fasteners_in_group: pretensionGroup.setPretensionForce(fastener,1000) print(f"{fastener.name} in {pretensionGroup.name}'s pretension magnitude is set to {pretensionGroup.getPretensionForce(fastener)}.") # Adding the pretension group to the Load Case 1 lc = model.getChild(type='LoadCase', name='Load Case 1') # Adding the pretension group to the load case # Now the pretension group will be added to the load case and the fasteners will have the specified pretension force lc.addPretensionGroup(pretensionGroup) # Alternatively, you can create a new load case named 'Linear Static 2' and add the pretension group to it lc2 = inspire.LoadCase(name='Linear Static 2') lc2.addPretensionGroup(pretensionGroup) print(f"{lc2.name}'s pretension enabled status is {lc2.pretensionEnabled}.") inspire.orientView(direction="isometric")
- class Group(groupIface)#
Bases:
object
Groups are collection of parts that can be used to apply solution settings.
Solution Settings such as refinement level, adapt to features, and adapt to thin solids can be applied globally to the entire assembly or locally to individual groups of parts.
This allows you to first determine the overall system response, then quickly drill-in to specific areas of interest.
Attribute Table# Name
Type
property
property
property
property
- property entities#
Get/sets the parts of the group.
- Parameters:
val (list[Part]) – Parts to be added to the group.
Example
from hwx import inspire #you can get an existing model model = inspire.getModel() # Alternatively, Start with an empty model # model = inspire.newModel() box = model.createSolidBlock(x=0.1, y=0.1, z=0.1) # create a load case to hold supports loadcaseSupports = inspire.LoadCase(name="Supports") # alternatively you get existing load case by it's name lc = model.getChild(type= 'LoadCase', name="Supports") # to get all the load cases in the model lcs = model.getChildren(type="LoadCase" ) support1 = inspire.Constraint(features=box.getFeatures(type='FeatureArea')[0]) loadcaseSupports.add(support1) print(f"BCs in LoadCase: {loadcaseSupports.name}") print(f"LoadCase Type: {loadcaseSupports.type}") print(f"Scale Factor: {loadcaseSupports.scaleFactor}") print(f"Use Inertia Relief: {loadcaseSupports.inertiaRelief}") print(" ", loadcaseSupports.loads) # Load Case solution settings ss = loadcaseSupports.solutionSettings print("Below are the solution settings properties:") print(f"Method: {ss.method}") print(f"Solution Adaption: {ss.solutionAdaption}") print(f"No of Groups: {len(ss.getAllGroups())}") # get the first solution settings group g1 = ss.getGroup(index=0) print("Below are the group properties for solution settings:") print(f"Entities: {g1.entities}") print(f"Adapt to Feature: {g1.adaptToFeature}") print(f"Adapt to Thin Solid: {g1.adaptToThinSolid}") print(f"Refinement Level: {g1.refinementLevel}") # By default, the method is set to "Global" # and solution adaption is set to 3 # refinement level is set to 'STANDARD' # adaptToThinSolid is set to True # adaptToFeature is set to False # entities are the the list of participating part. # By default, the entities are set to all the parts in the model to group 1. #To change the entities value method must be set to "Global+Local" ss.method = "Global+Local" # to get all the groups from the solution settings of the load case groups = ss.getAllGroups() # to get the entities of each group # you can loop through the groups and get the entities # entities are the the list of participating part. for index, group in enumerate (groups): print(f"Group {index}'s Entities: {group.entities}") # to change the entities of the group # you can set the entities to a list of parts # get the first group group = ss.getGroup(index=0) group.entities = model.parts print("Below are the group properties for solution settings:") print(f"Entities: {group.entities}") inspire.orientView(direction="isometric")
- property adaptToFeature#
Get/sets the adapt to feature setting of the group.
- Parameters:
val (bool) – The value to set for the adapt to feature setting for a group.
Example
from hwx import inspire #you can get an existing model model = inspire.getModel() # Alternatively, Start with an empty model # model = inspire.newModel() box = model.createSolidBlock(x=0.1, y=0.1, z=0.1) # create a load case to hold supports loadcaseSupports = inspire.LoadCase(name="Supports") # alternatively you get existing load case by it's name lc = model.getChild(type= 'LoadCase', name="Supports") # to get all the load cases in the model lcs = model.getChildren(type="LoadCase" ) support1 = inspire.Constraint(features=box.getFeatures(type='FeatureArea')[0]) loadcaseSupports.add(support1) print(f"BCs in LoadCase: {loadcaseSupports.name}") print(f"LoadCase Type: {loadcaseSupports.type}") print(f"Scale Factor: {loadcaseSupports.scaleFactor}") print(f"Use Inertia Relief: {loadcaseSupports.inertiaRelief}") print(" ", loadcaseSupports.loads) # Load Case solution settings ss = loadcaseSupports.solutionSettings print("Below are the solution settings properties:") print(f"Method: {ss.method}") print(f"Solution Adaption: {ss.solutionAdaption}") print(f"No of Groups: {len(ss.getAllGroups())}") # get the first solution settings group g1 = ss.getGroup(index=0) print("Below are the group properties for solution settings:") print(f"Entities: {g1.entities}") print(f"Adapt to Feature: {g1.adaptToFeature}") print(f"Adapt to Thin Solid: {g1.adaptToThinSolid}") print(f"Refinement Level: {g1.refinementLevel}") # By default, the method is set to "Global" # and solution adaption is set to 3 # refinement level is set to 'STANDARD' # adaptToThinSolid is set to True # adaptToFeature is set to False #To change the adaptToFeature value method must be set to "Global+Local" ss.method = "Global+Local" # to get all the groups in the model groups = ss.getAllGroups() # to change the adaptToFeature of all the groups # you can loop through the groups and set the adaptToFeature for group in groups: group.refinementLevel ='HIGH' #similarly you can change the adaptToFeature and adaptToThinSolid group.adaptToThinSolid = True group.adaptToFeature = True print("Below are the group properties for solution settings:") print(f"Entities: {group.entities}") print(f"Adapt to Feature: {group.adaptToFeature}") print(f"Adapt to Thin Solid: {group.adaptToThinSolid}") print(f"Refinement Level: {group.refinementLevel}") inspire.orientView(direction="isometric")
- property adaptToThinSolid#
Get/sets the adapt to thin solid setting of the group.
- Parameters:
val (bool) – The value to set for the adapt to thin solid setting for a group.
Example
from hwx import inspire #you can get an existing model model = inspire.getModel() # Alternatively, Start with an empty model # model = inspire.newModel() box = model.createSolidBlock(x=0.1, y=0.1, z=0.1) # create a load case to hold supports loadcaseSupports = inspire.LoadCase(name="Supports") # alternatively you get existing load case by it's name lc = model.getChild(type= 'LoadCase', name="Supports") # to get all the load cases in the model lcs = model.getChildren(type="LoadCase" ) support1 = inspire.Constraint(features=box.getFeatures(type='FeatureArea')[0]) loadcaseSupports.add(support1) print(f"BCs in LoadCase: {loadcaseSupports.name}") print(f"LoadCase Type: {loadcaseSupports.type}") print(f"Scale Factor: {loadcaseSupports.scaleFactor}") print(f"Use Inertia Relief: {loadcaseSupports.inertiaRelief}") print(" ", loadcaseSupports.loads) # Load Case solution settings ss = loadcaseSupports.solutionSettings print("Below are the solution settings properties:") print(f"Method: {ss.method}") print(f"Solution Adaption: {ss.solutionAdaption}") print(f"No of Groups: {len(ss.getAllGroups())}") # get the first solution settings group g1 = ss.getGroup(index=0) print("Below are the group properties for solution settings:") print(f"Entities: {g1.entities}") print(f"Adapt to Feature: {g1.adaptToFeature}") print(f"Adapt to Thin Solid: {g1.adaptToThinSolid}") print(f"Refinement Level: {g1.refinementLevel}") # By default, the method is set to "Global" # and solution adaption is set to 3 # refinement level is set to 'STANDARD' # adaptToThinSolid is set to True #To change the adaptToThinSolid value method must be set to "Global+Local" ss.method = "Global+Local" # to get all the groups in the model groups = ss.getAllGroups() # to change the adaptToThinSolid of all the groups # you can loop through the groups and set the adaptToThinSolid for group in groups: group.refinementLevel ='HIGH' #similarly you can change the adaptToFeature and adaptToThinSolid group.adaptToThinSolid = True group.adaptToFeature = True print("Below are the group properties for solution settings:") print(f"Entities: {group.entities}") print(f"Adapt to Feature: {group.adaptToFeature}") print(f"Adapt to Thin Solid: {group.adaptToThinSolid}") print(f"Refinement Level: {group.refinementLevel}") inspire.orientView(direction="isometric")
- property refinementLevel#
Get/sets the refinement level of the group.
- Parameters:
val (str) – The value to set for the refinement level. - “STANDARD” - “INCREASED” - “HIGH”
Example
from hwx import inspire #you can get an existing model model = inspire.getModel() # Alternatively, Start with an empty model # model = inspire.newModel() box = model.createSolidBlock(x=0.1, y=0.1, z=0.1) # create a load case to hold supports loadcaseSupports = inspire.LoadCase(name="Supports") # alternatively you get existing load case by it's name lc = model.getChild(type= 'LoadCase', name="Supports") # to get all the load cases in the model lcs = model.getChildren(type="LoadCase" ) support1 = inspire.Constraint(features=box.getFeatures(type='FeatureArea')[0]) loadcaseSupports.add(support1) print(f"BCs in LoadCase: {loadcaseSupports.name}") print(f"LoadCase Type: {loadcaseSupports.type}") print(f"Scale Factor: {loadcaseSupports.scaleFactor}") print(f"Use Inertia Relief: {loadcaseSupports.inertiaRelief}") print(" ", loadcaseSupports.loads) # Load Case solution settings ss = loadcaseSupports.solutionSettings print("Below are the solution settings properties:") print(f"Method: {ss.method}") print(f"Solution Adaption: {ss.solutionAdaption}") print(f"No of Groups: {len(ss.getAllGroups())}") # get the first solution settings group g1 = ss.getGroup(index=0) print("Below are the group properties for solution settings:") print(f"Entities: {g1.entities}") print(f"Adapt to Feature: {g1.adaptToFeature}") print(f"Adapt to Thin Solid: {g1.adaptToThinSolid}") print(f"Refinement Level: {g1.refinementLevel}") # By default, the method is set to "Global" # and solution adaption is set to 3 # refinement level is set to 'STANDARD' #To change the refinement level value method must be set to "Global+Local" ss.method = "Global+Local" # to get all the groups in the model groups = ss.getAllGroups() # to change the refinement level of all the groups # you can loop through the groups and set the refinement level for group in groups: group.refinementLevel ='HIGH' #similarly you can change the adaptToFeature and adaptToThinSolid group.adaptToThinSolid = True group.adaptToFeature = True print("Below are the group properties for solution settings:") print(f"Entities: {group.entities}") print(f"Adapt to Feature: {group.adaptToFeature}") print(f"Adapt to Thin Solid: {group.adaptToThinSolid}") print(f"Refinement Level: {group.refinementLevel}") inspire.orientView(direction="isometric")
- class SolutionSettings(loadCase)#
Bases:
object
Solution settings for the load case.
Applicable for SimSolid Solver.
Attribute Table# Name
Type
property
property
Method Table# Name
Description
addGroup
(self, item)Add a group to the solution settings.
getAllGroups
(self)Get all the groups in the solution settings.
getGroup
(self, index)Get the group at the specified index.
getNoOfGroups
(self)Get the number of groups in the solution settings.
removeGroup
(self, index)Remove a group from the solution settings.
- property method#
Get/set the adoption method of the SimSolid solution settings.
- Parameters:
val (str) – The value to set for the solution adaption. Valid options are, “Global”, “Global+Local”
Example
from hwx import inspire #you can get an existing model model = inspire.getModel() # Alternatively, Start with an empty model # model = inspire.newModel() box = model.createSolidBlock(x=0.1, y=0.1, z=0.1) # create a load case to hold supports loadcaseSupports = inspire.LoadCase(name="Supports") # alternatively you get existing load case by it's name lc = model.getChild(type= 'LoadCase', name="Supports") # to get all the load cases in the model lcs = model.getChildren(type="LoadCase" ) support1 = inspire.Constraint(features=box.getFeatures(type='FeatureArea')[0]) loadcaseSupports.add(support1) # Load Case solution settings ss = loadcaseSupports.solutionSettings print(f"Below are the solution settings properties with {ss.method}:") print(f"Solution Settings Method: {ss.method}") print(f"Solution Adaption: {ss.solutionAdaption}") print(f"No of Groups: {len(ss.getAllGroups())}") # Change the solution settings method # By default, the method is set to "Global" # and solution adaption is set to 3 print(f"Changing the solution settings method to 'Global+Local'.") ss.method = "Global+Local" print(f"Solution Setting method: {ss.method}") inspire.orientView(direction="isometric")
- property solutionAdaption#
Get/set the number of passes for the solution adaption.
- Parameters:
val (int) – The number of passes for the solution adaption.
Example
from hwx import inspire # Start with an empty model model = inspire.newModel() # Alternatively, you can get an existing model # model = inspire.getModel() box = model.createSolidBlock(x=0.1, y=0.1, z=0.1) # create a load case to hold supports loadcaseSupports = inspire.LoadCase(type='LINEAR_STATIC', name="Supports") # alternatively you get existing load case by it's name lc = model.getChild(type= 'LoadCase', name="Supports") # to get all the load cases from the model lcs = model.getChildren(type="LoadCase" ) # Create a support # A support is a constraint that restricts the movement of a feature support1 = inspire.Constraint(features=box.getFeatures(type='FeatureArea')[0]) # Add the support to the load case loadcaseSupports.add(support1) # Get the Load case solution settings object # The solution settings object contains the properties that control the solution settings of the load case ss = loadcaseSupports.solutionSettings print("Below are the solution settings properties with method {ss.method}:") print(f"Solution Aettings Method: {ss.method}") print(f"Solution Adaption: {ss.solutionAdaption}") print(f"No of Groups: {len(ss.getAllGroups())}") # To change the solution adaption value # the solution settings method must be set to "Global+Local" # By default, the method is set to "Global" # and solution adaption is set to 3 ss.method = "Global+Local" ss.solutionAdaption = 4 print(f"Below are the solution settings properties with {ss.method}:") print(f"Method: {ss.method}") print(f"Solution Adaption: {ss.solutionAdaption}") print(f"No of Groups: {len(ss.getAllGroups())}") inspire.orientView(direction="isometric")
- getNoOfGroups()#
Get the number of groups in the solution settings.
Example
from hwx import inspire from hwx.inspire.demo import openDemoFile, getDemoFilePath # Use the getDemoFilePath function to get the absoulte path to the demo file named "dangler_with_holes.stmod" filepath = getDemoFilePath("dangler_with_holes.stmod") model = inspire.openFile(file = filepath) lc = model.getChild(type='LoadCase', name ='Load Case 1') #get the solution settings of the load case ss= lc.solutionSettings print(f"Number of solution settings groups is {ss.getNoOfGroups()}.") inspire.orientView(direction="isometric")
- getGroup(index)#
Get the group at the specified index.
- Parameters:
index (int) – The index of the group to retrieve.
- Returns:
The group at the specified index.
- Return type:
Example
from hwx import inspire from hwx.inspire.demo import openDemoFile, getDemoFilePath # Use the getDemoFilePath function to get the absoulte path to the demo file named "dangler_with_holes.stmod" filepath = getDemoFilePath(file="dangler_with_holes.stmod") model = inspire.openFile(file = filepath) lc = model.getChild(type='LoadCase', name ='Load Case 1') #get the solution settings of the load case ss= lc.solutionSettings print(f"Get the first solution Settings Group: {ss.getGroup(index=0)}.") print(f"Solution Settings Group has follow properties:") print(f"Entities: {ss.getGroup(index=0).entities}") print(f"Adapt to Feature: {ss.getGroup(index=0).adaptToFeature}") print(f"Adapt to Thin Solid: {ss.getGroup(index=0).adaptToThinSolid}") print(f"Refinement Level: {ss.getGroup(index=0).refinementLevel}") inspire.orientView(direction="isometric")
- getAllGroups()#
Get all the groups in the solution settings.
Example
from hwx import inspire from hwx.inspire.demo import openDemoFile, getDemoFilePath # Use the getDemoFilePath function to get the absoulte path to the demo file named "dangler_with_holes.stmod" filepath = getDemoFilePath(file="dangler_with_holes.stmod") model = inspire.openFile(file = filepath) lc = model.getChild(type='LoadCase', name ='Load Case 1') #get the solution settings of the load case ss= lc.solutionSettings print(f"Number OF Soultion Settings groups in {lc.name} are: {len(ss.getAllGroups())}.") for group in ss.getAllGroups(): print(f"Solution Settings Group has follow properties:") print(f"Entities: {group.entities}") print(f"Adapt to Feature: {group.adaptToFeature}") print(f"Adapt to Thin Solid: {group.adaptToThinSolid}") print(f"Refinement Level: {group.refinementLevel}") inspire.orientView(direction="isometric")
- addGroup(item)#
Add a group to the solution settings.
- Parameters:
item (list[Part]) – The parts to be added to the group.
Example
from hwx import inspire from hwx.inspire.demo import openDemoFile, getDemoFilePath # Use the getDemoFilePath function to get the absoulte path to the demo file named "dangler_with_holes.stmod" filepath = getDemoFilePath(file="dangler_with_holes.stmod") model = inspire.openFile(file = filepath) lc = model.getChild(type='LoadCase', name ='Load Case 1') #get the solution settings of the load case ss= lc.solutionSettings # To modify the solution settings, thesolution method must be set to "Global+Local" ss.method = "Global+Local" print(f"Number OF Soultion Settings groups in {lc.name} are: {len(ss.getAllGroups())}.") # Create a new solution settings group with the specified properties new_group = ss.addGroup(item=model.parts) for index, group in enumerate (ss.getAllGroups()): print(f"Solution Settings Group index {index} has follow properties:") print(f" Entities: {group.entities}") print(f" Adapt to Feature: {group.adaptToFeature}") print(f" Adapt to Thin Solid: {group.adaptToThinSolid}") print(f" Refinement Level: {group.refinementLevel}") inspire.orientView(direction="isometric")
- removeGroup(index)#
Remove a group from the solution settings.
- Parameters:
index (int) – The index of the group to be removed.
Example
from hwx import inspire from hwx.inspire.demo import openDemoFile, getDemoFilePath # Use the getDemoFilePath function to get the absoulte path to the demo file named "dangler_with_holes.stmod" filepath = getDemoFilePath(file="dangler_with_holes.stmod") model = inspire.openFile(file = filepath) lc = model.getChild(type='LoadCase', name ='Load Case 1') #get the solution settings of the load case ss= lc.solutionSettings # To modify the solution settings, thesolution method must be set to "Global+Local" ss.method = "Global+Local" print(f"Number OF Soultion Settings groups in {lc.name} are: {len(ss.getAllGroups())}.") # getNoOfGroups returns the number of solution settings groups in the load case # to remove all the solution settings groups except the first one # the first group is the default group and cannot be removed # so we loop through the groups in reverse order and remove them #removeGroup method removes the group at the specified index for index in range(ss.getNoOfGroups()-1,0,-1): print(f"Removing Solution Settings Group at index {index}.") ss.removeGroup(index=index) print(f"Number OF Soultion Settings groups in {lc.name} are: {len(ss.getAllGroups())}.") inspire.orientView(direction="isometric")