TheSwamp

Code Red => VB(A) => Topic started by: silveroak on December 24, 2008, 04:47:14 PM

Title: Problem exploding dynamic blocks
Post by: silveroak on December 24, 2008, 04:47:14 PM
All, I've got a piece of code in which exploding blocks with the block reference .Explode() method plays an important role.  A drawing contains a number of block references.  After block references are exploded, the resulting geometry and relative location of primitives are analyzed.

We've started using dynamic blocks and visibility states just to make editing drawings easier.  Right then the code started failing on simplest dynamic blocks with two visibility states ON/OFF.  Calling .Explode results in "Invalid key" error with no further details.

However, the blocks will explode with the EXPLODE command from AutoCAD command line.

But even a simplest VBA macro with just the interactive pick utility and immediate .Explode of the selected block reference fails with "Invalid key".

Tried several CAD installations, both 2006 and 2008 - still "Invalid key". In all other respects the block behaves fine.

I appreicate any ideas. I would like to post an example but not sure if I can do it directly on the forum. If it is not possible, I'll link to it somehow.

Thanks!
Title: Re: Problem exploding dynamic blocks
Post by: silveroak on December 24, 2008, 04:53:39 PM
Update: if visibility grips are erased, VBA .Explode works.

Wondering if I have to take out the grips in code somehow before attempting to explode.  How would I get a reference to the grip itself?
Title: Re: Problem exploding dynamic blocks
Post by: silveroak on December 25, 2008, 12:40:43 AM
It works if I call ConvertToAnonymousBlock or ConverToStaticBlock prior to explosion.
Still, a strange problem and behavior.
Title: Re: Problem exploding dynamic blocks
Post by: David Hall on December 26, 2008, 12:50:14 PM
Glad you found it.  I was just about to say I heard you needed to convert to static block before exploding it.