Commands

The view commands are used to manage a graphics view. To run any command, you should call the method runCommand which a C3DModelView class instance has.

This function takes one argument - an object - which must have the field name of a command.

Example (TypeScript):

// run command "zoom to fit"
view.runCommand({
    name: "ZoomFitCommand", // name of command
    // next arguments
    uuid: node.id,
    duration: 200
})

The function also returns some value. It’s a resulting object containing the field name of a result type.

Example (TypeScript):

// run GetParametersCommand to get current camera parameters
let result = view.runCommand({
    name:"GetParametersCommand", // name of command
    // next arguments:
    type:"Camera"
})

if( result.name == "GetParametersResult" )
{
    // save parameters
    switch(result.params.name)
    {
        case "Camera":
            saveOrientation(result.params.orientation)
            break
    }
}