PDA

View Full Version : How to set the Allow Exploding flag via LISP


craig_russell
2006-12-11, 04:06 PM
Does anyone know of a way to set the Allow Exploding flag via LISP (or vba for that matter if it can't be done in LISP)?

We have a very extensive refrigerated case block library of around 2000 blocks that have dynamic abilities in them we don't want to have exploded, and really don't want to manually open, bedit, and set the allow exploding option.

Thanks

Opie
2006-12-11, 04:16 PM
Look into the Explodable property in the help.

craig_russell
2006-12-11, 04:32 PM
Thanks Opie. I wasn't searching for the right syntax when trying to figure out what property I was needing. I also found the vlisp version which is even better for me.

craig_russell
2006-12-11, 06:05 PM
OK, now that I know what the property value I need to set is, I can't figure out how to set it in the manner I need it set.


Here is what I need to do:

Open around 2000 drawing files via a script that are inserted as blocks in order to run this utility to set the EXPLODABLE = NO. These drawing files are in a wblock fashion, meaning when you open them they aren't already blocks. They contain attdefs along with dynamic abilities which were created using BEDIT on the Current Drawing. (*** See included file ***)

So how could I write a lsp that would set EXPLODABLE = NO when you can't select any block objects to manipulate?

Opie
2006-12-11, 06:34 PM
OK, now that I know what the property value I need to set is, I can't figure out how to set it in the manner I need it set.


Here is what I need to do:

Open around 2000 drawing files via a script that are inserted as blocks in order to run this utility to set the EXPLODABLE = NO. These drawing files are in a wblock fashion, meaning when you open them they aren't already blocks. They contain attdefs along with dynamic abilities which were created using BEDIT on the Current Drawing. (*** See included file ***)

So how could I write a lsp that would set EXPLODABLE = NO when you can't select any block objects to manipulate?
Could you write a script to insert the block/drawing into the current drawing, then set the desired variable and then wblock out the block/drawing (overwriting the original file)? You may want to make a backup of the original files or save to a new location to verify.

craig_russell
2006-12-11, 08:02 PM
Could you write a script to insert the block/drawing into the current drawing, then set the desired variable and then wblock out the block/drawing (overwriting the original file)? You may want to make a backup of the original files or save to a new location to verify.
I thought about that, but there is no good way to fully automate WBLOCK, as it still opens up a dialog box even in suppression mode. Plus, its very limited to what you can do when the dialog box is suppressed, and unless I am mission something, you can't even select the Allow Explode option.

craig_russell
2006-12-11, 08:34 PM
I have found an example on the Augi forums of exactly what I am wanting to do from here: http://forums.augi.com/showthread.php?t=33008&page=1&pp=10&highlight=explodable


(DEFUN C:EB ()
(VLAX-MAP-COLLECTION
(VLA-GET-BLOCKS
(VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT))
) ;_ end of vla-get-blocks
'(LAMBDA (X)
(AND
(VLAX-PROPERTY-AVAILABLE-P X 'EXPLODABLE)
(EQ (VLAX-GET-PROPERTY X 'EXPLODABLE) :VLAX-TRUE)
(NOT (VLAX-PUT-PROPERTY X 'EXPLODABLE :VLAX-FALSE))
) ;_ end of and
) ;_ end of lambda
) ;_ end of vlax-map-collection
) ;_ end of defun

Opie
2006-12-11, 09:18 PM
I thought about that, but there is no good way to fully automate WBLOCK, as it still opens up a dialog box even in suppression mode. Plus, its very limited to what you can do when the dialog box is suppressed, and unless I am mission something, you can't even select the Allow Explode option.
Are you using the command line version of the -wblock command? Do you have FILEDIA set to 0 during your testing?

I created a temporary block; ran the Block Editor on this block; adjusted the desired settings; and then wblocked it into it's own file. Upon reinsertion of the block to a new name, all previous settings were maintained.