Assembly: Kinematic Dragging and Creating Snapshots
This section describes the Creo TOOLKIT functions for dragging assembly entities through an allowable range to see how your assembly works in a specific configuration. These functions provide the same result as obtained by using the Drag dialog box in the Creo Parametric user interface.
This chapter also describes the functions to create snapshots of the assembly in different positions and orientations.
Connecting to a Kinematic Drag Session
Functions Introduced:
The function ProKinDragStart() starts a drag session. This function should be called before any other function for Kinematic drag or snapshots. All subsequent functions work with the snapshots of the top-level assembly. This function 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 function ProKinDragStop() stops the drag session. Use ProWindowRefresh() to view the change in the graphic window scale according to the updated outline.
The function ProKinDragSessionInquire() determines if the drag session is active. The drag session may exist automatically in some cases, such as redefine, regeneration, window switch, representation mode change.
The function ProKinDragEnvironmentSet() sets the environment for dragging and reconnect operations. It requires the following input arguments:
•  snap_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 ProAsmcomppath object to the active snapshot of a subassembly contained within the top-level assembly. Pass NULL for a top-level assembly snapshot.
•  type—Specifies the type of drag to be performed. It is given by the enumerated type ProKinDragType that takes the following values:
  PRO_KIN_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.
  PRO_KIN_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.
  PRO_KIN_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.
  PRO_KIN_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.
  PRO_KIN_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.
  PRO_KIN_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.
  PRO_KIN_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.
  PRO_KIN_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.
