Guest Posted October 6, 2014 Share Posted October 6, 2014 Hi , I am trying to write a lisp to draw a polyline in specific layer with Global width 0.10 here is the code (defun C:PLGB (/ plw) (COMMAND "_layer" "_m" "Global PL" "_c" "25" "DASHED2" "_lt" "DASHED2" "DASHED2" "") (COMMAND "_linetype" "_s" "DASHED2" "") (setq plw (getvar 'plinewid) (setvar 'plinewid 0.10) (command "_.pline") (setvar 'plinewid plw) ) ); defun This code gives me this message ; error: syntax error Can any one help me ? Thanks Quote Link to comment Share on other sites More sharing options...
hanhphuc Posted October 6, 2014 Share Posted October 6, 2014 (defun C:PLGB (/ plw) (COMMAND "_layer" "_m" "Global PL" "_c" "25" "DASHED2" "_lt" "DASHED2" "DASHED2" "") (COMMAND "_linetype" "_s" "DASHED2" "") (setq plw (getvar 'plinewid)[color="red"][b]) [/b]; missing parentheless?[/color] (setvar 'plinewid 0.10) (command "_.pline") (setvar 'plinewid plw) [color="red"] <--- remove this[/color] ); defun Quote Link to comment Share on other sites More sharing options...
Guest Posted October 6, 2014 Share Posted October 6, 2014 thank you for the reply hanhphuc I do the changes but i can not see the global width 0.50 . It still 0 ? (defun C:PLGB (/ plw) (COMMAND "_layer" "_m" "Global PL" "_c" "25" "DASHED2" "_lt" "DASHED2" "DASHED2" "") (COMMAND "_linetype" "_s" "DASHED2" "") (setq plw (getvar 'plinewid)) (setvar 'plinewid 0.50) (command "_.pline") (setvar 'plinewid plw) ); defun I want to add global width 0.50 line type scale 0.10 The collor of the layer is white and not 25 (i don't now why ? ) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 6, 2014 Share Posted October 6, 2014 Try the following: (defun c:plgb ( / lay val var ) (setq var '(clayer plinewid cmdecho celtscale cecolor celtype) val (mapcar 'getvar var) lay "Global PL" ) (mapcar 'setvar (cdr var) '(0.5 0 0.1 "bylayer" "bylayer")) (command "_.-layer" "_m" lay "_c" 25 lay "_l" "dashed2" lay "_t" lay "_u" lay "_on" lay "_s" lay "") (setvar 'cmdecho 1) (command "_.pline") (while (= 1 (logand 1 (getvar 'cmdactive))) (vl-cmdf "\\")) (mapcar 'setvar var val) (princ) ) Quote Link to comment Share on other sites More sharing options...
Guest Posted October 6, 2014 Share Posted October 6, 2014 Hi Lee Mac . I try your code but the results is not exactly what i want. I want to create a layer with name "Global PL" and color 25 with line type "dashed2" but a) in the line type Manager I want global scale factor 1 ,current object scale 1 b)When i select the polyline --> have global width 0.50 Look the attach photo Thanks Quote Link to comment Share on other sites More sharing options...
Guest Posted October 7, 2014 Share Posted October 7, 2014 I try to understand something in 1.dwg file lisp works perfect. in 2.dwg file the polyline have the same settings with 1.dwg but is not the same !!!! I can not understand (defun c:plgb ( / lay val var ) (setq var '(clayer plinewid cmdecho celtscale cecolor celtype) val (mapcar 'getvar var) lay "Global PL" ) (mapcar 'setvar (cdr var) '(0.5 0 0.1 "bylayer" "bylayer")) (command "_.-layer" "_m" lay "_c" 25 lay "_l" "DASHED2" lay "_t" lay "_u" lay "_on" lay "_s" lay "") (setvar 'cmdecho 1) (command "_.pline") (while (= 1 (logand 1 (getvar 'cmdactive))) (vl-cmdf "\\")) (mapcar 'setvar var val) (princ) (setvar 'CELTYPE old_clt) [color="red"]; I add this line to the code and now global scale factor 1 ,current object scale 1[/color] ) Thanks 1.dwg 2.dwg 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.