You could use the BURST command to explode dimenisons. BURST can be executed via the SendCommand() method.
For example to explode everything including dimensions, the following snippet works:
[CommandMethod("XA")] public static void ExplodeAllDrawingEntitiesViaSendCommand() { "DRAWORDERCTL{0}0{0}BURST{0}ALL{0}{0}EXPLODE{0}ALL{0}{0}DRAWORDERCTL{0}3{0}".SendCommand("\n"); }
where SendCommand is exposed as an extension method
public static void SendCommand(this string commandFormat, params object[] args) { var acadApplication = a.Application.AcadApplication as AcadApplication; acadApplication.ActiveDocument.SendCommand(string.Format(commandFormat, args)); }
The downside with this approach is that it requires interop with COM dlls.
Not sure about if this work on your end,
I tested on A2010 all is good for me
<CommandMethod("dex")> _ Public Sub TestExplode() Dim doc As Document = Application.DocumentManager.MdiActiveDocument Dim ed As Editor = doc.Editor ' Select a dimension Dim opts As New PromptEntityOptions(vbLf & "Select a dimension:") opts.SetRejectMessage(vbLf & "Must be a dimension...") ' opts.AddAllowedClass(GetType(Dimension), False) Dim res As PromptEntityResult = ed.GetEntity(opts) If res.Status <> PromptStatus.OK Then Exit Sub End If Dim db As Database = doc.Database Using trans As Transaction = db.TransactionManager.StartTransaction Dim dm As DBObject = trans.GetObject(res.ObjectId, OpenMode.ForRead) ed.WriteMessage(vbLf + "{0}", dm.GetType().Name) Dim m_dim As Dimension = TryCast(dm, Dimension) m_dim.UpgradeOpen() Dim objs As DBObjectCollection = New DBObjectCollection m_dim.Explode(objs) Dim btr As BlockTableRecord = trans.GetObject(db.CurrentSpaceId, OpenMode.ForWrite) 'add exploded object to database For Each obj As DBObject In objs Dim ent As Entity = TryCast(obj, Entity) If TypeOf ent Is MText Then Dim mtx As MText = TryCast(ent, MText) 'change textstyle here mtx.TextHeight = mtx.TextHeight * 0.5 End If btr.AppendEntity(ent) trans.AddNewlyCreatedDBObject(ent, True) ed.WriteMessage(vbLf + "{0}", obj.GetType().Name) Next 'erase dimension m_dim.Erase() trans.Commit() End Using End Sub
~'J'~
The eInvalidInput error occurs on newly created dimensions. The following worked for me.
1. Make sure the dimension has been appended and added (AppendEntity and AddNewlyCreatedDBObject) and has a valid ObjectId.
2. Execute Transaction.TransactionManager.QueueForGraphicsFlush().
3. Explode
Can't find what you're looking for? Ask the community or share your knowledge.