Core: Cross Sections
The functions in this section enable you to access, modify, and delete cross sections, and create planar cross sections.
Listing Cross Sections
Functions Introduced:
The function ProXsecRename() renames a specified cross section.
Use function ProXsecTypeGet() to retrieve the type of cross section. The input argument for this function is a handle to the specified cross section. The output argument p_type is a ProXsecType structure, which contains the following fields:
•  cutter—Specifies the cutting object type. The valid cutting object types are contained in the enumerated type ProXsecCut and are as follows:
  PRO_XSEC_PLANAR
  PRO_XSEC_OFFSET
  PRO_XSEC_PATTERN
•  cut_object—Specifies the object that was cut. The valid object types are contained in the enumerated type ProXsecCutobj and are as follows:
  PRO_XSECTYPE_MODEL—Specifies that the cross section was created on solid geometry.
  PRO_XSECTYPE_QUILTS—Specifies that the cross section was created on one quilt surface.
  PRO_XSECTYPE_MODELQUILTS—Specifies that the cross section was created on solid geometry and all quilt surfaces.
  PRO_XSECTYPE_ONEPART—Specifies that the cross section was created on one component in the assembly.
Extracting Cross-Sectional Geometry
Functions Introduced:
Superseded Functions:
The geometry of a cross section in an assembly is divided into components. Each component corresponds to one of the parts in the assembly that is intersected by the cross section, and describes the geometry of that intersection. A component can have disjoint geometry if the cross section intersects a given part instance in more than one place.
A cross section in a part has a single component.
The components of a cross section are identified by consecutive integer identifiers that always start at 0.
The function ProXSectionItemsCollect() returns an array of ProXSectionItem. An array item is created for each body. If no bodies are created, an array contains one item for each component. The function returns the error PRO_TK_E_NOT_FOUND when the input argument p_view is a drawing view and the input cross section is not found in the view.
The function ProXSectionItemDataGet() returns the data from the cross section body specified using the structure ProXSectionItem. The output arguments follow:
•  r_path—Path to the component being cut by the cross section.
•  r_id_type—Body or quilt type.
•  r_id—Id of the body or the quilt being cut.
•  r_geom—Geometry created by the cross section by cutting the specific body or quilt.
Use the function ProXSectionItemFree() to free the memory allocated to the ProXSectionItem structure.
Use the function ProXSectionItemsArrFree() to free the ProArray of cross section data allocated by the function ProXSectionItemsCollect().
The function ProXsecGeometryRetrieve() returns an array containing the geometry of all components in the specified cross section and retrieves the following information about a specified cross-sectional component:
•  The memb_num and memb_id_tab for the intersected part, with respect to the assembly that contains the cross section.
•  A handle to the geometry of the intersection.
The geometry handle can be treated as an ordinary face pointer. Extract its contours with function ProSurfaceContourVisit().
Use the function ProXsecGeometryArrayFree() to free the memory allocated to the array of cross section data and use the function ProXsecGeometryFree() to free memory allocated to the cross section data.
The geometry of a cross section is not maintained constantly by Creo Parametric—it is regenerated only when the user requests to see the cross section. Use function ProXsecRegenerate() to regenerate the cross section of a part or an assembly. Use function ProXsecDisplay() to display a cross section. ProXsecDisplay() does not add the cross section to the associated objects list, and the displayed cross section disappears on the first screen redraw.
The function ProXsecPlaneGet() returns the plane geometry for a specified cross section.
In Creo Parametric 9.0, the function ProOffsetXsecGet() is deprecated. Use the function ProOffsetXsecInfoGet() instead.
The function ProOffsetXsecInfoGet() returns the following parameters for a specified offset cross section.
•  p_ent_arr—Specifies a ProArray of Pro2dLinedef structures for the cross section entities.
•  plane—Specifies an entity plane.
•  p_one_sided—If this output argument is true, the cross section lies on one side of the entity plane, if it is false, the cross section is both-sided.
•  p_flip—If this output argument is false, Creo Parametric removes material from the left of the cross section entities if the viewing direction is from the positive side of the entity plane. If p_flip is true, Creo Parametric retains the material from the left of the cross section entities and removes the rest of the material.
•  p_side_xsec_mode—Specifies the side to which the cross-section is oriented. The side is specified by the enumerated data type ProXsecOffsetSide. The valid values are:
  PRO_XSEC_OFFSET_BOTH_SIDES—Orients the cross section to both sides of entity plane.
  PRO_XSEC_OFFSET_SIDE_1—Orients the cross section to the positive normal of entity plane.
  PRO_XSEC_OFFSET_SIDE_2—Orients the cross section to the negative normal of entity plane.
