wimal Posted February 15, 2018 Posted February 15, 2018 I need to set color, line type & line weight to by layer in my drawing by lisp. Quote
satishrajdev Posted February 15, 2018 Posted February 15, 2018 For Object : (vla-put-color ob 256) (vla-put-linetype ob "ByLayer") (vla-put-lineweight ob -1) For AutoCAD setting : (setvar "cecolor" "256") (setvar "celtype" "bylayer") (setvar "celweight" -1) Quote
wimal Posted February 15, 2018 Author Posted February 15, 2018 For Object : (vla-put-color ob 256) (vla-put-linetype ob "ByLayer") (vla-put-lineweight ob -1) For AutoCAD setting : (setvar "cecolor" "256") (setvar "celtype" "bylayer") (setvar "celweight" -1) Thanks a lot. It is very usefull Quote
BIGAL Posted February 15, 2018 Posted February 15, 2018 Another way (setq ssall (ssget "x")) (repeat (setq x (sslength ssall)) (setq obj (vlax-ename->vla-object (ssname ssall (setq x (- x 1))))) (vlax-put-property obj "Linetype" "Bylayer") (vlax-put-property obj "Lineweight" -1) (vlax-put-property obj "Color" acbylayer) ) ; end repeat Quote
wimal Posted February 16, 2018 Author Posted February 16, 2018 Another way (setq ssall (ssget "x")) (repeat (setq x (sslength ssall)) (setq obj (vlax-ename->vla-object (ssname ssall (setq x (- x 1))))) (vlax-put-property obj "Linetype" "Bylayer") (vlax-put-property obj "Lineweight" -1) (vlax-put-property obj "Color" acbylayer) ) ; end repeat Thanks for you also. Quote
pBe Posted February 16, 2018 Posted February 16, 2018 ...(foreach prop '( ("Linetype" "Bylayer" ) ("Lineweight" -1 ) ("Color" 256 ) ) (vlax-put obj (car prop) (cadr prop))) ... ... (mapcar '(lambda (p v) (vlax-put obj p v) v ) '("Linetype" "Lineweight" "Color") '("Bylayer" -1 256) ) .... (command "_Setbylayer" (ssget "X") "" "_Yes" "_Yes") Quote
wimal Posted February 16, 2018 Author Posted February 16, 2018 ...(foreach prop '( ("Linetype" "Bylayer" ) ("Lineweight" -1 ) ("Color" 256 ) ) (vlax-put obj (car prop) (cadr prop))) ... ... (mapcar '(lambda (p v) (vlax-put obj p v) v ) '("Linetype" "Lineweight" "Color") '("Bylayer" -1 256) ) .... (command "_Setbylayer" (ssget "X") "" "_Yes" "_Yes") Nice codes Thanks everybody. Quote
Anakozza Posted May 3, 2023 Posted May 3, 2023 Hi i need to do that in nested object inside block. 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.