Well,
I received an answer from ADN regarding my problem and they confirmed it to
be a problem with AutoCAD's Properties dialog. This is due because the
erase() function doesn't realy delete an object from the database, it just
marks it for deleting like it says in the manual. And that's why everything
looks ok when the drawing is saved and reopened.
Thanks for your help, guys!
"David Bartliff" wrote in message
news:B0556DCB4B37E44527F0716E292B3D48@in.WebX.maYIadrTaRb...
> Perhaps the vertex iterator is corrupt when you remove one. Try break
after
> finding and deleting the correct one.
>
> "Robert Tencic" wrote in message
> news:EEAB67BF859EDCDE9B6ED716A51FF58D@in.WebX.maYIadrTaRb...
> > In fact, after debugging my code I found out that only when I remove the
> > first vertex, AutoCAD Properties dialog box doesn't display any vertex
> data!
> > In all other cases, everything is working well. In both cases, AutoCAD
> keeps
> > running and everything seems ok.
> >
> > If the first vertex is deleted and then the drawing is saved and
reopened,
> > everything works fine.
> >
> > This is my code:
> >
> > int testMain ()
> > {
> > ads_name e;
> > ads_point pt;
> > int i = 0, iVert;
> > if (acedEntSel ("\n Select 2dPoly...", e, pt) != RTNORM) return 0;
> >
> > if (acedGetInt ("\n Which vertex to remove (0 - first, 1 - second...)?
",
> > &iVert) != RTNORM) return 0;
> >
> > AcDbObjectId idPoly, idVert;
> > if (acdbGetObjectId (idPoly, e) != Acad::eOk) return 0;
> >
> > AcDb2dPolyline *pPoly = NULL;
> > AcDb2dVertex *pVert = NULL;
> >
> > if (acdbOpenObject ((AcDbObject*&)pPoly, idPoly, AcDb::kForWrite) ==
> > Acad::eOk)
> > {
> > if (pPoly->isA() == AcDb2dPolyline::desc())
> > {
> > AcDbObjectIterator *vIter = pPoly->vertexIterator ();
> > vIter->start ();
> > while (!vIter->done ())
> > {
> > if (i == iVert)
> > {
> > idVert = vIter->objectId ();
> > if (pPoly->openVertex(pVert, idVert, AcDb::kForWrite) == Acad::eOk)
> > {
> > pVert->erase();
> > pVert->close();
> > }
> > }
> > i++;
> > vIter->step();
> > }
> > }
> > pPoly->close();
> > }
> > return 1;
> > }
> >
> >
> >
> >
> >
> > "dgoceva" wrote in message
> > news:f1099e8.0@WebX.maYIadrTaRb...
> > Your decision seems correctly. Please, publish your code for error
> checking.
> >
> >
>
>