Cross Sections
The methods in this section enable you to create, access, modify, and delete cross sections.
Listing Cross Sections
Methods Introduced:
The method pfcSolid::ListCrossSections returns a sequence of cross section objects represented by the Xsection interface. The method pfcSolid::GetCrossSection searches for a cross section given its name.
The method pfcXSection::GetName returns the name of the cross section in the Creo application. The method pfcXSection::SetName modifies the cross section name.
The method pfcXSection::GetXSecType returns the type of cross section as a pfcXSecType object, that is planar or offset, and the type of item intersected by the cross section.
The method pfcXSecType::GetType returns the type of intersection for the cross section using the enumerated type pfcXSecCutType. The valid values are:
•  pfcXSEC_PLANAR
•  pfcXSEC_OFFSET
The method pfcXSecType::GetObjectType returns the type of item intersected by the cross section using the enumerated type pfcXSecCutobjType. The valid values are:
•  pfcXSECTYPE_MODEL—Specifies that the cross section was created on solid geometry.
•  pfcXSECTYPE_QUILTS—Specifies that the cross section was created on one quilt surface.
•  pfcXSECTYPE_MODELQUILTS—Specifies that the cross section was created on solid geometry and all quilt surfaces.
•  pfcXSECTYPE_ONEPART—Specifies that the cross section was created on one component in the assembly.
The method pfcXSection::Delete deletes a cross section.
The method pfcXSection::Display forces a display of the cross section in the window.
The method pfcXSection::Regenerate regenerates the cross-section of a part or an assembly.
Extracting Cross-Sectional Geometry
Methods Introduced:
Superseded Methods:
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.
In Creo 7.0.0.0 and later, the method wfcWXSection::CollectGeometry is deprecated. Use the method wfcWXSection::CollectCutComponents instead.
The method wfcWXSection::CollectCutComponents returns the object XSectionCutComponent that contains the geometry of all cut components in a specified cross section. A sequence item is created for each body. If no bodies are created, the method returns one XSectionCutComponent object for each component. wfcXSectionCutComponents retrieves information from the wfcXSectionCutComponent object.
Note
The method returns only items containing solid geometry (nonquilt and nonfacetrep) components that intersect their nonhidden, nonsuppressed parts and are inside view borders. If the input argument drawing view is null, the method returns all nonempty components.
The method wfcWXSection::GetExcludedItems returns paths to the exclude or include components and bodies of the specified cross section using the object wfcXSectionExcludeItems.
The method wfcXSectionCutComponentItem::GetType returns the type of item - body or quilt.
The method wfcXSectionCutComponentItem::GetId returns the Id of the body or the quilt being cut.
The method wfcXSectionCutComponentItem::GetGeometry returns the surface geometry created by the cross section by cutting specific body or quilt.
The method wfcXSectionCutComponentItem::SetXHatchStyle sets the cross section xhatch style of the body. If the xhatch style exists in the session, it will be set.
The method wfcXSectionCutComponentItem::GetXHatchStyle returns the cross section xhatch style of the body.
The method wfcXSectionCutComponent::GetCutItems returns the items (body or quilt) that are cut on the component.
The method wfcXSectionCutComponent::GetPath returns the path to the component being cut by the cross section.
The method wfcXSectionCutComponent::SetXHatchStyle sets the cross section xhatch style on the component. If the xhatch style exists in the session, it will be set.
The method wfcXSectionCutComponent::GetXHatchStyle returns the cross section xhatch style of the component.
The method wfcXSectionExcludeItems::Create creates the interface for excluded items using the wfcXSectionExcludeItems object. The input arguments follow:
•  Items—The component or bodies selections.
•  ExcludeTrue if excluded, False if not.
The methods wfcXSectionExcludeItems::GetExclude and wfcXSectionExcludeItems::SetExclude get and set the flag to exclude or include items in the cross section.
The methods wfcXSectionExcludeItems::GetItems and wfcXSectionExcludeItems::SetItems get and set the items to exclude or include in the cross section.
The method wfcXSectionGeometry::GetGeometry returns the geometry of all components in the specified cross section as pfcSurface object. Use the methods wfcXSectionGeometry::GetMemberIdTable and wfcXSectionGeometry::GetQuiltId to get the component and quilt identifiers in the specified cross section.
The method wfcWXSection::GetPlane returns the plane geometry for a specified cross section.
The method wfcWXSection::GetOffsetXSectionData returns the parameters for a specified offset cross section.
The method wfcWXSection::GetFlip returns a boolean value that indicates the direction in which the cross section has been clipped. The value False indicates that the cross section has been clipped in the direction of the positive normal to the cross section plane. True indicates that the cross section has been clipped in the opposite direction of the positive normal.
The method wfcWXSection::GetComponents returns an array of paths to the assembly components that have been included or excluded for the specified cross section.
The methods wfcWXSection::GetName and wfcWXSection::SetName enable you to retrieve and rename the name of a cross section in an assembly, respectively.
The method wfcXSectionComponents::GetExclude specifies if the assembly components were excluded or not.
The method wfcXSectionComponents::SetExclude specifies if the assembly components are to be excluded or not.
The methods wfcXSectionComponents::GetComponents and wfcXSectionComponents::SetComponents get and set the sequence of components that have been included or excluded for the specified cross section definition.
The method wfcZoneXSectionGeometry::GetGeometries returns the geometry information of a zone feature in the specified cross section as the wfcXSectionGeometries object.
The method wfcOffsetXSectionData::GetXSectionLines returns information about the line segment entities in the cross section as a wfcSectionEntityLine object.
The method wfcOffsetXSectionData::GetPlaneData returns information about the entity datum plane.
The method wfcOffsetXSectionData::GetOneSided returns True if the cross section lies on one side of the entity plane. The method returns false if the cross section is both-sided.
If the output argument of the method wfcOffsetXSectionData::GetFlip is False, the Creo application removes material from the left of the cross section entities if the viewing direction is from the positive side of the entity plane and if wfcOffsetXSectionData::GetOneSided is true, the Creo application removes only the material from positive side of the entity plane.
Creating and Modifying Cross Sections
Methods Introduced:
The method wfcWSolid::CreateParallelXSection creates a cross section feature parallel to a given plane.
From Creo 7.0.0.0 and later, the method wfcWSolid::CreatePlanarXSection is deprecated. Use the method wfcWSolid::CreatePlanarXSectionWithOptions instead.
The method wfcWSolid::CreatePlanarXSectionWithOptions creates a cross section feature through a datum plane and also makes the cross section visible. The input arguments follow:
•  Name —Name of the cross section.
•  Plane —The cutting plane. The cutting plane must belong to the model.
•  CutObjectType—Type of the object that will be cut by the cross section. It is specified by the enumerated type pfcXSecCutobjType.
•  QuiltOrPart—Specifies the selection of the quilt or component.
•  Flip—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.
•  ExcludeItems—Selection of selected bodies or parts to be included or excludes from the cross section defined by the class wfcXSectionExcludeItems.
•  Data—Reserved for future use.
Note
•  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 methods wfcWSolid::CreateParallelXSection and wfcWSolid::CreatePlanarXSection automatically convert the legacy cross sections to new cross section features as defined in Creo Parametric 2.0 onward, before creating any new cross section feature.
Use the method wfcWModel::CanCreateSectionFeature to check if new cross section features can be created in the specified model. The method returns false if the specified model has legacy cross sections.
The method wfcWModel::ConvertOldXSectionsToNew converts the legacy cross sections to new cross section features as defined in Creo Parametric 2.0 onward for the specified model.
Use the method wfcWXSection::IsFeature to check whether the cross section is a feature.
The method wfcWXSection::GetFeature returns a pfcFeature object representing the cross section feature. You must use this method only if wfcWModel::CanCreateSectionFeature returns true.
Use the method wfcXSectionComponents::Create to create the object wfcXSectionComponents that contains interface for excluding or including components from a specified cross section. Pass the following values to this object:
•  Components—Specify the sequence of components to exclude or include from a cross section definition.
•  Exclude—Specify the value as true to exclude components and false to include.
Mass Properties of Cross Sections
Method Introduced:
The method wfcWXSection::GetMassProperty calculates the mass properties of the cross-section in the specified coordinate system. The method needs the name of a coordinate system datum whose X- and Y-axes are parallel to the cross section. The output from this method also refers to the coordinate system datum.
Note
•  The method wfcWXSection::GetMassProperty is not supported for offset and quilt type of cross-sections.
•  The following methods can be called on MassProperty object returned by wfcWXSection::GetMassProperty:
  pfcSolid::MassProperty
  pfcMassProperty::GetSurfaceArea
  pfcMassProperty::SetSurfaceArea
  pfcMassProperty::GetGravityCenter
  pfcMassProperty::SetGravityCenter
  pfcMassProperty::GetCoordSysInertia
  pfcMassProperty::SetCoordSysInertia