The function ProXsecGet() retrieves the cross section handle based on the specified solid model and cross section ID.
The function ProXsecMdlnameAlloc() allocates the ProXsecMdlname handle. The input arguments follow:
•  solid_owner—Specifies the model where the cross section will be created.
•  xsec_name—The name to set in the cross section. Maximum name size should be PRO_MDLNAME_SIZE.
Note
The function ProXsecMdlnameAlloc() returns the error PRO_TK_LINE_TOO_LONG if the name of the cross section is longer than PRO_NAME_SIZE.
Use the function ProXsecMdlnameFree() to free the memory allocated to the ProXsecMdlname handle.
The function ProXsecMdlnameNameGet() returns the name of the cross section handle.
Use the function ProXsecMdlnameNameSet() to set the name of the cross section. Maximum name size should be PRO_NAME_SIZE.
Note
The function ProXsecMdlnameNameSet() returns the error PRO_TK_LINE_TOO_LONG if the name of the cross section is longer than PRO_NAME_SIZE.
The functions ProXsecMdlnameSolidOwnerGet() and ProXsecMdlnameSolidOwnerSet() get and set the owner of the cross section.
The function ProXsecAsModelitemGet() converts a cross section handle into an appropriate model item.
The function ProXsecFlipGet() returns a integer value that indicates the direction in which the cross section has been clipped. Depending on the type of cross section, the integer value indicates different direction of clipping as below:
•  Planar cross section—The integer value:
  1 indicates that the cross section has been clipped in the direction of the positive normal to the cross section plane.
  -1 indicates that the cross section has been clipped in the opposite direction of the positive normal.
•  Offset cross section—The integer value:
  1 indicates that material has been removed from the left of the cross section entities if the viewing direction is from the positive side of the entity plane.
  -1 indicates that the material has been retained from the left of the cross section entities and rest of the material has been removed.
In Creo Parametric 7.0.0.0 the function ProXsecExcludeCompGet() is deprecated. Use the function ProXSectionExcludeCompGet() instead.
The function ProXSectionExcludeCompGet() returns the status and an array of paths to the assembly components and bodies that have been included and excluded for the specified cross section. The assembly paths are returned as a ProArray of type ProSelection. The status of the assembly components and bodies is returned by the enumerated type ProXsecExcludeModels and the valid values are:
•  PRO_XSEC_MODEL_EXCLUDE—Specifies that the assembly components and bodies have been excluded.
•  PRO_XSEC_MODEL_INCLUDE—Specifies that the assembly components and bodies have been included.
Use the function ProSelectionarrayFree() to free the memory allocated to the ProArray of type ProSelection.
Visiting Cross Sections
Function Introduced:
The function ProSolidXsecVisit() enables you to visit all named cross sections in the specified solid. Use ProSolidXsecVisitAction() to supply the function to be performed when visiting part or assembly cross sections.
Creating and Modifying Cross Sections
Functions Introduced:
Superseded Functions:
The function ProXsecParallelCreate() creates a cross section feature parallel to a given plane.
In Creo Parametric 7.0.0.0 the function ProXsecPlanarWithoptionsCreate() is deprecated. Use the function ProXSectionPlanarCreate() instead.
The function ProXSectionPlanarCreate() creates a cross section feature through a datum plane and also makes the cross section visible. The input arguments are:
•  solid_owner—Specifies the model where the cross section will be created.
•  xsec_name—Specifies the name of the cross section.
•  cutting_plane—Specifies the selection of the cutting plane. The cutting plane must belong to the top-level part or assembly.
•  xsec_type—Specifies the type of object that will be cut by the cross section. It is specified by the enumerated type ProXsecCutobj.
•  quilt_or_one_part—Specifies the selection of the quilt or component depending on type of object specified by xsec_type.
•  flip—Specifies the direction in which the cross section will be clipped. The value 1 indicates that the cross section will be clipped in the direction of the positive normal to the cutting plane. -1 indicates that the cross section will be clipped in the opposite direction of the positive normal.
•  excld_incld_opt—Specifies the items to exclude, specified by the input parameter exclude_items from cutting by the cross section and is defined by the enumerated data type ProXsecExcludeModels.
•  exclude_items—Specifies a ProArray of selected bodies or parts to be included or excludes from the cross section.
•  data—Reserved for future use.
Note
•  From Creo Parametric 4.0 F000 onward, when a cross section is created, it is not displayed by default in the model. You must call the function ProXsecMakeVisible() to display the cross section.
•  While porting Creo TOOLKIT applications, which have used the function ProXsecPlanarWithoptionsCreate() and have been created in releases prior to Creo Parametric 4.0 F000, depending on whether you want the cross section to be displayed, call the function ProXsecMakeVisible() in your applications. ProXsecMakeVisible() displays the cross section in the model.
•  From Creo Parametric 2.0 onward:
  the legacy cross sections, that is, the cross sections created in Pro/ENGINEER, Creo Elements/Pro, and in releases prior to Creo Parametric 2.0 are not supported.
  the functions ProXsecParallelCreate() and ProXsecPlanarWithoptionsCreate() create cross sections as features.
  the functions ProXsecParallelCreate() and ProXsecPlanarWithoptionsCreate() automatically convert the legacy cross sections to new cross section features as defined in Creo Parametric 2.0 before creating any new cross section feature.
