Motion

Motion

Class Motion()

Motion(parent='MODEL', name='Motion_n', label='Motion_n', active=True, 
use_markers=False, itype='DISP', jt=None, jt_type='TRANS', direction='X', i=None, j=None, 
ic_disp=0, ic_vel=0, user=False, usr_sub='`USER()`', local_funcname='MOTSUB', 
use_local_dll=False, local_dll='', local_func_type='DLL)

A motion is used to apply a motion to a joint or a motion constraint between two markers.

setValue, getAssociatedGraphics

Keyword Arguments

Argument Data Type Description Default
name String The variable name. Motion_n, for next available integer n.
label String The descriptive label. Motion_n, for next available integer n.
parent Object The parent. MODEL
active Bool Used to activate or deactivate this entity. True
use_markers Bool Motion between two markers if True, motion to a joint otherwise. False
itype Enum The type. One of DISP, VEL or ACCL. DISP
jt Joint The joint to which the motion is applied when use_markers is False. None
jt_type Enum Applies motion to the translational or rotational degree of freedom when using a cylindrical joint. Takes values TRANS or ROT. TRANS
direction Enum The motion direction. One of X, Y, Z for translation along the X, Y, Z axis of Marker 2. One of B1, B2, B3 for rotation along the X, Y, Z axis of Marker 2. X
i Marker The first marker, when use_markers is True. None
j Marker The second marker, when use_markers is True. None
ic_disp Double The initial displacement of the motion when itype is VEL or ACC. 0
ic_vel Double The initial velocity of the motion when itype is ACC. 0

Instances

value (Nonlinear) - Set nonlinear value or solver expression for motion. Defaults to .

Notes

1. The parent parameter can only be initialized by the constructor and should not be modified directly.

2. Only parent can be used as a positional argument in the constructor.

3. Instance is a reference to an entity. You cannot modify an instance, but can modify its properties.

Methods

getAssociatedGraphics()

Get all the graphics that are associated with this object.

Returns:

List of all graphic associated with this motion.

Return type:

(list)

setValue(name, value)

Sets value of an attribute.

Parameters:

       
name str Name of the attribute.  
value ** Value of the attribute to be set.  

Returns:

Returns True if the value was successfully set else False.

Return type:

Bool

Motion Pair

Class MotionPair()

MotionPair(parent='MODEL', name='MotionPair_n', label='MotionPair_n', active=True, sym='NONE')

Motion pair containing left and right instances of singles.

Keyword Arguments

Argument Data Type Description Default
name String The variable name. MotionPair_n, for next available integer n.
label String The descriptive label. MotionPair_n, for next available integer n.
parent Object The parent. MODEL
active Bool Defines if entity is activated when True or deactivated when False. True
sym Enum The symmetry of pair entity. Takes values 'LEFT' for left entity as leader, 'RIGHT' for right entity as leader or 'NONE' when it is not symmetric. NONE

Instances

Instance Type Description
l Point The left motion.
r Point The right motion.

Notes

Instance is a reference to an entity. You cannot modify an instance, but can modify its properties.

Examples

========
Create and modify attributes of a Motion.
>>> from hw import mview
>>> #Create body, graphic and joint for visible motion
>>> b1 = mview.Body(inertia_props_from_graphic = True)
>>> g1 = mview.Sphere(origin = 'P_Global_Origin',body = b1)
>>> j1 = mview.Joint(type = 'TransJoint')
>>> j1.setValues(b1 = b1,b2 = 'B_Ground',origin = 'P_Global_Origin',align_meth1 = 'VECTOR',align_vec1 = 'V_Global_Y')
>>> #Create joint based motion and set values
>>> m1 = mview.Motion(name = 'linear_translation')
>>> m1.jt = j1
>>> #Set multiple values at once
>>> m1.value.setValues(type = 'EXPR',expr = "`STEP5(TIME,0,0,3,100)`")
>>> m1.itype = 'DISP'
>>> #Switch to marker based motion with velocity
>>> m1.use_markers = True
>>> m1.itype = 'VEL'
>>> #Directions are 6 DOF: X,Y,Z,B1,B2,B3
>>> m1.direction = 'B1'
>>> m1.i = b1.cm
>>> m1.j = 'Global_Frame'
>>> m1.value.setValues(type = 'LIN',lin = 20)