Showing results for 
Search instead for 
Did you mean: 
Showing results for 
Search instead for 
Did you mean: 

Help with creating extrusion with sketch containing spline element


Help with creating extrusion with sketch containing spline element

Hello All,

I am trying to write a test code as part of our Pro/Toolkit-based
application using Microsoft Visual Studio 2005, to create a simple extrude
feature with a sketch containing a closed loop containing a spline and a
line element. However, I am unable to create the feature. I have tried to
explain my attempt here below. Any help or hint on this will be appreciated.

The gist of the code follows the pattern given in test functions in
pro/toolkit for WF 3.0.

1. I created an incomplete feature element tree using ProFeatureCreate
with setting proper values for all the parameters related to extrude feature
(other than the section/sketch). - Pro_TK_NO_ERROR returned
2. I got the handle to the ProSection structure of the element tree and
then add sketch entities to the section, copying data from my own
application and then calling ProFeatureRedefine to complete the feature
creation. The skeleton of the code looks like

return_status = Profile.Get_Entities(entities);

for (i=0; i<=entities.GetUpperBound(); i++)


Pro2dEntdef *proEntity;

int id=0;

if (entities[i]->Is_Line())


Pro2dLinedef line;

. /* copy line data from application's data structures */

line.type = PRO_2D_LINE;

status = ProSectionEntityAdd(section, (Pro2dEntdef*)&line,

proEntity = (Pro2dEntdef*)&line;


else if(entities[i]->Is_Arc())




else if(entities[i]->Is_Circle())




else if(entities[i]->Is_Ellipse() ||




else if (entities[i]->entity_type == GE2D_Entity::Spline)


// add spline entity to section

Pro2dSplinedef SplineDef;

GE3D_Point_Array aSplinePts; double dTemp;

SplineDef.type = PRO_2D_SPLINE;

((GE2D_Spline *)entities[i])->GetSplinePoints(aSplinePts);

SplineDef.n_points = aSplinePts.GetSize();

status = ProArrayAlloc(SplineDef.n_points,
sizeof(Pro2dPnt), 1, (ProArray *)&SplineDef.point_arr);

for (int j = 0; j < aSplinePts.GetSize(); j++)

SplineDef.point_arr[j][1], dTemp);

. /* copy start/end angle and tangency conditions from
application's data structures */

status = ProSectionEntityAdd(section,
(Pro2dEntdef*)&SplineDef, &id);



. /* code to set the reference planes for this section using
ProSelectionAlloc and ProSectionEntityFromProjection */

status = ProSecerrorAlloc(&serrors);

status = ProSectionAutodim(section, &serrors);


status = ProFeatureRedefine(NULL, &feature, created_tree, opts, 1,

ProUtilFeatErrsPrint (&errors);

3. The result from ProSectionAutoDim is Pro_TK_NO_ERROR. However, the
ProFeatureRefine call returns a PRO_TK_GENERAL_ERROR. The ProErrorlist array
is null. So, I am not sure what I am missing here.

Other observations:

a. If I ignore the spline entity in the section and just add the lines
(formed by joining the control points), the extrude feature (with lines
only) gets created fine.
b. The messages from the progress bar and the trail.txt file indicate a
discrepancy with mass properties. I am not sure how I need to proceed from
here to narrow down the error.

!%CIRegenerating SPLINE-PRO feature 5 out of 5 ...

!ProgressBarDlg: Regen Completed

!%CEFeature regeneration failed.

!%CDLine 83 part SPLINE-PRO: Model changed since mass props calculated. May
need to recalculate.

!ProgressBarDlg: Regen Started

!%CIRegenerating SPLINE-PRO feature 5 out of 5 ...

!%CIRegeneration completed: 1 incomplete feature(s) or component(s).

!ProgressBarDlg: Regen Completed


Saurabh Maitra

Software Engineer

Imagecom Inc.


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
Attention: Creo 7.0 Customers
Please consider upgrading
End of Life announcement here.

NEW Creo+ Topics:
PTC Control Center
Creo+ Portal
Real-time Collaboration