Assembly: Kinematic Dragging and Creating Snapshots
This section describes the Creo Object TOOLKIT C++ methods for dragging assembly entities through an allowable range to see how your assembly works in a specific configuration. These methods provide the same result as obtained by using the Drag dialog box in the Creo Parametric user interface.
This chapter also describes the methods to create snapshots of the assembly in different positions and orientations.
Connecting to a Kinematic Drag Session
Methods Introduced:
The method wfcWSession::StartKinDrag starts a drag session. This method should be called before any other method for Kinematic drag or snapshots. All subsequent methods work with the snapshots of the top-level assembly. This method can be called for design assemblies in the Standard Assembly and Mechanism modes only. It cannot be used in the following cases:
•  If the assembly is in the exploded state
•  If the Sketcher mode is active
•  When component placement is active
•  When the Drag dialog box is active
The method wfcWSession::StopKinDrag stops the drag session. Use pfcWindow::Refresh to view the change in the graphic window scale according to the updated outline.
The method wfcWSession::SetKinDragEnvironment sets the environment for dragging and reconnect operations. It requires the following input arguments:
•  Type—Specifies the type of drag to be performed. It is given by the enumerated type wfcKinDragType that takes the following values:
  wfcKIN_POINT_DRAG— Select a point to drag in a part within the top-level assembly. During the dragging operation, the point you selected follows the pointer’s movement while maintaining connections.
  wfcKIN_BODY_DRAG—Select a part from the top-level assembly to drag. When you drag a part, its position in the graphics window changes, but its orientation remains fixed. If the assembly requires a part to be reoriented in conjunction with a change in position, the part does not move at all, as the assembly cannot reassemble in the new position.
  wfcKIN_ADVANCED_TRANS_X—Specifies the translation in the X direction of the selected coordinate system. This type is applicable only in case of an advanced drag operation. You can select a coordinate system by selecting the part to be dragged.
  wfcKIN_ADVANCED_TRANS_Y—Specifies the translation in the Y direction of the selected coordinate system. This type is applicable only in case of an advanced drag operation.
  wfcKIN_ADVANCED_TRANS_Z—Specifies the translation in the Z direction of the selected coordinate system. This type is applicable only in case of an advanced drag operation.
  wfcKIN_ADVANCED_ROT_X—Specifies the rotation around the X axis of the selected coordinate system. This type is applicable only in case of an advanced drag operation. You can select a coordinate system by selecting the part to be dragged.
  wfcKIN_ADVANCED_ROT_Y—Specifies the rotation around the Y axis of the selected coordinate system. This type is applicable only in case of an advanced drag operation.
  wfcKIN_ADVANCED_ROT_Z—Specifies the rotation around the Z axis of the selected coordinate system. This type is applicable only in case of an advanced drag operation.
•  Name—Specifies the name of the active snapshot whose constraints are used for the drag operation. The snapshot is checked for statuses such as good, outdated, or incomplete. Pass NULL if not required.
The outdated status means some parts from the body have a relative transformation that is different from the current transformation. The incomplete status means that some parts from the body are missing in the active snapshot.
•  path—Specifies the path in terms of the pfcComponentPath object to the active snapshot of a subassembly contained within the top-level assembly. Pass NULL for a top-level assembly snapshot.
•  Reference—Specifies the selection reference in the form a coordinate system , part, or mechanism body for an advanced drag operation. This argument is relevant only for advanced drag types. For all other drag types, it is ignored and NULL should be passed.
Performing Kinematic Drag
Methods Introduced:
The method wfcWSession::MoveKinDrag drags the selected geometric object to the specified X and Y screen coordinates given by array of pfcPoint2Ds object. A hook point is displayed on the object selected for drag, which is removed at the end of the drag operation. The dragging is performed according to the environment set by the method wfcWSession::SetKinDragEnvironment. Use the constraints set for the active snapshot while dragging.
The method wfcWSession::MoveKinDragForModel brings to drag the selected object. Performs a drag according to the environment set in wfcWSession::SetKinDragEnvironment For dragging use constraints from the current snapshot, if it is set. The input arguments are as follows:
•  DragPoint—A geometrical object point, surface, axis or component to be dragged. Set the selected-point using pfcSelection::GetPoint, otherwise the hook point will be wrong and movement result will be wrong as well.
•  Moves—Sequence of 3d points in model coordinates.
•  Matrix—The view transformation matrix for the drag operation and the value can be NULL. If NULL, the method will take currently active model and view matrix.
Creating and Modifying Snapshots
Methods Introduced:
The method wfcWSession::CreateSnapshot creates a new snapshot for the top-level assembly as per its current position in the Creo Parametric window. Constraints are copied from the active snapshot. The newly created snapshot becomes active.
The method wfcWSession::UpdateSnapshot updates the snapshot for the top-level assembly as per its current position in the Creo Parametric window. Constraints are copied from the active snapshot. The newly updated snapshot becomes active.
The method wfcWSession::DeleteSnapshot deletes a specified snapshot. The snapshot can be of the top-level assembly or any of its subassemblies. Pass NULL for the argument path to specify the top-level assembly.
Snapshot Transforms
Methods Introduced:
The method wfcWSession::GetKinSnapshotTransformations retrieves the transformation paths and transformation matrices saved in the snapshots for the subassemblies and their components with respect to the top-level assembly snapshot.