The function ProXsecOffsetCreate() is deprecated. Use the function ProXSectionOffsetCreate() instead.
The function ProXSectionOffsetCreate() creates an offset cross section from a polyline. The polyline lies on a plane and the plane is defined by a local coordinate system. Offset cross section is created by extruding the polyline perpendicular to the sketching plane. The input arguments are:
•  solid_owner—Specifies the model where the cross section will be created.
•  xsec_name—Specifies the name of the cross section.
•  trf—Specifies the local coordinate system of the plane which contains the polyline.
•  ent_arr—Specifies a ProArray of Pro2dEntdef structure. The structure contains information about the entities of the polyline.
•  side—Specifies the side to which the cross section must be extended. The cross section is extended normal to the polyline plane. The side is specified using the enumerated data type ProXsecOffsetSide. The valid values are:
  PRO_XSEC_OFFSET_BOTH_SIDES—Extends the cross section to both sides of polyline plane.
  PRO_XSEC_OFFSET_SIDE_1—Extends the cross section to the positive normal of polyline plane.
  PRO_XSEC_OFFSET_SIDE_2—Extends the cross section to the negative normal of polyline plane.
•  flip—Specifies the direction in which the cross section will be clipped. The value False indicates that the material on the right side of the polyline plane is retained. When the argument side is set to PRO_XSEC_OFFSET_SIDE_1 or PRO_XSEC_OFFSET_SIDE_2 then the material is retained from positive or negative side of polyline plane respectively.
When the value is set to True the above area is removed. The remaining material is retained.
Note
If the polyline from which the cross section has been created is closed, then flip works a little different.
Polyline Direction
Flip Value
Description
Closed polyline created clockwise
False
The material inside of the closed polyline is retained.
When the argument side is set to PRO_XSEC_OFFSET_SIDE_1 or PRO_XSEC_OFFSET_SIDE_2 then the material is retained from positive or negative side of polyline plane respectively.
Closed polyline created clockwise
True
The material described in above case is removed. The remaining material is retained.
Closed polyline created counter clockwise
True
The material inside of the closed polyline is retained.
When the argument side is set to PRO_XSEC_OFFSET_SIDE_1 or PRO_XSEC_OFFSET_SIDE_2 then the material is retained from positive or negative side of polyline plane respectively.
Closed polyline created counter clockwise
False
The material described in above case is removed. The remaining material is retained.
•  excld_incld_opt—Specifies the items to be excluded from cutting by the cross section and is defined by the enumerated data type ProXsecExcludeModels. The items to be excluded are specified by the input parameter exclude_items.
•  exclude_items—Specifies a ProArray of selected bodies or parts to include or exclude from the cross section.
•  data—This option is specified using the data structure ProXSectionCreateData and is used to set quilt cross section type as PRO_XSECTYPE_QUILTS or PRO_XSECTYPE_MODELQUILTS for offset cross section. . This input argument is optional. If you do not want to offset cross section to cut quilts, set this as Null.
The functions ProXSectionPlanarCreate() and ProXSectionOffsetCreate() return an error PRO_TK_LINE_TOO_LONG, when the xsec_name is longer than PRO_NAME_SIZE.
The function ProXSectionCreateDataAlloc() allocates memory for the ProXSectionCreateData data structure.
Use the function ProXSectionCreateDataFree() to free the ProXSectionCreateData data structure memory.
The data structure ProXSectionCreateData is defined as follows:
Use the function ProXSectionCreateDataQuiltSelGet() to retrieve the quilt selection data. The output argument r_quilt_sel is the address of the quilt selection pointer given through the ProSelection object.
The function ProXSectionCreateDataQuiltSelSet() sets the quilt selection data using the structure ProXSectionCreateData.
The function ProXSectionCreateDataQuiltTypeGet() gets the quilt cross section type using the structure ProXSectionCreateData. The output argument r_xsec_type is defined by the enumerated data type ProXsecCutobj. The valid values can be PRO_XSECTYPE_QUILTS or PRO_XSECTYPE_MODELQUILTS.
Use the function ProXSectionCreateDataQuiltTypeSet() to set the quilt cross section type using the structure ProXSectionCreateData.
The function ProXsecMakeVisible() displays the specified cross section in the model. Use the function ProXsecIsVisible() to check if the specified cross section is displayed in the model.
The function ProXsecActiveSet() sets the specified cross section as active in the current view. Use the function ProXsecActiveGet() to retrieve the cross section, which is active in the current view.
Use the function ProXsecCanCreateAsFeature() to check if new cross section features can be created in the specified model. The function returns PRO_B_FALSE if the specified model has legacy cross sections.
The function ProXsecOldToNewConvert() converts the legacy cross sections to new cross section features as defined in Creo Parametric 2.0 for the specified model.
Use the function ProXsecIsFeature() to check whether the cross section is a feature.
The function ProXsecFeatureGet() returns a pointer to the cross section feature. The function returns the error type PRO_TK_BAD_CONTEXT for legacy cross sections.
The function ProXsecDelete() deletes a given cross section from a part or assembly.
Mass Properties of Cross Sections
Function Introduced:
The function ProXsecMassPropertyCompute() calculates the mass properties of the cross section in the specified coordinate system. The function needs the name of a coordinate system datum whose X- and Y-axes are parallel to the cross section. The output from this function also refers to the coordinate system datum. Call ProXsecRegenerate() before ProXsecMassPropertyCompute().
Note
The function ProXsecMassPropertyCompute() is not supported for offset and quilt type of cross sections.
Line Patterns of Cross Section Components
Functions Introduced:
Superseded Functions:
Creo Parametric supports hatch pattern files of the *.pat file format. The new hatch supports nonlinear hatching styles.
The old hatch uses the Xhatch *.xch file format. It is recommended to use the *.pat files. Refer to the Creo Parametric Online Help for more information.
The function ProXsecCompXhatchGet() returns the line patterns of a cross section component based on the specified cross section handle and the ID of the cross section component. The line patterns obtained are ProXsecXhatch structures that contain the following fields:
•  angle—Specifies the angle of the line patterns.
•  spacing—Specifies the distance between the line patterns.
•  offset—Specifies the offset of the first line in the pattern.
Note
The functions ProXsecCompXhatchGet(), ProXsecCompXhatchAdd(), and ProXsecCompXhatchReplace() support only the old hatching styles, that is, the *.xch file format.
The function ProXsecCompXhatchAdd() adds a line pattern to a specified cross section component. This function takes the handle to the cross section, the ID of the cross section component, the handle to the drawing view containing the cross section component and a pointer to the ProXsecXhatch object as its input arguments.
Note
If the cross section component already includes a line pattern, then the function ProXsecCompXhatchAdd() does not add a line pattern.
The function ProXsecCompXhatchReplace() replaces all existing line patterns of a specified cross section component with a new one.
In Creo Parametric 7.0.0.0 the functions ProXsecCompXhatchStyleGet() and ProXsecCompNewXhatchStyleGet() are deprecated. Use the function ProXsectionCompXhatchStyleGet () to get p_xhatch_style from a component and ProXSectionItemXhatchStyleGet() to get p_xhatch_style from a body.
The function ProXSectionItemXhatchStyleGet() returns the cross section p_xhatch_style for the cross section handle of the body. The output argument p_xhatch_style returns a ProXsecNewXhatchStyle handle.
The function ProXsectionCompXhatchStyleGet() returns information about the style of hatch pattern in the specified cross section component. The output argument p_xhatch_style returns a ProXsecNewXhatchStyle handle. The structure ProXsecNewXhatchStyle specifies the following information:
•  type—Type of hatch. Specify the following values:
  PRO_XHATCH—Cross section component is appears as a hatch.
  PRO_XSEC_EXCLUDED—Cross section is excluded for the specified assembly component.
  PRO_XSEC_FILL—Cross section component appears as a solid.
  PRO_XHATCH_ERASED—Cross section component is erased, that is, neither hatched nor filled.
