HandleOperator

class Operators.HandleOperator()

Handles are added scene elements that can update the position of your parts through user interaction. Find more information [here](https://docs.techsoft3d.com/communicator/latest/tutorials/additive-manufacturing/handles.html).

Constructors


Constructors

HandleOperator.constructor(viewer, view)
Arguments:
Return type:

HandleOperator

Methods

addAxisRotationHandle

HandleOperator.addAxisRotationHandle(position, axis, color, positionNormal, groupId)
Arguments:
  • position (Point3()) – center of the handle.
  • axis (Point3()) – axis to rotate around
  • color (Color()) – color of the handle geometry
  • positionNormal (null | Point3()) – optional vector to control the orientation of the handle geometry.
  • groupId (null | number()) – optional parameter to associate this handle with a group of NodeIds

Adds a handle that rotates around an axis

Return type:Promise <number>

addAxisTranslationHandle

HandleOperator.addAxisTranslationHandle(position, axis, color, positionNormal, groupId)
Arguments:
  • position (Point3()) – center of the handle.
  • axis (Point3()) – axis to move along
  • color (Color()) – color of the handle geometry
  • positionNormal (null | Point3()) – optional vector to control the orientation of the handle geometry.
  • groupId (null | number()) – optional parameter to associate this handle with a group of NodeIds

Adds a handle that moves along an axis.

Return type:Promise <number>

addHandles

HandleOperator.addHandles(nodeIds, position, groupId)
Arguments:
  • nodeIds ([number]()) – corresponding to the parts that will move with the handles
  • position (null | Point3()) – world space coordinates the the handle position
  • groupId (null | number()) – None

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

Return type:Promise <void>

addMapping

HandleOperator.addMapping(button, modifier)
Arguments:
  • button (Button()) – None
  • modifier (KeyModifiers()) – None

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.

Return type:void

addPlaneTranslationHandle

HandleOperator.addPlaneTranslationHandle(position, normal, faceColor, lineColor, positionNormal, groupId)
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 (null | Point3()) – optional vector to control the orientation of the handle geometry.
  • groupId (null | number()) – optional parameter to associate this handle with a group of NodeIds

Adds a handle that restricts movement to a plane.

Return type:Promise <number>

addTrackedPoint

HandleOperator.addTrackedPoint(point)
Arguments:

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

Returns:point index
Return type:number

addViewPlaneTranslationHandle

HandleOperator.addViewPlaneTranslationHandle(position, color, groupId)
Arguments:
  • position (Point3()) – center of the handle
  • color (Color()) – geometry color
  • groupId (null | number()) – optional parameter to associate this handle with a group of NodeIds

Adds a handle that restricts movement to the viewplane.

Return type:Promise <number>

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)
Arguments:
  • groupId (null | number()) – optional parameter that specifies if the NodeIds to retrieve are part of a group.

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

Return type:[number]

getPosition

HandleOperator.getPosition()
Returns:the current handle position or null if not currently active.
Return type:null | Point3

getTrackedPoints

HandleOperator.getTrackedPoints()

Gets the tracked point list.

Return type:[Point3]

getTranslation

HandleOperator.getTranslation()
Returns:the total translation applied to the handles.
Return type:Point3

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)
Arguments:

Sets the mesh data for axis handles.

Return type:Promise <void>

setHandleSize

HandleOperator.setHandleSize(size)
Arguments:
  • size (number()) – None

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

Return type:void

setMapping

HandleOperator.setMapping(button, modifier)
Arguments:
  • button (Button()) – None
  • modifier (KeyModifiers()) – None

Sets the button and key modifier mapping for the operator.

Return type:void

setNodeIds

HandleOperator.setNodeIds(nodeIds, groupId)
Arguments:
  • nodeIds ([number]()) – None
  • groupId (null | number()) – optional parameter that associates a group of NodeIds with a group of handles.

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

Return type:void

setPlaneMeshData

HandleOperator.setPlaneMeshData(meshData)
Arguments:

Sets the mesh data for plane handles.

Return type:Promise <void>

setRotateMeshData

HandleOperator.setRotateMeshData(meshData)
Arguments:

Sets the mesh data for rotation handles.

Return type:Promise <void>

setViewPlaneMeshData

HandleOperator.setViewPlaneMeshData(meshData)
Arguments:

Sets the mesh data for view plane handles.

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)
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 (null | number()) – None

Updates the current handle position.

Return type:Promise <void>