titoprax Posted February 3, 2009 Posted February 3, 2009 Hi to everyone my question is: I have created several blocks, some are dynamic blocks in a folder. I wanted to know if possible, by means of VBA, AutoLISP to create a command that insert in a fast every block that I created. I also have another question ... In autocad 2008 and autocad 2009 guideline functions give us the possibility to insert textoM or guideline with a block that contains (circle, square, etc) Can this be done through a menu or toolbar guideline to decide which block we want to insert? I mean, to have several buttons and allows us to insert each guideline with circular block, another block with square, triangle, etc. Quote
Lee Mac Posted February 3, 2009 Posted February 3, 2009 I have created several blocks, some are dynamic blocks in a folder. I wanted to know if possible, by means of VBA, AutoLISP to create a command that insert in a fast every block that I created. This could be achieved through LISP - but each block would need a basepoint to be inserted at ~ would this just be the origin? Quote
fixo Posted February 3, 2009 Posted February 3, 2009 Take a look at his page: http://usa.autodesk.com/adsk/servlet/autoindex?siteID=123112&id=2253435 scroll down half of page and search "Applying Customization: Building Toolbar - Part1-4" ~'J'~ Quote
Lee Mac Posted February 3, 2009 Posted February 3, 2009 If it is just a "fast block inserter" you are after: (defun c:fstblk (/ *error* vLst oVar file fLst dir) (vl-load-com) (defun *error* (msg) (mapcar 'setvar vLst oVar) (if (not (eq msg "")) (princ (strcat "<< Error: " (strcase msg) " >>"))) (princ)) (setq vLst (list "ATTREQ" "CLAYER" "CMDECHO") oVar (mapcar 'getvar vLst)) (if (not (tblsearch "LAYER" "BLOCKS")) (command "-layer" "M" "BLOCKS" "")) (if (setq file (getfiled "Select First Block" "C:\\" "dwg" 128)) (progn (setq fLst (vl-directory-files (setq dir (vl-filename-directory file)) "*.dwg" 0) fLst (mapcar '(lambda (f) (strcat dir "\\" f)) fLst)) (mapcar 'setvar vLst (list 0 "BLOCKS" 0)) (foreach x fLst (command "-insert" x (list 0 0 0) "" "" "")) (setq fLen (length fLst)) (princ (strcat "<< " (itoa fLen) " Blocks Inserted >>"))) (princ "\n<!> No File Selected <!>")) (*error* "") (princ)) Hope this helps 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.