Autolisp support required to change selected element to 123 layer and set color of the selected element to by layer

Autolisp support required to change selected element to 123 layer and set color of the selected element to by layer

karthikeyanskm
Contributor Contributor
404 Views
3 Replies
Message 1 of 4

Autolisp support required to change selected element to 123 layer and set color of the selected element to by layer

karthikeyanskm
Contributor
Contributor

i have prepared a lisp to set selected element to 123 layer. But dont know to how set the color to bylayer.
My code:
Changes selected objects to Layer 123
(defun c:RD1 ()
(command "_.chprop"
(ssget ) "" "LA" "123" "") )

0 Likes
Accepted solutions (2)
405 Views
3 Replies
Replies (3)
Message 2 of 4

paullimapa
Mentor
Mentor
Accepted solution

You’re almost there.  It’s another prompt in the Chprop command:

(command "_.chprop"
(ssget) "" "_LA" "123" "_Color" "_Bylayer" "") )

Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 4

TomBeauford
Advisor
Advisor
Accepted solution
(defun c:RD1 ()
  (command "_.chprop"
  (ssget ) "" "LA" "123" "Color" "ByLayer" "")
)

Of course that function only works for changing to one layer and only sets one property to ByLayer.

You can set any layer you want for selected objects from the Layers drop-down in the Ribbon or Quick Access Toolbar and the SETBYLAYER command can set all properties you want to ByLayer in it's Settings or set the Color from the drop-down in Properties.

64bit AutoCAD Map & Civil 3D 2023
Architecture Engineering & Construction Collection
2023
Windows 10 Dell i7-12850HX 2.1 Ghz 12GB NVIDIA RTX A3000 12GB Graphics Adapter
0 Likes
Message 4 of 4

Sea-Haven
Mentor
Mentor

Bylayer is also color 256.

0 Likes