Core: Solids, Parts, and Materials
This section describes how to access solids, parts, and their contents.
Solid Objects
The Creo Parametric term “solid” denotes a part or an assembly. The object is called ProSolid and is declared as an opaque handle. It is an instance of ProMdl and can be cast to that type to use functions that have the prefix “ProMdl”.
Creating a Solid
Function Introduced:
The function ProSolidMdlnameCreate() creates an empty part or assembly with the specified name, and provides a handle to the new object. It does not make the new solid current, nor does it display the solid. In Creo Parametric 7.0.0.0 and later, an empty part is created with absolute accuracy, by default. Refer to the Creo Parametric help for more information on Model Accuracy.
Contents of a Solid
Functions Introduced:
The following visit functions enable you to access the various types of objects inside a part or assembly:
•  ProSolidFeatVisit()—Visits all the features, including those used internally (which are not visible to the Creo Parametric user). You can also use this function to visit the components of an assembly.
•  ProSolidSurfaceVisit()— Visits the surfaces of the model only if the model has a single body else returns the error PRO_TK_MULTIBODY_UNSUPPORTED. This includes all surfaces created by solid features, but not datum surfaces.
•  ProSolidQuiltVisit()—Visits all the quilts in a part or an assembly.
•  ProSolidAxisVisit()—Visits all the axes in a part or an assembly.
•  ProSolidCsysVisit()—Visits all the coordinate system datums in a part or an assembly.
The function ProSolidFeatstatusGet() retrieves a list of the integer identifiers and statuses of all the features in a specified solid in the order in which they are regenerated. The integer identifier of a feature is the value of the id field in the ProFeature object and also the INTERNAL ID seen in Creo Parametric.
The function ProSolidFeatstatusSet() enables you to set the regeneration order and statuses of the features in the solid.
The function ProSolidFeatstatusWithoptionsSet() assigns the regeneration order and status bit flags for the specified features in a solid based on the bitmask containing one or more regeneration control bit flags of the type PRO_REGEN_* defined in ProSolid.h. Refer to the Regenerating a Solid section for more information on the bit flags.
The function ProSolidFeatstatusflagsGet() retrieves the array of integer identifiers of the features in a specified solid and the corresponding array of bitmasks representing one or more feature status bit flags of the type PRO_FEAT_STAT_* defined in ProFeature.h. Refer to the Core: Features section for more information on the feature status bit flags.
The function ProSolidFailedFeatsList() retrieves the list of identifiers of failed features in a specified solid.
Note
From Pro/ENGINEER Wildfire 5.0 onward, the function ProSolidFailedFeatsList() has been deprecated. Use the function ProSolidFailedfeaturesList() instead. Pass NULL for the input arguments co_failed_ids and co_x_failed_ids while using ProSolidFailedfeaturesList() in the Resolve mode.
The function ProSolidFailedfeaturesList() retrieves the list of identifiers of all or any of the failed features, children of failed features, children of external failed features, or both the features and their children.
The function ProSldsurfaceShellsAndVoidsFind() returns an ordered list of surface-contour pairs for each shell and void in a solid.
The surface-contour pairs describe the shell faces and are specified by the ProSldsurfaceShellface objects. If the contour field in the ProSldsurfaceShellface object is NULL, it means all the contours in the geometry belong to the same surface and the shell_faces array contains only one surface ID. However, if the contours belong to different shells, the shell_faces array contains items equal to the number of contours.
The ordered list of surface-contour pairs is specified by the ProSldsurfaceShellorder objects; each of this object contains the following fields:
•  orientation—Specifies the shell orientation. If this field is 1, the shell is oriented outward, if it is -1, the shell is inward oriented meaning it is a void.
•  first_face—Specifies the index in the array of ProSldsurfaceShellface objects.
•  number_of_faces—Specifies the total number of shell faces.
•  ambient_shell—Specifies the index in the array of ProSldsurfaceShellorder objects.
The function ProSolidToleranceStandardGet() returns the tolerance standard assigned to a solid. Use the method ProSolidToleranceStandardSet() to set the tolerance standard for a solid. After you set the tolerance standard for a solid, you must regenerate the solid, if required. The function does not regenerate the solid.
The function ProSolidToleranceStandardVersionSet() sets the version for assigned tolerance standard of a specified solid.
Note
In the Creo Parametric user interface, this operation asks to regenerate the solid. The function ProSolidToleranceStandardVersionSet() does not perform regeneration itself.
Use the function ProSolidToleranceStandardVersionGet() to get the version for assigned tolerance standard of a specified solid.
Use the function ProSolidToleranceStandardUpdate() to update the solid to the most current version of its tolerance standard. The function does not regenerate the solid.
Displaying a Solid
Function Introduced:
The function ProSolidDisplay() displays a solid in the current Creo Parametric window. This does not make the object current from the point of Creo Parametric.
Example 1: Loading and Displaying a Solid
The example in the file UgSolidLoadDisp.c located at <creo_toolkit_loadpoint>/protk_appls/pt_userguide/ptu_solid, shows how to use the functions ProObjectwindowMdlnameCreate() and ProSolidDisplay().
Regenerating a Solid
Function Introduced:
The function ProSolidRegenerate() regenerates the specified solid. One of the inputs to the function is a bitmask that specifies how the regeneration must be performed. The bitmask may contain the following flags:
•  PRO_REGEN_NO_FLAGS—Equivalent to passing no flags.
•  PRO_REGEN_CAN_FIX—Allows the user to interactively fix the model using the user interface, if regeneration fails. This bit flag needs to be set only in case of interactive applications. If this option is not included, the user interface does not update even if regeneration is successful. Use ProWindowRepaint() and ProTreetoolRefresh() to perform the update if needed. Also, this bit flag must be set only in the Resolve mode. Otherwise, ProSolidRegenerate() returns PRO_TK_BAD_CONTEXT.
•  PRO_REGEN_ALLOW_CONFIRM—This flag has been deprecated from Creo Parametric 4.0 M030. Allows the user to interactively select the option of retaining failed features and children of failed features via a pop-up dialog box, if regeneration fails. This bit flag must be set only in the No-Resolve mode. Otherwise, ProSolidRegenerate() returns PRO_TK_BAD_CONTEXT.
Note
The interactive dialog box which provided an option to retain failed features and children of failed features, if regeneration fails is no longer supported. Creo Parametric displays a warning message which gives details of failed features.
•  PRO_REGEN_UNDO_IF_FAIL—Allows the user to undo the failed regeneration and restore the previous status. This flag needs to be set only in the No-Resolve mode. Otherwise, ProSolidRegenerate() returns PRO_TK_BAD_CONTEXT. The result obtained may be different from the one attained by using the Restore option in the Resolve mode. Restore in the Resolve mode can be used immediately after the first failure. But undo in the No-Resolve mode due to this bit flag happens only after all the features are regenerated or failed. In some cases, the undo may not happen at all.
Note
The bit flags PRO_REGEN_ALLOW_CONFIRM and PRO_REGEN_UNDO_IF_FAIL are not compatible with each other. Setting both of them together will result in PRO_TK_BAD_CONTEXT.
•  PRO_REGEN_SKIP_DISALLOW_SYS_RECOVER—Skips the preparation for failure recovery. If this option is used, Undo Changes is possible if a failure occurs. This option is used only in conjunction with PRO_REGEN_CAN_FIX.
•  PRO_REGEN_UPDATE_INSTS—Updates instances of the solid in memory. This may slow down the regeneration process.
•  PRO_REGEN_RGN_BCK_USING_DISK—Stores the backup model on the disk. This is useful only if PRO_REGEN_CAN_FIX is set.
•  PRO_REGEN_FORCE_REGEN—Forces the solid to fully regenerate. This will regenerate every feature in the solid. If not set, Creo Parametric uses its internal algorithm to determine which features to regenerate.
•  PRO_REGEN_TOP_ASM_ONLY—Forces only top level assembly to regenerate. This flag forces the regeneration of all the features and components that are defined in the specified top level assembly, even when they are considered up-to-date. The features and components from the low level assembly that are essential for the correct assembly regeneration results, might also be regenerated during the regeneration process. However, they are not excluded from the regeneration process.
Note
This flag cannot be used with PRO_REGEN_FORCE_REGEN.
•  PRO_REGEN_UPDATE_ASSEMBLY_ONLY—Updates assembly and sub-assembly placements and regenerates assembly features and intersected parts. If the affected assembly is retrieved as a simplified representation, this flag will update the locations of the components. If the flag is not set, the component locations are not updated by default when the simplified representation is retrieved.
Note
This flag cannot be used with PRO_REGEN_FORCE_REGEN.
•  PRO_REGEN_RESUME_EXCL_COMPS—Enables Creo Parametric to resume available excluded components of the simplified representation during regeneration. This can result in a more accurate update of the simplified representation.
Note
Component models which are not in session at the time of the call to ProSolidRegenerate() will not be retrieved due to this option.
•  PRO_REGEN_NO_RESOLVE_MODE — Specifies the No-Resolve mode introduced in Pro/ENGINEER Wildfire 5.0. This is the default mode in Creo Parametric. In this mode, if a model and feature regeneration fails, failed features and children of failed features are created and regeneration of other features continues.
•  PRO_REGEN_RESOLVE_MODE — Specifies the Resolve mode. In this mode, you can continue with the Pro/ENGINEER Wildfire 4.0 behavior, wherein if a model and feature regeneration fails, the failure needs to be resolved before regeneration can be resumed. You can also switch to the Resolve mode by setting the configuration option regen_failure_handling to resolve_mode in the Creo Parametric session.
In Creo Parametric 7.0.1.0 and later, the configuration option regen_failure_handling has been deprecated. If a model and feature regeneration fails and if you want to use Resolve mode, you need to contact PTC Customer Support. For more information, refer to the section Contacting PTC Technical Support in the Getting Started with Creo TOOLKIT guide.
Note
Setting the configuration option to switch to Resolve mode ensures the old behavior as long as you do not retrieve the models saved under the No-Resolve mode. To consistently preserve the old behavior, use Resolve mode from the beginning and throughout your Creo Parametric session. Temporarily setting the bit flag PRO_REGEN_RESOLVE_MODE in the relevant functions does not ensure the old behavior.
•  PRO_REGEN_INTERACTIVE_UI—Supports an interactive user interface in Creo Parametric. For example, if an error occurs while reading or executing an imported PRO_PROGRAM_FILE file, a dialog box opens inCreo Parametric asking you if you want to continue with the operation.
The function ProSolidRegenerationIsNoresolvemode() identifies if the regeneration mode in the active Creo Parametric session is the No-Resolve mode.
The function ProSolidRegenerationstatusGet() returns the regeneration status of the solid model. This status is similar to the regeneration status indicator (Green/Yellow/Red) in the Creo Parametric User Interface.
The regeneration status can take one of the following values:
•  PRO_SOLID_REGENERATED—Specifies that the model is up-to-date and requires no regeneration.
•  PRO_SOLID_NEEDS_REGENERATION—Specifies that the model has changed and requires regeneration.
•  PRO_SOLID_FAILED_REGENERATION—Specifies that the regeneration has failed or has warnings.
Note
Models with certain contents, such as circular references or assembly analysis features, will never return a fully “regenerated” status. Thus, this status should not provide an absolute restriction. If the flag remains in the “PRO_SOLID_NEEDS_REGENERATION” status through two successful regenerations, the model could be considered up-to-date.
•  PRO_SOLID_CONNECT_FAILED—Specifies that the model has successfully regenerated, however, the connect operation for mechanisms in the solid model has failed. This status is applicable only for assemblies which have moving components.
Example 2: Combining Regeneration Flags
The sample code in UgSolidRegen.c located at <creo_toolkit_loadpoint>/protk_appls/pt_userguide/ptu_solid shows how to use the function ProSolidRegenerate().
Combined States of a Solid
With a combined state, you can combine and apply multiple display states to a Creo Parametric model. Combined states are composed of the following two or more display states:
•  Saved Views
•  Layer state
•  Annotations
•  Cross section
•  Exploded view
•  Simplified representation
•  Model style
The object ProCombstate for a combined state has the same declaration as the ProModelitem object, only with the type set to PRO_COMBINED_STATE. The declaration is as follows:
typedef struct pro_model_item
{
  ProType  type;
  int      id;
  ProMdl   owner;
}ProCombstate;
Functions Introduced:
The function ProMdlCombstatesGet() returns an array of combined states of a specified solid.
The function ProCombstateActiveGet() retrieves the active combined state in a specified solid model. The active combined state is the default state when the model is opened.
The function ProCombstateDataGet() returns information for a specified combined state. The output arguments of this function are:
•  cs_name—The name of the combined state.
•  cs_ref_arr—An array of reference states of the type ProModelitem. This array can contain states of the following types:
  PRO_VIEW
  PRO_LAYER_STATE
  PRO_SIMP_REP
  PRO_EXPLD_STATE
  PRO_XSEC
  PRO_STYLE_STATE
