TheSwamp
Code Red => VB(A) => Topic started by: Dan on July 14, 2008, 03:01:46 PM
-
How would I Explode an AutoCAD Table object? I have created a sset of
tables, and wish to explode them into individual entities.
Any clues about how I should obtain this?
Thanks,
Dan
'code snippet
Dim Ent As AcadEntity
Dim oTable As AcadTable
Dim oSet As AcadSelectionSet
FilterType(0) = 0
FilterData(0) = "ACAD_TABLE"
Set oSet = ThisDrawing.SelectionSets.Add("DeleteTable")
oSet.Select acSelectionSetAll, , , FilterType, FilterData
For Each Ent In oSet
Set oTable = Ent
oTable.Explode 'obviously this will not work
Next
-
Hi Dan
Here is a dirty method but seems to be worked
for me
Option Explicit
Sub XplodeTest()
Dim Ent As AcadEntity
Dim oTable As AcadTable
Dim oSet As AcadSelectionSet
Dim FilterType(0) As Integer
Dim FilterData(0) As Variant
FilterType(0) = 0
FilterData(0) = "ACAD_TABLE"
With ThisDrawing.SelectionSets
While .Count > 0
.Item(0).Delete
Wend
Set oSet = .Add("DeleteTable")
End With
oSet.Select acSelectionSetAll, , , FilterType, FilterData
For Each Ent In oSet
Set oTable = Ent
'''oTable.Explode 'obviously this will not work
Dim hdl As String
hdl = oTable.Handle
Dim strcom As String
strcom = "EXPLODE" & Chr(32) & "(handent " & Chr(34) & hdl & Chr(34) & ")" & vbCr & vbCr & vbCr
ThisDrawing.SendCommand strcom
Next Ent
SendKeys "{ESC}"
DoEvents
End Sub
~'J'~
-
Thank you for the clever approach. I personally hate to use sendcommand for anything, but I have yet to find a method through VBA. Thank you again. This will work for my needs.
-
You're welcome
Cheers :)
~'J'~