Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
Has anyone played with Pro2dPolylinedef?
I wanted to create a closed polyline loop and create a nice extrusion out of it. It did indeed work but when I tried to grab the polyline for later processing according to the dialog value from the section plane with the correct id it sadly returns me just a line, type 2 instead of type 7. I have tried with malloc and using the ProArrays. Nothing, it refuses to return me a polyline type. From the code I provide am I doing something wrong? I am a new guy in ProToolkit programming but the code seems logical.
What am I doing wrong and the last command returns ent->type = 2 instead of 7?
Pro2dPolylinedef Lshape;
Lshape.type = PRO_2D_POLYLINE;
ProArrayAlloc(0, sizeof(Pro2dPnt), 1, (ProArray*)&Lshape.point_arr);
Pro2dPnt pnt;
pnt[0] = center.pnt[0];
pnt[1] = center.pnt[1];
ProArrayObjectAdd((ProArray*)&Lshape.point_arr, -1, 1, &pnt);
pnt[0] = center.pnt[0];
pnt[1] = center.pnt[1] + VerticalLength;
ProArrayObjectAdd((ProArray*)&Lshape.point_arr, -1, 1, &pnt);
pnt[0] = center.pnt[0] + Thickness;
pnt[1] = center.pnt[1] + VerticalLength;
ProArrayObjectAdd((ProArray*)&Lshape.point_arr, -1, 1, &pnt);
pnt[0] = center.pnt[0] + Thickness;
pnt[1] = center.pnt[1] + Thickness;
ProArrayObjectAdd((ProArray*)&Lshape.point_arr, -1, 1, &pnt);
pnt[0] = center.pnt[0] + BaseLength;
pnt[1] = center.pnt[1] + Thickness;
ProArrayObjectAdd((ProArray*)&Lshape.point_arr, -1, 1, &pnt);
pnt[0] = center.pnt[0] + BaseLength;
pnt[1] = center.pnt[1];
ProArrayObjectAdd((ProArray*)&Lshape.point_arr, -1, 1, &pnt);
pnt[0] = center.pnt[0];
pnt[1] = center.pnt[1];
ProArrayObjectAdd((ProArray*)&Lshape.point_arr, -1, 1, &pnt);
Lshape.n_points = 7;
int* pLid;
ProError err = ProSectionEntityAdd(section, (Pro2dEntdef*)&Lshape, pLid);
Pro2dEntdef* ent;
ProError status = ProSectionEntityGet(section, *pLid, &ent);
pLid is a reference from a variable. So its well defined, I have put it here for completeness for you to know what I am doing.
Are you sure that you need to create a PRO_2D_POLYLINE in a section to be used for a protrusion-type feature? The common approach would be to create a closed loop of lines, arcs, splines - take a look at UgSectModelCreate.c in protk_appls.
AFAIK, PRO_2D_POLYLINE type was historically used for IGES or DXF imported 2D geometry.
HIH.
Done, did it as a closed loop of lines, I thought of this but I was waiting for someone to tell me that this is the correct way. I think Creo should be notified that there is a problem with this and say its deprecated and will be removed. Many thanks.
Regards,
Alexander.