•  p_clip_opt—A pointer to the value of the cross section clip. This is applicable only in case of a valid reference of the type PRO_XSEC. The PRO_XSEC item represents a ProXsec object or a zone feature.
The values for the cross section clip are specified by the enumerated type ProCrossecClipOpt. The possible values are as follows:
  PRO_VIS_OPT_NONE—Specifies that the cross section or zone feature is not clipped.
  PRO_VIS_OPT_FRONT—Specifies that the cross section or zone feature is clipped by removing the material on the front side. The front side is where the positive normals of the planes of the cross section or zone feature are directed.
  PRO_VIS_OPT_BACK—Specifies that the cross section or zone feature is clipped by removing the material on the back side.
•  p_is_expld—A ProBoolean value that specifies whether the combined state is exploded. This value is available only if when a valid PRO_EXPLD_STATE reference state is retrieved. It is not available for Creo Parametric parts since an exploded state does not exist in the part mode.
Use the function ProCombstateActivate() to activate a specified combined state.
The function ProMdlCombStateCreate() creates a new combined state based on specified references. The input arguments of this function are as follows:
•  p_solid—Specify the solid model in which you want to create a new combined state.
•  new_name—Specify the name of the new combined state.
•  ref_arr—Specify the array of reference states. Refer to the description of the argument cs_ref_arr of the function ProCombstateDataGet() for the valid reference states.
•  clip_opt—Specify the value of the cross section clip. Refer to the description of the argument p_clip_opt of the function ProCombstateDataGet() for more information.
•  is_expld—Specify PRO_B_TRUE if the combined state is exploded, else specify PRO_B_FALSE. This argument needs to be set only in case of a valid PRO_EXPLD_STATE reference state. It is not applicable for Creo Parametric parts since an exploded state does not exist in the part mode.
Use the function ProCombstateRedefine() to redefine a created combined state. The values specified by the input arguments ref_arr, clip_opt, and is_expld of the function ProMdlCombStateCreate() are redefined.
In case you do not want to redefine a reference state, pass the reference state with the same value. While redefining, you must specify reference states. If you do not pass reference states, the combined state is redefined to a NO_STATE state. NO_STATE state means the display of the reference state is not changed on activation of combined state.
In case you want to refine or create a combined state that uses the most recently used instance of a reference state, use the PRO_COMBSTATE_REF_MRU option as the id field of that type of reference state in the ProModelitem object.
The function ProCombstateAnnotationsGet() retrieves an array of annotations and their status flags from a specified combined state item. If the display of supplementary geometry is controlled by the object ProCombState, the function returns non-annotations model items as well.
The function ProCombstateAnnotationsAdd() adds an array of annotations to a specified combined state item. The input argument status_flags specifies if an annotation must be displayed in the combined state. If you specify the value 0 for this argument, then the annotation is displayed in the combined state. If you specify the value 1, then the annotation is not displayed.
Use the function ProCombstateAnnotationsRemove() to remove the annotations from a specified combined state item.
Use the function ProCombstateDelete() to delete a specified combined state. The function fails if the specified combined state is the default or active combined state.
Annotations and annotation elements can be assigned to a combined state. When the combined state is active, the annotations are displayed in the graphics window. Similarly, annotations and annotation elements can be assigned to layers. Supplementary geometry such as datum planes, points, coordinate systems, axes, curves, and surfaces can also be assigned to combined state or layers. The display of annotations and supplementary geometry in a model is controlled either by the combined state or layers. The configuration option combined_state_type is used to define how the visibility of annotations and supplementary geometry is controlled in a new combined state.
Refer to Creo Parametric Help for more information.
The function ProCombstateAnnotationsStateGet() checks if the display of annotations is controlled by the specified combined state or layers. The function returns PRO_B_TRUE when the display is controlled by combined state. Use the function ProCombstateSupplGeomStateGet() to check if the display of supplementary geometry is controlled by the specified combined state or layers. The function returns PRO_B_TRUE when the display is controlled by combined state.
The function ProCombstateAnnotationsAndSupplGeomStateSet() allows you to change the display of annotations and supplementary geometry by the combined state or layers. The input arguments follow:
•  cs_item—Specifies a pointer to the combined state item from which the state needs to be retrieved.
•  annotation_state—Flag to set the specified combined state to annotation state. Pass the value of annotation_state as PRO_B_TRUE if display of annotations should be controlled by combined state. Pass it as PRO_B_FALSE if display of annotations should be controlled by layers.
•  supplgeom_state—Flag to set the specified combined state to supplementary geometry state. Pass the value of supplgeom_state as PRO_B_TRUE if display of supplementary geometry should be controlled by combined state. Pass it as PRO_B_FALSE if display of supplementary geometry should be controlled by layers.
Note
If value of the input argument supplgeom_state is set to PRO_B_TRUE, the value of annotation_state also, must be set to PRO_B_TRUE.
The function returns PRO_TK_NO_CHANGE if the current states of annotations and supplementary geometry in the combined state are same as the requested states.
The function ProCombstateIsPublished() checks if the specified combined state has been published to Creo View.
Use the function ProCombstateIsDefault() checks if the specified combined state is set as the default combined state for the model.
Layer State
A layer state stores the display state of existing layers and all the hidden layers of the top-level assembly. You can create and save one or more layer states and switch between them to change the assembly display.
The object ProLayerstate represents the layer state. It has the same declaration as the ProModelitem object, only with the type set to PRO_LAYER_STATE. The declaration is as follows:
typedef struct pro_model_item
{
  ProType  type;
  int      id;
  ProMdl   owner;
}ProLayerstate;
Functions Introduced:
The function ProLayerstatesGet() returns an array of layer states for a specified solid.
The function ProLayerstateActiveGet() retrieves the active layer state in a specified solid model.
The function ProLayerstateNameGet() retrieves the name of a specified layer state.
Use the function ProLayerstateActivate() to activate a specified layer state.
The function ProLayerstateCreate() creates a new layer state based on specified references. The input arguments of this function are as follows:
•  p_solid—Specify the solid model in which you want to create a new layer state.
•  state_name—Specify the name of the new layer state. The name can only consist of alphanumeric, underscore, and hypen characters.
•  layers—Specify an array of reference layers.
•  disp_arr—Specify an array of display statuses. The number of display statues is equal to the number of reference layers.
•  hidden_items—Specify an array of hidden items.
Note
ProLayerItem of type PRO_LAYER_LAYER is not supported in the function ProLayerstateCreate(), when you create a new layer state.
The function ProLayerstateLayersGet() retrieves the reference data for a specified layer state.
The function ProLayerstateLayerAdd() adds a new layer to an existing layer state. Specify the new layer, its display state, and the name of the existing layer state as input arguments to this function.
The function ProLayerstateLayerRemove() removes a specific layer from a specified layer state.
The function ProLayerstateActivestateUpdate() updates the layer state, which is active in the specified model. If the display statues of layers have changed, then calling this function ensures that the active layer state in the model is updated with the new display statuses of the layers.
Use the function ProLayerstateModelitemHide() to hide the display of a specific item on the specified layer state.
Use the function ProLayerstateModelitemUnhide() to remove a specific item from the list of hidden items on a layer state.
Use the function ProLayerstateModelitemIsHidden() to identify if an item is hidden on a layer state.
Use the function ProLayerstateDelete() to delete a specified layer state.
Evaluating Mathematical Expressions for a Solid
Functions Introduced:
The function ProMathExpressionEvaluate() evaluates the given mathematical expression in the context of a given solid. The expression may include parameters, dimensions, embedded functions, or predefined constants. This function returns a pointer to the calculated result and a pointer to the unit of the calculated result.
Solid Outline
Functions Introduced:
The function ProSolidOutlineGet() provides you with the maximum and minimum values of X, Y, and Z occupied by the contents of the solid, with respect to the default, solid coordinate system.
The function ProSolidOutlineCompute() calculates the outline of the solid with respect to any orientation, defined by a transformation matrix. (For more information, see the Core: Coordinate Systems and Transformations section.) The function enables you to exclude from the calculation items of any or all of the following types:
•  Datum plane
•  Datum point
•  Datum axes
•  Datum coordinate system
•  Facets
This function ProSolidOutlineWithOptionsCompute() calculates the outline of a solid using the specified filter. This filter is defined by the filter function ProFeatureFilterAction() , and excludes features based on user-defined logic. This filter works in addition to the excluded types, that is, if either check excludes a feature, it will be excluded. The input arguments are:
•  p_solid—The solid whose outline is to be calculated.
•  matrix —The orientation matrix (with respect to the base coordinate system) that will be used to calculate the outline.
•  excludes—An array of types that are excluded from the outline calculations such as nongeometric features and is defined by the enumerated data type ProSolidOutlExclTypes . If you set this to PRO_OUTL_EXC_NOT_USED , nothing is excluded.
•  num_excludes—Specifies the number of exclusions in the array.
•  filter_action—The filter defined by the callback function ProFeatureFilterAction(). If this is null, all features are considered while computing the outline.
•  app_data —The application data that is passed to the filter functions.
The output argument r_outline_points are the two points that define the boundary box of the solid in the specified orientation.
Example 3: Computing the Outline of a Solid
The sample code in UgSolidOutlineComp.c located at <creo_toolkit_loadpoint>/protk_appls/pt_userguide/ptu_solid computes the outline of a solid with respect to a selected coordinate system, and converts the result back to solid coordinates.
Calculated Text Height
The detail option text_height sets the default text height for newly created annotations. The default value is calculated.
Functions Introduced:
Use the function ProSolidCalcTextHeightGet() to get the calculated text height of a model, which is derived from the model’s size. This text height is used when an annotation is created, when the detail option text_height is set to calculated.
Use the function ProAnnotationOffsetSymbolsGet() to get all offset symbol instances for the annotation. This function has a valid annotation and the top drawing as the input argument. The output argument of this function is syminsts that specifies the ProArray of the associated syminsts.
Solid Accuracy
Functions Introduced:
Use the functions ProSolidAccuracyGet() and ProSolidAccuracySet() to retrieve and set the accuracy of a specified part or assembly, respectively.
Note
To set or retrieve the accuracy for an assembly you must traverse through all its parts in the assembly with these functions.
The input arguments for the function ProSolidAccuracySet() are as follows:
•  solid—The part or assembly whose accuracy you want to set.
•  type—The type of the accuracy. The valid values are:
  PRO_ACCURACY_RELATIVE—Specifies the relative accuracy
  PRO_ACCURACY_ABSOLUTE—Specifies the absolute accuracy
