Box
The PMI object to add a mark on the scene.
New in version 1.6.0: A box object with solid fill and frame.
Object
Each box object is created/removed by add/delete annotation commands. It may be received also by get parameters command. Everywhere uses the same type to represent a visual 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
}
type: Necessarily field, value is
C3DViewObjectTypes.Box
or string"Box"
.uuid: Unique identifier of the box object.
position: The object position on the scene:
center: Point of the box center.
angleX, angleY, angleZ: Euler angles to control the box incline.
width: A box width (axios X size).
height: A box height (axios Y size).
depth: A box depth (axios Z size).
options: Additional options.
userData: Custom user data for object.
Note
The new object will be created if the uuid
isn’t present.
The exist object with be update if the uuid
if the id belongs to it.
Additional options
Type of simple geometry options (TypeScript):
export type C3DViewSimpleGeometryOptions = {
colors?: {
fill?: C3DViewRGB
lines?: C3DViewRGB
}
}
colors: Grouped values to change colors of graphics object:
fill:
{r,b,g}
values of a solid fill color.lines:
{r,b,g}
values of a frame wire color.
Note
The frame wire will not show without lines
color setting.
The object surface will not show without fill
color setting.
The object will not show without any color setting.
User data
Custom user object that can be attached to every object.
Later they can be obtained using the command with GetParametersTypes.AnnotationList
as a type.
export type C3DUserData = object|undefined;
Example
Adding the new box command example (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},
},
}
]
})