.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Reversing a polyline

0 REPLIES 0
Reply
Message 1 of 1
Anonymous
294 Views, 0 Replies

Reversing a polyline

I need to reverse a polyline including its start/end widths and bulges
appropriately. I found a function in ObjectARX (C++) by Jon at this address:

http://groups.google.com/group/autodesk.autocad.customization/browse_thread/thread/2fceb2940d856fdb/cef982eed173cd61?lnk=st&q=ObjectARX+reversing+a+polyline#cef982eed173cd61

which I am copying below. It is quite dated, from 1999:

Acad::ErrorStatus reversePolyline(AcDbPolyline*& pPline)
{
AcDbPolyline *pCopy = new AcDbPolyline(pPline->numVerts());
for (int i=0, j = pPline->numVerts() - 1; i < pPline->numVerts(); i++,
j--)
{
AcGePoint3d pt;
double blg, sw, ew;
pPline->getPointAt(j, pt);
if (j)
{
pPline->getBulgeAt(j-1, blg);
pPline->getWidthsAt(j-1, sw, ew);
}
else
{
blg = 0;
pPline->getWidthsAt(pPline->numVerts() - 1, sw, ew);
}
pCopy->addVertexAt(i, AcGePoint2d(pt.x, pt.y), -blg, ew, sw);
}
pCopy->setPropertiesFrom(pPline);
pCopy->setElevation(pPline->elevation());
Acad::ErrorStatus es = pPline->handOverTo(pCopy);
if (es != Acad::eObjectToBeDeleted)
delete pCopy;
else
{
delete pPline;
pPline = pCopy;
}
return es;
}
I am trying to port the above to managed C++. The question is that this
function gets a polyline vertex using getPontAt(AcGEPoint3d&) which
returns it in WCS while it adds the vertex to a new polyline using
addVertexAt() that uses ECS. IMO this is not correct - the point should
be transformed to ECS before adding to the polyline - can someone voice
their opinion or comment on this - I will really appreciate it.
0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost