wimal Posted February 15, 2018 Share Posted February 15, 2018 I need to set color, line type & line weight to by layer in my drawing by lisp. Quote Link to comment Share on other sites More sharing options...
satishrajdev Posted February 15, 2018 Share 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 Link to comment Share on other sites More sharing options...
wimal Posted February 15, 2018 Author Share 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 Link to comment Share on other sites More sharing options...
BIGAL Posted February 15, 2018 Share 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 Link to comment Share on other sites More sharing options...
wimal Posted February 16, 2018 Author Share 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 Link to comment Share on other sites More sharing options...
pBe Posted February 16, 2018 Share 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 Link to comment Share on other sites More sharing options...
wimal Posted February 16, 2018 Author Share 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 Link to comment Share on other sites More sharing options...
Anakozza Posted May 3, 2023 Share Posted May 3, 2023 Hi i need to do that in nested object inside block. 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.