Sphere
The PMI object to add a mark on the scene.
New in version 1.6.0: A sphere object with solid fill and frame.
Object
Each sphere 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 a sphere object (TypeScript):
export type C3DViewSphere = {
type: C3DViewObjectTypes.Sphere // "Sphere"
uuid?: string
center: C3DViewPoint
radius: number
options: C3DViewSimpleGeometryOptions
userData: C3DUserData
}
type: Necessarily field, value is
C3DViewObjectTypes.Sphere
or string"Sphere"
.uuid: Unique identifier of the sphere object.
center: Position point of the sphere center.
radius: A sphere radius.
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 sphere command example (TypeScript):
view.runCommand({
name: "AddAnnotation",
objs: [
{
type: "Sphere",
center: {x: 10, y: 10, z: 10},
radius: 20,
options: {
fill: {r: 255, g: 0, b: 0},
},
userData: {
customField: 'custom data'
}
}
]
})