TheSwamp

Code Red => VB(A) => Topic started by: Dan on July 14, 2008, 03:01:46 PM

Title: How would I Explode an AutoCAD Table object?
Post 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
Title: Re: How would I Explode an AutoCAD Table object?
Post by: fixo on July 14, 2008, 04:34:59 PM
Hi Dan
Here is a dirty method but seems to be worked
for me

Code: [Select]
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'~
Title: Re: How would I Explode an AutoCAD Table object?
Post by: Dan on July 14, 2008, 04:51:21 PM
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.
Title: Re: How would I Explode an AutoCAD Table object?
Post by: fixo on July 14, 2008, 05:09:14 PM
You're welcome
Cheers :)

~'J'~