•  ProXsecXhatchPattern—Structure that contains information about the old hatch pattern in a cross section. It specifies the following information:
  angle—Angle of the lines in the patterns.
  spacing—Distance between the lines in the patterns.
  offset—Offset of the first line in the pattern.
  font—Line style for the line pattern.
  color—Color for the line pattern.
Note
When the cross section has old hatch patterns, the field *new_lines in the structure ProXsecNewXhatchStyle is returned as NULL.
•  ProXsecNewXhatchPattern—Structure that contains information about the new hatch pattern in a cross section. It specifies the following information:
Image
  1 X-Origin, Y-Origin
  2 Angle
  3 Delta X
  4 Delta Y
  angle—Angle of the lines in the patterns.
  x_origin—Origin of the first pattern line along the x-axis.
  y_origin—Origin of the first pattern line along the y-axis.
  delta_x—For a dashed line pattern, the distance after which the next dashed line starts in a pattern.
  delta_y—For a continuous and dashed line pattern, the distance between the pattern lines.
  dash—Dashed line pattern.
  num_dash—Number of dashes for the line pattern. Max number of dashes is 6.
  color—Color for the line pattern.
Note
When the cross section has new hatch patterns, the field *old_lines in the structure ProXsecNewXhatchStyle is returned as NULL.
In Creo Parametric 7.0.0.0 the function ProXsecCompNewXhatchStyleSetByName() is deprecated. Use the function ProXsecNewXhatchStyleCreateFromName () to create ProXsecNewXhatchStyle. Use the functions ProXsectionCompXhatchStyleSet() and ProXSectionItemXhatchStyleSet() to set ProXsecNewXhatchStyle.
Use the function ProXsecNewXhatchStyleCreateFromName() to create a ProXsecNewXhatchStyle structure using the hatch pattern specified by the input argument hatch_name. This function supports only new, that is, PAT hatch patterns. The input arguments follows:
•  hatch_name—Name of the existing PAT hatch.
•  color —Color of the newly created pattern.
•  type—Type of the hatch specified by structure ProXsecNewXhatchStyle and has the following values:
  PRO_XHATCH—Cross section component appears as a hatch.
  PRO_XSEC_EXCLUDED—Cross section is excluded for the specified assembly component.
  PRO_XSEC_FILL—Cross section component appears as a solid.
  PRO_XHATCH_ERASED—Cross section component is erased, that is, neither hatched nor filled.
