Skip to main content

Rocky PrePost scripting 2025 R1

RATranslation

Last update: 17.07.2025

class RATranslation

Rocky PrePost Scripting wrapper representing a Translation motion.

Retrieve this specific wrapper after setting the correct motion type on a RAMotion. For example:

motions = motion_frame.GetMotions()
motion_1 = motions.New()
motion_1.SetType('Translation')
translation = motion_1.GetTypeObject()

Methods:

Name Description
GetAcceleration([unit]) Get the value of "Acceleration".
GetFinalVelocity([unit]) Get the value of "Final Velocity".
GetInput() Get "Input" as a string.
GetValidInputValues() Get a list of all possible values for "Input".
GetVelocity([unit]) Get the value of "Velocity".
SetAcceleration(values[, unit]) Set the values of "Acceleration".
SetFinalVelocity(values[, unit]) Set the values of "Final Velocity".
SetInput(value) Set the value of "Input".
SetVelocity(values[, unit]) Set the values of "Velocity".

GetAcceleration(unit: Optional[str] = None)

Get the value of “Acceleration”.

  • Parameters: unit – The unit for the returned values. If no unit is provided, the returned values will be in “m/s2”.

GetFinalVelocity(unit: Optional[str] = None)

Get the value of “Final Velocity”.

  • Parameters: unit – The unit for the returned values. If no unit is provided, the returned values will be in “m/s”.

GetInput()

Get “Input” as a string.

  • Returns: The returned value will be one of [‘fixed_velocity’, ‘initial_and_final_velocity’, ‘initial_velocity_and_acceleration’].

GetValidInputValues()

Get a list of all possible values for “Input”.

  • Returns: The returned list is [‘fixed_velocity’, ‘initial_and_final_velocity’, ‘initial_velocity_and_acceleration’].

GetVelocity(unit: Optional[str] = None)

Get the value of “Velocity”.

  • Parameters: unit – The unit for the returned values. If no unit is provided, the returned values will be in “m/s”.

SetAcceleration(values: Sequence[Union[str, float]], unit: Optional[str] = None)

Set the values of “Acceleration”.

  • Parameters:
    • values – The values to set. The values can be heterogeneous, the element of values can be an expression with input variables or a float. Must have exactly 3 elements.
    • unit – The unit for values. If no unit is provided, values is assumed to be in “m/s2”.
  • Raises: RockyApiError – If values doesn’t have exactly 3 elements.

SetFinalVelocity(values: Sequence[Union[str, float]], unit: Optional[str] = None)

Set the values of “Final Velocity”.

  • Parameters:
    • values – The values to set. The values can be heterogeneous, the element of values can be an expression with input variables or a float. Must have exactly 3 elements.
    • unit – The unit for values. If no unit is provided, values is assumed to be in “m/s”.
  • Raises: RockyApiError – If values doesn’t have exactly 3 elements.

SetInput(value: str)

Set the value of “Input”.

  • Parameters: value – The value to set. Must be one of [‘fixed_velocity’, ‘initial_and_final_velocity’, ‘initial_velocity_and_acceleration’].
  • Raises: RockyApiError – If value is not a valid “Input” option.

SetVelocity(values: Sequence[Union[str, float]], unit: Optional[str] = None)

Set the values of “Velocity”.

  • Parameters:
    • values – The values to set. The values can be heterogeneous, the element of values can be an expression with input variables or a float. Must have exactly 3 elements.
    • unit – The unit for values. If no unit is provided, values is assumed to be in “m/s”.
  • Raises: RockyApiError – If values doesn’t have exactly 3 elements.

Connect with Ansys