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");
}