ZZombie Posted July 10, 2009 Posted July 10, 2009 I believe I found this LISP on this site a while back, and it actually works great. Its for duplicating and inserting a block, which also asks for for new attribute definitions. What i need help with, is every time the block is duplicated it asks for scale and rotation once inserted. I would like to get rid of those 2 steps if possible. Any help always appreciated! ;;; Create a duplicate block definition (defun c:DD (/ en ed bname nname fname fdia) (if (and (setq en (entsel "\nPick block: ")) (setq ed (entget (car en))) (= (cdr (assoc 0 ed)) "INSERT") (setq nname (getstring nil "\nNew name: ")) ) ;_ end of and (progn (setq bname (cdr (assoc 2 ed)) fname (strcat (getvar "TEMPPREFIX") nname ".DWG") ) ;_ end of setq (if (findfile fname) (vl-file-delete fname) ) ;_ end of if (setq fdia (getvar "FILEDIA")) (setvar "FILEDIA" 0) (command ".-WBLOCK" fname bname) (command ".-INSERT" fname) (setvar "FILEDIA" fdia) ) ;_ end of progn ) ;_ end of if (princ) ) ;_ end of defun Quote
Commandobill Posted July 10, 2009 Posted July 10, 2009 Ugly. but will work.... ;;; Create a duplicate block definition (defun c:DD (/ en ed bname nname fname fdia) (if (and (setq en (entsel "\nPick block: ")) (setq ed (entget (car en))) (= (cdr (assoc 0 ed)) "INSERT") (setq nname (getstring nil "\nNew name: ")) ) ;_ end of and (progn (setq bname (cdr (assoc 2 ed)) fname (strcat (getvar "TEMPPREFIX") nname ".DWG") ) ;_ end of setq (if (findfile fname) (vl-file-delete fname) ) ;_ end of if (setq fdia (getvar "FILEDIA")) (setvar "FILEDIA" 0) (command ".-WBLOCK" fname bname) (command ".-INSERT" fname (getpoint) 1 1 0) (setvar "FILEDIA" fdia) ) ;_ end of progn ) ;_ end of if (princ) ) ;_ end of defun so all you want is a block thats the same as another block just with a different name? Quote
ZZombie Posted July 10, 2009 Author Posted July 10, 2009 I have a block with 3 attributes, which i need to repeatedly copy/paste for different info on different parts of the drawing. The only input i actually need when inserting the block, is for the block name and for another attribute, which i setup when i make the block. This lisp does just that, except it asks for scale/rot when i go to insert the block, and its just a couple of unneccesary steps for me 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.