Assembly: Assembling Components
This section describes how to use the concepts of feature creation to assemble components into an assembly. Read the section Element Trees: Principles of Feature Creation before this section.
Assembling Components by Functions
Functions Introduced:
Superseded Function:
Use the function ProAsmcompMdlnameCreateCopy() to create a new component in the assembly by copying from an existing model. Specify the handle to the model to be used as a template for the copy. If a model is not specified, a component that does not have initial geometry is created. The function provides the ProAsmcomp handle to the new component.
The function ProAsmcompAssemble() assembles a component to the assembly or sub-assembly using the parametric constraints available when assembling a component in Creo Parametric. The initial position of the component is a ProMatrix object. Specify the orientation of the three axes and the position of the origin of the component coordinate system, with respect to the target assembly coordinate system. The function provides the ProAsmcomp feature handle to the newly created assembly.
Note
If the transform matrix passed as the initial position of the component is incorrect and non-orthonormal, the function ProAsmcompAssemble() returns the error PRO_TK_BAD_INPUTS. In such scenario, you can use the function ProMatrixMakeOrthonormal() to convert this non-orthonormal matrix to an orthonormal matrix.
The function ProAsmcompPositionGet() retrieves the component's initial position before constraint are applied.
The function ProAsmcompPositionSet() specifies the initial position of the component before constraints are applied. This affects the position of the component only if the component is packaged or underconstrained.
The function ProAsmcompConstraintsWithDtmOrientGet() is deprecated in Creo Parametric 7.0.0.0. Use the function ProAsmcompConstraintsWithComppathGet() instead. The function retrieves the specified constraints for the given assembly component and component path. The orientation of the constraints is returned as a value of enumerated data type ProDatumside. The input argument component_path is the path to the owner assembly only if the constraints have references to the other members of the top-level assembly. If the constraints have references only to the owner assembly, then you need to pass this as Null.
The function ProAsmcompConstraintsSet() sets an array of constraints for a given assembly component. This function modifies the component feature data and regenerates the assembly component.
The function ProAsmcompAllConstrRemove() removes all types of constraints including interface constraints for the specified assembly component. Specify a a ProAsmcomp handle to the assembly component in the input argument p_feat_handle.
The function ProAsmcompConstrRemove() removes one or all constraints for the specified assembly component. However, the function does not remove the interface constraint. The input arguments are as follows:
•  p_feat_handle—Specifies a ProAsmcomp handle to the assembly component.
•  index—Specifies the constraint index. Pass the value as 1 to remove all the constraints. Use the function ProAsmcompConstraintGet() to determine the index of a particular constraint.
The function ProAsmcompRegenerate() regenerates the placement instructions for an assembly component, given the component handle. The function regenerates the placement instructions just as in an interactive Creo Parametric session. Alternatively, you can use the visit functionality to regenerate recursively some or all of the components in the assembly.
Assembling a Component Parametrically
Functions Introduced:
The function ProAsmcompconstraintAlloc() allocates memory for the constraint data structure. This data structure describes the types of constraints that can be applied to the assembly component.
The function ProAsmcompconstraintTypeGet() retrieves the constraint type of the specified constraint. The types of constraints are:
•  PRO_ASM_UNDEF—Use this option to initialize a variable. This option is never returned by the function ProAsmcompconstraintTypeGet() and can be ignored.
•  PRO_ASM_MATE—Use this option to make two surfaces coincident with one another and facing each other.
•  PRO_ASM_MATE_OFF—Use this option to make two planar surfaces parallel and facing each other.
•  PRO_ASM_ALIGN—Use this option to make two planes coplanar, two axes coaxial or two points coincident. You can also align revolved surfaces or edges.
•  PRO_ASM_ALIGN_OFF—Use this option to align two planar surfaces at an offset.
•  PRO_ASM_INSERT—Use this option to insert a "male" revolved surface into a "female" revolved surface, making their respective axes coaxial.
•  PRO_ASM_ORIENT—Use this option to make two planar surfaces to be parallel in the same direction.
•  PRO_ASM_CSYS—Use this option to place a component in an assembly by aligning the coordinate system of the component with the coordinate system of the assembly.
•  PRO_ASM_TANGENT—Use this option to force two surfaces to be tangent.
•  PRO_ASM_PNT_ON_SRF—Use this option to align a point with a of a surface.
•  PROS_ASM_EDGE_ON_SRF—Use this option to align a straight edge with a surface.
•  PRO_ASM_DEF_PLACEMENT—Use this option to align the default coordinate system of the component to the default coordinate system of the assembly.
•  PRO_ASM_SUBSTITUTE—This constraint type is used in simplified representations only when the component is replaced by a substitute component.
•  PRO_ASM_PNT_ON_LINE—Use this option to force the intersection of a line with a point.
•  PRO_ASM_FIX—Use this option to fix the current location of the component as a constraint.
•  PRO_ASM_AUTO—Not for use by Creo TOOLKIT.
•  PRO_ASM_ALIGN_ANG_OFF—This option can only be used in conjunction with another constraint. If you have two flat surfaces and create an align edge or axis constraint where the edge or axis lies on the surface, then you can specify an angle offset constraint between the two surfaces.
•  PRO_ASM_MATE_ANG_OFF—This option can only be used in conjunction with another constraint. If you have two flat surfaces and create a mate edge or axis constraint where the edge or axis lies on the surface, then you can specify an angle offset constraint between the two surfaces.
•  PRO_ASM_CSYS_PNT—This option can be used in User Defined, General, and Gimbal connections. Use this option to place a component in an assembly by aligning the origins of the coordinate systems. Here the axes are not aligned, and thus, the component can be freely rotated along the three rotation axes. In User Defined and Rigid connections you can switch from Coord Sys Point to Coord Sys constraint and vice-versa.
•  PRO_ASM_TANGENT_ALIGN—Use this option to support flip in tangent constraint. OR
Use this option to flip the component and align it in the other direction. This supports flipping in the tangent constraint.
Use the function ProAsmcompconstraintTypeSet() to set the constraints for the assembly component constraint.
The function ProAsmcompconstraintAsmreferenceGet() retrieves the ProSelection handle to a reference on the assembly and the orientation of the assembly for the specified assembly component constraint. The assembly orientation can have the following values:
•  PRO_DATUM_SIDE_YELLOW—The primary side of the datum plane which is the default direction of the arrow.
•  PRO_DATUM_SIDE_RED—The secondary side of the datum plane which is the direction opposite to that of the arrow.
•  PRO_DATUM_SIDE_NONE—No orientation is specified.
The assembly orientation is applicable for legacy models prior to M260.
The function ProAsmcompconstraintAsmreferenceSet() selects a reference on the assembly and sets the orientation of the assembly for a specified assembly component constraint.
Note
The assembly reference selection must be assigned an assembly component path, even if the reference geometry is in the top-level assembly. In that situation the table_num value of the ProAsmcomppath structure would be 0.
The function ProAsmcompconstraintCompreferenceGet() retrieves the ProSelection handle to a reference on the placed component and the orientation of the component for the specified assembly component constraint. The component orientation can have the following values:
•  PRO_DATUM_SIDE_YELLOW—The primary side of the datum plane which is the default direction of the arrow.
•  PRO_DATUM_SIDE_RED—The secondary side of the datum plane which is the direction opposite to that of the arrow.
•  PRO_DATUM_SIDE_NONE—No orientation is specified.
The component orientation is applicable for legacy models prior to M260.
ProAsmcompconstraintCompreferenceSet() selects a reference on the placed component and sets the orientation of the component for a specified assembly component constraint.
ProAsmcompconstraintOffsetGet() retrieves the offset value from the reference for the Mate or Align constraint type and the function ProAsmcompconstraintOffsetSet() defines the offset value.
The function ProAsmcompconstraintAttributesGet() retrieves the constraint attributes for the specified assembly component constraint. The function ProAsmcompconstraintAttributesSet() sets the constraint attributes. The types of constraint attributes are:
•  PRO_ASM_CONSTR_ATTR_FORCE—Force the constraint, causing strict alignment for axes, lines, and points. You can force a constraint only if the constraint type is Align.
•  PRO_ASM_CONSTR_ATTR_IGNORE—Not for use by Creo TOOLKIT.
•  PRO_ASM_CONSTR_ATTR_NONE—No constraint attributes are specified. This is the default value.
•  PRO_ASM_CONSTR_ATTR_INTFC_DEPENDENT—When set in a component interface, the constraint cannot be changed by application of settings making it coincident, offset, or reoriented.
•  PRO_ASM_CONSTR_ATTR_INACTIVE—The constraint should not be applied to the feature. This corresponds to the Constraint Enabled check box in the component feature user interface.
The function ProAsmcompconstraintUserdataGet() retrieves the user data for the given constraint while the function ProAsmcompconstraintUserdataSet() specifies the user data for the given constraint.
Use the function ProAsmcompconstraintFree() to free the constraint data structure from the memory.
The function ProAsmcompconstraintArrayFree() provides a single function to use to free an entire ProArray of ProAsmcompconstraint structures.
Example 1: Component Constraints
The sample code in the file UgAsmcompConstraint.c located at <creo_toolkit_loadpoint>/protk_appls/pt_userguide/ptu_asm displays each constraint of the component visually on the screen, and includes a text explanation for each constraint.
Example 2: Assembling Components
The sample code in the file UgAsmcompConstraint.c located at <creo_toolkit_loadpoint>/protk_appls/pt_userguide/ptu_asm demonstrates how to assemble a component into an assembly, and how to constrain the component by aligning datum planes. If the complete set of datum planes is not found, the function will show the component constraint dialog to the user to allow them to adjust the placement as they wish.
Redefining Components Interactively
The functions described in this section enable you to reroute previously assembled components, as in an interactive session of Creo Parametric.
Functions Introduced:
The function ProAsmcompConstrRedefUI() is intended for use in interactive Creo TOOLKIT applications. This function displays the Creo Parametric Component Placement dialog box, enabling you to redefine the constraints interactively. Control is given back to the Creo TOOLKIT application when you select OK or Cancel the dialog box is closed.
The function ProAsmcompPackageMove() supports interactive and programmatic packaging of components. The arguments to this function allow the user or the program to repackage an existing component. If the component is used for interactive purposes, the control is given back to the Creo TOOLKIT application when you select OK or Cancel the dialog box is closed.
Assembling Components by Element Tree
Assembly components are treated as features in Creo Parametric, so it is logical to replace those dedicated functions by a feature element tree that provides the same functionality, but uses the existing Creo TOOLKIT functions ProFeatureCreate(), ProFeatureRedefine() and ProFeatureElemtreeExtract().
The Element Tree for an Assembly Component
The element tree for a component assembly is documented in the header file ProAsmcomp.h and is shown in the following figure.
Top-level Feature Element tree for Component Assembly
Image
Model
The element PRO_E_COMPONENT_MODEL defines the model to be assembled into the assembly.
Attributes
The element PRO_E_MISC_ATTR defines the type of component being assembled. You can also access this property through ProAsmcompTypeGet() and ProAsmcompTypeSet().
Initial Position
The element PRO_E_COMPONENT_INIT_POS defines the absolute position of the component in the absence of any parametric constraints. Its value is a ProMatrix object describing the component position. If you supply this element but no PRO_E_COMPONENT_CONSTRAINT elements, the component is assembled as packaged at this location.
If you under constrain the component, the value of this element is used in conjunction with the constraints to set the packaged position for the component.
Constraint Sets and Mechanism Connections
The element PRO_E_COMPONENT_SETS is an array of elements of type PRO_E_COMPONENT_SET. Each of these elements is a predefined set of constraints.
Although you can define a user-defined type of constraint set containing any type and combination of constraints, the set element is also important when used to create predefined types of sets in Creo Parametric.
Mechanism uses predefined set types to represent connections. The connection can also contain elements describing mechanism motion axes stored for the connection.
PRO_E_COMPONENT_SET
Image
Each component set contains the following elements:
•  PRO_E_COMPONENT_SET_ID—Specifies the component set id. This value is generated automatically by Creo Parametric upon creation of the set. The set ids should remain the same when redefining the component.
•  PRO_E_COMPONENT_SET_TYPE—Specifies the component set type. The following table describes the valid values in details.
Component Set Type
Description
PRO_ASM_SET_TYPE_FIXED
A "Rigid" Mechanism connection: Connects two components so that they do not move relatively to each other.
PRO_ASM_SET_TYPE_PIN
A "Pin" Mechanism connection: Connects a component to a referenced axis so that the component rotates or moves along this axis with one degree of freedom.
PRO_ASM_SET_TYPE_SLIDER
A "Slider" Mechanism connection: Connects a component to a referenced axis so that the component moves along the axis with one degree of freedom.
PRO_ASM_SET_TYPE_CYLINDRICAL
A "Slider" Mechanism connection: Connects a component so that it moves along and rotates about a specific axis with two degrees of freedom.
PRO_ASM_SET_TYPE_PLANAR
A "Planar" Mechanism connection: Connects components so that they move in a plane relatively to each other with two degrees of freedom in the plane and one degree of freedom around an axis perpendicular to it.
PRO_ASM_SET_TYPE_BALL
A "Ball" Mechanism connection: Connects a component so that it can rotate in any direction with three degrees of freedom (360? rotation).
PRO_ASM_SET_TYPE_WELD
A "Weld" Mechanism connection: Connects a component to another so that they do not move relatively to each other.
PRO_ASM_SET_TYPE_BEARING
A "Bearing" Mechanism connection: A combination of Ball and Slider connections with four degrees of freedom.
PRO_ASM_SET_TYPE_GENERAL
A "General" Mechanism connection: Has one or two configurable constraints that are identical to those in a user-defined set.
PRO_ASM_SET_TYPE_6DOF
A "Six Degrees of Freedom" Mechanism connection: Does not affect the motion of the component in relation to the assembly because no constraints are applied.
PRO_ASM_SET_TYPE_GIMBAL
A “Gimbal” Mechanism connection: This connection behaves similar to the "Six Degrees of Freedom" connection except that in Gimbal connection the translational degrees of freedom are locked.
PRO_ASM_SET_TYPE_SLOT
A "Slot" Mechanism connection: A point on a non straight trajectory. This connection has four degrees of freedom, where the point follows the trajectory in three directions.
PRO_ASM_SET_USER_DEFINED_TYPE
A user defined constraint set. Legacy components which do not have defined Mechanism connections will always use this type.
•  PRO_E_COMPONENT_SET_NAME—Specifies the name of the component set.
•  PRO_E_COMPONENT_SET_MISC_ATTR—Specifies the component set attributes. Currently, these attributes are limited to flags which enable or disable the set.
•  PRO_E_COMPONENT_JAS_SETS is an array of compound elements of type PRO_E_COMPONENT_JAS_SET which indicate Joint Axis Set (JAS). It represents the motion axis settings for the Mechanism connection. It consists of the following elements—
  PRO_E_COMPONENT_JAS_ZERO_TYPE—Specifies the type of motion represented by this motion axis element and the value is drawn from the following types:
  PRO_AXIS_ZERO_TRANSLATE1
  PRO_AXIS_ZERO_TRANSLATE2
  PRO_AXIS_ZERO_TRANSLATE3
  PRO_AXIS_ZERO_ROTATION1
  PRO_AXIS_ZERO_ROTATION2
  PRO_AXIS_ZERO_ROTATION3
  PRO_AXIS_ZERO_SLOT
  PRO_E_COMPONENT_JAS_REFS—Specifies initial position references for the motion axis.
  PRO_E_COMPONENT_JAS_ORANGE_REF—Specifies the component reference of the motion axis.
  PRO_E_COMPONENT_JAS_GREEN_REF—Specifies the assembly reference of the motion axis.
  PRO_E_COMPONENT_JAS_0_OFFSET_VAL—Specifies the zero offset value for the motion axis.
  PRO_E_COMPONENT_JAS_REGEN_VALUE_GROUP is a compound element specifying the motion axis regeneration options. The motion axis regeneration value is an offset value used when regenerating the model. This value determines the offset of the component being placed in the assembly from the zero reference during regeneration.
  PRO_E_COMPONENT_JAS_REGEN_VALUE_FLAG—Specifies enabling or disabling the regeneration value. When you disable it, the motion axis becomes free of constraint.
  PRO_E_COMPONENT_JAS_REGEN_VALUE— Specifies the value along this motion axis that will be used for regeneration of the position and orientation of the component.
  PRO_E_COMPONENT_JAS_MIN_LIMIT specifies the minimum limit for regeneration value. It consists of the following elements:
  PRO_E_COMPONENT_JAS_MIN_LIMIT_FLAG—A boolean element indicating whether the minimum limit is applied to the component.
  PRO_E_COMPONENT_JAS_MIN_LIMIT_VAL—The value for the minimum limit.
  PRO_E_COMPONENT_JAS_MIN_LIMIT_REF—A selected item which serves as the minimum limit instead of using an assigned value.
  PRO_E_COMPONENT_JAS_MAX_LIMIT—Specifies the maximum limit for regeneration value. It consists of the following elements:
  PRO_E_COMPONENT_JAS_MAX_LIMIT_FLAG—A boolean element indicating if the maximum limit is applied to the component.
  PRO_E_COMPONENT_JAS_MAX_LIMIT_VAL—The value for the maximum limit.
  PRO_E_COMPONENT_JAS_MAX_LIMIT_REF—A selected item, which serves as the maximum limit instead of using an assigned value.
  PRO_E_COMPONENT_JAS_RESTITUTION—Specifies coefficient of restitution for the motion axis. It is a compound element and consists of the following elements:
  PRO_E_COMPONENT_JAS_RESTITUTION_FLAG—A boolean element indicating if a coefficient of restitution is applied.
  PRO_E_COMPONENT_JAS_RESTITUTION_COEF— Specifies the coefficient of restitution value.
  PRO_E_COMPONENT_JAS_FRICTION—Specifies coefficient of friction for the motion axis. It is a compound element and consists of the following elements:
  PRO_E_COMPONENT_JAS_FRICTION_FLAG—A boolean element indicating if the coefficients of friction are applied.
  PRO_E_COMPONENT_JAS_STATIC_FRIC_COEF— Specifies the coefficient of static friction value.
  PRO_E_COMPONENT_JAS_KINEM_FRIC_COEF— Specifies the coefficient of kinetic friction value.
  PRO_E_COMPONENT_JAS_RADIUS_VALUE— Specifies the contact radius value.