After creating the ProXsecNewXhatchStyle structure using the function ProXsecNewXhatchStyleCreateFromName(), either of the following situations might occur:
•  The new PAT hatch that is created using the function ProXSectionItemXhatchStyleSet() is available in the hatch edit dialog in the part and assembly mode and a suffix _TK is added to the hatch name.
•  If the hatch name is used as the input parameter to the function ProXSectionItemXhatchStyleSet() is used, then a new hatch is not added.
The output argument p_xhatch_style can be set by the functions ProXSectionItemXhatchStyleSet() and ProXsectionCompXhatchStyleSet().
The function ProXSectionItemXhatchStyleSet() sets the cross section p_xhatch_style for the cross section handle of the body, using the ProXsecNewXhatchStyle structure. The input arguments follow:
•  xsec_item—Cross section handle of the specific body.
•  p_view—View handle.
•  hatch_name—Name of the nonlinear hatch.
•  p_xhatch_style—Handle to ProXsecNewXhatchStyle. The unused hatch field must be set to NULL.
In Creo Parametric 7.0.0.0 the function ProXsecCompXhatchStyleSet() is deprecated. Use the function ProXsectionCompXhatchStyleSet() to set p_xhatch_style on a component and ProXSectionItemXhatchStyleSet() to set p_xhatch_style on a body.
Note
Use the function ProXsecCompNewXhatchStyleGet() for nonlinear hatch support.
The function ProXsectionCompXhatchStyleSet() sets the cross section p_xhatch_style for the specified component using the ProXsecNewXhatchStyle structure. The input arguments follow:
•  xsec—Cross section handle of the specific body.
•  path—Path to the specified component.
•  p_view—View handle.
•  hatch_name—Name of the nonlinear hatch.
•  p_xhatch_style—Handle to ProXsecNewXhatchStyle. The unused hatch field must be set to NULL.
Note
PRO_XSEC_EXCLUDED type is applied only in the drawing environment.
When parts with multiple solid bodies are being cut by the cross section, the following functions return the error PRO_TK_MULTIBODY_UNSUPPORTED:
•  ProXsecCompNewXhatchStyleSetByName
•  ProXsecCompNewXhatchStyleSet()
•  ProXsecCompXhatchStyleSet()
•  ProXsecCompNewXhatchStyleGet()
•  ProXsecCompXhatchStyleGet()