•  refobject—Specifies the selection reference in the form a coordinate system (PRO_CSYS), part (PRO_PART), or mechanism body (PRO_MDO_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.
The function ProKinDragReconnect() reconnects to a drag session taking into account constraints but not transforms from the active snapshot specified in ProKinDragEnvironmentSet(). Use ProWindowRefresh() to view the changes in the positions of the assembly components. Refer to the sections Snapshot Constraints and Snapshot Transforms for more information.
Performing Kinematic Drag
Function Introduced:
The function ProKinDragPerformMove() drags the selected geometric object to the specified X and Y screen coordinates given by ProArray of Pro2dPnt object. The geometric object can be PRO_POINT, PRO_SURFACE_PNT, PRO_AXIS, PRO_EDGE, PRO_CURVE, PRO_DATUM_PLANE, PRO_SRF_PLANE_PNT, or PRO_SURFACE in case of a point drag, and PRO_PART or PRO_MDO_BODY for all other drag types. 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 function ProKinDragEnvironmentSet(). Use the constraints set for the active snapshot while dragging.
Creating and Modifying Snapshots
Functions Introduced:
The function ProKinDragSnapshotsNamesGet() retrieves an array of names of the snapshots belonging to the top-level assembly and all its subassemblies.
The function ProSnapshotCreate() 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 function ProSnapshotUpdate() 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 function ProSnapshotRename() renames the active snapshot of the top-level assembly.
The function ProSnapshotDelete() 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.
The function ProSnapshotApply() applies the transforms of the active snapshot. Unlike in the user interface, no attempt to reconnect is made. Call ProKinDragReconnect() if reconnect is necessary. Use ProWindowRefresh() to view the changes in the positions of the assembly components.
Snapshot Constraints
The constraints that can be applied to a snapshot are contained by the structure ProSnapshotConstraint. The declaration for ProSnapshotConstraint is as follows:
typedef struct proSnapshotConstraint
{
ProSnapshotConstraintType   type;
ProSelection               *sel_array;
double                      value;
ProBool                     user_active;
ProBool                     valid
} ProSnapshotConstraint;
The fields in the above structure are described as follows:
•  type—Specifies the type of snapshot constraint. The type is represented by the enumerated type ProSnapshotConstraintType and can take one of the following values:
  PRO_SNAP_ALIGN—Select two points, two lines, or two planes from the top-level assembly. The two entities remain aligned during the drag operation.
  PRO_SNAP_MATE—Select two planes from the top-level assembly. The planes remain mated during the drag operation.
  PRO_SNAP_ORIENT—Select two planes that orient at an angle with each other.
  PRO_SNAP_MOTION_AXIS_POS—Select a motion axis to specify the motion axis position.
  PRO_SNAP_BODY_LOCK—Select the bodies to be locked together while dragging.
  PRO_SNAP_CONNECTION_DISABLE—Select a connection that will be disabled while dragging.
  PRO_SNAP_PARALLEL_VIEW_PLANE—Select a body that will move parallel only to the view plane. This constraint type is the same as the PRO_SNAP_ALIGN or PRO_SNAP_MATE types, but the second reference in this case is the view plane. This constraint type is available only via Creo TOOLKIT. If set by the Creo TOOLKIT application, this constraint type becomes visible in the Drag dialog box in the Creo Parametric user interface, but it cannot be stored.
  PRO_SNAP_CAM_LIFTOFF_ENABLE—Allows two cams with a cam-follower connection to separate and collide during a dragging operation.
  PRO_SNAP_CAM_LIFTOFF_DISABLE—Requires two cams with a cam-follower connection to be in contact with each other during the dragging operation.
Note
The constraint types PRO_SNAP_CAM_LIFTOFF_ENABLE and PRO_SNAP_CAM_LIFTOFF_DISABLE override the Enable Liftoff property that you set from the Cam-Follower Connection Definition dialog box in the Creo Parametric user interface.
•  *sel_array—Specifies the ProArray of selections. The number of selections needed and the permitted selection types for each constraint type are specified in the following table:
Constraint Type
Number of Selections needed
Permitted Selection Types
PRO_SNAP_ALIGN
2
PRO_POINT, PRO_SURFACE_PNT, PRO_AXIS, PRO_EDGE, PRO_CURVE, PRO_DATUM_PLANE, PRO_SRF_PLANE_PNT, PRO_SURFACE
PRO_SNAP_MATE, PRO_SNAP_ORIENT
PRO_DATUM_PLANE, PRO_SRF_PLANE_PNT, PRO_SURFACE
PRO_SNAP_MOTION_AXIS_POS
1
PRO_MDO_CONN_AXIS_ROT_1/2/3, PRO_MDO_CONN_AXIS_TR_1/2/3, PRO_MDO_SLOT_AXIS
PRO_SNAP_CONNECTION_DISABLE
PRO_MDO_CONN, PRO_MDO_CAM_CONN, PRO_MDO_SLOT_CONN, PRO_MDO_GEAR_CONN
PRO_SNAP_PARALLEL_VIEW_PLANE
PRO_POINT, PRO_SURFACE_PNT, PRO_EDGE_START, PRO_EDGE_END, PRO_CRV_START, PRO_CRV_END, PRO_AXIS, PRO_EDGE, PRO_CURVE, PRO_SRF_PLANE_PNT, PRO_SURFACE, PRO_DATUM_PLANE
PRO_SNAP_CAM_LIFTOFF
_ENABLE
PRO_MDO_CAM_CONN
PRO_SNAP_CAM_LIFTOFF
_DISABLE
PRO_SNAP_BODY_LOCK
2 or more
PRO_PART, PRO_MDO_BODY
•  value—Depending upon the constraint type, this field takes the following values:
  For the PRO_SNAP_ALIGN and PRO_SNAP_MATE constraint types, value specifies the linear distance between the references.
  For the PRO_SNAP_ORIENT type, value specifies the angle between the references.
  For the PRO_SNAP_MOTION_AXIS_POS type, value specifies the offset of the joint axis zero position. This value is angular for the rotation axis and linear for the translational axis. The references for the joint axis zero position may be default or as specified by the user.
•  active—Specifies the ProBoolean option to enable or disable a constraint.
•  valid—Specifies if the constraint is valid or invalid in the current model context. If this ProBoolean option is PRO_B_TRUE, the constraint is valid (active), and if it is PRO_B_FALSE, the constraint is invalid (suppressed).
Functions Introduced:
The function ProSnapshotConstraintsGet() retrieves all the constraints of 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.
The function ProSnapshotConstraintAdd() adds a constraint to the snapshot of the top-level assembly.
The function ProSnapshotConstraintDelete() deletes a constraint from the snapshot of the top-level assembly.
The function ProSnapshotConstraintUpdate() updates a constraint for the snapshot of the top-level assembly.
The function ProSnapshotConstraintEvaluate() calculates the position of the motion axis for the constraint type PRO_SNAP_MOTION_AXIS_POS for the active model in the Creo Parametric window. This value does not depend on the current snapshot and it is not necessary for the snapshot to contain the constraint.
Snapshot Transforms
Functions Introduced:
The function ProSnapshotTrfsGet() 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.
The function ProSnapshotTrfsUpdate() updates the transformation matrices saved in the snapshots for the subassemblies and their components with respect to the top-level assembly snapshot.
Snapshots in Drawing Views
Functions Introduced:
The function ProSnapshotAllowedInDrawingSet() assigns the active snapshot of the top-level assembly to be available or unavailable in drawings. Set the argument allow to PRO_B_TRUE to make the snapshot available in drawings.
The function ProSnapshotAllowedInDrawingGet() determines if the active snapshot is allowed in drawings. The argument p_is_allowed is PRO_B_TRUE if the snapshot is allowed in drawings.
Manikin Edit
A Creo Manikin is a detailed model of a human being, used to test designs for ergonomic compatibility and other human-centric requirements. A manikin model is considered a standard Creo Parametric assembly. PTC provides an out-of-the-box library of manikins. The manikins represent different populations by nationality, size percentiles, and genders. You might want to represent a specific population, for instance, based on third-party statistics, or on specific measurements. For that reason, an editable manikin is provided to use as a basis for customization.
For more details about Creo Manikin user interface and how to configure this functionality, refer to the Creo Manikin module in the Creo online help.
In Creo TOOLKIT, you can customize a manikin by changing the dimensions and parameters of the manikin using the data structure ProManikinEditVarPair added in the header file ProManikinCust.h.
Functions Introduced:
Use the function ProManikinCustomize () to edit a manikin by changing the dimensions and setting the specified parameters for a manikin. This operation may perform a regeneration, if required. This function works with the custom manikin which has to be the top object in the current Creo work window. All the modifications that you make to the model will be applied to the model immediately. If you set a particular dimension, the other dimensions of the manikin will be impacted accordingly.
The input argument *vars_array is a ProArray of arrays specified using the structure ProManikinEditVarPair.
To customize a manikin the following list of parameters that can be modified:
•  Dimenions—Manikin dimensions that you can edit.
  DESIRED_HEIGHT—Double value in meter and is directly dependent on the Model Height. When you edit any of the Height Proportion dimensions, editing one dimension can affect the other two dimensions.
  DESIRED_WEIGHT—Double value in kilogram and is directly dependent on the Model Weight. The chest, waist and thigh dimensions are dependent. The shoulder width is dependent if it is not set earlier.
  Anthropometric Dimensions–Part 1. Only 2 parameters in this section can be modified. When you set parameter 1, the other 2 parameters change. When you set the other 2 parameters, the parameter which was already set changes.
  DESIRED_UPPER_BODY_LENGTH—Double value in meter and is dependent on the MODEL_UPPER_BODY_LENGTH.
  DESIRED_UPPER_LEG_LENGTH_SEATED—Double value in meter and is dependent on the MODEL_UPPER_LEG_LENGTH.
  DESIRED_LOWER_LEG_LENGTH_SEATED—Double value in meter and is dependent on the MODEL_LOWER_LEG_LENGTH.
  Anthropometric Dimensions–Part 2.
  DESIRED_ARM_LENGTH—Double value in meter and dependent on the MODEL_ARM_LENGTH.
  DESIRED_SHOULDER_WIDTH—Double value in meter and dependent on the MODEL_SHOULDER_WIDTH.
  DESIRED_HAND_LENGTH—Double value in meter and dependent on the MODEL_HAND_LENGTH.
  DESIRED_HAND_WIDTH—Double value in meter and dependent on the MODEL_HAND_WIDTH.
  DESIRED_SHOE_LENGTH—Double value in meter and dependent on the MODEL_SHOE_LENGTH.
  Circumferences—Optimization is used to achieve this value. As a result getting the desired value requires some time.
  DESIRED_CHEST_CIRCUMFERENCE—Double value in meter and dependent on the MODEL_CHEST_CIRCUMFERENCE.
  DESIRED_WAIST_CIRCUMFERENCE—Double value in meter and dependent on the MODEL_WAIST_CIRCUMFERENCE.
  DESIRED_THIGH_CIRCUMFERENCE—Double value in meter and dependent on the MODEL_THIGH_CIRCUMFERENCE.
•  Attributes—Manikin attributes such as demographic, version, and descriptive information. You can edit these parameters according to your manikin specifications.
  MANIKIN_AGE_GROUP—Age group specified using wchar_t in ProLine.
  MANIKIN_COUNTRY—Name of the country specified using wchar_t in ProLine.
  MANIKIN_DATABASE—Data base specified using wchar_t in ProLine.
  MANIKIN_PERCENTILE—Size percentile specified as an integer.
  MANIKIN_VERSION—Version specified as a double value.
  MODELED_BY—Specified using wchar_t in ProLine.
  DESCRIPTION—Specified using wchar_t in ProLine.
If the process of updating the dimensions and parameters failed, the function returns the output argument failed_param_name which is the name of the problematic parameter that could not be updated.