The CAD Import model generation environment in detail > Primitive association
Primitive parameter edition
The parameters of a primitive are computed automatically based on the shapes of the primitive itself, the ports, and the parts (if required). In some cases for which the CAD was not built using Parasolid; the topology of the CAD body shape is not correctly interpreted and the parameter is not computed. In that case you can enter an expression to get the required parameter.
The expression interpreter uses JavaScript programming language. A dedicated JavaScript object "CAD" allows you to perform geometric measurement on the CAD body. The JavaScript Math object allows you also to perform mathematical tasks on numbers.
Here is an example of calculating the curvature radius of a bend:
Copy
Cad.distance(port_a, port_b)/(2*Math.sin(Math.PI/180*Cad.angle
(port_a, port_b)/2)+Cad.radius(port_a, Inner)
JavaScript Cad object
| Method | Description |
|---|---|
| angle( |
Returns the angle between two CAD entities that are defined by a port or a part |
| angle_to_plane( |
Returns the angle between a CAD entity that is defined by a port, a part, or a primitive and a plane of the frame. The frame is either the absolute frame, the relative frame or the frame of the primitive |
| area( |
Returns the area of the surface of a CAD entity that is defined by a port, a part, or a primitive |
| center_of_gravity( |
Returns the coordinates of the center of gravity of a CAD entity defined by a port, a part, or a primitive. The frame is either the absolute frame, the relative frame or the frame of the primitive. As an option only one of the three coordinates values is returned |
| contour( |
Returns the list of the coordinates of the points that defined a contour. The frame is either the absolute frame, the relative frame or the frame of the primitive. As an option only two of the three coordinates values is returned |
| distance( |
Returns the distance between two CAD entities that are defined by a port or a part |
| inertia_matrix( |
Returns the matrix of inertia of a CAD solid body that is defined by a port, a part or a primitive. As option only one element of the matrix is returned |
| length( |
Returns the length of an edge based on the CAD entity that is defined by a port or a part |
| mass( |
Returns the mass of a CAD solid body that is defined by a port, a part, or a primitive |
| position( |
Returns the coordinates of a point of a CAD entity defined by a port, a part, or a primitive. The frame is either the absolute frame, the relative frame or the frame of the primitive. As an option only one of the three coordinates values is returned |
| property( |
Returns the property of a CAD entity that is defined in the Object inspector in CAD Import |
| radius( |
Returns the radius of a CAD entity defined by a port, a part, or a primitive. The radius is either the inner radius (circle) or the curvature radius (bend) |
| topology( |
Returns the topology of a CAD entity that is defined by a port, a part, or a primitive. The topology is the list of all the faces (Face), all the edges (Edge), or all the points (Vertex) that are part of the CAD entity. The frame is either the absolute frame, the relative frame or the frame of the primitive |
| volume( |
Returns the volume of a CAD solid body that is defined by a port, a part, or a primitive |
JavaScript Math object
| Method | Description |
|---|---|
| abs(x) | Returns the absolute value of x |
| acos(x) | Returns the arccosine of x, in radians |
| asin(x) | Returns the arcsine of x, in radians |
| atan(x) | Returns the arctangent of x as a numeric value between -PI/2 and PI/2 radians |
| atan2(x) | Returns the arctangent of the quotient of its arguments |
| ceil(x) | Returns the value of x rounded up to its nearest integer |
| cos(x) | Returns the cosine of x (x is in radians) |
| exp(x) | Returns the value of Ex |
| floor(x) | Returns the value of x rounded down to its nearest integer |
| log(x) | Returns the natural logarithm (base E) of x |
| max(x, y, z, …, n) | Returns the number with the highest value |
| min(x, y, z, …, n) | Returns the number with the lowest value |
| pow(x, y) | Returns the value of x to the power of y |
| random(x) | Returns a random value between 0 and 1 |
| round(x) | Returns the value of x rounded to its nearest integer |
| sin(x) | Returns the sine of x (x is in radians) |
| sqrt(x) | Returns the square root of x |
| tan(x) | Returns the tangent of an angle |
Source: https://docs.sw.siemens.com/en-US/doc/254352342/PL20250521841123434.amesim_collection.CAD2AME/xid1405266 · retrieved 2026-07-17