Ejemplo n.º 1
0
 removeDuplicateVertex(ObjectId id)
 {
     try
     {
         using (Transaction tr = BaseObjs.startTransactionDb())
         {
             DBObject dbObj = tr.GetObject(id, OpenMode.ForWrite);
             if (dbObj is Polyline)
             {
                 Polyline          poly   = (Polyline)tr.GetObject(id, OpenMode.ForRead);
                 Point3dCollection pnts3d = poly.getCoordinates3d();
                 Point3dCollection pnts3dRev;
                 if (hasDuplicateVertex(pnts3d, out pnts3dRev))
                 {
                     string layer = poly.Layer;
                     Misc.deleteObj(id);
                     Draw.addPoly(pnts3d, layer);
                 }
             }
             if (dbObj is Polyline3d)
             {
                 Polyline3d        poly3d = (Polyline3d)tr.GetObject(id, OpenMode.ForRead);
                 Point3dCollection pnts3d = poly3d.getCoordinates3d();
                 Point3dCollection pnts3dRev;
                 if (hasDuplicateVertex(pnts3d, out pnts3dRev))
                 {
                     string layer = poly3d.Layer;
                     Misc.deleteObj(id);
                     Draw.addPoly3d(pnts3d, layer);
                 }
             }
         }
     }
     catch (System.Exception ex)
     {
         BaseObjs.writeDebug(ex.Message + " Mod.cs: line: 649");
     }
 }