I am writing function to remove vertexes from AcDbPolyline. My function works, but I can't see vertexes of AcDbPolyline if command is active.
I want it to look like this than I select vertexes
But it looks like this
How can I make AcDbPolyline look like first image in process of selecting vertexes?
My current code is
void removeVertexFromPoly()
{
int ec = RTERROR;
ads_point adsPoint;
ads_name ent;
AcDbObjectId id;
Acad::ErrorStatus es = Acad::eOk;
AcDbObjectPointer<AcDbPolyline> pPoly;
while(ec != RTNORM)
{
ec = acedEntSel( _T( "\nSelect polyline:" ), ent, adsPoint );
if(ec == RTCAN) return;
es = acdbGetObjectId( id, ent );
if(es != Acad::eOk)
{
acutPrintf( _T( "\nacdbGetObjectId failed. Error: %s" ), acadErrorStatusText( es ) );
return;
}
pPoly.open( id, AcDb::kForRead );
if((es = pPoly.openStatus()) == Acad::eNotThatKindOfClass)
{
acutPrintf( _T( "\nNot a polyline! " ) );
ec = RTERROR;
continue;
}
else if((es = pPoly.openStatus()) != Acad::eOk)
{
acutPrintf( _T( "\nCould not open polyline. Error: %s" ), acadErrorStatusText( es ) );
return;
}
pPoly->highlight();
}
AcGePoint3d point;
AcGePoint2d vertex;
while(true)
{
ec = acedGetPoint( NULL, _T( "\nSelect vertex: " ), adsPoint );
if(ec == RTCAN)
{
return;
}
point = asPnt3d( adsPoint );
for(int i = 0; i < pPoly->numVerts(); i++)
{
pPoly->getPointAt( i, vertex );
if(vertex.x == point.x && vertex.y == point.y)
{
pPoly->upgradeOpen();
pPoly->removeVertexAt( i );
pPoly->downgradeOpen();
pPoly->draw();
pPoly->highlight();
}
}
}
}
Solved! Go to Solution.
Solved by DonatasAzaravicius. Go to Solution.
Not exactly the same, but used transients to draw all vertexes.
Used code from here https://adndevblog.typepad.com/autocad/2012/04/using-transient-graphics.html
Can't find what you're looking for? Ask the community or share your knowledge.