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

constructor()

Methods

addAxisRotationHandle()

addAxisTranslationHandle()

addHandles()

addMapping()

addPlaneTranslationHandle()

addTrackedPoint()

addViewPlaneTranslationHandle()

clearMapping()

clearTrackedPoints()

generateGroupId()

getNodeIds()

getPosition()

getTrackedPoints()

getTranslation()

isEnabled()

removeHandles()

setAxisMeshData()

setHandleSize()

setMapping()

setNodeIds()

setPlaneMeshData()

setRotateMeshData()

setViewPlaneMeshData()

showHandles()

updatePosition()


Constructors

constructor

Communicator.Operator.HandleOperator.constructor(viewer)
Arguments
  • viewer (Communicator.WebViewer()) –

Return type

Communicator.Operator.HandleOperator

Methods

addAxisRotationHandle

Communicator.Operator.HandleOperator.addAxisRotationHandle(position, axis, color, positionNormal, groupId)

Adds a handle that rotates around an axis

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

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

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

  • positionNormal ({  }()) – optional vector to control the orientation of the handle geometry.

  • groupId ({  }()) – optional parameter to associate this handle with a group of NodeIds

Return type

Promise[Communicator.NodeId]

addAxisTranslationHandle

Communicator.Operator.HandleOperator.addAxisTranslationHandle(position, axis, color, positionNormal, groupId)

Adds a handle that moves along an axis.

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

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

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

  • positionNormal ({  }()) – optional vector to control the orientation of the handle geometry.

  • groupId ({  }()) – optional parameter to associate this handle with a group of NodeIds

Return type

Promise[Communicator.NodeId]

addHandles

Communicator.Operator.HandleOperator.addHandles(nodeIds, position, groupId)

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

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

  • position ({  }()) – world space coordinates the the handle position

  • groupId ({  }()) –

Return type

Promise[void]

addMapping

Communicator.Operator.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
  • button (Communicator.Button()) –

  • modifier (Communicator.KeyModifiers()) –

Return type

void

addPlaneTranslationHandle

Communicator.Operator.HandleOperator.addPlaneTranslationHandle(position, normal, faceColor, lineColor, positionNormal, groupId)

Adds a handle that restricts movement to a plane.

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

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

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

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

  • positionNormal ({  }()) – optional vector to control the orientation of the handle geometry.

  • groupId ({  }()) – optional parameter to associate this handle with a group of NodeIds

Return type

Promise[Communicator.NodeId]

addTrackedPoint

Communicator.Operator.HandleOperator.addTrackedPoint(point)

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

Arguments
  • point (Communicator.Point3()) –

Return type

number

Returns

point index

addViewPlaneTranslationHandle

Communicator.Operator.HandleOperator.addViewPlaneTranslationHandle(position, color, groupId)

Adds a handle that restricts movement to the viewplane.

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

  • color (Communicator.Color()) – geometry color

  • groupId ({  }()) – optional parameter to associate this handle with a group of NodeIds

Return type

Promise[Communicator.NodeId]

clearMapping

Communicator.Operator.HandleOperator.clearMapping()

Clears any button and key modifier mappings for the operator.

Return type

void

clearTrackedPoints

Communicator.Operator.HandleOperator.clearTrackedPoints()

Clear the list of tracked points.

Return type

void

generateGroupId

Communicator.Operator.HandleOperator.generateGroupId()

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

Return type

number

getNodeIds

Communicator.Operator.HandleOperator.getNodeIds(groupId)

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

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

Return type

[Communicator.NodeId]

getPosition

Communicator.Operator.HandleOperator.getPosition()
Return type

{  }

Returns

the current handle position or null if not currently active.

getTrackedPoints

Communicator.Operator.HandleOperator.getTrackedPoints()

Gets the tracked point list.

Return type

[Communicator.Point3]

getTranslation

Communicator.Operator.HandleOperator.getTranslation()
Return type

Communicator.Point3

Returns

the total translation applied to the handles.

isEnabled

Communicator.Operator.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

Communicator.Operator.HandleOperator.removeHandles()

Removes all handles from the scene.

Return type

Promise[void]

setAxisMeshData

Communicator.Operator.HandleOperator.setAxisMeshData(meshData)

Sets the mesh data for axis handles.

Arguments
  • meshData (Communicator.MeshData()) –

Return type

Promise[void]

setHandleSize

Communicator.Operator.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

Communicator.Operator.HandleOperator.setMapping(button, modifier)

Sets the button and key modifier mapping for the operator.

Arguments
  • button (Communicator.Button()) –

  • modifier (Communicator.KeyModifiers()) –

Return type

void

setNodeIds

Communicator.Operator.HandleOperator.setNodeIds(nodeIds, groupId)

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

Arguments
  • nodeIds ([Communicator.NodeId]()) –

  • groupId ({  }()) – optional parameter that associates a group of NodeIds with a group of handles.

Return type

void

setPlaneMeshData

Communicator.Operator.HandleOperator.setPlaneMeshData(meshData)

Sets the mesh data for plane handles.

Arguments
  • meshData (Communicator.MeshData()) –

Return type

Promise[void]

setRotateMeshData

Communicator.Operator.HandleOperator.setRotateMeshData(meshData)

Sets the mesh data for rotation handles.

Arguments
  • meshData (Communicator.MeshData()) –

Return type

Promise[void]

setViewPlaneMeshData

Communicator.Operator.HandleOperator.setViewPlaneMeshData(meshData)

Sets the mesh data for view plane handles.

Arguments
  • meshData (Communicator.MeshData()) –

Return type

Promise[void]

showHandles

Communicator.Operator.HandleOperator.showHandles()

Shows any handles that have been added to the scene.

Return type

void

updatePosition

Communicator.Operator.HandleOperator.updatePosition(translation, rotation, finalizePosition, groupId)

Updates the current handle position.

Arguments
  • translation (Communicator.Point3()) – additional translation

  • rotation (Communicator.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 ({  }()) –

Return type

Promise[void]