•  accuracy—The value of the accuracy that you want to set. The unit used for the absolute accuracy of the dimension is based on the unit of the part or assembly.
Note
Regenerate the model using the function ProSolidRegenerate() after setting the accuracy using ProSolidAccuracySet().
The function ProSolidAccuracyGet() returns the type and value of the accuracy. The accuracy may be relative or absolute.
Using these functions to set and retrieve part accuracy is similar to performing these functions in Creo Parametric using File  Prepare  Model Properties.
Derive the geometry epsilon for the required relative accuracy as follows:
geometry_epsilon = max_model_size  x relative_accuracy x 0.08333
where, max_model_size is the output returned by the function ProSolidMaxsizeGet() and 0.08333 is the scaling factor.
Use the function ProSolidMaxsizeGet() to get the maximum model size of the specified solid. The maximum model size does not decrease even when material is removed from the solid.
Solid Units
Introduction to Unit of Measurement and System of Units
Each model has a basic system of unit to ensure that all material properties of that model are consistently measured and defined. All models are defined on the basis of system of units. A part can have only one system of unit.
Following are the types of quantities which govern the definition of unit of measurement:
•  Basic Quantities—The basic units and dimensions of the system of units. For example, consider the Centimeter Gram Second (CGS) system of unit. The basic quantity for this system of unit is:
  Length—cm
  Mass—g
  Force—dyne
  Time—sec
  Temperature—K
