Body

Body

Class Body()

class Body(parent='MODEL', name='Body_n', label='Body_n', active=True, mass=0.0, 
ixx=0.0, ixy=0.0, iyz=0.0, ixz=0.0, iyy=0.0, izz=0.0, use_vx=False, use_vy=False, 
use_vz=False, use_wx=False, use_wy=False, use_wz=False, vx=0.0, vy=0.0, vz=0.0, wx=0.0, 
wy=0.0, wz=0.0, use_vm=False, use_wm=False, vm=None, wm=None, usecm=False, 
useim=False, uselprf=False, cg=None, im_origin=None, lprf_origin=None, use_flex=False, 
inertia_props_from_graphic=False)

Rigid body.

setValue, getValue, getAssociatedGraphics

Keyword Arguments

Argument Data Type Description Default
name String The variable name. Body_n, for next available integer n.
label String The descriptive label. Body_n, for next available integer n.
parent Object The parent. MODEL
active Bool Used to activate or deactivate this entity. True
mass Double The mass. 0
ixx Double The ixx inertia property with respect to center of mass or body coordinate system. 0
iyy Double The iyy inertia property with respect to center of mass or body coordinate system. 0
izz Double The izz inertia property with respect to center of mass or body coordinate system. 0
ixy Double The ixy inertia property with respect to center of mass or body coordinate system. 0
iyz Double The iyz inertia property with respect to center of mass or body coordinate system. 0
ixz Double The ixz inertia property with respect to center of mass or body coordinate system. 0
use_vx Bool Use initial translation velocity in x direction when True. False
use_vy Bool Use initial translation velocity in y direction when True. False
use_vz Bool Use initial translation velocity in z direction when True. False
use_wx Bool Use initial rotational velocity about x when True. False
use_wy Bool Use initial rotational velocity about y when True. False
use_wz Bool Use initial rotational velocity about z when True. False
vx Double The initial translation velocity in x direction. 0
vy Double The initial translation velocity in y direction. 0
vz Double The initial translation velocity in z direction. 0
wx Double The initial rotational velocity about x. 0
wy Double The initial rotational velocity about y. 0
wz Double The initial rotational velocity about z. 0
usevm Bool Use reference marker (vm) for initial translational velocity when True. False
usewm Bool Use reference marker (wm) for initial rotational velocity when True. False
vm Marker The reference marker (vm) for initial translational velocity. 0
wm Marker The reference (vm) for initial rotational velocity. 0
usecm Bool Use center of mass coordinate system when True. False
useim Bool Use inertia coordinate system when True. False
uselprf Bool Use body coordinate system when True. False
cg Point The origin for center of mass coordinate system. None
im_origin Point The origin for inertia coordinate system. None
lprf_origin Point The origin for body coordinate system. None
useflex Bool Use as a flexible body if True. False
inertia_props_from_graphic Bool Use properties from associated inertia graphic when True. False

Instances

Instance Type Description
cm Marker Marker for center of mass coordinate system.
im Marker Marker for inertia coordinate system.
lprf Marker Marker for body coordinate system.
flex FlexBody Flexbody when useflex is True.

Readonly Properties

geomprops (InertiaProps) - Inertia properties of the body when get properties from associated graphics [inertia_props_from_graphic] is True. 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.

4. Readonly Properties cannot be modified.

Methods

getAssociatedGraphics()

Get all the graphics that are associated with this object.

Returns:

List of all graphic associated with this body.

Return type:

(list)

getValue(name)

Returns value of an attribute.

Parameters:

name (str) - Name of the attribute. Defaults to -.

Returns:

The return value. Return type depends on the attribute type.

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

Body Pair

Class BodyPair()

BodyPair(parent='MODEL', name='Point_n', label='Point_n', active=True, sym='NONE')

Body pair containing left and right instances of singles.

Keyword Arguments

Argument Data Type Description Default
name String The variable name. BodyPair_n, for next available integer n.
label String The descriptive label. BodyPair_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 master, 'RIGHT' for right entity as master or 'NONE' when it is not symmetric. NONE

Instances

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

Notes

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

Inertia Props

Class InertiaProps()

InertiaProps(**kwds)

Utility class to hold inertia properties of a body when body gets inertia properties from associated graphics.

Notes

You cannot create instances of the InertiaProps class. This class is used to modify the inertia properties of a body when it gets the properties from associated graphics.

Readonly Properties:

Argument Data Type Description Default
mass Double The mass of associated graphics. -
ixx Double The ixx inertia property with respect to center of mass coordinate system of associated graphics. -
iyy Double The iyy inertia property with respect to center of mass coordinate system of associated graphics. -
izz Double The izz inertia property with respect to center of mass coordinate system of associated graphics. -
ixy Double The ixy inertia property with respect to center of mass coordinate system of associated graphics. -
iyz Double The iyz inertia property with respect to center of mass coordinate system of associated graphics. -
ixz Double The ixz inertia property with respect to center of mass coordinate system of associated graphics. -
cg Point The origin for center of mass coordinate system. -
cm Marker The marker for center of mass coordinate system. -

Examples

========
Create and modify attributes of a Body.
>>> from hw import mview
>>> #Create a body and get values
>>> b1 = mview.Body(name='b1',label='Body1')
>>> b1.mass
0.0
>>> #Set multiple values at once
>>> b1.setValues(mass=10,ixx=100,iyy=5000)
>>> #Use graphic for intertia properties
>>> b1.intertia_props_from_graphic = True
>>> #Center of mass marker
>>> b1.usecm = True
>>> p1 = mview.Point(label='PointForCM')
>>> b1.cm.origin = p1
>>> #Aligning CM marker
>>> b1.cm.align_meth1 = 'DxDyDz'
>>> b1.cm.ornt_meth = 'ANGLES'
>>> b1.e1 = 20
>>> b1.cm.e1 = 20
>>> #Reference marker for CM
>>> m1 = mview.Marker(label='Reference')
>>> b1.cm.rm = m1
>>> #Make the body flexible get the H3D
>>> b1.useflex = True
>>> b1.rigidify = True
>>> b1.flex.MotionSolve.graphic_file = r"C:\Users\user\Desktop\flexfile.h3d"
>>> b1.flex.MotionSolve.h3d_file = b1.flex.MotionSolve.graphic_file
>>> #Set initial conditions for BodyPair
>>> b2 = mview.BodyPair(name='b_2',sym='NONE')
>>> b2.l.use_vx = True
>>> b2.l.vx = 25
>>> b2.r.use_wy = True
>>> #Set paramteric value
>>> b2.r.wy = "b_2.l.vx-12"