Jump to content

Set color, line type & line weight to by layer


wimal

Recommended Posts

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)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

...(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")

Link to comment
Share on other sites

...(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.

Link to comment
Share on other sites

  • 5 years later...

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...