
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello Gentlemen,
I am getting Fatal error at the explode method in the following highlighed (red) code.
Can you please help me?
public class ExplodeDynamicBlocks
{
[CommandMethod("EDB")]
public static void ExplodeDymanicBlockReference()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
using (Transaction tr = db.TransactionManager.StartTransaction())
{
BlockTable bt = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
BlockTableRecord btr = tr.GetObject(bt["JDuct-SP"], OpenMode.ForWrite) as BlockTableRecord;
ObjectIdCollection oidc1 = btr.GetAnonymousBlockIds();
ObjectIdCollection oidc2 = btr.GetBlockReferenceIds(true, false);
DBObjectCollection dboc = new DBObjectCollection();
foreach (ObjectId id in oidc1)
{
BlockReference br = tr.GetObject(id, OpenMode.ForWrite) as BlockReference;
br.ExplodeToOwnerSpace(); // I am getting Fatal Error at this point
}
}
}
}
Also, if possible, how to combine two objectidcollection into one?
Solved! Go to Solution.