Entity.Explode() missing lines/not exploding fully
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I have a drawing (attached) that contains a block reference. When I explode the drawing (multiple times, to get the most exploded state), and run my code, I'm seeing a total of 28 entities/objects in my blockTableRecord. However, when I don't explode the drawing, load it into my code and run the .NET Explode() function on the only BlockReference in the blockTableRecord, I get a total of 3 lines (using the code below). It's almost like the remaining 25 lines are in a different database, they're being completely ignored by the Explode() function.
Document doc = Application.DocumentManager.MdiActiveDocument;
using (Database db = doc.Database)
{
using (Transaction trans = db.TransactionManager.StartOpenCloseTransaction())
{
// Open the Block table record Model space for read
BlockTableRecord blockTblRec = (BlockTableRecord)trans.GetObject(
SymbolUtilityServices.GetBlockModelSpaceId(db),
OpenMode.ForRead
);
HashSet<DBObject> allExploded = new HashSet<DBObject>();
//get all objects
foreach (ObjectId obj in blockTblRec)
{
//convert object to entity to check it's layerID
Entity unexEnt = (Entity)trans.GetObject(obj, OpenMode.ForRead);
//explode the current object if it does not exist in the list of non explodable objects
if (unexEnt is BlockReference)
{
using (DBObjectCollection tempExploded = new DBObjectCollection())
{
//explode the entity
unexEnt.Explode(tempExploded);
for (int i = 0; i < tempExploded.Count; i++)
{
Entity temp = (Entity)tempExploded[i];
//ONLY 3 LINES BEING ADDED INTO THIS
//NO MORE BLOCK REFERENCES ARE BEING PASSED THROUGH
allExploded.Add(temp);
}
}
}
}
}
}
Above is the modified version of my code. In my solution I'm actually running a recursion to ensure any block reference are exploded multiple times. But for some reason the only thing coming through are the 3 lines.
Has anybody seen this before or know why it's happening?
Cheers