•  Derived Quantities—The derived units are those that are derived from the basic quantities. For example, consider the Centimeter Gram Second (CGS) system of unit. The derived quantities for this system of unit are as follows:
  Area—cm^2
  Volume—cm^3
  Velocity—cm/sec
Types of Systems of Units
Following are the types of system of units:
•  Pre-defined system of unit—This system of unit is provided by default.
•  Custom-defined system of unit—This system of unit is defined by the user only if the model does not contain standard metric or nonmetric units or if the material file contains units that cannot be derived from the predefined system of units or both.
In Creo Parametric, the system of units are categorized as follows:
•  Mass Length Time (MLT)
  The following systems of units belong to this category:
  CGS —Centimeter Gram Second
  MKS—Meter Kilogram Second
  mmKS—millimeter Kilogram Second
•  Force Length Time (FLT)
  The following systems of units belong to this category:
  Creo Parametric Default—Inch lbm Second. This is the default system followed by Creo Parametric.
  FPS—Foot Pound Second
  IPS—Inch Pound Second
  mmNS—Millimeter Newton Second
Definitions
For Creo TOOLKIT, a system of units is represented by the structure ProUnitsystem. This structure is defined as:
typedef struct {
  ProMdl  owner;
  ProName name;
}ProUnitsystem;
where the name is the user-visible name used in the Unit Manager dialog.
An individual unit is represented by the structure ProUnititem. This structure is defined as:
typedef struct {
  ProMdl  owner;
  ProName name;
}ProUnititem;
where the name is the user-visible abbreviation used in the Unit Manager dialog.
Note
The functions described in the following sections supersede the functions prodb_get_model_units() and prodb_set_model_units().
Retrieving Systems of Units
Functions Introduced:
Use the function ProMdlUnitsystemsCollect() to retrieve the set of systems of units which are accessible to the model in the form of an array. The input arguments of the function are as follows:
•  mdl—Specifies a handle to the model.
The function outputs a ProArray containing the set of systems of units for the specified model.
Note
The function retrieves both the pre-defined as well as the custom-defined system of unit.
Use the function ProMdlPrincipalunitsystemGet() to retrieve the principal system of units for the specified model.
Modifying Systems of Units
Functions Introduced:
Use the function ProUnitsystemRename() to rename a custom- defined system of unit. The input parameters for this function are as follows:
•  system—Specifies a handle to the system of unit.
•  new_name—Specifies the new name for the system.
Use the function ProUnitsystemDelete() to delete a custom- defined system of unit. Specify a handle to the system of units to be deleted as the input parameter for this function.
Note
You can only delete a custom-defined system of units. You cannot delete a pre-defined system of units.
Accessing Systems of Units
Functions Introduced:
Use the function ProUnitsystemIsStandard() to check whether the system of unit is a Creo Parametric standard system. Specify the name of the system of unit as the input parameter.
Use the function ProUnitsystemTypeGet() to retrieve the type of system of unit. Specify the name of the system of unit as the input argument. The output argument of this function is as follows:
•  type—The type of system of unit. It can have the following values:
  PRO_UNITSYSTEM_MLT—Mass Length Time
  PRO_UNITSYSTEM_FLT—Force Length Time
