HyperWorks Solvers

Conventions

Conventions

Previous topic Next topic No expanding text in this topic  

Conventions

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

The MotionSolve API statements adhere to the following style conventions.

Python is case sensitive – so is the MotionSolve Python Interface

Thus, you will see the following behavior:

>>>

>>> from math import sin, pi

>>> sin(pi/2)

1.0

 

>>> Sin(pi/2)

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

NameError: name 'Sin' is not defined

The MotionSolve-Python interface adheres to this convention also.

>>>

>>> from math import sin, pi

>>> sin(pi/2)

1.0

 

>>> Sin(pi/2)

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

NameError: name 'Sin' is not defined

MotionSolve Classes

All MotionSolve classes use Upper Camel Case for capitalization: The first letter is always a capital letter. If the class name consists of two or more meaningful words joined together, the first letter of the subsequent words are also capitalized. All other letters are lower case. The examples below explain.

Valid Class Name

Invalid Variations of the Class Name

Part

PART, part, pART, etc.

Joint

JOINT, joint, jOiNt, etc.

SpringDamper

Springdamper, SPRINGDAMPER, springdamper, etc.

>>> from msolve import *

>>>

>>> jupiter = PaRT(MASS=1.89E27)        # Incorrect capitalization

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

NameError: name 'PaRT' is not defined

 

>>> jupiter = Part (mass=1.89813E27)        # Correct capitalization

>>> jupiter.mass

1.89813e+27

MotionSolve Class Attributes

Attributes are always lower-case. The table below illustrates.

Valid Attribute Names for Poutput

Invalid Attribute Names for Poutput

id

ID, Id, iD

label

Label, labeL, etc.

variables

Variables, VARiables, etc.