totzky Posted November 30, 2008 Posted November 30, 2008 Somebody help me fix my code. Please! (defun C:llt() (command "-linetype" "l" "cen*" "acadiso.lin" "") (command "-linetype" "l" "hid*" "acadiso.lin" "") (princ) ) Quote
totzky Posted December 1, 2008 Author Posted December 1, 2008 ...working on it and this is what I've got. It seems to work fine. Any suggestions? (defun c:llt() (setq a "Center") (if (= (tblsearch "ltype" a) nil) (command "-linetype" "l" a "acadiso.lin" "") (princ)) (setq b "Center2") (if (= (tblsearch "ltype" b) nil) (command "-linetype" "l" b "acadiso.lin" "") (princ)) (setq c "Centerx2") (if (= (tblsearch "ltype" c) nil) (command "-linetype" "l" c "acadiso.lin" "") (princ)) (setq d "Hidden") (if (= (tblsearch "ltype" d) nil) (command "-linetype" "l" d "acadiso.lin" "") (princ)) (setq e "Hidden2") (if (= (tblsearch "ltype" e) nil) (command "-linetype" "l" e "acadiso.lin" "") (princ)) (setq f "Hiddenx2") (if (= (tblsearch "ltype" f) nil) (command "-linetype" "l" f "acadiso.lin" "") (princ)) (princ) ) Quote
ASMI Posted December 1, 2008 Posted December 1, 2008 Too much exatra code: (defun c:llt() (foreach lt '("Center" "Center2" "Centerx2" "Hidden" "Hidden2" "Hiddenx2") (if(not(tblsearch "ltype"lt)) (command "_.-linetype" "_l" lt "acadiso.lin" "") ); end if ); end foreach (princ) ); end of c:llt Quote
JONTHEPOPE Posted December 1, 2008 Posted December 1, 2008 this could help if you want to add some words to lines. not sure how to shorten second dot if word is shorter than 3 letters i think it puts def in folder than you edit from there . ;Tip1684: LTXT.LSP Linetype Generator (c)2001, Darren Marker (defun C:LTXT () (setvar "cmdecho" 0) (setq V:CLAYER (getvar "clayer")) (setq V:EXPERT (getvar "expert")) (if (not V:LINET) (setq V:LINET "XX") ) ;_ end of if (setq V:LINET_X (getstring (strcat "\n \n \nEnter line text: <" V:LINET ">" ) ;_ end of strcat ) ;_ end of getstring ) ;_ end of setq (if (/= V:LINET_X "") (setq V:LINET (strcase V:LINET_X)) ) ;_ end of if (setq V:LINET (strcase V:LINET)) (LT_MAKER) ) ;_ end of defun (defun LT_MAKER () (setvar "expert" 4) (setq V:LINET_L (strlen V:LINET)) (setq V:LINET_W (rtos (* V:LINET_L 0.1) 2 1)) (setq V:LT_FILE "c:\\temp\\lt_temp.lin") (setq V:LT_VAR1 (open V:LT_FILE "w")) (setq V:LT_TEXTL1 (strcat "*" V:LINET "," V:LINET "----" V:LINET "----" V:LINET "----" V:LINET ) ;_ end of strcat ) ;_ end of setq (setq V:LT_TEXTL2 (strcat "A,5.5,-1.5,[" (chr 34) V:LINET (chr 34 ) ;_ end of chr ",SIMPLEX,S=0.1,R=0.0,X=-1.25,Y=-0.25],-" V:LINET_W ) ;_ end of strcat ) ;_ end of setq (setq V:LT_VAR2 (write-line V:LT_TEXTL1 V:LT_VAR1)) (setq V:LT_VAR3 (write-line V:LT_TEXTL2 V:LT_VAR1)) (close V:LT_VAR1) (command "-linetype" "l" V:LINET V:LT_FILE "") (setvar "expert" V:EXPERT) (command ".celtype" V:LINET) (princ (strcat "\n \n \nCurrent Layer -" (getvar "clayer" ) ;_ end of getvar ) ;_ end of strcat ) ;_ end of princ (princ) (princ (strcat "\n \n \nCurrent Entity linetype set to:" V:LINET ) ;_ end of strcat ) ;_ end of princ (princ) (setq V:PNT1 (getpoint "\nPick start point:")) (command ".line" V:PNT1) (while (setq V:PT (getpoint (getvar "lastpoint") "\nNext point or <Return to terminate>:" ) ;_ end of getpoint ) ;_ end of setq (command V:PT) ) ;_ end of while (command) (command) (setvar "celtype" "bylayer") (princ) (princ "\n \nLine-Text terminated. Linetype set to BYLAYER:" ) ;_ end of princ (princ) ) ;_ end of defun (princ) (princ " Line-Text Loaded...") (princ) (princ (strcat "\n \n" (chr 34) "LTXT" (chr 34) " to execute:" ) ;_ end of strcat ) ;_ end of princ (princ) Quote
totzky Posted December 2, 2008 Author Posted December 2, 2008 I have tried your code JOINTHEPOPE but it didn't give what I wanted. I don't know if its just that I don't know how to use or what, but its not working. Anyway ASMI's code is good enough. Thanks for the effort. 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.