Line Patterns of Cross Section Components
Methods Introduced:
The method wfcWXSection::GetCompXSectionHatches returns the line patterns of a cross section as a wfcXSectionHatches object. The input arguments to the method are the ID of the cross section component and the drawing view containing the cross section component. The information related to line patterns is obtained from wfcXSectionHatch. Use the method wfcWXSection::SetCompXSectionHatches to set the line patterns for a cross section.
The method wfcXSectionHatch::Create creates a data object that contains information about the line patterns.
Use the methods wfcXSectionHatch::GetAngle and wfcXSectionHatch::SetAngle to get and set the angle in the line patterns.
The methods wfcXSectionHatch::GetSpacing and wfcXSectionHatch::SetSpacing get and set the distance between the line patterns.
The methods wfcXSectionHatch::GetOffset and wfcXSectionHatch::SetOffset get and set the offset of the first line in the pattern.
The methods wfcXSectionHatchStyle::GetType and wfcXSectionHatchStyle::SetType get and set the type of the hatch style.
The methods wfcXSectionHatchStyle::GetOldHatches and wfcXSectionHatchStyle::SetOldHatches get and set the old line hatch object sequence using the object wfcXSectionOldHatches.
The methods wfcXSectionHatchStyle::GetNewHatches and wfcXSectionHatchStyle::SetNewHatches get and set the new line hatch object sequence using the object wfcXSectionNewHatches.
The method wfcXSectionNewHatch::Create creates the interface for new line pattern hatching using the wfcXSectionNewHatch object. The input arguments follow:
•  Angle—Angle for new line pattern.
•  Color—Color for new line pattern.
The methods wfcXSectionNewHatch::GetAngle and wfcXSectionNewHatch::SetAngle get and set the angle for new line pattern.
The methods wfcXSectionNewHatch::GetXOrigin and wfcXSectionNewHatch::SetXOrigin get and set the X origin for the new line pattern.
The methods wfcXSectionNewHatch::GetYOrigin and wfcXSectionNewHatch::SetYOrigin get and set the Y origin for the new line pattern.
The methods wfcXSectionNewHatch::GetXDelta and wfcXSectionNewHatch::SetXDelta get and set the X delta for the new line pattern.
The methods wfcXSectionNewHatch::GetYDelta and wfcXSectionNewHatch::SetYDelta get and set the Y delta for the new line pattern.
The methods wfcXSectionNewHatch::GetDash and wfcXSectionNewHatch::SetDash get and set the dash for the new line pattern.
The methods wfcXSectionNewHatch::GetColor and wfcXSectionNewHatch::SetColor get and set the color for the new line pattern.
The method wfcXSectionOldHatch::Create creates the interface for old line pattern hatching using the wfcXSectionOldHatch object. The input argument Angle is the angle for old line pattern.
The methods wfcXSectionOldHatch::GetAngle and wfcXSectionOldHatch::SetAngle get and set the angle for old line pattern.
The methods wfcXSectionOldHatch::GetSpacing and wfcXSectionOldHatch::SetSpacing get and set the spacing for the old line pattern.
The methods wfcXSectionOldHatch::GetOffset and wfcXSectionOldHatch::SetOffset get and set the offset for the old line pattern.
The methods wfcXSectionOldHatch::GetFont and wfcXSectionOldHatch::SetFont get and set the font for the old line pattern.
The methods wfcXSectionOldHatch::GetColor and wfcXSectionOldHatch::SetColor get and set the color for the old line pattern.
Example 1: Creating a Planar Cross Section and Editing the Hatch Parameters
The sample code in OTKXCrossSection.cxx located at <creo_otk_loadpoint_app>/otk_examples/otk_examples_solid shows how to create a planar cross section using the Creo Object TOOLKIT C++ methods. It also shows how to edit hatch parameters for all the cross sections in the current model.