For more information on the same refer to the section on Types of Systems of Units above.
Use the function ProUnitsystemUnitGet() to retrieve the unit of particular type for a specified system of derived unit.
Creating a New System of Units
Function Introduced:
Use the function ProMdlUnitsystemCreate() to create a new system of unit or to create a copy of an existing system of unit. The function expects the following input parameters:
•  mdl—Specifies a handle to the model.
•  type—Specifies the new type of system of unit.
•  name—Specifies the name of the new system of unit.
•  units—Specifies the set of units for the new system of unit created.
It outputs the newly created system of unit.
Accessing Individual Units
Functions Introduced:
Use the function ProMdlUnitsCollect() to retrieve a set of derived units of a particular type that are available to the specified model.
The function ProUnitInit() retrieves the unit of a particular name for a specified model.
Note
The function is applicable only for basic units and not for derived ones.
The function ProUnitNameGet() returns the name of the unit. For system generated unit, that has no user-friendly name, it returns the error PRO_TK_NOT_DISPLAYED.
Use the function ProUnitTypeGet() to retrieve the unit type of a particular unit.
Unit types can have any of the following values for basic units:
•  PRO_UNITTYPE_LENGTH
•  PRO_UNITTYPE_MASS
•  PRO_UNITTYPE_FORCE
•  PRO_UNITTYPE_TIME
•  PRO_UNITTYPE_TEMPERATURE
•  PRO_UNITTYPE_ANGLE
Unit types can have any of the following values for derived units:
•  PRO_UNITTYPE_AREA
•  PRO_UNITTYPE_VOLUME
•  PRO_UNITTYPE_VELOCITY
•  PRO_UNITTYPE_ACCELERATION
•  PRO_UNITTYPE_ROTATIONAL_VELOCITY
•  PRO_UNITTYPE_ROTATIONAL_ACCELERATION
•  PRO_UNITTYPE_FREQUENCY
•  PRO_UNITTYPE_DENSITY
•  PRO_UNITTYPE_TORQUE_MOMENT
•  PRO_UNITTYPE_FORCE_ALONG_CURVE
•  PRO_UNITTYPE_FORCE_PER_LENGTH
•  PRO_UNITTYPE_MOMENT_ALONG_CURVE
•  PRO_UNITTYPE_MOMENT_PER_LENGTH
•  PRO_UNITTYPE_FORCE_OVER_SURFACE
•  PRO_UNITTYPE_FORCE_PER_AREA
•  PRO_UNITTYPE_MOMENT_PER_VOLUME
•  PRO_UNITTYPE_PRESSURE
•  PRO_UNITTYPE_STRESS
•  PRO_UNITTYPE_YOUNG_MODULUS
•  PRO_UNITTYPE_MOMENT_OVER_SURFACE
•  PRO_UNITTYPE_MOMENT_PER_AREA
•  PRO_UNITTYPE_TRANSLATIONAL_STIFFNESS
•  PRO_UNITTYPE_ROTATIONAL_STIFFNESS
•  PRO_UNITTYPE_THERMAL_EXPANSION_COEFF
•  PRO_UNITTYPE_MOMENT_OF_INERTIA_SECTION
•  PRO_UNITTYPE_MOMENT_OF_INERTIA_SECTION
•  PRO_UNITTYPE_MASS_MOMENT_OF_INERTIA
•  PRO_UNITTYPE_ENERGY
•  PRO_UNITTYPE_WORK
•  PRO_UNITTYPE_HEAT
•  PRO_UNITTYPE_POWER
•  PRO_UNITTYPE_HEAT_TRANSFER_RATE
•  PRO_UNITTYPE_TEMPERATURE_GRADIENT
•  PRO_UNITTYPE_HEAT_FLUX
•  PRO_UNITTYPE_HEAT_FLUX_PER_LENGTH
•  PRO_UNITTYPE_THERMAL_CONDUCTIVITY
•  PRO_UNITTYPE_CONVECTION_COEFF
•  PRO_UNITTYPE_CONVECTION_COEFF_PER_AREA
•  PRO_UNITTYPE_SPECIFIC_HEAT
•  PRO_UNITTYPE_THERM_RES_FORCE
•  PRO_UNITTYPE_THERM_RES_MOMENT
•  PRO_UNITTYPE_WARPING_COEFFICIENT
•  PRO_UNITTYPE_MASS_PER_LENGTH
•  PRO_UNITTYPE_MASS_INERTIA_PER_LENGTH
•  PRO_UNITTYPE_DAMPING_COEFFICIENT
•  PRO_UNITTYPE_HEAT_RATE_PER_LENGTH
•  PRO_UNITTYPE_DIMENSIONLESS
•  PRO_UNITTYPE_MASS_PER_AREA
•  PRO_UNITTYPE_ROT_DAMPING_COEFF
•  PRO_UNITTYPE_VOLUME_HEAT_GEN
•  PRO_UNITTYPE_TRANS_STIFF_PER_AREA
•  PRO_UNITTYPE_FORCE_PER_VOLUME
•  PRO_UNITTYPE_CURVATURE
•  PRO_UNITTYPE_CURVATURE_SQ
•  PRO_UNITTYPE_LINEAR_MOMENTUM
•  PRO_UNITTYPE_ANGULAR_MOMENTUM
•  PRO_UNITTYPE_INV_STRESS
•  PRO_UNITTYPE_TRANS_STIFF_PER_LENGTH
•  PRO_UNITTYPE_ROT_STIFF_PER_LENGTH
•  PRO_UNITTYPE_DAMPING_COEFF_PER_LENGTH
•  PRO_UNITTYPE_INV_VELOCITY
•  PRO_UNITTYPE_CONVECTION_COEFF_PER_VOLUME
•  PRO_UNITTYPE_CONVECTION_COEFF_PER_LENGTH
•  PRO_UNITTYPE_CONVECTION_COEFF_PER_POINT
•  PRO_UNITTYPE_RADIATION_COEFF_PER_VOLUME
•  PRO_UNITTYPE_RADIATION_COEFF_PER_AREA
•  PRO_UNITTYPE_RADIATION_COEFF_PER_LENGTH
•  PRO_UNITTYPE_RADIATION_COEFF_PER_POINT
•  PRO_UNITTYPE_ENERGY_PER_VOLUME
•  PRO_UNITTYPE_ENERGY_PER_AREA
•  PRO_UNITTYPE_ENERGY_PER_LENGTH
•  PRO_UNITTYPE_LENGTH_SPECTDENS
•  PRO_UNITTYPE_VELOCITY_SPECTDENS
•  PRO_UNITTYPE_ACCELERATION_SPECTDENS
•  PRO_UNITTYPE_STRESS_SPECTDENS
•  PRO_UNITTYPE_STRAIN_SPECTDENS
•  PRO_UNITTYPE_ROTATIONAL_VELOCITY_SPECTDENS
•  PRO_UNITTYPE_ROTATIONAL_ACCELERATION_SPECTDENS
•  PRO_UNITTYPE_FORCE_SPECTDENS
•  PRO_UNITTYPE_MOMENT_SPECTDENS
•  PRO_UNITTYPE_ROTATIONAL_LENGTH_SPECTDENS
•  PRO_UNITTYPE_MASS_FLOW_RATE
•  PRO_UNITTYPE_VISCOSITY
•  PRO_UNITTYPE_VOLUME_FLOW
The following units have been added to the volume flow:
  m3/sec
  cm3/sec
  mm3/sec
  ft3/sec
  in3/sec
  L/sec
  gal/sec
  mL/sec
