How to explode a table in autocad using VBA

How to explode a table in autocad using VBA

Anonymous
Not applicable
2,719 Views
4 Replies
Message 1 of 5

How to explode a table in autocad using VBA

Anonymous
Not applicable

I have create an excel based VBA program that creates a table in Autocad. However, I need the program to explode the table. I have tried many different ways. But am struggling to find a solution, as Excel keeps saying "Object doesn't support this property or method".

 

Does anyone know a solution to my problem? Maybe creating the table in a block reference?

 

// My table that gets produced

Set MyTable = acadDoc.ModelSpace.AddTable(ptChart2, NewSheetCounter - 1, 8, 0.2, 0.5) '.AddTable(InsertionPoint, NumRows, NumColumns, RowHeight, ColWidth)
                       

// This was used to create a section box to explode everything inside of it.

Set ssetObj = acadDoc.SelectionSets.Add("SSET")
Mode = acSelectionSetAll
corner1(0) = 0: corner1(1) = 0: corner1(2) = 0
corner2(0) = 16.25: corner2(1) = 10.25: corner2(2) = 0
ssetObj.Select Mode, corner1, corner2
explodedObjects = ssetObj.Explode

0 Likes
Accepted solutions (1)
2,720 Views
4 Replies
Replies (4)
Message 2 of 5

cadffm
Consultant
Consultant
Iterate thrue the selectionset and explode each item you want to explode.

Dim obj As AcadObject

For Each obj In ssetOBJ
....
Next



But for this goal
"However, I need the program to explode the table."
Your selectionset is not pretty well if you only want to explode your table.
Why do you not explode your MyTable?

Sebastian

0 Likes
Message 3 of 5

cadffm
Consultant
Consultant

Oups, my mistake (thx to @Alfred.NESWADBA )

 

I saw "ssetObj.Explode" and thought that explode is not a valid method for the selectionset,
but the problem is deeper because exploding is not a valid method for tables.

As documented here

[F1] - Explode Method (ActiveX)

 

So you have to take a different route, the easiest way would be to use the AutoCAD command Explode via sendcommand explode

for one object only, if you have more - use the for-next loop (see [F1] for explode command in acad help)

 

Ent as Entity

     ThisDrawing.SendCommand("_explode" & vbcr & "(handent """ & tEnt.Handle & """)" & vbcr)
 

 

Sebastian

Message 4 of 5

Anonymous
Not applicable

Please see link to my excel sheet - AutoCAD wouldn't let me upload it.

 

https://www.dropbox.com/s/pyu73i55m1vs0y4/Stringing%20Template.xlsm?dl=0

 

The reason why I am trying to explode a MyTable, is because I am using importing DXFs into another program (PLSCADD). This program won't import anything but Lines, Polylines, Arcs. Circles, Ellipses, Text, Points, Solids, Faces and Blocks.

0 Likes
Message 5 of 5

cadffm
Consultant
Consultant
Accepted solution

Sorry, i need too much time for this, it isnt my usual enviroment.

 

Read about sendcommand and try my hint from my last answer.

Thats for only one objects and you can use the way via Handent like the sample above,

or if the table was the last object you can send LAST for object selection.

 

? acaddoc.SendCommand("_explode" & vbcr & "_last" & vbcr & vbcr)

 

There are so many example code in the www, but I hope that someone else helps you if you can not do it.

 

 

Sebastian

0 Likes