Jump to content

Recommended Posts

Posted

I need to set color, line type & line weight to by layer

in my drawing by lisp.

Posted

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)

Posted
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

Posted

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

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

Posted

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

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

  • 5 years later...
Posted

Hi i need to do that in nested object inside block.

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