Beispiel #1
0
        doCleanup1()
        {
            //unload xrefs
            ObjectIdCollection xrefBTRs = xRef.getXRefBlockTableRecords();

            BaseObjs._db.UnloadXrefs(xrefBTRs);

            //unload CIVIL3D2015.dvb
            try{
                acadApp.UnloadDVB(@"C:\TSet\VBA2015\CIVIL3D2015.dvb");
            }
            catch {}

            Extents3d ext3d = BaseObjs._getExtents;

            //change view to all
            VPort.zoomWindow(ext3d);

            TypedValue[] tvs = new TypedValue[4] {
                new TypedValue((int)DxfCode.Operator, "<OR"),
                new TypedValue((int)DxfCode.Start, RXClass.GetClass(typeof(MText)).DxfName),
                new TypedValue((int)DxfCode.Start, RXClass.GetClass(typeof(Leader)).DxfName),
                new TypedValue((int)DxfCode.Operator, "OR>")
            };

            SelectionSet ss = Select.buildSSet(tvs);

            ObjectId[] ids = null;
            if (ss != null)
            {
                ids = ss.GetObjectIds();
                for (int i = 0; i < ids.Length; i++)
                {
                    ids[i].clearAllXdata();
                }
            }

            //explode

            tvs = new TypedValue[17] {
                new TypedValue((int)DxfCode.Operator, "<NOT"),
                new TypedValue((int)DxfCode.Start, RXClass.GetClass(typeof(Polyline3d)).DxfName),
                new TypedValue((int)DxfCode.Operator, "NOT>"),
                new TypedValue((int)DxfCode.Operator, "<NOT"),
                new TypedValue((int)DxfCode.Start, RXClass.GetClass(typeof(CogoPoint)).DxfName),
                new TypedValue((int)DxfCode.Operator, "NOT>"),
                new TypedValue((int)DxfCode.Operator, "<NOT"),
                new TypedValue((int)DxfCode.Start, RXClass.GetClass(typeof(MText)).DxfName),
                new TypedValue((int)DxfCode.Operator, "NOT>"),
                new TypedValue((int)DxfCode.Operator, "<NOT"),
                new TypedValue((int)DxfCode.Start, RXClass.GetClass(typeof(Leader)).DxfName),
                new TypedValue((int)DxfCode.Operator, "NOT>"),
                new TypedValue((int)DxfCode.Operator, "<NOT"),
                new TypedValue((int)DxfCode.Start, RXClass.GetClass(typeof(Wipeout)).DxfName),
                new TypedValue((int)DxfCode.Operator, "NOT>"),
                new TypedValue((int)DxfCode.Start, RXClass.GetClass(typeof(BlockReference)).DxfName),
                new TypedValue((int)DxfCode.Operator, "NOT>")
            };

            ss = Select.buildSSet(tvs, ext3d.MinPoint, ext3d.MaxPoint);
            if (ss != null)
            {
                ids = ss.GetObjectIds();
                ObjectIdCollection idsExp = ids.explode();
            }

            //delete breaklines and points
            //DELETE BREAKLINES
            tvs = new TypedValue[2] {
                new TypedValue((int)DxfCode.Start, RXClass.GetClass(typeof(Polyline3d)).DxfName),
                new TypedValue((int)DxfCode.LayerName, "CPNT-BRKLINE")
            };

            ss = Select.buildSSet(tvs);
            if (ss != null)
            {
                ids = ss.GetObjectIds();
                ids.deleteObjs();
            }

            //DELETE COGO POINTS
            tvs = new TypedValue[1] {
                new TypedValue((int)DxfCode.Start, RXClass.GetClass(typeof(CogoPoint)).DxfName),
            };

            ss = Select.buildSSet(tvs);
            if (ss != null)
            {
                ids = ss.GetObjectIds();
                ids.deleteObjs();
            }

            //load CIVIL3D2015.dvb
            try
            {
                acadApp.LoadDVB(@"C:\TSet\VBA2015\CIVIL3D2015.dvb");
            }
            catch { }
        }