Lee Mac Posted January 6, 2009 Posted January 6, 2009 The Attribute Editor does not appear for me... lee/wannabe if it does appear during an insertion of a block with attribute while running your lisp, set attdia to 0 to remove the editor.....:-) How do you know so many variables.... Quote
wannabe Posted January 6, 2009 Posted January 6, 2009 Superb, Lee. Now I can get back to what I come to work for and not have to insert blocks and spend my time on CAD ( chatting up the receptionist ) Quote
wizman Posted January 6, 2009 Posted January 6, 2009 also, during insertion of a block using insert command, your osnaps may give wrong coordinates. either; (command "-insert" blkfile "_non" pts "1" "1" "0") or set osmode to 0 Quote
Lee Mac Posted January 6, 2009 Posted January 6, 2009 Good point Wizman, I think by the end of this, the routine will be close to perfect with the amount of refinements we've had! Quote
Lee Mac Posted January 6, 2009 Posted January 6, 2009 I have added Wizman's suggestion, and improved the way the routine sets the variables. - its untested my end, so *hopefully* it'll work! (defun c:ITREE (/ *error* file file1 blk blkfile pts atrib blkent) (defun *error* (msg) (mapcar 'setvar varlist oldvars) (if (= msg "") (princ (strcat (itoa blk) " Blocks Inserted.")) (princ (strcat "\n" (strcase msg))) ) ;_ end if ) ;_ end defun (setq varlist (list "CMDECHO" "ATTREQ" "OSMODE") oldvars (mapcar 'getvar varlist) ) ;_ end setq (selcfile) (blocksel) (mapcar 'setvar varlist (list 0 0 0)) (setq file1 (open file "r") blk 0 ) ;_ end setq (while (and (/= (setq pts (read-line file1)) nil) (/= (setq atrib (read-line file1)) nil) ) ;_ end and (command "-insert" blkfile pts "1" "1" "0") (setq blkent (entget (entnext (entlast)))) (setq blkent (subst (cons 1 atrib) (assoc 1 blkent) blkent)) (entmod blkent) (setq blk (1+ blk)) ) ;_ end while (command "_regenall") (*error* "") (close file1) (princ) ) ;_ end defun (defun selcfile () (setq file (getfiled "Select a Co-ordinate File" "C:\\" ; [b][color=Red]Change this to change default Search path[/color][/b] "txt" 8 ) ;_ end getfiled ) ;_ end setq ) ;_ end defun (defun blocksel () (setq blkfile (getfiled "Select a Block" "C:\\" ; [b][color=Red]Change this to change default Search path[/color][/b] "dwg" 8 ) ;_ end getfiled ) ;_ end setq ) ;_ end defun Now you can get back to chatting up the receptionist... Quote
Lee Mac Posted January 6, 2009 Posted January 6, 2009 Ahh, and one more thing - bear in mind that you can change the parts that I have highlighted in red to suit your filepath so that you won't need so many clicks! - Even more time converted to chat-up time! Just remember to use double backslash, and also finish on a double backslash, i.e. C:\\Lee Mac\\Folder\\ Quote
wannabe Posted January 6, 2009 Posted January 6, 2009 Ahh, and one more thing - bear in mind that you can change the parts that I have highlighted in red to suit your filepath so that you won't need so many clicks! - Even more time converted to chat-up time! Just remember to use double backslash, and also finish on a double backslash, i.e. C:\\Lee Mac\\Folder\\ LOL Cheers. Quote
Madruga_SP Posted January 15, 2013 Posted January 15, 2013 Mr. Lee, Your lisp seems to be perfect to me. I'm looking for it in ages. Do you mind if ask for a little request for your code? your lisp didn't working for my text format. FUNCTION CANCELLED Can you help me, please? TEST.txt BTREE.dwg Thank in advance Quote
javid Posted January 25, 2013 Posted January 25, 2013 (edited) Hi Dear Lee Mac, Would you please help me to solve my problem? Indeed I need a lisp routin that can insert a block atomate in to any intersections i have in my drawing. Thanks in advance for your kindness. Sincerely Yours, Javid. Edited January 25, 2013 by javid Wrong request:"> Quote
WBODE Posted October 8, 2013 Posted October 8, 2013 I hope you guys are still there... I have same problem. Trying to insert a block at particular coordinates and put a text adjacent. I have created a .txt file - with these sample : 12090,968118.4815',202777.4346' 12063,968118.5594',202360.2748' 12033,968118.7333',201601.7047' 12044,968118.7707',201736.1973' 12038,968118.8927',201647.7227' when I put in lisp routine - I get pop up asking for location of txt file then pop up for block location. All that works o.k. - but then I get: BAD ARGUMENT TYPE: LENTITYP NIL I am sure it is something I am missing - remember, I am not fluent in lisp routines... Quote
WBODE Posted October 8, 2013 Posted October 8, 2013 (defun c:ITREE (/ *error* file file1 blk blkfile pts atrib blkent) (defun *error* (msg) (mapcar 'setvar varlist oldvars) (if (= msg "") (princ (strcat (itoa blk) " Blocks Inserted.")) (princ (strcat "\n" (strcase msg))) ) ;_ end if ) ;_ end defun (setq varlist (list "CMDECHO" "ATTREQ") oldvars (mapcar 'getvar varlist) ) ;_ end setq (selcfile) (blocksel) (setvar "CMDECHO" 0) (setvar "ATTREQ" 0) (setq file1 (open file "r") blk 0 ) ;_ end setq (while (and (/= (setq pts (read-line file1)) nil) (/= (setq atrib (read-line file1)) nil) ) ;_ end and (command "-insert" blkfile pts "1" "1" "0") (setq blkent (entget (entnext (entlast)))) (setq blkent (subst (cons 1 atrib) (assoc 1 blkent) blkent)) (entmod blkent) (setq blk (1+ blk)) ) ;_ end while (command "_regenall") (*error* "") (close file1) (princ) ) ;_ end defun (defun selcfile () (setq file (getfiled "Select a Co-ordinate File" "C:\\Users\\Wbode\\Documents\\c.txt\\" "txt" 8 ) ;_ end getfiled ) ;_ end setq ) ;_ end defun (defun blocksel () (setq blkfile (getfiled "Select a Block" "C:\\Users\\Wbode\\Documents\\donut.dwg\\" "dwg" 8 ) ;_ end getfiled ) ;_ end setq ) ;_ end defun Quote
Lee Mac Posted October 8, 2013 Posted October 8, 2013 Wow - this is an old thread! @WBODE: First off - welcome to CADTutor! My code in this thread is incredibly old and very poorly written by my current programming standards; as a quick workaround, you could try my (also rather old) Point Manager program, with the input set to 'File' and output set to 'Block'. I hope this helps! PS: Please edit your post and enclose your code with code tags: [highlight][noparse] [/noparse][/highlight] Your code here [highlight][noparse] [/noparse][/highlight] Quote
WBODE Posted October 9, 2013 Posted October 9, 2013 I will see if our IT group will let me download... thank you. 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.