TorsionSpring (hwx.inspire.motion)#
- class TorsionSpring(self, connection=None, **kwds)#
Bases:
MotionConnector
Creates a Torsion Spring.
Torsion Springs are used to apply a rotational spring-damper force about the pivot axis for two parts. Torsion Springs provide a angular resistance and/or damping between two objects.
Changing any one of preload, installedLength, freeLength, or k will influence the other values:
Changing preload modifies freeLength.
Changing installedLength, k, or freeLength modifies preload.
# Name
Type
connectorMode
str
Variable
ctspline
Spline
Variable
property
property
icon
str
Variable
joint
Variable
ktspline
Spline
solverVariables
property
# Name
Description
getArmEnds
(self, local=False, offset=1)Get end points of wire arms.
getArmLength_M
(self)Returns the distance down the arm for the drag point manipulator.
getInstalledArmPosition_M
(self)Returns a Matrix44 with an origin at the installed arm end closes to
getMountArmPosition_M
(self)Returns a Matrix44 with an origin at the mount arm end closes to
isValidConnection
(connection)Determines if the torsion spring can be created from the Joint.
Example
from hwx import inspire from hwx.inspire import motion model = inspire.openTutorialFile("Motion/M01_FourBar.x_t") axleFt = model.getChild('Link Crank').features[26] mountFt = model.getChild('Assembly-Base').getChild('Mount Crank').features[102] mountFt.part.ground = True spring = motion.TorsionSpring( axleConnection = axleFt, axleLocation = (.5, .5), mountConnection = mountFt, installedAngle = 90, ct = 1e-4, restrainCenterline = True ) print("spring.preload", spring.preload.guiValue) # Hide irrelevant parts for part in set(model.parts) - set(spring.getReferences()): part.active = False inspire.fitView()
- property type#
Specifies the type of Torsion Spring.
Torsion Spring can be of type Spring Damper or only Spring or Damper, defaults to Spring Damper.
- property restrainCenterline#
When enabled, the pivot axis of the torsion spring is restrained to essentially create a cylindrical or revolute joint between the parts.
- property centerlineJoint#
Specifies what type of joint to be created if Restrain Centerline is enabled.
- property locked#
If True, prevents the spring from exerting exert a torque during Motion Analysis.
- property kt#
The torsional stiffness rate of the spring, defaults to 0.1 N*m/rad.
- property ktlinear#
Enables linear stiffness with the value specified for property kt, else uses interpolation methods to get stiffness value.
- property ktsplineMethod#
Specifies the type of interpolation method to use.
Types can be Akima, Cubic or Linear.
- property ct#
The torsional damping rate of the spring, defaults to 0.001 N*m*s/rad
- property ctlinear#
Enables linear damping with the value specified for property ct, else uses interpolation methods to get damping value.
- property ctsplineMethod#
Specifies the type of interpolation method to use.
Types can be Akima, Cubic or Linear.
- property preload#
Specifies the torsional force applied to the spring to reach its free angle.This property is auto computed based on the free angle and the torsional stiffness.
- property installedAngle#
The angle of the spring as installed in the mechanism, defaults to 0 deg.
- property freeAngle#
The angle of the spring in its resting state, defaults to 0 deg.
- property reverseDirection#
Reverses the direction of the preload torque in the spring.
- property entity1#
Specifies the feature or Joint where the torsion spring axle is attached to.
- property location1#
The location of the torsion spring wrt to axle connection.
- property direction#
The direction of the torsion spring wrt to axle connection.
- property entity2#
Specifies the feature or Joint where the torsion spring mount is attached to.
- property axleConnection#
Specifies the feature or Joint where the torsion spring axle is attached to.
- property axleLocation#
The location of the torsion spring wrt to axle connection.
- property axleDirection#
The direction of the torsion spring wrt to axle connection.
- property mountConnection#
Specifies the feature or Joint where the torsion spring mount is attached to.
- property factor#
Used to update the length of torsion spring axis on basis of its radius.
- property coils#
Number of coils in the spring, defaults to 5.
This is not specifiable if the spring is of type Damper.
- property coilColor#
Specifies the color of the coils around the spring.
- property damperColor#
Specifies the color of the damper of the spring.
- property diameter#
Used to change the diameter of the torsion spring.
- property wireDiameter#
Use to change the wire diameter of the torsion spring.
- property hasSpring#
Specifies if the torsion spring has any springs.
- property hasDamper#
Specifies if the torsion spring has any dampers.
- getArmEnds(local=False, offset=1)#
Get end points of wire arms.
- Parameters:
local (bool) – If set to True, returns the end points of the arm wrt to local space, otherwise in-terms of global torsion spring position.
offset (float) – offset can be passed to get point a little past arm ends which is useful for manipulators.
- Returns:
The end points of the torsion spring arms.
- Return type:
(math.Point, math.Point)
- getMountArmPosition_M()#
Returns a Matrix44 with an origin at the mount arm end closes to the spring, and the z aligin with the other end.
- getInstalledArmPosition_M()#
Returns a Matrix44 with an origin at the installed arm end closes to the spring, and the z aligin with the other end.
- getArmLength_M()#
Returns the distance down the arm for the drag point manipulator.