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, &id);
. /* 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);
opts[0] = PRO_FEAT_CR_DEFINE_MISS_ELEMS;
status = ProFeatureRedefine(NULL, &feature, created_tree, opts, 1, &errors);
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
Thanks
Saurabh Maitra
Software Engineer
Imagecom Inc.
Email: saurabh.maitra@aspire3d.com
www: 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.