Element Trees: Sections
A section is a parametric two-dimensional cross section used to define the shape of three-dimensional features, such as extrusions. In the Creo application, you create a section interactively using Sketcher mode. In a Creo Object TOOLKIT C++ application, you can create sections completely programmatically using the methods described in this section.
Overview
Sections fall into two types: 2D and 3D. Both types are represented by the wfcSection object and manipulated by the same methods.
The difference between the types arises out of the context in which the section is being used, and affects the requirements for the contents of the section and also of the feature element tree in which it is placed when creating a sketched feature.
Put simply, a 2D section is self-contained, whereas a 3D section contains references to 3D geometry in a parent part or assembly.
You can add section entities programmatically using the Intent Manager mode. This corresponds to creating sections within the Intent Manager mode in the Creo application.
This section is concerned with 2D. The extra steps required to construct a 3D section are described in the section Element Trees: Sketched Features.
Creating Section Models
A 2D section, because it is self-contained, can be stored as a Creo model file. It then has the extension .sec.
The steps required to create and save a section model using Creo Object TOOLKIT C++ follow closely those used in creating a section interactively using Sketcher mode in the Creo application.
Setting the Intent Manager Mode of a Section
Methods Introduced:
The Creo Object TOOLKIT C++ methods for 2D and 3D sections work only when the Intent Manager mode is set to ON. Use the method wfcSection::GetIntentManagerMode to check if the Intent Manager mode is ON for the specified section. The mode is set to OFF by default.
Use the method wfcSection::SetIntentManagerMode to set the Intent Manager mode to ON for the specified section. Call this method before using the other Creo Object TOOLKIT C++ methods that access the sections.
Example 1: Creating a Section Model
The sample code in OTKXCreateSection2D.cxx located at <creo_otk_loadpoint_app>/otk_examples/otk_examples_model illustrates how to use all the methods described in this section to create a section model.
To Create and Save a Section Model
1. Allocate the two-dimensional section and define its name.
2. Set the Intent manager mode to ON using the method wfcSection::SetIntentManagerMode.
3. Add section entities (lines, arcs, splines, and so on) to define the section geometry, in section coordinates.
4. Save the section.
When you are creating a section that is to be used in a sketched feature, Steps 1 and 4 will be replaced by different techniques. These techniques are described fully in the section Element Trees: Sketched Features.
The steps are described in more detail in the following sections.
Allocating a Two-Dimensional Section
Methods Introduced:
The method wfcWSession::CreateSection2D allocates memory for a new, standalone two dimensional section and outputs a section handle to identify it.
The method wfcSection::SetName enables you to set the name of a section. Calling this method places the section in the Creo application namelist and enables it to be recognized by the Creo application as a section model in the database.
Such sections created programmatically have the Intent Manager mode OFF by default.
Copying the Current Section
Methods Introduced:
The method wfcWSession::GetActiveSection creates a copy of the section that you are using currently. This copy is created within the same Sketcher session. To set the Intent Manager mode to ON, call the method wfcSection::SetIntentManagerMode after this method.
Use the method wfcSection::SetActive to set the specified section as the current active Sketcher section. The Intent Manager mode must be set to ON when you call this method.
Note
The call to the method wfcSection::SetActive makes the Undo and Redo menu options available in Creo Parametric.
Epsilon Value in Sections
Methods Introduced:
Epsilon is the tolerance value, which is used to set the proximity for automatic finding of constraints. Use the function wfcSection::SetEpsilon to set the value for epsilon. For example, if your section has two lines that differ in length by 0.5, set the epsilon to a value less than 0.5 to ensure that the two lines are not constrained as same length. To get the current epsilon value for the section, use the function wfcSection::GetEpsilon.
Please note the following important points related to epsilon:
•  Epsilon determines the smallest possible entity in a section. If an entity is smaller than epsilon, then the entity is considered to be a degenerate entity. Degenerate entity is an entity which cannot be solved. It causes solving and regenerating of the section to fail. For example, a circle with radius 0 or line with length 0 are considered as degenerate entities.
•  There are many types of constraints, and epsilon has a different meaning for each type. For example, consider two points. In case of constraint for coincident points, , epsilon is the minimum distance between the two points beyond which the points will be treated as separate points. If the distance between the two points is within the epsilon value, the two points are treated as coincident points.
•  Creo Parametric has a default value set for epsilon. This value is also used in the Sketcher user interface.
•  If the input geometry is accurate and the user does not want the solver to change it by adding constraints, then set the value of epsilon to 1E-9.
•  If the input geometry is nearly accurate and the user wants the solver to guess the intent by adding constraints and further aligning the geometry, then in this case epsilon should reflect the maximal proximity between geometry to be constrained.
•  You cannot set the value of epsilon to zero.
Section Entities
Methods Introduced:
The method wfcSection::AddEntity takes as input the wfcSectionEntity object that defines the section entity type using the enumerated type wfcSection2dEntType. The following types of entities are defined:
•  wfcSEC_ENTITY_2D_POINT
•  wfcSEC_ENTITY_2D_LINE
•  wfcSEC_ENTITY_2D_CENTER_LINE
•  wfcSEC_ENTITY_2D_ARC
•  wfcSEC_ENTITY_2D_CIRCLE
•  wfcSEC_ENTITY_2D_COORD_SYS
•  wfcSEC_ENTITY_2D_POLYLINE
•  wfcSEC_ENTITY_2D_SPLINE
•  wfcSEC_ENTITY_2D_TEXT
•  wfcSEC_ENTITY_2D_CONSTR_CIRCLE
•  wfcSEC_ENTITY_2D_BLEND_VERTEX
•  wfcSEC_ENTITY_2D_ELLIPSE
•  wfcSEC_ENTITY_2D_CONIC
•  wfcSEC_ENTITY_2D_SEC_GROUP
Some classes in Creo Object TOOLKIT C++ allow you to create and modify various types of section entities. The class wfcSectionEntity is the parent class for the following entity classes:
•  wfcSectionEntityArc
•  wfcSectionEntityBlendVertex
•  wfcSectionEntityCSys
•  wfcSectionEntityCenterLine
•  wfcSectionEntityCircle
•  wfcSectionEntityConic
•  wfcSectionEntityEllipse
•  wfcSectionEntityLine
•  wfcSectionEntityPoint
•  wfcSectionEntityPolyline
•  wfcSectionEntitySpline
•  wfcSectionEntityText
The method wfcSection::AddEntity outputs an integer that is the identifier of the new entity within the section. The Creo Object TOOLKIT C++ application needs these values because they are used to refer to entities when adding dimensions.
The method wfcSection::DeleteEntity enables you to delete a section entity from the specified section.
The method wfcSection::GetEntity takes as input the integer identifier for a section entity and outputs a copy of the section entity object.
Use the method wfcSection::ListSectionEntities to retrieve the list of entities present in the specified section.
The method wfcSection::GetEntityIds returns the array of integer identifiers for the all the entities in the specified section.
The method wfcSectionEntity::GetSectionEntityType returns the section entity type using the enumerated type wfcSection2dEntType.
Section Entity Arc
Methods Introduced:
The method wfcSectionEntityArc::Create creates an arc entity in a specified section using the center, start and end angles, and radius of the arc as inputs.
The methods wfcSectionEntityArc::GetCenter and wfcSectionEntityArc::SetCenter retrieve and set the center of the arc using the pfcPoint2D object.
The methods wfcSectionEntityArc::GetEndAngle and wfcSectionEntityArc::SetEndAngle retrieve and set the end angle of the arc.
The methods wfcSectionEntityArc::GetRadius and wfcSectionEntityArc::SetRadius retrieve and set the radius of the arc.
The methods wfcSectionEntityArc::GetStartAngle and wfcSectionEntityArc::SetStartAngle retrieve and set the start angle of the arc.
Section Entity Blend Vertex
Methods Introduced:
The method wfcSectionEntityBlendVertex::Create creates a blend vertex entity in a specified section using the point and depth level of the blend vertex as inputs.
The methods wfcSectionEntityBlendVertex::GetDepthLevel and wfcSectionEntityBlendVertex::SetDepthLevel retrieve and set the depth level of the blend.
The methods wfcSectionEntityBlendVertex::GetPoint and wfcSectionEntityBlendVertex::SetPoint retrieve and set the points of the blend vertices using the pfcPoint2D object.
Section Entity Coordinate System
Methods Introduced:
The method wfcSectionEntityCSys::Create creates a coordinate system entity in a specified section using the center point of the coordinate system as input.
The method wfcSectionEntityCSys::GetCSysPoint and wfcSectionEntityCSys::SetCSysPoint retrieve and set the center point for the coordinate system using the pfcPoint2D object.
Section Entity CenterLine
Methods Introduced:
The method wfcSectionEntityCenterLine::Create creates a centerline entity in a specified section.
The methods wfcSectionEntityCenterLine::GetCenterLine and wfcSectionEntityCenterLine::SetCenterLine retrieve and set the centerline using the pfcOutline2D object.
Section Entity Circle
Methods Introduced:
The method wfcSectionEntityCircle::Create creates a circle entity in a specified section using the center and radius of the circle as inputs.
The methods wfcSectionEntityCircle::GetCenter and wfcSectionEntityCircle::SetCenter retrieve and set the center of the circle using the pfcPoint2D object.
The methods wfcSectionEntityCircle::GetRadius and wfcSectionEntityCircle::SetRadius retrieve and set the radius of the circle.
Section Entity Ellipse
Methods Introduced:
The method wfcSectionEntityEllipse::Create creates an ellipse entity in a specified section using the center, X-axis and Y-axis radii of the eclipse as inputs.
The methods wfcSectionEntityEllipse::GetCenter and wfcSectionEntityEllipse::SetCenter retrieve and set the center of the ellipse.
The methods wfcSectionEntityEllipse::GetXRadius and wfcSectionEntityEllipse::GetXRadius retrieve and set the XRadius of the ellipse.
The methods wfcSectionEntityEllipse::GetYRadius and wfcSectionEntityEllipse::SetYRadius retrieve and set the YRadius of the ellipse.
Section Entity Conic
Methods Introduced:
The method wfcSectionEntityConic::Create creates a conic entity in a specified section using the first, second, and shoulder endpoints and parameter of the cone as inputs.
The methods wfcSectionEntityConic::GetFirstEndPoint and wfcSectionEntityConic::SetFirstEndPoint retrieve and set the first endpoint of the conic entity.
The methods wfcSectionEntityConic::GetSecondEndPoint and wfcSectionEntityConic::SetSecondEndPoint retrieve and set the second endpoint of the conic entity.
The methods wfcSectionEntityConic::GetParameter and wfcSectionEntityConic::SetParameter retrieve and set the parameter of the conic entity.
The methods wfcSectionEntityConic::GetShoulderEndPoint and wfcSectionEntityConic::SetShoulderEndPoint retrieve and set the shoulder endpoint of the conic entity.
Section Entity Line
Methods Introduced:
The method wfcSectionEntityLine::Create creates a line entity in a specified section.
The methods wfcSectionEntityLine::GetLine and wfcSectionEntityLine::SetLine retrieve and set the lines in a specified section using the pfcOutline2D object.
Section Entity Point
Methods Introduced:
The method wfcSectionEntityPoint::Create creates a point entity in a section.
The methods wfcSectionEntityPoint::GetPoint and wfcSectionEntityPoint::SetPoint retrieve and set the points in a specified section using the pfcPoint2D object.
Section Entity Polyline
Methods Introduced:
The method wfcSectionEntityPolyline::Create creates a polyline entity in a specified section.
The methods wfcSectionEntityPolyline::GetPoints and wfcSectionEntityPolyline::SetPoints retrieve and set the points using the pfcPoint2Ds object.
Section Entity Spline
Methods Introduced:
The method wfcSectionEntitySpline::Create creates a spline entity in a specified section using the tangent type, points, and start and end angles of the tangent of the spline as inputs.
The methods wfcSectionEntitySpline::GetTangentType and wfcSectionEntitySpline::SetTangentType retrieve and set the type of tangent in the spline using the wfcSplineTangentType object.
The methods wfcSectionEntitySpline::GetPoints and wfcSectionEntitySpline::SetPoints retrieve and set the points in the spline using the pfcPoint2Ds object.
The methods wfcSectionEntitySpline::GetStartTangentAngle and wfcSectionEntitySpline::SetStartTangentAngle retrieve and set the start angle of a tangent in the spline.
The methods wfcSectionEntitySpline::GetEndTangentAngle and wfcSectionEntitySpline::SetEndTangentAngle retrieve and set the end angle of a tangent in the spline.
Section Entity Text
Methods Introduced:
The method wfcSectionEntityText::Create creates a text entity in a specified section using the first and second corner of the text box and the text to be entered inside the text box as inputs.
The methods wfcSectionEntityText::GetFirstCorner and wfcSectionEntityText::SetFirstCorner retrieve and set the first corner of the text box using the pfcPoint2D class.
The methods wfcSectionEntityText::GetSecondCorner and wfcSectionEntityText::SetSecondCorner retrieve and set the second corner of the text box using the pfcPoint2D class.
The methods wfcSectionEntityText::GetFontName and wfcSectionEntityText::SetFontName retrieve and set the font of the text to be entered.
The methods wfcSectionEntityText::GetComment and wfcSectionEntityText::SetComment retrieve and set the comment or text to be entered inside the text box.
Retrieving a Section
Method Introduced:
The method wfcWFeature::GetSections retrieve sections from the specified feature.
Note
The method will not return sections that are not available for use. For example, the selected trajectory in a Sweep feature will not be returned.
The method wfcSection::GetSectionDimensions returns corresponding arrays of section dimension identifiers and solid dimension identifiers using the class wfcSectionDimIds.
The method wfcSectionDimIds::GetSolidIds returns solid dimension identifiers.
The method wfcSectionDimIds::GetSectionIds returns section dimension identifiers.