HandleOperator

class Communicator.Operator.HandleOperator()

Handles are added scene elements that can update the position of your parts through user interaction. Find more information here.

Constructors


Constructors

HandleOperator.constructor(viewer)
Arguments
Return type

HandleOperator()

Methods

addAxisRotationHandle

HandleOperator.addAxisRotationHandle(position, axis, color[, positionNormal[, groupId]])

Adds a handle that rotates around an axis

Arguments
  • position (Point3()) – center of the handle.

  • axis (Point3()) – axis to rotate around

  • color (Color()) – color of the handle geometry

  • positionNormal (Point3() | null) – optional optional vector to control the orientation of the handle geometry.

  • groupId (number | null()) – optional optional parameter to associate this handle with a group of NodeIds

Return type

Promise <NodeId>

addAxisTranslationHandle

HandleOperator.addAxisTranslationHandle(position, axis, color[, positionNormal[, groupId]])

Adds a handle that moves along an axis.

Arguments
  • position (Point3()) – center of the handle.

  • axis (Point3()) – axis to move along

  • color (Color()) – color of the handle geometry

  • positionNormal (Point3() | null) – optional optional vector to control the orientation of the handle geometry.

  • groupId (number | null()) – optional optional parameter to associate this handle with a group of NodeIds

Return type

Promise <NodeId>

addHandles

HandleOperator.addHandles(nodeIds[, position[, groupId]])

Adds all handles into the scene, oriented along the primary axes

Arguments
  • nodeIds ([NodeId]) – corresponding to the parts that will move with the handles

  • position (Point3() | null) – optional world space coordinates the the handle position

  • groupId (number | null()) – optional

Return type

Promise <void>

addMapping

HandleOperator.addMapping(button[, modifier])

Adds a button and key modifier mapping for the operator. If no mapping is provided, all combinations are considered valid. All mappings require a mouse button, but a key modifier is optional.

Arguments
Return type

void

addPlaneTranslationHandle

HandleOperator.addPlaneTranslationHandle(position, normal, faceColor, lineColor[, positionNormal[, groupId]])

Adds a handle that restricts movement to a plane.

Arguments
  • position (Point3()) – center of the handle.

  • normal (Point3()) – normal of the plane

  • faceColor (Color()) – face color of the handle geometry

  • lineColor (Color()) – outline color of the handle geometry

  • positionNormal (Point3() | null) – optional optional vector to control the orientation of the handle geometry.

  • groupId (number | null()) – optional optional parameter to associate this handle with a group of NodeIds

Return type

Promise <NodeId>

addTrackedPoint

HandleOperator.addTrackedPoint(point)

Add a point to the tracked points list. When the handle moves, these points will update in world space.

Arguments
Return type

number

Returns

point index

addViewPlaneTranslationHandle

HandleOperator.addViewPlaneTranslationHandle(position, color[, groupId])

Adds a handle that restricts movement to the viewplane.

Arguments
  • position (Point3()) – center of the handle

  • color (Color()) – geometry color

  • groupId (number | null()) – optional optional parameter to associate this handle with a group of NodeIds

Return type

Promise <NodeId>

clearMapping

HandleOperator.clearMapping()

Clears any button and key modifier mappings for the operator.

Return type

void

clearTrackedPoints

HandleOperator.clearTrackedPoints()

Clear the list of tracked points.

Return type

void

generateGroupId

HandleOperator.generateGroupId()

This will generate a unique id to associate a group of handles with a group of NodeIds.

Return type

number

getNodeIds

HandleOperator.getNodeIds([groupId])

Gets the NodeIds that the handles in the scene will move.

Arguments
  • groupId (number | null()) – optional optional paramater that specifies if the NodeIds to retrieve are part of a group.

Return type

[NodeId]

getPosition

HandleOperator.getPosition()
Return type

Point3() | null

Returns

the current handle position or null if not currently active.

getTrackedPoints

HandleOperator.getTrackedPoints()

Gets the tracked point list.

Return type

[Point3()]

getTranslation

HandleOperator.getTranslation()
Return type

Point3()

Returns

the total translation applied to the handles.

isEnabled

HandleOperator.isEnabled()

Returns a boolean value indicating if handles are available to be added to the scene If there is an active explode, active measure, or the model is a 2d drawing. this will be false.

Return type

boolean

removeHandles

HandleOperator.removeHandles()

Removes all handles from the scene.

Return type

Promise <void>

setAxisMeshData

HandleOperator.setAxisMeshData(meshData)

Sets the mesh data for axis handles.

Arguments
Return type

Promise <void>

setHandleSize

HandleOperator.setHandleSize(size)

Takes a scale value to change the handle size with 1 representing the default size

Arguments
  • size (number()) –

Return type

void

setMapping

HandleOperator.setMapping(button[, modifier])

Sets the button and key modifier mapping for the operator.

Arguments
Return type

void

setNodeIds

HandleOperator.setNodeIds(nodeIds[, groupId])

Sets the NodeIds that any handles in the scene will move.

Arguments
  • nodeIds ([NodeId]) –

  • groupId (number | null()) – optional optional parameter that associates a group of NodeIds with a group of handles.

Return type

void

setPlaneMeshData

HandleOperator.setPlaneMeshData(meshData)

Sets the mesh data for plane handles.

Arguments
Return type

Promise <void>

setRotateMeshData

HandleOperator.setRotateMeshData(meshData)

Sets the mesh data for rotation handles.

Arguments
Return type

Promise <void>

setViewPlaneMeshData

HandleOperator.setViewPlaneMeshData(meshData)

Sets the mesh data for view plane handles.

Arguments
Return type

Promise <void>

showHandles

HandleOperator.showHandles()

Shows any handles that have been added to the scene.

Return type

void

updatePosition

HandleOperator.updatePosition(translation, rotation, finalizePosition[, groupId])

Updates the current handle position.

Arguments
  • translation (Point3()) – additional translation

  • rotation (Matrix()) – additional rotation

  • finalizePosition (boolean()) – keep translation and rotation. If true, added translation and rotation will not reset the next time the position is updated.

  • groupId (number | null()) – optional

Return type

Promise <void>