Editing Section Plane Process

Below we will consider the process that allows to update a cutting plane with a highlighted section plane.

Below a section plane being edited

Common process type (TypeScript):

export type EditSectionPlaneProcess = {
    name: "EditSectionPlane"
    id?: number
    options: {
        placement?: {
            a: number
            b: number
            c: number 
        }
        colors?: {
            lines: C3DViewRGB
            rect: C3DViewRGB
            transparent: number
        }
        direction?: "front"|"back"
    }
    events: {
        onUpdate?: (a:number, b:number, c:number) => void
        onInvert?: (value: "front"|"back") => void
    }
}

In addition to options, this process has an optional property id. It allows to update cutting planes already added by command if set.

Note

It’s possible to add a new cutting plane (if the limit in four planes is not exceeded) by editing a section plane with an empty id parameter.

Options

Name

Description

placement

A section plane defined by two angles and offset. Details. The default is {a: 0, b: 0, c: 0}

colors.lines

A RGB outline plane color. The default is {r: 255, g: 0, b: 0}

colors.rect

A RGB plane filling color. The default is {r: 255, g: 0: b: 0}

colors.transparent

Transparency of the section plane rect. The default is 0.4

direction

The cutting plane splits a model into two parts. This option defines which of them will be shown (the other one will be hidden). The default is front

Note

All options can be changed during performing the process via updating command.

Running the Process

Example of running the process (TypeScript):

view.runCommand({
    name: "RunProcessCommand", 
    process: {
        name: "EditSectionPlane",
        id: 1,
        options: {
            placement: {
                a: 3,
                b: 1,
                c: 100
            }
        },
        events: {}
    }
})

Callbacks

Available events:

  • onUpdate(a, b, c): emitted when a plane is changed (via update process command).

  • onInvert(direction): emitted when a direction of a plane is changed.

Updating Process

Any changes in a cutting plane available only via the updating command.

Common type of the updating command (TypeScript):

type UpdateProcess = {
    name: "UpdateProcessCommand"
    options: {
        name: "EditSectionPlane"
        placement?: {
            a: number
            b: number
            c: number 
        }
        colors?: {
            lines: C3DViewRGB
            rect: C3DViewRGB
            transparent: number
        }
        direction?: "front"|"back"
    }
}

Example of command to update a plane definition (TypeScript):

view.runCommand({
    name: "UpdateProcessCommand", 
    options: {
        name: "EditSectionPlane",
        placement: {
            a: 3,
            b: 2,
            c: 100
        }
    }
})