danyra Posted December 2, 2019 Posted December 2, 2019 (edited) Im a begginer, I drawn a line in autolisp with this "code": (setq p1 (getpoint "\nPunto Inicial:")) (setq p2 (polar p1 (* 1.5 pi) 0.18)) (command "line" p1 p2 "") but, how can I change the color of this line?? For example I want yellow Thanks for your help. Edited December 2, 2019 by danyra Quote
rkmcswain Posted December 2, 2019 Posted December 2, 2019 You could change your current layer to a layer that is yellow before creating the line. You could use (entmake) instead of (command) and set the color during creation time. (sample below) You could run (command "._change) after (command ._line") and change the color of (entlast) to yellow, or move it to a yellow layer. (setq p1 (getpoint "\nPunto Inicial:")) (setq p2 (polar p1 (* 1.5 pi) 0.18)) (entmake (list (cons 0 "LINE") (cons 8 "0") (cons 62 2) (cons 10 p1) (cons 11 p2) ) ) 1 Quote
ronjonp Posted December 2, 2019 Posted December 2, 2019 As @rkmcswain mentioned you could do something like so: (if (setq p1 (getpoint "\nPunto Inicial:")) (progn (setq p2 (polar p1 (* 1.5 pi) 0.18)) ;; (command "line" p1 p2 "") (entmakex (list '(0 . "line") (cons 10 p1) (cons 11 p2) '(62 . 2))) ) ) 1 Quote
danyra Posted December 2, 2019 Author Posted December 2, 2019 8 minutes ago, ronjonp said: (entmakex (list '(0 . "line") (cons 10 p1) (cons 11 p2) '(62 . 2))) Ok, its works, thanks you both. But, how can I change to a blue color now? Quote
danyra Posted December 2, 2019 Author Posted December 2, 2019 26 minutes ago, rkmcswain said: (list (cons 0 "LINE") (cons 8 "0") (cons 62 2) (cons 10 p1) (cons 11 p2) ) ) Thank you a lot, can you explain me how its works? what does each of those numbers mean? Becaause I have a lot of lines and they have different colors, for example blue. Quote
ronjonp Posted December 2, 2019 Posted December 2, 2019 (edited) 21 minutes ago, danyra said: Ok, its works, thanks you both. But, how can I change to a blue color now? The '(62 . #) is the index color. Make this change for blue: '(62 . 5) Edited December 2, 2019 by ronjonp 1 Quote
danyra Posted December 2, 2019 Author Posted December 2, 2019 5 minutes ago, ronjonp said: The '(62 . #) is the index color. Make this change for blue: '(62 . 5) ok thanks you, I get it Quote
ronjonp Posted December 2, 2019 Posted December 2, 2019 38 minutes ago, danyra said: ok thanks you, I get it Glad to help You could use something like this to be able to choose your color before drawing the line: (defun c:foo (/ c p1) (if (and (setq c (acad_colordlg 1)) (setq p1 (getpoint "\nPunto Inicial:"))) (entmakex (list '(0 . "line") (cons 10 p1) (cons 11 (polar p1 (* 1.5 pi) 0.18)) (cons 62 c))) ) (princ) ) 1 Quote
BIGAL Posted December 3, 2019 Posted December 3, 2019 A command style version (defun c:foo2 (/ c p1) (if (and (setq c (acad_colordlg 1)) (setq p1 (getpoint "\nPunto Inicial:"))) (progn (setq p2 (polar p1 (* 1.5 pi) 0.18)) (command "line" p1 p2 "") (command "chprop" (entlast) "" "c" c "") ) ) (princ) ) 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.