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.
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.