- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying create a routine for AutoCAD 2015.
I am using VSC 2013 with ObjectARX 2015.
Public Shared Sub ExplodeNestedBlocks()
Dim doc As Document = Application.DocumentManager.MdiActiveDocument
doc.LockDocument()
Application.DocumentManager.MdiActiveDocument.Lock
Dim ed As Editor = doc.Editor
Dim acTypValAr(0) As TypedValue
acTypValAr.SetValue(New TypedValue(DxfCode.Start, "INSERT"), 0)
Dim acSelFtr As SelectionFilter = New SelectionFilter(acTypValAr)
Dim trans As Transaction = Application.DocumentManager.MdiActiveDocument.Data
Dim acSSPrompt As PromptSelectionResult
acSSPrompt = ed.SelectAll(acSelFtr)
If acSSPrompt.Status = PromptStatus.OK Then
Dim acSSet As SelectionSet = acSSPrompt.Value
For Each Itm As SelectedObject In acSSet
Dim BlkRef As BlockReference = trans.GetObject(Itm.ObjectId, OpenMode.ForWrite, False, True)
Dim BlkRec As BlockTableRecord = trans.GetObject(BlkRef.BlockTableRecord, OpenMode.ForWrite, False, True)
If BlkRec.XrefStatus = XrefStatus.NotAnXref And _
BlkRef.IsAProxy = False And _
BlkRef.IsDynamicBlock = False And _
BlkRec.Explodable = True And _
BlkRec.HasAttributeDefinitions = False And _
BlkRec.IsAProxy = False And _
BlkRec.IsDependent = False And _
BlkRec.IsDynamicBlock = False And _
BlkRec.IsLayout = False Then
For Each ent In BlkRec
If ent.ObjectClass.DxfName = "INSERT" Then
Dim SubBlkRef As BlockReference = trans.GetObject(ent, OpenMode.ForWrite, False, True)
Dim SubBlkRec As BlockTableRecord = trans.GetObject(SubBlkRef.BlockTableRecord, OpenMode.ForWrite, False, True)
If SubBlkRec.HasAttributeDefinitions = True Then
<<EXPLODE BLKREF>> This is the part of the routine that escapes me right now. BlkRef.ExplodeToOwnerSpace and BlkRef.Explode do not seem to work.
End If
End If
Next
End If
Next
trans.Commit()
End If
End Sub
Thanks in advance for any insight.
Solved! Go to Solution.