Editing Section Plane Process

Below we will consider the process that allows to create and edit a section plane.

Section plane

Features

EditSectionPlaneProcess type (TypeScript):

export type EditSectionPlaneProcess = {
    name: "EditSectionPlane"
    id?: number
    options: EditSectionPlaneOptions
    events: {
        onUpdate?: (a: number, b: number, c: number) => void
        onInvert?: (value: "front" | "back") => void
        onCtrlOriginChanged?: (centered: boolean) => void
    }
}

In addition to the options, this process has an optional property id. If specified, it allows editing section planes already added by the command.

Note

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

New in version 1.8.0: Increased the number of planes, simultaneously in a scene, from 4 to 6. Added the controller to transform the placement of plane interactively.

Interactive Transforming

The process also gives an opportunity to interactively transform the placement of plane by using the so-called controller (created automatically after the process is run). This represents some kind of a Vision object which is added to a scene. The controller provides the following types of transformation:

  • linear movement along the Z axis;

  • planar movement along the XY plane;

  • rotation along the X, and Y axes.

The plane controller

Options

Section Plane Options type (Typescript):

export type EditSectionPlaneOptions = {
    placement?: {
        a: number,
        b: number,
        c: number
    }
    colors?: {
        lines: C3DViewRGB,
        rect: C3DViewRGB,
        transparent: number
    }
    direction?: "front" | "back"
    centering?: boolean
}

Name

Description

placement

Section plane defined by two angles and offset (more details). The default is {a: 0, b: 0, c: 0}

colors.lines

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

colors.rect

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

colors.transparent

Transparency of section plane rect. The default is 0.4

direction

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

centering

Whether the process aligns the controller by the center (origin) of section plane. The default is true

Note

All options can be changed while the process is run via the updating command.

New in version 1.8.0: Added the option centering to center the controller.

Callbacks

Available events:

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

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

  3. onCtrlOriginChanged(centered) is emitted when the controller origin becomes different from the plane one (centered is false) or equal to it (centered is true).

New in version 1.8.0: Added the event onCtrlOriginChanged.

Running

Example of running the process (TypeScript):

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

Updating

Any changes in a section 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
        }
    }
})