Guest Posted April 14, 2014 Share Posted April 14, 2014 Hi, i want load my linetypes from topo.lin file. Here is my code. (DEFUN C:fen (/ A1 KLIM PER S1 S2 SCL) (COMMAND "_layer" "_m" "fen" "_c" "140" "" "_LT" "" "C:\\topocad\\topo.lin\\fen" "") (SETQ SCL (GETVAR "useri1")) (SETQ KLIM (* 0.005 SCL)) (SETQ PER "Fen") (COMMAND "_linetype" "_s" "C:\\topocad\\topo.lin\\fen" "") (PRINT "") (SETQ S1 (GETPOINT "give the first point :")) (PRINT "") (WHILE (SETQ S2 (GETPOINT S1 " give the second point:")) (PRINT "") (COMMAND "_line" "non" S1 "non" S2 "") (COMMAND "_CHPROP" (ENTLAST) "" "_S" KLIM "") (SETQ S1 S2) ) ) when i run the code gives me this result ; error: Function cancelledSpecify linetype name or [?] : Can you help? Thanks Quote Link to comment Share on other sites More sharing options...
MSasu Posted April 14, 2014 Share Posted April 14, 2014 I think that you missed to specify what linetype to load: (COMMAND "_linetype" [color=red]"_L"[/color] [color=red]"NameOfYourLIneType"[/color] "C:\\topocad\\topo.lin\\fen[color=red].lin[/color]" "") To make that current, may want to check CELTYPE system variable, too. Quote Link to comment Share on other sites More sharing options...
Guest Posted April 14, 2014 Share Posted April 14, 2014 The lin file is topo.lin why you write fen.lin? Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted April 14, 2014 Share Posted April 14, 2014 Try this : (DEFUN C:fen ( / A1 KLIM S1 S2 SCL ) (COMMAND "_.-linetype" "_L" "fen" "C:\\topocad\\topo.lin") (COMMAND "_.-layer" "_m" "fen" "_c" "140" "" "_LT" "fen" "" "") (SETQ SCL (GETVAR "useri1")) (SETQ KLIM (* 0.005 SCL)) (PRINT "") (SETQ S1 (GETPOINT "give the first point :")) (PRINT "") (WHILE (SETQ S2 (GETPOINT S1 " give the second point:")) (PRINT "") (COMMAND "_.line" "non" S1 "non" S2 "") (COMMAND "_.change" (entlast) "" "_P" "_LT" "fen" "_S" KLIM "") (SETQ S1 S2) ) (PRINC) ) Quote Link to comment Share on other sites More sharing options...
Guest Posted April 14, 2014 Share Posted April 14, 2014 marko_ribar now gives me this Command: (LOAD "C:/Users/Prodromos/Desktop/fen.lsp") C:FENCommand: fen _.-linetype Current line type: "ByLayer" Enter an option [?/Create/Load/Set]: _L Enter linetype(s) to load: fen Enter name of linetype file to search : C:\topocad\topo.lin Linetype "fen" is already loaded. Reload it? _.-layer Yes or No, please. ; error: Function cancelled Linetype "fen" is already loaded. Reload it? Quote Link to comment Share on other sites More sharing options...
hmsilva Posted April 14, 2014 Share Posted April 14, 2014 Something like this perhaps. (DEFUN C:fen (/ A1 KLIM OLD_CLT PER S1 S2 SCL) (setq old_clt (getvar 'CELTYPE)) (if (and (not (tblsearch "ltype" "fen")) (findfile "C:\\topocad\\topo.lin") ) (command "-linetype" "l" "fen" "C:\\topocad\\topo.lin" "") ) (if (tblsearch "ltype" "fen") (progn (COMMAND "_layer" "_m" "fen" "_c" "140" "fen" "_lt" "fen" "fen" "") (SETQ SCL (GETVAR "useri1")) (SETQ KLIM (* 0.005 SCL)) ;; (SETQ PER "Fen") ????? (COMMAND "_linetype" "_s" "fen" "") ;;(PRINT "") (SETQ S1 (GETPOINT "\nSpecify the first point :")) ;;(PRINT "") (WHILE (SETQ S2 (GETPOINT S1 "\nSpecify the second point:")) ;;(PRINT "") (COMMAND "_line" "non" S1 "non" S2 "") (COMMAND "_CHPROP" (ENTLAST) "" "_S" KLIM "") (SETQ S1 S2) ) (setvar 'CELTYPE old_clt) ) ) (princ) ) HTH Henrique Quote Link to comment Share on other sites More sharing options...
Guest Posted April 14, 2014 Share Posted April 14, 2014 hmsilva this work , thanks Quote Link to comment Share on other sites More sharing options...
hmsilva Posted April 14, 2014 Share Posted April 14, 2014 hmsilva this work , thanks You're welcome, prodromosm Glad I could help Henrique Quote Link to comment Share on other sites More sharing options...
Guest Posted April 16, 2014 Share Posted April 16, 2014 Can any one add an option at the end of this lisp You want to convert this line to polyline Y/N (DEFUN C:fen (/ A1 KLIM OLD_CLT PER S1 S2 SCL) (setq old_clt (getvar 'CELTYPE)) (if (and (not (tblsearch "ltype" "fen")) (findfile "C:\\topocad\\topo.lin") ) (command "-linetype" "l" "fen" "C:\\topocad\\topo.lin" "") ) (if (tblsearch "ltype" "fen") (progn (COMMAND "_layer" "_m" "fen" "_c" "140" "fen" "_lt" "fen" "fen" "") (SETQ SCL (GETVAR "useri1")) (SETQ KLIM (* 0.005 SCL)) ;; (SETQ PER "Fen") ????? (COMMAND "_linetype" "_s" "fen" "") ;;(PRINT "") (SETQ S1 (GETPOINT "\nSpecify the first point :")) ;;(PRINT "") (WHILE (SETQ S2 (GETPOINT S1 "\nSpecify the second point:")) ;;(PRINT "") (COMMAND "_line" "non" S1 "non" S2 "") (COMMAND "_CHPROP" (ENTLAST) "" "_S" KLIM "") (SETQ S1 S2) ) (setvar 'CELTYPE old_clt) ) ) (princ) ) (initget "Yes No") (setq convert (cond ( (getkword "\nConvert to polylines? [Yes/No] <Y>: ") ) ( "Yes" ))) (if ( "Yes" convert) (command "_.pedit" "_M" "" "_J" "" "")) ) I dont know how to conect them thanks Quote Link to comment Share on other sites More sharing options...
MSasu Posted April 16, 2014 Share Posted April 16, 2014 Since the routine is drawing only one segment, why don't create that as polyline directly? (COMMAND "_[color=magenta]P[/color]line" "non" S1 "non" S2 "") Quote Link to comment Share on other sites More sharing options...
hmsilva Posted April 16, 2014 Share Posted April 16, 2014 Something like this perhaps (DEFUN C:fen (/ CONVERT KLIM OLD_CLT S1 S2 SCL SS) (setq old_clt (getvar 'CELTYPE)) (if (and (not (tblsearch "ltype" "fen")) (findfile "C:\\topocad\\topo.lin") ) (command "-linetype" "l" "fen" "C:\\topocad\\topo.lin" "") ) (if (tblsearch "ltype" "fen") (progn (setq ss (ssadd)) (COMMAND "_layer" "_m" "fen" "_c" "140" "fen" "_lt" "fen" "fen" "") (SETQ SCL (GETVAR "useri1")) (SETQ KLIM (* 0.005 SCL)) (COMMAND "_linetype" "_s" "fen" "") (SETQ S1 (GETPOINT "\nSpecify the first point :")) (WHILE (SETQ S2 (GETPOINT S1 "\nSpecify the second point:")) (COMMAND "_line" "non" S1 "non" S2 "") (COMMAND "_CHPROP" (ENTLAST) "" "_S" KLIM "") (ssadd (ENTLAST) ss) (SETQ S1 S2) ) (setvar 'CELTYPE old_clt) (initget "Yes No") (if (and (setq convert (cond ((getkword "\nConvert to polylines? [Yes/No] <Y>: ")) ("Yes") ) ) (/= (sslength ss) 0) (= convert "Yes") ) (if (= (getvar 'PEDITACCEPT) 0) (command "_.pedit" "_M" ss "" "_Y" "_J" "" "") (command "_.pedit" "_M" ss "" "_J" "" "") ) ) ) ) (princ) ) HTH Henrique Quote Link to comment Share on other sites More sharing options...
Guest Posted April 16, 2014 Share Posted April 16, 2014 Yes. Thank you hmsilva Quote Link to comment Share on other sites More sharing options...
hmsilva Posted April 16, 2014 Share Posted April 16, 2014 You're welcome, prodromosm Henrique Quote Link to comment Share on other sites More sharing options...
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.