Communicator.Operator.HandleOperator

 HandleOperator

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

Implements

Constructors

constructor

Methods

addAxisRotationHandle

  • Adds a handle that rotates around an axis

    Parameters

    • position: Point3

      center of the handle.

    • axis: Point3

      axis to rotate around

    • color: Color

      color of the handle geometry

    • Optional positionNormal: Point3 | null

      optional vector to control the orientation of the handle geometry.

    • Optional groupId: number | null

      optional parameter to associate this handle with a group of NodeIds

    Returns Promise<NodeId>

addAxisTranslationHandle

  • addAxisTranslationHandle(position: Point3, axis: Point3, color: Color, positionNormal?: Point3 | null, groupId?: number | null): Promise<NodeId>
  • Adds a handle that moves along an axis.

    Parameters

    • position: Point3

      center of the handle.

    • axis: Point3

      axis to move along

    • color: Color

      color of the handle geometry

    • Optional positionNormal: Point3 | null

      optional vector to control the orientation of the handle geometry.

    • Optional groupId: number | null

      optional parameter to associate this handle with a group of NodeIds

    Returns Promise<NodeId>

addHandles

  • addHandles(nodeIds: NodeId[], position?: Point3 | null, groupId?: number | null): Promise<void>
  • Adds all handles into the scene, oriented along the primary axes

    Parameters

    • nodeIds: NodeId[]

      corresponding to the parts that will move with the handles

    • Optional position: Point3 | null

      world space coordinates the the handle position

    • Optional groupId: number | null

    Returns Promise<void>

addMapping

  • 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.

    Parameters

    Returns void

addPlaneTranslationHandle

  • addPlaneTranslationHandle(position: Point3, normal: Point3, faceColor: Color, lineColor: Color, positionNormal?: Point3 | null, groupId?: number | null): Promise<NodeId>
  • Adds a handle that restricts movement to a plane.

    Parameters

    • 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

    • Optional positionNormal: Point3 | null

      optional vector to control the orientation of the handle geometry.

    • Optional groupId: number | null

      optional parameter to associate this handle with a group of NodeIds

    Returns Promise<NodeId>

addTrackedPoint

  • addTrackedPoint(point: Point3): number
  • Add a point to the tracked points list. When the handle moves, these points will update in world space.

    Parameters

    Returns number

    point index

addViewPlaneTranslationHandle

  • addViewPlaneTranslationHandle(position: Point3, color: Color, groupId?: number | null): Promise<NodeId>
  • Adds a handle that restricts movement to the viewplane.

    Parameters

    • position: Point3

      center of the handle

    • color: Color

      geometry color

    • Optional groupId: number | null

      optional parameter to associate this handle with a group of NodeIds

    Returns Promise<NodeId>

clearMapping

  • clearMapping(): void
  • Clears any button and key modifier mappings for the operator.

    Returns void

clearTrackedPoints

  • clearTrackedPoints(): void
  • Clear the list of tracked points.

    Returns void

generateGroupId

  • generateGroupId(): number
  • This will generate a unique id to associate a group of handles with a group of NodeIds.

    Returns number

getNodeIds

  • getNodeIds(groupId?: number | null): NodeId[]
  • Gets the NodeIds that the handles in the scene will move.

    Parameters

    • Optional groupId: number | null

      optional paramater that specifies if the NodeIds to retrieve are part of a group.

    Returns NodeId[]

getPosition

  • getPosition(): Point3 | null
  • Returns Point3 | null

    the current handle position or null if not currently active.

getTrackedPoints

  • getTrackedPoints(): Point3[]
  • Gets the tracked point list.

    Returns Point3[]

getTranslation

  • Returns Point3

    the total translation applied to the handles.

isEnabled

  • isEnabled(): boolean
  • 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.

    Returns boolean

removeHandles

  • removeHandles(): Promise<void>
  • Removes all handles from the scene.

    Returns Promise<void>

setAxisMeshData

  • setAxisMeshData(meshData: MeshData): Promise<void>
  • Sets the mesh data for axis handles.

    Parameters

    Returns Promise<void>

setHandleSize

  • setHandleSize(size: number): void
  • Takes a scale value to change the handle size with 1 representing the default size

    Parameters

    • size: number

    Returns void

setMapping

  • Sets the button and key modifier mapping for the operator.

    Parameters

    Returns void

setNodeIds

  • setNodeIds(nodeIds: NodeId[], groupId?: number | null): void
  • Sets the NodeIds that any handles in the scene will move.

    Parameters

    • nodeIds: NodeId[]
    • Optional groupId: number | null

      optional parameter that associates a group of NodeIds with a group of handles.

    Returns void

setPlaneMeshData

  • setPlaneMeshData(meshData: MeshData): Promise<void>
  • Sets the mesh data for plane handles.

    Parameters

    Returns Promise<void>

setRotateMeshData

  • setRotateMeshData(meshData: MeshData): Promise<void>
  • Sets the mesh data for rotation handles.

    Parameters

    Returns Promise<void>

setViewPlaneMeshData

  • setViewPlaneMeshData(meshData: MeshData): Promise<void>
  • Sets the mesh data for view plane handles.

    Parameters

    Returns Promise<void>

showHandles

  • showHandles(): void
  • Shows any handles that have been added to the scene.

    Returns void

updatePosition

  • updatePosition(translation: Point3, rotation: Matrix, finalizePosition: boolean, groupId?: number | null): Promise<void>
  • Updates the current handle position.

    Parameters

    • 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.

    • Optional groupId: number | null

    Returns Promise<void>