Use the function ProUnitConversionGet() to retrieve the conversion factor for a particular unit. The output arguments of this function are:
•  conversion—Specifies the conversion factor for a unit in terms of scale of the unit and an offset value.
Example - Consider the formula to convert temperature from Centigrade
to Fahrenheit F = a + (C * b) where F is the temperature in Fahrenheit C is the temperature in Centigrade a = 32 (constant signifying the offset value) b = 9/5 (ratio signifying the scale of the unit)
Note
Creo Parametric scales the length dimensions of the model using the factor specified. If the scale is modified, the model is regenerated. When you scale the model, the model units are not changed. Imported geometry cannot be scaled.
•  ref_unit— Specifies the reference unit for the conversion.
Use the function ProUnitConversionCalculate() to calculate the conversion factor between two units. These units can belong to the same model or two different models.
Use the function ProUnitIsStandard() to determine whether the unit is a standard unit as defined in Creo Parametric.
Creo Parametric uses named quantities to represent units other than the basic units (e.g. "Ilbs_stress_unit", which represents a quantity of stress in the default Creo Parametric unit systems). Parameters and material properties which are assigned derived units will return the name in the ProUnititem structure, rather than the actual unit-based expression for the quantity.
Use the function ProUnitExpressionGet() to retrieve the unit-based expression for a given Creo Parametric unit name.
Use the function ProUnitInitByExpression() to retrieve the ProUnititem given a unit-based expression.
The function ProUnitCreateByExpression() creates a derived or basic unit, based on expression. Use the function ProUnitModifyByExpression() to modify a derived unit.
The function ProUnitCreateByExpressionAndType() creates a derived unit for the specified unit-based expression and type.
Use the function ProUnitModifyByExpressionAndType() to modify a derived unit based on the specified unit-based expression and type. The input arguments are as follows:
•  unit—Unit to be modified.
•  type—Type of unit specified by the enumerated data type ProUnitType.
•  expression—Expression of the unit specified by the character string using the ProPath object.
The function ProUnitInitByExpressionAndType() returns a ProUnititem structure for the specified unit-based expression. The input arguments are as follows:
•  mdl—The model that owns the units.
•  type—Type of unit specified by the enumerated data type ProUnitType.
•  expression—Expression of the unit specified by the character string using the ProPath object.
Modifying Units
Functions Introduced:
Use the function ProUnitModify() to modify a pre-defined unit. Modifying the units can invalidate your relations, as they are not scaled along with the model. The input parameters are:
•  unit— Specifies the unit to be modified.
•  conversion—Specifies the conversion factor for the unit.
•  ref_unit—Specifies the reference unit.
Use the function ProUnitDelete() to delete a previously created unit.
Note
You cannot delete a pre-defined unit. If you delete a unit, you cannot undo the deletion.
Use the function ProUnitRename() to rename an existing unit.
Creation of a new Unit
Use the function ProUnitCreate() to create a new basic unit given a reference unit and the required conversion factor.
Conversion of Models to a New Unit System
Function Introduced:
Use the function ProMdlPrincipalunitsystemSet() to change the principal system of units assigned to the solid model. The options available for the conversion are:
•  PRO_UNITCONVERT_SAME_DIMS—Specifies the option to keep the dimension values despite the change in units.
•  PRO_UNITCONVERT_SAME_SIZE—Specifies the option to scale the dimension values to keep the same size for the model.
Conversion of a system of units may result in regeneration failures due to the modification of dimensions, parameters, and relations. ProMdlPrincipalunitsystemSet() does not support a flag to undo the changes made by the unit system conversion, and will always bring the Fix Model interface to fix any regeneration failure. Therefore use this function only in interactive mode applications.While updating the principal system of units in an assembly environment, update the system of units in the following order:
1. Update the system of unit for all the parts separately. Update the parts using the following procedure:
a. Retrieve the parts.
b. Update the units.
c. Save the part and erase it from the current session.
2. Update all the sub-assemblies, that either need to be changed, or contain already processed components.
3. Update the topmost level assembly.
Note
The initial units for an assembly are those of its base component. If, however, the units of the base component have been changed, the assembly units do not automatically change. You must also modify the units of the assembly. You cannot change the units of an assembly containing assembly features that intersect a part.
Mass Properties
Function Introduced:
In Creo Parametric 7.0.0.0 and later, the density parameter for any material is PTC_MASS_DENSITY. When you edit the density of a material, the value of this parameter is updated. The alternate mass property parameter for an assembly, part, or body is PRO_MP_ALT_DENSITY. The reported density parameter for an assembly, part, or body is PRO_MP_DENSITY. In the case of an assembly or a part with different materials, the value of this parameter is the average density.
The function ProSolidMassPropertyGet() provides information about the distribution of mass in the part or assembly.
The function ProSolidMassPropertyWrite() writes the mass properties of the specified solid or body referenced by the coordinate system selection in the specified format. The input arguments are as follows:
•  solid_or_bodyProSelection handle to the solid or body.
•  csys_selProSelection handle for the coordinate system. If this value is NULL, the function uses the default coordinate system of the input solid.
Note
You can select the coordinate system using the component path of component or subassembly whose mass properties are required.
•  format—Format of the mass property file. This is specified using the enumerated data type ProMassPropertyFormat and the valid values are:
  PRO_MP_TXT—Text format. The default value is 0.
  PRO_MP_CSV—CSV format. The default value is 1.
  PRO_MP_XML—XML format. The default value is 2.
The function ProSolidBodyMassPropertyGet() calculates the mass properties of a body in the specified coordinate system. The input parameter body is the handle to a part or an assembly.
Both the functions provide the mass distribution information relative to the specified coordinate system datum csys_name. If the value of the parameter csys_name is NULL, the default coordinate system is used.
The functions ProSolidMassPropertyGet() and ProSolidBodyMassPropertyGet() return the information in the structure ProMassProperty, declared in the header file ProSolid.h.
The ProMassProperty structure contains the following fields (all doubles):
•  volume—The volume.
•  surface_area—The surface area.
•  density—The density is not defined until a material with well-defined density is assigned.
•  mass—The mass.
•  center_of_gravity[3]—The center of gravity (COG).
•  coor_sys_inertia[3][3]—The inertia matrix.
•  coor_sys_inertia_tensor[3][3]—The inertia tensor.
•  cg_inertia_tensor[3][3]—The inertia about the COG.
•  principal_moments[3]—The principal moments of inertia (the eigenvalues of the COG inertia).
•  principal_axes[3][3]—The principal axes (the eigenvectors of the COG inertia).
The function ProSolidBodyDensityGet() determines the density of the material assigned to a body. The input parameters body is the handle to the body.
Note
If a material is already assigned to the part, the output of the function is the density of the material that is assigned to the body. The density is measured in the units of the model. The density of the body is always the density of the material assigned to the body.
The function ProSolidMassPropertyWithDensityGet() calculates the mass properties of a part or an assembly in the specified coordinate system. This function does not impact the mass properties of a solid. The input arguments are as follows:
•  solid—Handle to the part or assembly specified by the ProSolid object.
•  csys_name—Name of the coordinate system. If this is Null, the function uses the default coordinate system.
•  dens_use_flag—Value of the density flag specified using the enumerated data type ProMPDensUse and the valid values are as follows:
  PRO_MP_DENS_DEFAULT—Calculate the mass properties using the material density.
  PRO_MP_DENS_USE_ALWAYS—Calculate the mass properties using the specified density, even if material has a defined density.
  PRO_MP_DENS_USE_IF_MISSING—Calculate mass properties using specified density, even if material does not have a defined density.
