- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
The code below was provided by Sea.Haven. It was his solution to a LISP command I requested in a different post and I wanted to modify it a little bit, but I do not have the knowledge to do so. I am just getting into the LISP coding and have little to none knowledge about LISP code. I did do some C++ coding in my past and hopefully this knowledge will help me understand and jump into learning the LISP language a little faster.
Anyways this is the code sea.haven came up with.
(defun c:xrlyrc2 ( / c_lyrs obj lay)
(vl-load-com)
(setvar 'xrefoverride 1)
(setq c_lyrs (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))))
(while (setq col (getreal "\nEnter colour number 1-255 Enter to Exit "))
(setq obj (vlax-ename->vla-object (car (nentsel "\nselect xref layer"))))
(setq lay (vla-get-layer obj))
(vlax-for lyr c_lyrs
(if (= (vlax-get lyr 'name) lay) (vlax-put lyr 'color col))
)
(command "regen")
)
(princ)
)
(c:xrlyrc2)
This code asks the user to select a color between 1-255 then asks the user to select which layer the user wants the color selected earlier to be applied to.
There are 2 things I would like to modify if possible.
1) The order in which this code works. I would like to select the xref layer 1st then select the color.
2) Instead of telling the user to type in a color # between 1-255. Is it possible to have the "Select color" window to pop-up. And have it say "Select Color from color pallet window." This is the pop-up I am thinking could pop-up.
Thanks for your help!
Solved! Go to Solution.