Jump to content

Recommended Posts

Posted

Can someone please create a simple Autolisp that inserts a block into model space and then explodes it. Then run it and try to see if you can switch to paperspace and double click into viewports.

 

For some reason my autolisp that does this screws up my abillity to double click into viewports and its really annoying. When I get rid of the explode in the autolisp it works fine, but as soon as I put this one line back in I have to problem.

 

Thanks

Posted

Just an FYI, the command 2dto3d is a 3rd party software command that my company uses to distribute its 2-d and 3-d symbols to customers and employees.

 

(defun C:sa ()

(command "2dto3d" "l" "" "" "")

(command "_.tilemode" "1")

(setvar "qaflags" 1)

(command "_explode" "all" "")

(command "undo" "1")

(command "_explode" "all" "")

(setvar "qaflags" 0)

)

Posted

Try this:

 

(defun C:sa (/ i ss obj)
 (vl-load-com)
 (command "2dto3d" "l" "" "" "")
 (setvar 'TILEMODE 1)
 (if (setq i -1 ss (ssget "_X" '((0 . "INSERT"))))
   (while (setq ent (ssname ss (setq i (1+ i))))
     (and (vlax-method-applicable-p
            (setq obj (vlax-ename->vla-object ent)) 'Explode)
          (vla-explode obj))))
 (princ))

Posted

Worked like a charm... But do you mind explaining what the difference was... Other than the fact that I'm still a autolisp rookie.

Posted
Worked like a charm... But do you mind explaining what the difference was... Other than the fact that I'm still a autolisp rookie.

 

I just don't like using 'command' calls - they are slow and unreliable (as you have found...).

 

So I would opt for Visual LISP, if an AutoLISP method is not available. These methods are much more robust and 10x faster too. And, as we are only exploding blocks, vla-explode is fine. :)

 

Lee

Posted

I think I just found a problem... It seems that this lisp is creating a copy of the 3-d symbol and then exploding one of them, leaveing a block still there. I need only one 3-d block and I need it to be exploded.

 

Any ideas?

 

 

Edit:

 

Also, this could be related, but its copying my titleblock (which is a block) in paperspace onto itself and exploding one of them... I need this lisp to leave my my title block alone.

Posted
I think I just found a problem... It seems that this lisp is creating a copy of the 3-d symbol and then exploding one of them, leaveing a block still there. I need only one 3-d block and I need it to be exploded.

 

Any ideas?

 

 

Edit:

 

Also, this could be related, but its copying my titleblock (which is a block) in paperspace onto itself and exploding one of them... I need this lisp to leave my my title block alone.

 

It is currently exploding all blocks that it finds.

 

You can add a filter for the block name if you wish:

 

(defun C:sa (/ i ss obj)
 (vl-load-com)
 (command "2dto3d" "l" "" "" "")
 (setvar 'TILEMODE 1)
 (if (setq i -1 ss (ssget "_X" '((0 . "INSERT") (2 . "~Titleblock"))))
   (while (setq ent (ssname ss (setq i (1+ i))))
     (and (vlax-method-applicable-p
            (setq obj (vlax-ename->vla-object ent)) 'Explode)
          (vla-explode obj))
     (entdel ent)))
 (princ))

 

The above filter means: Filter out blocks called "Titleblock"

Posted

Works great, thanks again!!!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...