PretensionGroup (hwx.inspire)#
- class PretensionGroup(fasteners, name='', **kwds)#
Bases:
Config
Creates a config of type fasterner group.
Attribute Table# Name
Type
property
Method Table# Name
Description
addFastener
(self, fastener, force)Set the fastener to the pretension group.
addFasteners
(self, fastnersWithForce)Set the fasteners of the pretension group.
getPretensionForce
(self, fastener)Get/Set the pretension force to the fastener group.
removeAllFasteners
(self)Reset the fasteners of the pretension group.
removeFastener
(self, fastener)Remove the fastener from the pretension group.
setPretensionForce
(self, fastener, value)Set the pretension force to the fastener group.
Example
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 " f"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 " f"set to {pretensionGroup.getPretensionForce(fastener)}.") inspire.orientView(direction="isometric")
- property method#
Sets/Gets the run method.
Example
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 method from the pretension group print(f"{pretensionGroup.name} is having method of : {pretensionGroup.method}") inspire.orientView(direction="isometric")
- property fasteners#
The list of fasteners in the pretension group.
Example
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 print(f"{pretensionGroup.name} is having fasteners: {pretensionGroup.fasteners}") 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
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. fastener = model.getChildren(type='Fastener')[0] pretensionGroup = inspire.PretensionGroup(fasteners=fastener, name = 'Pretension Group 1') # get the pretension force of the fastener in the pretension group pretensionForce = pretensionGroup.getPretensionForce(fastener) print(f"The pretension force of the fastener {fastener.name} in the " f"pretension group {pretensionGroup.name} is {pretensionForce}.")
- 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
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. fastener = model.getChildren(type='Fastener')[0] pretensionGroup = inspire.PretensionGroup(fasteners=fastener, name = 'Pretension Group 1') # remove all fasteners from the pretension group pretensionGroup.setPretensionForce(fastener=fastener,value=500) print(f"The pretension force of the fastener {fastener.name} in the pretension group " f"{pretensionGroup.name} is set to {pretensionGroup.getPretensionForce(fastener)}.")
- addFastener(fastener, force)#
Set the fastener to the pretension group.
- Parameters:
fastener (Fastener) – Fastener to be set.
force (float) – Pretension force to be set.
Example
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. fastener = model.getChildren(type='Fastener')[0] pretensionGroup = inspire.PretensionGroup(fasteners=fastener, name = 'Pretension Group 1') # Alternatively, you can get an existing pretension group by its name pretensionGroup = model.getChild(type='PretensionGroup', name='Pretension Group 1') # Adding a fastener to the pretension group pretensionGroup.addFastener(fastener = model.getChildren(type='Fastener')[1],force =100) # how to get method from the pretension group print(f"{pretensionGroup.name} is having fasteners of : {pretensionGroup.fasteners}") inspire.orientView(direction="isometric")
- removeFastener(fastener)#
Remove the fastener from the pretension group.
- Parameters:
fastener (Fastener) – Fastener to be removed.
Example
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. fastener = model.getChildren(type='Fastener')[0] pretensionGroup = inspire.PretensionGroup(fasteners=fastener, name = 'Pretension Group 1') # remove all fasteners from the pretension group pretensionGroup.removeFastener(fastener=fastener) print(f"The pretension group {pretensionGroup.name} has fasteners: {pretensionGroup.fasteners}")
- removeAllFasteners()#
Reset the fasteners of the pretension group.
Example
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. fastener = model.getChildren(type='Fastener')[0] pretensionGroup = inspire.PretensionGroup(fasteners=fastener, name = 'Pretension Group 1') # remove all fasteners from the pretension group pretensionGroup.removeAllFasteners() print(f"The pretension group {pretensionGroup.name} has fasteners: {pretensionGroup.fasteners}") # After removing all fasteners, the pretension group will be empty inspire.orientView(direction="isometric")
- addFasteners(fastnersWithForce)#
Set the fasteners of the pretension group.
- Parameters:
fastnersWithForce (list(tuple(Fastener, Force))) – Fastener and Force value to be set. for example [(fastener1, force1), (fastener2, force2)…] here fastener1, fastener2 are fasteners and force1, force2 are the force values.
Example
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. fastener = model.getChildren(type='Fastener')[0] pretensionGroup = inspire.PretensionGroup(fasteners=fastener, name = 'Pretension Group 1') # Alternatively, you can get an existing pretension group by its name pretensionGroup = model.getChild(type='PretensionGroup', name='Pretension Group 1') # Adding a fastener to the pretension group fastnersWithForce =[] for fastener in model.getChildren(type='Fastener')[1:]: fastnersWithForce.append((fastener, 1000)) pretensionGroup.addFasteners(fastnersWithForce =fastnersWithForce) for fastener in pretensionGroup.fasteners: print(f"{fastener.name} in {pretensionGroup.name} has pretension force of " f"{pretensionGroup.getPretensionForce(fastener)}.") inspire.orientView(direction="isometric")