•  density—Density used while calculating mass properties depending on the value specified for the input argument dens_use_flag.
The function ProAssemblySolidMassPropertyGet() calculates the mass properties of a solid that is referenced by the specified coordinate system selection. The input arguments follow:
•  solid —The handle to top assembly or component/sub-assembly.
•  csys_sel—Selection of coordinate system specified using the array of ProSelection object. If this is NULL, the function uses the default coordinate system of the specified solid.
Solid Postfix Identifiers
Functions Introduced:
The postfix identifier of a solid is the integer run-time identifier used in relations to make the names of its dimensions unique in the context of a parent assembly. Creo Parametric automatically updates these values when they are used in relations. The function ProSolidToPostfixId() gives you the identifier for the solid in session. The ProPostfixIdToSolid() function provides the solid handle, given the identifier.
Part Objects
The object ProPart is an instance of ProSolid. It is an opaque handle that can be cast to a ProSolid or ProMdl so you can use any of the functions for those objects.
Density
Functions Introduced:
Superseded Functions:
The density of a part is used in many calculations inside of Creo Parametric, including mass properties calculations and shrinkwrap export. The function ProPartDensityGet() returns the calculated or reported density that is defined by the parameter PRO_MP_DENSITY.
In Creo Parametric 7.0.0.0 and later, the function ProPartDensitySet() is deprecated. Use the functions ProMaterialCurrentSet() and ProMaterialPropertySet() instead.
Note
You can use ProMaterialPropertySet() with the property type as PRO_MATPROP_MASS_DENSITY to change the density in the material.
For more information about materials, refer to Accessing Material Data.
Example 4: Writing the Mass of a Given Part to the Model Tree
The sample code in UgSolidInfoMass.c located at <creo_toolkit_loadpoint>/protk_appls/pt_userguide/ptu_solid demonstrates the use of ProPartDensityGet(), ProSolidMassPropertyGet() and several units related functions. It writes the mass of the given part to the model tree, along with the appropriate units for the mass value.
Material Objects
Creo TOOLKIT enables you to programmatically access the material properties of parts. Using the Creo TOOLKIT functions, you can do the following actions:
•  Create or delete materials.
•  Set the current material.
•  Retrieve and set the material types and properties.
•  Read and write to material files.
To enable access to materials, Creo TOOLKIT uses the following objects:
•  ProMaterial—A structure that contains a material name and the part (ProSolid object) to which it is assigned. This handle is used in older material functions.
•  ProMaterialItem—Another name for a ProModelitem, it contains the material owner, ID, and type (PRO_RP_MATERIAL).
To convert between ProMaterial and ProMaterialItem, use ProModelitemByNameInit() to obtain the item from the material owner and name. To obtain a ProMaterial from a ProMaterialItem, use ProModelitemNameGet() to get the material name.
Accessing Material Data
Functions Introduced:
The function ProMaterialCreate() creates a new material with the name you specify, and sets the default values within an associated ProMaterialdata object. Your application must set the correct material properties in the fields of the ProMaterialdata structure.
The input arguments of this function are as follows:
•  part — Specifies the part.
•  matl_name — Specifies the material name.
•  p_matl_data — This argument has been deprecated. Pass NULL to create an empty material item whose properties can be set by ProMaterialPropertySet().
The function ProPartMaterialsGet() obtains an array containing material names that exist in a part database. Note that you must use ProArrayAlloc() to allocate memory for this array. To remove a specified material from the part’s database, call the function ProMaterialDelete().
The current material of a part determines the material properties that will be used in some computational analyses of that part. Although multiple materials can be stored in a part database, only one material can be current. The function ProMaterialCurrentGet() gets the handle for the master material of the specified part. To set the master material, call the function ProMaterialCurrentSet().
Note
•  When the master material on a part with a single body is changed, the appearance, density, and sheet metal properties of the body are updated. When you create a new body, it is automatically assigned the material assigned to the part. You can also explicitly assign a material to a body. In this case, even when the master material on the model is changed, the appearance, density, and sheet metal properties of the body are not changed.
•  By default, when assigning a material to a sheet metal part, the function ProMaterialCurrentSet() might modify the values of the sheet metal properties such as Y factor and bend table according to the material file definition. This triggers a modification of the developed length parameters of the sheet metal part. To prevent this modification, set the value of the configuration option material_update_smt_bend_table to never_replace. To trigger a modification of the developed length parameters of the sheet metal part, set the configuration option material_update_smt_bend_table to always_replace. The default value is always_replace. Call ProSolidRegenerate() to trigger the regeneration and recalculate the developed length dimension of the part.
See the Creo Parametric Sheetmetal online help for more information on Bend Allowance.
•  The function ProMaterialCurrentSet() may change the model display, if the new material has a default appearance assigned to it.
•  The function may also change the family table, if the parameter PTC_MASTER_MATERIAL is a part of the family table.
•  You can still use the legacy parameter PTC_MASTER_MATERIAL, however, these legacy parameters do not appear correctly in calculations and reports when you are working with a part that uses multiple materials.
Material Types and Properties
The enumerated type ProMaterialPropertyType contains the material types and material property types.
The material type is given by PRO_MATPROP_TYPE that takes the following values:
•  PRO_MATERIAL_TYPE_STRUCTURAL_ISOTROPIC—Specifies a material with an infinite number of planes of material symmetry, making the structural material properties equal in all directions.
•  PRO_MATERIAL_TYPE_STRUCTURAL_ORTHOTROPIC—Specifies a material with symmetry relative to three mutually perpendicular planes for structural material properties.
•  PRO_MATERIAL_TYPE_STRUCTURAL_TRANS_ISOTROPIC—Specifies a material with rotational symmetry about an axis for structural material properties. These properties are equal for all directions in the plane of isotropy.
•  PRO_MATERIAL_TYPE_THERMAL_ISOTROPIC—Specifies a material with an infinite number of planes of material symmetry, making the thermal material properties equal in all directions.
•  PRO_MATERIAL_TYPE_THERMAL_ORTHOTROPIC—Specifies a material with symmetry relative to three mutually perpendicular planes for thermal material properties.
•  PRO_MATERIAL_TYPE_THERMAL_TRANS_ISOTROPIC — Specifies a material with rotational symmetry about an axis for thermal material properties. These properties are equal for all directions in the plane of isotropy.
•  PRO_MATERIAL_TYPE_FLUID—Specifies a material with fluid properties.
The material subtype is given by PRO_MATPROP_SUB_TYPE that takes the following values:
•  PRO_MATERIAL_SUB_TYPE_LINEAR—Specifies the linear elastic material type. This is the default value.
•  PRO_MATERIAL_SUB_TYPE_HYPERELASTICSpecifies the hyperelastic (non-linear) material types, such as rubber, that exhibit instantaneous elastic response to large strains.
•  PRO_MATERIAL_SUB_TYPE_ELASTOPLASTIC—Specifies the elastoplastic (non-linear) material types, such as metals, with the following isotropic hardening laws:
  Perfect Plasticity—Given by the value PRO_MATERIAL_HARDENING_PERFECT_PLASTICITY
  Linear Hardening—Given by the value PRO_MATERIAL_HARDENING_LINEAR_HARDENING
  Power Law—Given by the value PRO_MATERIAL_HARDENING_POWER_LAW
  Exponential Law—Given by the value PRO_MATERIAL_HARDENING_EXPONENTIAL_LAW
