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 Java 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 Java 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 Java methods for 2D and 3D sections work only when the Intent Manager mode is set to ON. Use the method wfcSection.Section.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.Section.SetIntentManagerMode to set the Intent Manager mode to ON for the specified section. Call this method before using the other Creo Object TOOLKIT Java methods that access the sections.
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.Section.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 wfcSession.WSession.CreateSection2D allocates memory for a new, standalone two dimensional section and outputs a section handle to identify it.
The method wfcSection.Section.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 Creo 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 wfcSession.WSession.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.Section.SetIntentManagerMode after this method.
Use the method wfcSection.Section.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.Section.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.Section.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.Section.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.Section.AddEntity takes as input the wfcSectionEntity object that defines the section entity type using the enumerated class wfcSection.Section2dEntType. The following types of entities are defined:
•  SEC_ENTITY_2D_POINT
•  SEC_ENTITY_2D_LINE
•  SEC_ENTITY_2D_CENTER_LINE
•  SEC_ENTITY_2D_ARC
•  SEC_ENTITY_2D_CIRCLE
•  SEC_ENTITY_2D_COORD_SYS
•  SEC_ENTITY_2D_POLYLINE
•  SEC_ENTITY_2D_SPLINE
•  SEC_ENTITY_2D_TEXT
•  SEC_ENTITY_2D_CONSTR_CIRCLE
•  SEC_ENTITY_2D_BLEND_VERTEX
•  SEC_ENTITY_2D_ELLIPSE
•  SEC_ENTITY_2D_CONIC
•  SEC_ENTITY_2D_SEC_GROUP
Some classes in Creo Object TOOLKIT Java allow you to create and modify various types of section entities. The class wfcSection.SectionEntity is the parent class for the following entity classes:
•  wfcSection.SectionEntityArc
•  wfcSection.SectionEntityBlendVertex
•  wfcSection.SectionEntityCSys
•  wfcSection.SectionEntityCenterLine
•  wfcSection.SectionEntityCircle
•  wfcSection.SectionEntityConic
•  wfcSection.SectionEntityEllipse
•  wfcSection.SectionEntityLine
•  wfcSection.SectionEntityPoint
•  wfcSection.SectionEntityPolyline
•  wfcSection.SectionEntitySpline
•  wfcSection.SectionEntityText
The method wfcSection.Section.AddEntity outputs an integer that is the identifier of the new entity within the section. The Creo Object TOOLKIT Java application needs these values because they are used to refer to entities when adding dimensions.
The method wfcSection.Section.DeleteEntity enables you to delete a section entity from the specified section.
The method wfcSection.Section.GetEntity takes as input the integer identifier for a section entity and outputs a copy of the section entity object.
Use the method wfcSection.Section.ListSectionEntities to retrieve the list of entities present in the specified section.
The method wfcSection.Section.GetEntityIds returns the array of integer identifiers for the all the entities in the specified section.
The method wfcSection.SectionEntity.GetSectionEntityType returns the section entity type using the enumerated class wfcSection.Section2dEntType.
Section Entity Arc
Methods Introduced:
The method wfcSection.wfcSection.SectionEntityArc_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 wfcSection.SectionEntityArc.GetCenter and wfcSection.SectionEntityArc.SetCenter retrieve and set the center of the arc using the pfcBase.Point2D object.
The methods wfcSection.SectionEntityArc.GetEndAngle and wfcSection.SectionEntityArc.SetEndAngle retrieve and set the end angle of the arc.
The methods wfcSection.SectionEntityArc.GetRadius and wfcSection.SectionEntityArc.SetRadius retrieve and set the radius of the arc.
The methods wfcSection.SectionEntityArc.GetStartAngle and wfcSection.SectionEntityArc.SetStartAngle retrieve and set the start angle of the arc.
Section Entity Blend Vertex
Methods Introduced:
The method wfcSection.wfcSection.SectionEntityBlendVertex_Create creates a blend vertex entity in a specified section using the point and depth level of the blend vertex as inputs.
The methods wfcSection.SectionEntityBlendVertex.GetDepthLevel and wfcSection.SectionEntityBlendVertex.SetDepthLevel retrieve and set the depth level of the blend.
The methods wfcSection.SectionEntityBlendVertex.GetPoint and wfcSection.SectionEntityBlendVertex.SetPoint retrieve and set the points of the blend vertices using the pfcBase.Point2D object.
Section Entity Coordinate System
Methods Introduced:
The method wfcSection.wfcSection.SectionEntityCSys_Create creates a coordinate system entity in a specified section using the center point of the coordinate system as input.
The method wfcSection.SectionEntityCSys.GetCSysPoint and wfcSection.SectionEntityCSys.SetCSysPoint retrieve and set the center point for the coordinate system using the pfcBase.Point2D object.
Section Entity CenterLine
Methods Introduced:
The method wfcSection.wfcSection.SectionEntityCenterLine_Create creates a centerline entity in a specified section.
The methods wfcSection.SectionEntityCenterLine.GetCenterLine and wfcSection.SectionEntityCenterLine.SetCenterLine retrieve and set centerline using the pfcBase.Outline2D object.
Section Entity Circle
Methods Introduced:
The method wfcSection.wfcSection.SectionEntityCircle_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 wfcSection.wfcSection.SectionEntityEllipse_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 wfcSection.SectionEntityEllipse.GetCenter and wfcSection.SectionEntityEllipse.SetCenter retrieve and set the center of the ellipse.
The methods wfcSection.SectionEntityEllipse.GetXRadius and wfcSection.SectionEntityEllipse.SetXRadius retrieve and set the XRadius of the ellipse.
The methods wfcSection.SectionEntityEllipse.GetYRadius and wfcSection.SectionEntityEllipse.SetYRadius retrieve and set the YRadius of the ellipse.
Section Entity Conic
Methods Introduced:
The method wfcSection.wfcSection.SectionEntityConic_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 wfcSection.SectionEntityConic.GetFirstEndPoint and wfcSection.SectionEntityConic.SetFirstEndPoint retrieve and set the first endpoint of the conic entity.
The methods wfcSection.SectionEntityConic.GetSecondEndPoint and wfcSection.SectionEntityConic.SetSecondEndPoint retrieve and set the second endpoint of the conic entity.
The methods wfcSection.SectionEntityConic.GetParameter and wfcSection.SectionEntityConic.SetParameter retrieve and set the parameter of the conic entity.
The methods wfcSection.SectionEntityConic.GetShoulderEndPoint and wfcSection.SectionEntityConic.SetShoulderEndPoint retrieve and set the shoulder endpoint of the conic entity.
Section Entity Line
Methods Introduced:
The method wfcSection.wfcSection.SectionEntityLine_Create creates a line entity in a specified section.
The methods wfcSection.SectionEntityLine.GetLine and wfcSection.SectionEntityLine.SetLine retrieve and set the lines in a specified section using the pfcBase.Outline2D object.
Section Entity Point
Methods Introduced:
The method wfcSection.wfcSection.SectionEntityPoint_Create creates a point entity in a section.
The methods wfcSection.SectionEntityPoint.GetPoint and wfcSection.SectionEntityPoint.SetPoint retrieve and set the points in a specified section using the pfcBase.Point2D object.
Section Entity Polyline
Methods Introduced:
The method wfcSection.wfcSection.SectionEntityPolyline_Create creates a polyline entity in a specified section.
The methods wfcSection.SectionEntityPolyline.GetPoints and wfcSection.SectionEntityPolyline.SetPoints retrieve and set the points using the pfcBase.Point2Ds object.
Section Entity Spline
Methods Introduced:
The method wfcSection.wfcSection.SectionEntitySpline_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 wfcSection.SectionEntitySpline.GetTangentType and wfcSection.SectionEntitySpline.SetTangentType retrieve and set the type of tangent in the spline using the wfcSection.SplineTangentType object.
The methods wfcSection.SectionEntitySpline.GetPoints and wfcSection.SectionEntitySpline.SetPoints retrieve and set the points in the spline using the pfcBase.Point2Ds object.
The methods wfcSection.SectionEntitySpline.GetStartTangentAngle and wfcSection.SectionEntitySpline.SetStartTangentAngle retrieve and set the start angle of a tangent in the spline.
The methods wfcSection.SectionEntitySpline.GetEndTangentAngle and wfcSection.SectionEntitySpline.SetEndTangentAngle retrieve and set the end angle of a tangent in the spline.
Section Entity Text
Methods Introduced:
The method wfcSection.wfcSection.SectionEntityText_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 wfcSection.SectionEntityText.GetFirstCorner and wfcSection.SectionEntityText.SetFirstCorner retrieve and set the first corner of the text box using the pfcBase.Point2D class.
The methods wfcSection.SectionEntityText.GetSecondCorner and wfcSection.SectionEntityText.SetSecondCorner retrieve and set the second corner of the text box using the pfcBase.Point2D class.
The methods wfcSection.SectionEntityText.GetFontName and wfcSection.SectionEntityText.SetFontName retrieve and set the font of the text to be entered.
The methods wfcSection.SectionEntityText.GetComment and wfcSection.SectionEntityText.SetComment retrieve and set the comment or text to be entered inside the text box.
Retrieving a Section
Method Introduced:
The method wfcFeature.WFeature.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.Section.GetSectionDimensions returns corresponding arrays of section dimension identifiers and solid dimension identifiers using the class wfcSection.SectionDimIds.
The method wfcSection.SectionDimIds.GetSolidIds returns solid dimension identifiers.
The method wfcSection.SectionDimIds.GetSectionIds returns section dimension identifiers.