Geometry is described as an array of shells or polyline annotations. The shell geometry is a triangular mesh representation of some CAD shape for 3D display. Each element of the array identifies its type, usage, and numeric values.
[{ 'type': string, 'class': (optional) string, 'geom': { Mesh, Polyline, or Placement object } }]
Property | Type | Description |
---|---|---|
type | string | This string determines the contents of the "geom" property. Valid
values are "mesh" , "polyline" ,
and "placement" . |
class | string | Optional. When omitted, the geometry is part of the fundamental
shape information. The "annotation" value means that the
geometry describes PMI callouts on the shape.
The "constructive" value means that the geometry
describes auxilliary planes and placements on the shape. |
geom | object | The geometric description of the shape element. The object for each of the different types is different and detailed below. |
When the type is "mesh"
, the geometry object is a
triangular mesh representation of some CAD shape for 3D display. This
shell is described as follows:
'geom': { 'id': string, 'faces': FaceRef[], 'precision': int, 'points': int[], 'normals': int[] }
Property | Type | Description |
---|---|---|
id | string | The unique identifier for the Shell. |
faces | FaceRef[] | See below. An array of face information for the Shell. |
precision | int | The power of ten scaling factor applied to the normal and point arrays to get integer values. |
points | int[] |
A sequence of XYZ values describing each vertex in the shell. Items [0-2] of the array describe the first XYZ point, items [3-5] describe the second set of XYZ values, etc. Each group of three XYZ points describe a single triangle, and the points are ordered so that the right hand rule will give the surface normal of the triangle. So the nine integers in points[0-8] describe a single triangle, which goes from points[0-2], to points[3-5], to points[6-8]. The second triangle is given by the next nine integers in points[9-17]. The mesh is scaled so that all XYZ coordinate values and IJK normal direction components are integers. To get the original floating point values, divide by 10precision. |
normals | int[] |
A sequence of IJK values describing the surface normal at each vertex in the shell. This operates in parallel with the 'points' array, so the IJK given by normals[0-2] is the surface normal for the vertex given by points[0-2]. These vertex normals are typically used for smooth shading of the triangular mesh. |
The FaceRef objects hold a face ID, a color, and a count of triangles in the face. The triangles in the shell points array are sorted by face. The first face starts with the first triangle and extends for 'face1.count' triangles. The second face starts at the next triangle and continues for 'face2.count' triangles. This face description is expanded into a start/end index by the client code for easier access.
{ 'count': int, 'id': string, 'color': double[3] }
Property | Type | Description |
---|---|---|
id | string | The unique ID for the associated face. |
count | int | Number of points this applies to? |
color | double[3] | The RGB color of the face, using (0..1) ranges. |
An abbreviated example of a mesh is shown below. The precision is 4, so the integer values must be dividied by 10000 to get the original floating point values. So the first normal is (0,0,-1) and the first point is at (800, 235.4999, 134.9991). The first face contains the first 312 triangles, the second face contains the next 42 triangles, and so on.
[{ "type": "mesh", "geom": { "faces": [ { "count": 312, "id": 23343, "color": [0.250980, 0.250980, 0.250980] }, { "count": 42, "id": 23344, "color": [0.250980, 0.250980, 0.250980] }, Many faces omitted ], "precision": 4, "normals": [0,0,-10000, 0,0,-10000, 0,0,-10000, Many normals omitted ], "points": [8000000,2354999,1349991, 7810000,3360000,1349991, 8000000,4659999,1349991, Many points omitted ]} }]
When the type is "polyline"
, the geometry object is a
an array of polyline segments objects. Each segment contains an RGB
color and an sequence of floating point XYZ values as follows:
'geom': [{ 'color': double[3], 'points': [ double[3] ] }
Property | Type | Description |
---|---|---|
color | double[3] | The RGB color of the face, using (0..1) ranges. |
points | array of double[3] | The XYZ values for each point in the polyline. These are conventional floating point values, not the scaled integers used by the mesh structures. |
An abbreviated example of a polyline is shown below.
[{ "type": "polyline", "geom": [ { "color": [0.000000, 1.000000, 0.000000], "points": [ [0,0,30], [24.9624,-37.3252,25], [49.9248,-74.6505,20], [74.8873,-111.976,15], [99.8497,-149.301,10] ] } , { "color": [1.000000, 1.000000, 1.000000], "points": [ [99.8497,-149.301,10], [99.8497,-149.301,7], [99.8497,-149.301,4], [99.8497,-149.301,1], [99.8497,-149.301,-2] ] } , Many polyline segments omitted ] }]
When the type is "placement"
, the geometry object is a
coordinate system placement. This describes a location in space, a
direction for the Z-axis, and a direction for the X-axis. The Y-axis
direction can be found by computing the cross product.
"geom": { "origin": double[3], "axis": double[3], "ref": double[3] }
An example of a placement is shown below. This has the origin at (400, 0, 0) and the new Z-axis pointing in the positive X direction. The new X-axis points in the positive Y direction. By cross product (Z x X) the new Y-axis will point in the positive Z direction.
{ "type": "placement", "class": "constructive", "geom": { "origin": [400, 0, 0], "axis": [1, 0, 0], "ref": [0, 1, 0] } }