Rotation (hwx.inspire)#

class Rotation(location, direction, velocity=0, acceleration=0, **kwds)#

Bases: BoundaryCondition

Global rotation velocity and acceleration of the model.

Angular velocity defines the speed of rotation of the entire model and the axis about which it rotates. Angular acceleration is the rate of change of the model’s angular velocity.

Attribute Table#

Name

Type

acceleration

Double

accelerationEnabled

Bool

direction

property

velocity

Double

velocityEnabled

Bool

Example

from hwx import inspire

model = inspire.newModel()
cylinder = model.createSolidCylinder(radius=1,height=6)
rotation = inspire.Rotation(
  location=(0, 0, 0), direction=(0, 0, 1), 
  velocity='15.0 rpm', acceleration='1.0 rad/s2', loadCase='current'
)
print("Some Rotation values:")
print("Rotation Velocity: " + str(rotation.velocity))
print("Rotation Acceleration: " + str(rotation.acceleration))

# modify some rotation attributes
rotation.velocity = '0.10471 rad/s'
rotation.acceleration = '10 rad/ms2'

# How to disable the rotation velocity and acceleration
rotation.velocityEnabled = False
rotation.accelerationEnabled = False

# How to enable the rotation acceleration and velocity
rotation.velocityEnabled = True
rotation.accelerationEnabled = True

print("Rotation values after modification:")
print("Rotation Velocity: " + str(rotation.velocity))
print("Rotation Acceleration: " + str(rotation.acceleration))

# How to make the rotation parametric
# Add a model variable for rotation velocity
model.variables.add(name="rotationVelocity", type='AngularVelocity', expression='15.0 rpm')
model.variables.add(name="rotationAcceleration", type='AngularAcceleration', expression='10.0 rad/s2')
# Assign the variable to the rotation velocity
rotation.velocity = "rotationVelocity"
rotation.acceleration = "rotationAcceleration"
# How to modify the rotation velocity variable
model.variables.update(name="rotationVelocity", expression='30.0 rpm')
# How to change the rotation velocity with a string with units
rotation.velocity = "30.0 rpm"

# How to query the existing rotations from the model
existing_rotations = model.getChildren(type='Rotation')
print("Existing rotations in the model:")
for rotation in existing_rotations:
    print(f"	Rotation at {rotation.location}, direction: {rotation.direction}, "
    f"velocity: {rotation.velocity}, acceleration: {rotation.acceleration}")

# How to query the rotation by its name
rotation_by_name = model.getChild(type='Rotation', name='Rotation 1')
if rotation_by_name:  
    print("Queried rotation by name:")
    print(f"	Rotation at {rotation_by_name.location}, direction: {rotation_by_name.direction}, "   
    f"velocity: {rotation_by_name.velocity}, acceleration: {rotation_by_name.acceleration}")

inspire.orientView(direction="bottom")
property velocity#

The angular velocity.

The angular velocity defines the speed of rotation of the entire model and the axis about which it rotates.

property acceleration#

The angular acceleration.

The angular acceleration is the rate of change of the model’s angular velocity.

property velocityEnabled#

Sets the state of angular velocity

property accelerationEnabled#

Sets the state of angular acceleration

property direction#

The axis of rotation.