Sphere

The PMI object to add a mark to a scene.

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
}

The properties type, uuid, and userData are described here. Additionally for this PMI object:

  • type can be C3DViewObjectTypes.Sphere or a string "Sphere";

  • userData object can be obtained later using the command with GetParametersTypes.AnnotationList as a type.

  1. center is a center point of sphere.

  2. radius is a sphere radius.

  3. options is additional options.

Additional options

Type of simple geometry options (TypeScript):

export type C3DViewSimpleGeometryOptions = {
    group?: number
    colors?: {
        fill?: C3DViewRGB
        lines?: C3DViewRGB
    }
}
  1. group field defines to which group a sphere belongs.

  2. colors is a group of values to change colors of a graphics object:

    • fill is a {r, g, b} value of solid fill color;

    • lines is a {r, g, b} value of 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 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.

Example

Example of the command adding a new sphere (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'
            }
        }
    ]
})