KRBeckman Posted February 2, 2010 Posted February 2, 2010 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 Quote
Lee Mac Posted February 2, 2010 Posted February 2, 2010 Could you post the code that is causing the problem? Quote
KRBeckman Posted February 2, 2010 Author Posted February 2, 2010 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) ) Quote
Lee Mac Posted February 2, 2010 Posted February 2, 2010 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)) Quote
KRBeckman Posted February 2, 2010 Author Posted February 2, 2010 Worked like a charm... But do you mind explaining what the difference was... Other than the fact that I'm still a autolisp rookie. Quote
Lee Mac Posted February 2, 2010 Posted February 2, 2010 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 Quote
KRBeckman Posted February 3, 2010 Author Posted February 3, 2010 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. Quote
Lee Mac Posted February 3, 2010 Posted February 3, 2010 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" Quote
Recommended Posts
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.