• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

exploding selected blocks by name

  • Thread starter Thread starter wallace23
  • Start date Start date

wallace23

Guest
good morning to all, I would need a lisp that automatically selects all the blocks with a certain name in the whole design and explodes them. .
For example, by launching the command "xxx" all the blocks called "aaa" present in the design are selected, and then explode them.
How can you write this lisp?
where can I find a list with all these variables described well?

Thank you very much in advance (:
 
You don't need any lisp. selections with the _qselect command the blocks that are called "aaa"; once created the selection group launches _explode
 
I'd really need the lisp, because I'm composing a bigger lisp that automatically makes me many steps together. . .
 
proof così:
Code:
(set variant "qaflags" 1)
(if (setq blk (ssget "_x" (list '(0. "insert") '(aaa"))))))))
(vl-cmdf "._explode" blk "")
)
(set variant "qaflags" 0)
 
Thank you very much.
just what I wanted...
Can I ask you what this variable does, and the other information of this language?
 
wallace, I translate gp lisp into English:wink:

search throughout the dwg, blocks that are called aaa, if you find them put them in the blk variable after which they explode.
the varibie quaflags set to 1 is necessary to the correct execution of the explode, for this is put first to 1 and then reported to 0

(I read the gp! also the undocumented variables use! :finger:)
 
Thank you very much.
...
Can I ask you what this variable does, and the other information of this language?
Please.

to the crystal answer I add that normally it is possible to pass a selection set to a command, while explode without qaflags=1 would explode only the first object of the set.

to leave this variable it is possible to use another method, in this example the blocks are exploded one by one, but if they were in high number the procedure would be slower:
Code:
(if (setq blk (ssget "_x" (list '(0 . "insert") '(2 . "aaa"))))
    (repeat (setq n (sslength blk))
        (vl-cmdf "._explode" (ssname blk (setq n (1- n))) "")
    )
)
as documentation I can suggest my lisp, while for the help (in English) related to lisp, visuallisp and dxf it is better to consult the manual of some version back, I would say until 2012, because in the last it is an immonda crap.



....pure undocumented variables. . .
Well, the good arri had already reported it A long time ago.
I wonder why this variable, which influences the behavior of different procedures, continues to be ignored by documentation.
 
I wonder why this variable, which influences the behavior of different procedures, continues to be ignored by documentation.
It is probable that the effect of the various qaflags settings can change from version to version of autocad... so.. better not make too much 'publicity'. :-)
I don't know if they implement it yet, but maybe the programmers used it/use it as a ' switch' to run their tests on the sw.
It should be noted that the excellent bricscad (maintaining compatibility with autocad) supports the variable and documents the various values that it can support image allego in which some values have effects on the debug of the sdkqaflags_bricscad.gifas I am also involved in: "festival of the explode" :-)))
another alternative to the code shown in previous posts to explode the blocks and valid only for autocad 2009 and later is this:
(if (setq blk (ssget "_x" (list '(0 . "insert") '(2 . "aaa"))))
(progn)
(initcommandversion 2)
(command "._explode" blk ")
)
)
initcommandversion, recalled before the command, runs the command as from command-line.
Hi.
 
enclose everything in a defunct (define function)

(defun c:xx)

<qui codice="" il="" lisp="" tuo="">)</qui>
 
It says command unknown. . .
instead of xx put az:

(defun c:az ()
(if (setq blk (ssget "_x" (list '(0 . "insert") '(2 . "nord_az"))))
(progn)
(initcommandversion 2)
(command "._explode" blk ")
)
)
 
add another bracket closed at the end!! !

save everything in a file with .lsp extension and upload with appload
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top