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 the inertia coordinate system. 0
iyy Double The iyy inertia property with respect to the inertia coordinate system. 0
izz Double The izz inertia property with respect to the inertia coordinate system. 0
ixy Double The ixy inertia property with respect to the inertia coordinate system. 0
iyz Double The iyz inertia property with respect to the inertia coordinate system. 0
ixz Double The ixz inertia property with respect to the inertia 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 leader, 'RIGHT' for right entity as leader 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. -

Flexbody

Class Flexbody()

Flexbody(kwds)

Utility class to hold and modify properties of a body when it is flexible (flexbody).

Notes

You cannot create instances of the Flexbody class. This class is used to modify the properties of a body when it is flexible.

Keyword Arguments

Argument Data Type Description Default
MotionSolve.graphic_file File This file is used for visual display of the flexbody. Any relocation of this graphic will also be applied to the functional files. ''
MotionSolve.h3d_file File The H3D file. ''
MotionSolve.anim_scale Double The animation scale. 1
MotionSolve.rigidify Bool Flag to set the flexbody as rigid with the mass inertia properties from the flexbody data. False
MotionSolve.inc_geom_non_lin Bool Include geometric stiffness data when True. False
ADAMS.graphic_file File Graphic file for solver mode Adams. ''
ADAMS.h3d_file File H3D file for solver mode Adams. ''
ADAMS.mtx_file File MTX file for solver mode Adams. ''
ADAMS.input_type Enum Input type for solver mode Adams. One of CMS_H3D or CMS_MTX. CMS_H3D
ABAQUS.graphic_file File Graphic file for solver mode Abaqus. ''
ABAQUS.inp_file File Inp file for solver mode Abaqus. ''
ABAQUS.sup_file File Sup file for solver mode Abaqus. ''
ABAQUS.input_type Enum Input type for solver mode Abaqus. The functional source. One of CMS or FEA. CMS
ABAQUS.damping_type Enum Damping type for solver mode Abaqus. One of DEFAULT, CRATIO, ALPHA, BETA, ALPHA_BETA. DEFAULT
ABAQUS.cratio Double Damping ratio for the Abaqus flex body. 0
ABAQUS.alpha Double Defaults to 0. * ABAQUS.beta (Double) 0

Instances

Instance Type Description
MotionSolve FlexMotionSolveData Instance which holds the flex body solver data when solver mode is MotionSolve.
ADAMS FlexAdamsData Instance which holds the flex body solver data when solver mode is Adams.
ABAQUS FlexAbaqusData Instance which holds the flex body solver data when solver mode is Abaqus.

Readonly Properties

Argument Data Type Description Default
mass Double The mass of the flexible body. -
cm_x Double The x coordinate of center of mass of the body. -
cm_y Double The y coordinate of center of mass of the body. -
cm_z Double The z coordinate of center of mass of the body. -
ixx Double The ixx inertia property with respect to center of mass. -
ixy Double The ixy inertia property with respect to center of mass. -
ixz Double The ixz inertia property with respect to center of mass. -
iyx Double The iyx inertia property with respect to center of mass. -
iyy Double The iyy inertia property with respect to center of mass. -
iyz Double The iyz inertia property with respect to center of mass. -
izx Double The izx inertia property with respect to center of mass. -
izy Double The izy inertia property with respect to center of mass. -
izz Double The izz inertia property with respect to center of mass. -

Methods

createPointsAtInterfaceNodes()

Create MDL points at current interface nodes.

Returns:

None.

getInterfaceNodeCoordByIndex(idx)

Retrieves the interface node coordinate using an index number.

Parameters:

idx (int): The index number of the interface node.

Returns:

A list of x y z coordinates.

Return type:

list

getInterfaceNodeIdByIndex(idx)

Retrieves the interface node ID using an index number.

Parameters:

idx (int): The index number of the interface node.

Returns:

Node ID using a corresponding index number.

Return type:

int

getNodeCoordByIndex(idx)

Retrieves the node coordinate using an index number.

Parameters:

idx (int): The index number of the node.

Returns:

A list of x y z coordinates.

Return type:

list

getNumInterfaceNodes()

Retrieves the number of interface nodes in the flexbody.

Returns:

The number of interface nodes.

Return type:

int

getNumNodes()

Retrieves the number of nodes in the flexbody.

Returns:

The number of nodes.

Return type:

int

Examples

>>> from hw import mview
   >>> #Create a body and get values
   >>> b1 = mview.Body(name='b1',label='Body1')
   >>> b1.mass
   0.0
   >>> b1.name
   'b1'
   >>> #Set multiple values at once
   >>> b1.setValues(mass=10,ixx=100,iyy=5000)
   >>> b1.iyy
   5000
   >>> #Use graphic for intertia properties
   >>> b1.intertia_props_from_graphic = True
   >>> #Center of mass marker
   >>> b1.usecm = True
   >>> p1 = mview.Point(name='PointForCM', label='PointForCM')
   >>> b1.cm.origin = p1
   >>> b1.cg.name
   'PointForCM'
   >>> #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.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.l.vx
   25.0
   >>> b2.r.use_wy = True
   >>> #Set paramteric value
   >>> b2.r.wy = "b_2.l.vx/12"
Create a flexbody and modify its properties.
   >>> from hw import mview
   >>> b = mview.Body(name='b_0', useflex=True)
   >>> b.flex.MotionSolve.graphic_file = r'C:/Users/Training/sla_flex.h3d'
   >>> b.flex.MotionSolve.h3d_file = r'C:/Users/Training/sla_flex.h3d'
   >>> b.flex.getNumInterfaceNodes()
   4
   >>> b.uselprf = True
   >>> b.lprf_origin = mview.Point(x=1,y=3)
   >>> b.flex.createPointsAtInterfaceNodes()