exploding blocks

exploding blocks

Anonymous
Not applicable
709 Views
8 Replies
Message 1 of 9

exploding blocks

Anonymous
Not applicable
I'm cycling through a selection set of blocks, and I explode all the blocks
one by one (as long as they meet certain criteria). However, AutoCAD,
instead of simply exploding the blocks, makes a bad 'exploded' copy of the
block (with the text & dimensions also exploded) and places it right on top
of the existing block which is untouched. What is going on!!??

portion of code(note: this is in VB not VBA):

For intCount = 1 To 3 '''iterate 3 times for nested blocks
'''check if selection set exists and, if so, delete it
intSSCount = MyACAD.ActiveDocument.SelectionSets.Count
For intCount2 = 0 To intSSCount - 1
If MyACAD.ActiveDocument.SelectionSets.Item(intCount2).Name =
"DeleteBlock" Then

MyACAD.ActiveDocument.SelectionSets.Item("DeleteBlock").Delete
Exit For
End If
Next
'''(re)make selection set
Set ssBlock = MyACAD.ActiveDocument.SelectionSets.Add("DeleteBlock")
intCodes(0) = 0 'sets filter to block name
varCodeValues(0) = "INSERT"
ssBlock.Select acSelectionSetAll, , , intCodes, varCodeValues
intBlockCount = ssBlock.Count - 1
'''explode blocks
On Error Resume Next
For intCount2 = 0 To intBlockCount
Set objBlockRef = ssBlock(intCount2)
If OrigIDExists(objBlockRef.Name) Then ''''checks block criteria
before exploding
objBlockRef.Explode
End If
Next
On Error GoTo 0
Next

Thank you very much,
Edward
0 Likes
710 Views
8 Replies
Replies (8)
Message 2 of 9

Ed__Jobe
Mentor
Mentor
The Explode method does not work exactly like the Explode command, it leaves the original. Just follow objBlockRef.Explode with objBlockRef.Delete

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 3 of 9

Anonymous
Not applicable
Thanks, but it seems to exploded the nested text and such. Is this also a
normal feature of the VB explode method? Is there a way around this?

Also, I tried using sendcommand but I'm not sure how to translate the
objBlockRef variable to something that is useful in a sendcommand string.

Thanks again,
Edward


"Ed_Jobe" wrote in message news:[email protected]...
The Explode method does not work exactly like the Explode command, it leaves
the original. Just follow objBlockRef.Explode with objBlockRef.Delete
0 Likes
Message 4 of 9

Anonymous
Not applicable
I'm sorry, it only seems to be exploding the nested Mtext. Whhyyyyyyy!!!!!
NOooooOooo!!!

time for a cup of coffee.
Any way around this?

Edward
"Ed_Jobe" wrote in message news:[email protected]...
The Explode method does not work exactly like the Explode command, it leaves
the original. Just follow objBlockRef.Explode with objBlockRef.Delete
0 Likes
Message 5 of 9

Ed__Jobe
Mentor
Mentor
Try setting a breakpoint and stepping through your code. You've got another function not shown (OrigIDExists) that determines the criteria for whether or not an ent gets exploded. Watch ther value of variables to see what's getting passed to the Explode method. Also, the SendCommand function only accepts string arguments and is asyncronous, that is, you don't know when it will execute. However, the lisp (command) function will accept objects as arguments.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 6 of 9

Anonymous
Not applicable
Thanks again...

I'll think I'll rename my blocks instead of
exploding them.  It will serve the same purpose.


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"Ed_Jobe" <eljobe> wrote in message
href="news:[email protected]">news:[email protected]
...
Try
setting a breakpoint and stepping through your code. You've got another
function not shown (OrigIDExists) that determines the criteria for whether or
not an ent gets exploded. Watch ther value of variables to see what's getting
passed to the Explode method. Also, the SendCommand function only accepts
string arguments and is asyncronous, that is, you don't know when it will
execute. However, the lisp (command) function will accept objects as
arguments.
0 Likes
Message 7 of 9

Ed__Jobe
Mentor
Mentor
I just tried a simple example of my own. I created a block out of a three line mtext and exploded it. It indeed did explode the mtext into three line of text. This is odd, since the Mtext object doesn't have an explode method and of course the Help file doesn't mention such behavior.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 8 of 9

Ed__Jobe
Mentor
Mentor
Just for fun I tried it with a block made of a pline and it didn't explode it into lines. Beware of inconsistent behavior. If the method is going to explode down further than the top level, it should consistently do it for all types of entities.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 9 of 9

Anonymous
Not applicable
I believe that is a known bug. Randall Rath has a function called ExplodeEX
that does not exhibit this behavior. It is available for free download at
www.vbdesign.net.

Chuck


"Edward Bagby" wrote in message
news:[email protected]...
> I'm sorry, it only seems to be exploding the nested Mtext.
Whhyyyyyyy!!!!!
> NOooooOooo!!!
>
> time for a cup of coffee.
> Any way around this?
>
> Edward
> "Ed_Jobe" wrote in message news:[email protected]...
> The Explode method does not work exactly like the Explode command, it
leaves
> the original. Just follow objBlockRef.Explode with objBlockRef.Delete
>
>
0 Likes