Explode blocks!

Explode blocks!

Anonymous
Not applicable
1,185 Views
3 Replies
Message 1 of 4

Explode blocks!

Anonymous
Not applicable

(defun C:delbl ()
(setq a (ssget '((0 . "INSERT"))))
(command "_.explode" a "")
(princ)
)

 

----------------

I am trying to explode the blocks in my drawing, but after selecting the blocks, it exploded only one objects

for example,  " delbl" found 4 blocks(objects) but exploded only one, and the remaining blocks I have to continue to "delbl" and one block exploded again......Anybody can tell me the reason why?

 

I still can use cad command "explode" to explode them by manual. They can be exploded! 

0 Likes
1,186 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

I found the solution, thanks for concerning! 

0 Likes
Message 3 of 4

dlanorh
Advisor
Advisor

@Anonymous wrote:

(defun C:delbl ()
(setq a (ssget '((0 . "INSERT"))))
(command "_.explode" a "")
(princ)
)

 

----------------

I am trying to explode the blocks in my drawing, but after selecting the blocks, it exploded only one objects

for example,  " delbl" found 4 blocks(objects) but exploded only one, and the remaining blocks I have to continue to "delbl" and one block exploded again......Anybody can tell me the reason why?

 

I still can use cad command "explode" to explode them by manual. They can be exploded! 


(defun C:delbl (  / a cnt ent)
(setq a (ssget '((0 . "INSERT"))))
(repeat (setq cnt (sslength a))
  (setq ent (ssname a (setq cnt (1- cnt))))
  (command "_.explode" ent "")
)
(princ)
)

 

I am not one of the robots you're looking for

0 Likes
Message 4 of 4

cadffm
Consultant
Consultant

@Anonymous wrote:

Anybody can tell me the reason why?

 


Read your EXPLODE Help[F1]  and you will see:

AutoDESK: Usual and it is as designed! (in this case "Script" means 'automation' )

 

My explaination:

In automatation autocad starts some commands in an older instead of the current version of a command.

 (for compatibility with older scripts or for scripts that should work with newer and older versions)

 

See also. INITCOMMANDVERSION (AutoLISP)

(defun C:explbl ()
  (if (setq a (ssget '((0 . "INSERT"))))
       (progn (initcommandversion 2)(command "_.EXPLODE" a ""))

  )
(princ)
)

 

Sebastian

0 Likes