Placement Constraints
The element PRO_E_COMPONENT_CONSTRAINTS is an array of elements of type PRO_E_COMPONENT_CONSTRAINT, each representing a single component placement constraint.
PRO_E_COMPONENT_CONSTRAINT
Image
Each constraint element contains the following elements:
•  PRO_E_COMPONENT_CONSTR_TYPE—See discussion regarding Assembling a Component Parametrically.
•  PRO_E_COMPONENT_COMP_CONSTR_REF—Identifies the geometry item in the component referenced by the constraint. This element is of type Selection.
•  PRO_E_COMPONENT_ASSEM_CONSTR_REF—Identifies the constraint reference in the assembly.
Note
this reference must include a component path referencing the top level assembly, even if the reference belongs directly to the top level assembly.
•  PRO_E_COMPONENT_CONSTR_REF_OFFSET—Gives the offset value, if the constraint type is an offset.
•  PRO_E_COMPONENT_USER_DATA—Specifies user data.
•  PRO_E_COMPONENT_CONSTR_ATTR—See discussion under Assembling a Component Parametrically.
•  The elements PRO_E_COMPONENT_COMP_ORIENT and PRO_E_COMPONENT_ASSM_ORIENT indicate which side of a referenced surface to be used. These values have different meanings for user-defined constraint sets and mechanism connections. See discussion under ProAsmcompconstraintAsmreferenceGet() and ProAsmcompconstraintCompreferenceGet().
•  PRO_E_COMPONENT_CONSTR_SET_ID—Specifies the index of the member of the array of PRO_E_COMPONENT_SET elements that owns the constraint.
•  PRO_E_COMPONENT_SLOT_EXTRA_CRV_REF—Specifies the extra curve references used by a Slot connection only. This is a multivalued element.
Component Movement in Assembly
The element PRO_E_COMPONENT_MOVEMENTS is an array of elements of type PRO_E_COMPONENT_MOVEMENT which represent movements applied to the component being assembled.
PRO_E_COMPONENT_MOVEMENT
Image
Each movement element contains the following elements:
•  PRO_E_COMPONENT_MOVEMENT_TYPE specifies allowed movement types
Use the following options to move the component parallel to the reference selected and are of the following values:
•  PRO_ASM_TRANSLATE_X
•  PRO_ASM_TRANSLATE_Y
•  PRO_ASM_TRANSLATE_Z
Use the following options to rotate the component about the selected references.
•  PRO_ASM_ROTATE_X
•  PRO_ASM_ROTATE_Y
•  PRO_ASM_ROTATE_Z
•  PRO_ASM_TWIST_FIT
•  PRO_E_COMPONENT_MOVEMENT_REF specifies the translational and rotational motion references.
•  PRO_E_COMPONENT_MOVEMENT_VALUE
Placement via Interface
The element PRO_E_COMP_PLACE_INTERFACE is a compound element that defines an alternative assembly technique: using component interfaces to define the placement instead of traditional constraints.
PRO_E_COMP_PLACE_INTERFACE
Image
The element contains the following elements:
•  PRO_E_COMP_PLACE_INTERFACE_TYPE—Specifies the interface types as follows:
  PRO_ASM_INTFC_TO_GEOM—Assembly of the component by matching an interface on the component to referenced geometry in the assembly.
  PRO_ASM_INTFC_TO_INTFC—Assembly of the component by matching an interface on the component to an interface defined in the assembly.
Note
If this value is not set (set to 0) then component interfaces are not used to define this component.
•  PRO_E_COMP_PLACE_INTERFACE_COMP—Specifies the component model interface. This should contain the component interface feature.
•  PRO_E_COMP_PLACE_INTERFACE_ASSEMS—Specifies an array of assembly references. If the placement type is PRO_ASM_INTFC_TO_GEOM this contains 1 or more geometric references from the assembly. If the placement type is PRO_ASM_INTFC_TO_INTFC this contains a single reference element containing the component interface feature.
Assembling Components Using Intent Datums
You can use Intent Datums such as Intent Axis, Intent Point, Intent Plane, and Intent Coordinate System in assembly component placement and constraints.
Example 3: Assembling Components Using Intent Datums
The sample code in the file UgAsmcompConstraint.c located at <creo_toolkit_loadpoint>/protk_appls/pt_userguide/ptu_asm demonstrates how to assemble a component into an assembly using intent point and intent plane, and how to set constraints after assembling a component using intents.