Exploding vertical product objects

Exploding vertical product objects

Bradleywalker12380
Advocate Advocate
440 Views
2 Replies
Message 1 of 3

Exploding vertical product objects

Bradleywalker12380
Advocate
Advocate

Hello,

 

I am trying to explode some AEC entities in ObjectARX with .Net but need some assistance exploding like "AeccDbTreeNode" 

 

ApplicationDescription: "AeccvBase120|Product Desc: AutoCAD Civil 3D 

 

Any assistance is appreciated!

 

-B

0 Likes
441 Views
2 Replies
Replies (2)
Message 2 of 3

Bradleywalker12380
Advocate
Advocate

Does anyone have answers to this?

0 Likes
Message 3 of 3

Gepaha
Collaborator
Collaborator

In ACA/MEP Autodesk.Aec.DatabaseServices.StreamExplode?

I've never used it. Maybe in MgdDbgAec you will find something about it.

I found this:

 

 

 

        private void StreamExplodeSample()
        {
            // intro message
            Editor editor = GetEditor();
            editor.WriteMessage("* StreamExplode *\n");
            editor.WriteMessage("StreamExplode converts all entities to AutoCAD primitive entities.\n");
            editor.WriteMessage("Pick an object in the current drawing. The object you picked will be packaged to an anonymous block and finally referenced in the current space. The block-referenced object will be overlapping with the original one.\n");

            // pick a object to be exploded
            ObjectId id = PickObject(typeof(Entity), false);
            if (id.IsNull)
            {
                editor.WriteMessage("No object is picked\n");
                return;
            }

            Database db = GetDatabase();
            DBObjectCollection objects = new DBObjectCollection();
            StreamExplode streamExplode = new StreamExplode(db, objects);
            streamExplode.IsVisualExplode = true;
            streamExplode.SetForBoundarySearch(false);

            TransactionManager tm = db.TransactionManager;
            using (Transaction trans = tm.StartTransaction())
            {
                Entity ent = trans.GetObject(id, OpenMode.ForRead) as Entity;

                streamExplode.PushDisplayParameters(DictionaryDisplayConfiguration.GetStandardDisplayConfiguration(db), trans);
                streamExplode.PushEntity(ent);
                streamExplode.PushProperties(ent);

                streamExplode.Stream(ent);
                streamExplode.PackageExplodedEntities();

                streamExplode.PopProperties();
                streamExplode.PopEntity();
                streamExplode.PopDisplayParameters();

                trans.Commit();
            }

            BlockReference blockRef = null;
            foreach (DBObject obj in objects)
            {
                if (obj.GetType() == typeof(BlockReference))
                    blockRef = obj as BlockReference;
            }

            if (blockRef == null)
                return;

            blockRef.Position = Point3d.Origin;

            using (Transaction trans = tm.StartTransaction())
            {
                BlockTableRecord btr = trans.GetObject(db.CurrentSpaceId, OpenMode.ForWrite) as BlockTableRecord;
                btr.AppendEntity(blockRef);
                trans.AddNewlyCreatedDBObject(blockRef, true);
                trans.Commit();
            }
        }
        private Database GetDatabase()
        {
            return Application.DocumentManager.MdiActiveDocument.Database;
        }
        private Editor GetEditor()
        {
            return Application.DocumentManager.MdiActiveDocument.Editor;
        }
        ObjectId PickObject(Type type, bool exactMatch, string tips)
        {
            Editor editor = GetEditor();
            PromptEntityOptions options = null;
            PromptEntityResult result;
            if (type != null)
            {
                options = new PromptEntityOptions(tips);
                options.SetRejectMessage("This type of object is not allowed.\n");
                options.AddAllowedClass(type, exactMatch);
                result = editor.GetEntity(options);
            }
            else
            {
                result = editor.GetEntity(tips);
            }
            if (result.Status == PromptStatus.OK && result.ObjectId.IsValid)
                return result.ObjectId;
            else
                return ObjectId.Null;
        }

        ObjectId PickObject(Type type, bool exactMatch)
        {
            return PickObject(type, exactMatch, "Please pick an object or return");
        }

 

 

 

 

0 Likes