The above three subtypes are available only for PRO_MATERIAL_TYPE_STRUCTURAL_ISOTROPIC and PRO_MATERIAL_TYPE_THERMAL_ISOTROPIC material types.
From Creo Parametric 3.0 onward, two additional material types PRO_MATERIAL_FATIGUE_MAT_TYPE_FERROUS and PRO_MATERIAL_FATIGUE_MAT_TYPE_OTHER have been added for fatigue analysis. The material types PRO_MATERIAL_FATIGUE_MAT_TYPE_UNALLOYED_STEELS and PRO_MATERIAL_FATIGUE_MAT_TYPE_LOW_ALLOY_STEELS are obsolete. Use the material type PRO_MATERIAL_FATIGUE_MAT_TYPE_FERROUS instead. The following surface finish types for fatigue analysis are also obsolete:
•  PRO_MATERIAL_FATIGUE_FINISH_FORGED
•  PRO_MATERIAL_FATIGUE_FINISH_WATER_CORRODED
•  PRO_MATERIAL_FATIGUE_FINISH_SEA_WATER_CORRODED
•  PRO_MATERIAL_FATIGUE_FINISH_NITIRIDED
•  PRO_MATERIAL_FATIGUE_FINISH_SHOT_PEENED
PTC recommends that you review your existing Creo TOOLKIT applications and modify the code as appropriate to ensure that the applications work correctly for the fatigue materials and material finish types.
Functions Introduced:
The functions ProMaterialDataGet() and ProMaterialDataSet() have been deprecated, and do not support all of the available material properties. PTC recommends that for accessing material properties, you convert the ProMaterial type to a model item using ProModelitemByNameInit(), and use ProMaterialPropertyGet() and ProMaterialPropertySet() the properties of that item, respectively.
A part created in Creo Parametric 7.0.0.0 and later, can contain multiple solid bodies where each body can have its own material assignment. A part created in an earlier release of Creo Parametric contains one body and one material is assigned to the part.
The function ProSolidBodyMaterialSet() assigns a material to the specified body. You can set the default material by specifying the value of the system parameter PTC_MASTER_MATERIAL as PTC_SYSTEM_MTRL_PROPS. In legacy parts, the value of PTC_MASTER_MATERIAL is the material assigned to the part. The input arguments follow:
•  body—Body for which the material needs to be assigned.
•  mtl—Name of the material that needs to be assigned to the body.
Use the function ProSolidBodyMaterialGet() to retrieve the information of the material assigned to the body.
Note
Refer to the Creo Parametric online help for more information about Materials.
If you do not assign a material to a body, Creo Parametric assigns PTC_GENERIC_MATERIAL material to the body. The density of this material as well as other properties are empty.
The function ProMaterialPropertyGet() returns the value and the units for a material property.
Note
The name of the units returned can be the name of a Creo Parametric unit, which may not be obviously understood by a user. Use ProUnitExpressionGet() to change this name to familiar units.
Use the function ProMaterialPropertySet() to create or modify a material property. It has the following input parameters:
•  p_material—Specifies the material as defined by ProMaterialItem.
•  prop_type—Specifies the material property type as defined by ProMaterialPropertyType.
•  p_value—Specifies the material property value.
•  p_units—Specifies the material property units.
Note
This function expects the Creo Parametric unit name for some unit properties. To obtain this name, pass the user-visible units through ProUnitByExpressionInit().
The following table displays the possible combinations of arguments for p_value and p_units:
p_value
p_units
Is the property already created in the material?
Result
Any value
Appropriate units for this property, or NULL, if the property is unitless
NO
Property is created with the given units and value.
Any value
NULL
NO
Property is created with the given value using the appropriate units from the owner model.
Any value
Current units for this property, or NULL, if the property is unitless
YES
Property value is changed to the new value.
Any value
NULL
YES
Property value is changed to the new value (which is interpreted as being in the units from the owner model)
The current value
New appropriate units
YES
Property units are changed but the value is interpreted as being for the new units.
NULL
New appropriate units
YES
Property units are changed and the current value is converted to the new units.
Note
When using ProMaterialPropertySet() to change the sheet metal Y-factor or bend table assigned to the current material, pass the current material to ProMaterialCurrentSet() again to force Creo Parametric to update the bend allowance preferences of the sheet metal part.
Use the function ProMaterialDescriptionGet() to get the material description. This property is also accessible as the material property PRO_MATPROP_MATERIAL_DESCRIPTION.
Use the function ProMaterialDescriptionSet() to set the material description.
Use the function ProMaterialPropertyDelete() to remove a property from the material definition.
Material Input and Output
Functions Introduced:
Material properties are frequently stored in text files accessible for repeated assignment to parts. Creo TOOLKIT includes functions that write to and read these files.
The function ProMaterialfileWrite() writes the information contained in a ProMaterial object to a file with the specified name.
The format of this file is the new material file format which is consistent with the Creo Parametric materials library.
The function ProMaterialfileRead() reads from a material file, the properties of the material with the specified name. The name of the file read can be either:
•  <name>.mtl—Specifies a new material file format.
•  <name>.mat—Specifies an old material file format (pre-Wildfire 3.0).
If the material is not already in the part database, ProMaterialfileRead() adds the material to the database after reading the material file. If the material is already in the database, the function replaces the material properties in the database with those contained in the material file.
Example 5: Working with Materials and Material Properties
The sample code in UgMaterial.c located at <creo_toolkit_loadpoint>/protk_appls/pt_userguide/ptu_param shows how to work with materials and material properties.
Example 6: Creating a Non-linear Material
The sample code in UgSolidMaterial.c located at <creo_toolkit_loadpoint>/protk_appls/pt_userguide/ptu_solid shows how to create a non-linear material and assign it to a solid.