The section
Element Trees: Principles of Feature Creation explained that to create a feature from an element tree, you build the tree of elements using
ProElementAlloc(),
ProElemtreeElementAdd(), and so on, and then call
ProFeatureCreate() to create the feature using the tree. If the feature is to contain a sketch, the sequence is a little more complex.
As explained in the documentation in the section topic on
Element Trees: Sections, a 2D section stored in a model file can be allocated by calling
ProSection2dAlloc(). Instead,
Creo Parametric must allocate as part of the initial creation of the sketched feature, a section that will be part of a feature. The allocation is done by calling
ProFeatureCreate() with an element tree which describes at minimum the feature type and form, in order to create an incomplete feature. In creating the feature,
Creo Parametric calculates the location and orientation of the section, and allocates the
ProSection object. This section is then retrieved from the value of the
PRO_E_SKETCHER element that is found in the element tree extracted from the created feature. Fill the empty section using
ProSection related functions.
After adding the section contents and the remaining elements in the tree, add the new information to the feature using
ProFeatureRedefine().