Box
The PMI object to add a mark to a scene.
Object
Common type of box object (TypeScript):
export type C3DViewBox = {
type: C3DViewObjectTypes.Box
uuid?: string
position: {
center: C3DViewPoint
angleX?: number
angleY?: number
angleZ?: number
}
width: number
height: number
depth: number
options: C3DViewSimpleGeometryOptions
userData: C3DUserData
}
The properties type, uuid, and userData are described here. Additionally for this PMI object:
type can be
C3DViewObjectTypes.Box
or a string"Box"
;userData object can be obtained later using the command with
GetParametersTypes.AnnotationList
as a type.
position is an object position in a scene:
center is a center point of box;
angleX, angleY, angleZ are Euler angles to control box incline.
width is a box width (X-axis size).
height is a box height (Y-axis size).
depth is a box depth (Z-axis size).
options is additional options.
Additional options
Type of simple geometry options (TypeScript):
export type C3DViewSimpleGeometryOptions = {
group?: number
colors?: {
fill?: C3DViewRGB
lines?: C3DViewRGB
}
}
group field defines to which group a box belongs.
colors is a group of values to change colors of a graphics object:
fill is a
{r, g, b}
value of a solid fill color;lines is a
{r, g, b}
value of a wireframe color.
Note
If the lines color is not present, the object wireframe is not displayed. If the fill color is not present, the object surface is not displayed. If the no color settings are present, the entire object is not displayed.
New in version 1.6.0: Added the solid fill and lines (wireframe) color properties.
New in version 1.8.0: Added the group property.
Example
Example of the command adding a new box (TypeScript):
view.runCommand({
name: "AddAnnotation",
objs: [
{
type: "Box",
position: {
center: {x: 10, y: 0, z: 0},
},
width: 20,
height: 20,
depth: 20,
options: {
fill: {r: 255, g: 0, b: 0},
},
}
]
})