Point Process

Below we will consider the process that allows a user to select any point on a model.

Set point process type (TypeScript):

export type SetPointProcess = {
    name: "SetPointProcess"
    snap?: SnapOptions
    events: {
        onInitPoint?: (p: C3DViewPoint) => void
        onMovePoint?: (p: C3DViewPoint) => void
        onContextPoint?: (p: C3DViewPoint) => void
    }
}

The option snap allows to move the points indicated by the user’s mouse cursor to the nearest vertices of the triangle. More details in the section Snap option. This option is disabled by default.

The process provides the following callback methods (all of them receive a event point as the argument):

Parameter

Execution condition

onInitPoint

Left click on the model.

onMovePoint

Move cursor under the model.

onContextPoint

Right click on the model.

New in version 1.6.0: Added the onMovePoint and onContextPoint callbacks.

Running the Process

Example of running the point process (TypeScript):

view.runCommand({
    name: "RunProcessCommand", 
    process: {
        name: "SetPointProcess",
        events: {
            onInitPoint: (p: C3DViewPoint) => {
                console.log(`Selected point: (x: ${p.x}, y: ${p.y}, z: ${p.z})`)
            }
        }
    }
})

This process doesn’t have any additional options.

Important

Updating process is not provided!