Gravity

Class Gravity()

Gravity(parent='MODEL', name='gravity', label='Gravity')

Gravity definition.

Keyword Arguments

Argument Data Type Description Default
switch Enum Gravity enabled in the simulation. One of On, Off. On
x Double x component of gravity. 0
y Double y component of gravity. 0
z Double z component of gravity. 9810.0

Examples

Modify the gravity components used in the model.
   >>> # Import mview module
   >>> from hw import mview
   >>> # Get the model handle
   >>> mod = mview.getModel()
   >>> mod.name
   'the_model'
   >>> # Disable the gravity for the current model
   >>> mod.gravity.switch = 'Off'
   >>> mod.gravity.switch
   'Off'
   >>> # Set the x component of gravity to :100
   >>> mod.gravity.x = :100
   >>> mod.gravity.x
   :100
   >>> # Set the y component of gravity to 10
   >>> mod.gravity.y = 10
   >>> mod.gravity.y
   10
   >>> # Set the z component of gravity to 0
   >>> mod.gravity.z = 0
   >>> mod.gravity.z
   0

Methods

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 any Value of the attribute to be set.

Returns:

Returns True if the value was successfully set else False.

Return type:

bool