Beispiel #1
0
        public static void ExplodeSolid()
        {
            Database workingDatabase = HostApplicationServices.WorkingDatabase;
            Editor   editor          = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            try
            {
                //LicenseManager.CheckValid("FULL");
                TypedValue[] array = new TypedValue[]
                {
                    new TypedValue(0, "3DSOLID")
                };
                PromptSelectionOptions promptSelectionOptions = new PromptSelectionOptions();
                promptSelectionOptions.MessageForAdding = ("Select 3d solids");
                PromptSelectionResult selection = editor.GetSelection(promptSelectionOptions, new SelectionFilter(array));
                if (selection.Status == (PromptStatus)5100)
                {
                    ObjectId[]         objectIds          = selection.Value.GetObjectIds();
                    DBObjectCollection dBObjectCollection = new DBObjectCollection();
                    using (Transaction transaction = workingDatabase.TransactionManager.StartTransaction())
                    {
                        for (int i = 0; i < objectIds.Length; i++)
                        {
                            dBObjectCollection.Add(transaction.GetObject(objectIds[i], (OpenMode)0));
                        }
                    }
                    DBObjectCollection dBObjectCollection2 = new DBObjectCollection();
                    Tesselation.smethod_0(dBObjectCollection, ref dBObjectCollection2);
                    editor.WriteMessage("\nElements: " + dBObjectCollection2.Count);
                }
            }
            catch (System.Exception ex)
            {
                editor.WriteMessage("\nException during traversal: {0}", new object[]
                {
                    ex.ToString()
                });
            }
        }
Beispiel #2
0
        internal static void smethod_0(DBObjectCollection dbobjectCollection_0, ref DBObjectCollection dbobjectCollection_1)
        {
            Editor arg_0F_0 = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            foreach (DBObject dBObject in dbobjectCollection_0)
            {
                Entity             entity             = (Entity)dBObject;
                DBObjectCollection dBObjectCollection = new DBObjectCollection();
                try
                {
                    entity.Explode(dBObjectCollection);
                    Tesselation.smethod_0(dBObjectCollection, ref dbobjectCollection_1);
                }
                catch
                {
                    dbobjectCollection_1.Add(dBObject);
                }
                finally
                {
                    dBObject.Dispose();
                }
            }
        }