Selected Objects to color# LIS
Hi guys i'm trying to figure out how to make this lisp and I'm just not able to get it doneI would like a lisp to do this by launching "CHC"
- Select objects (or objects could be already selected when launching the CHC lisp)
- Question asked: "Which color ?" (answering a color number)
- If number is 256 or more (its wrong) and the question has to be reasked to get a number between 1 and 255.
-Change selection set to the color# answered
I've try this but it doesnt work :
(defun c:chc ( / obj col#)(setq cmdecho 0)(setq obj (ssget))(setq col# (getint "\nQuelle couleur ? : "))(if (< col# 255) (setq col# (getint "\nQuelle couleur ? : " (command "change" obj "" "properties" "color" col# ""))))(princ))
Thanks! How many people know what color is associated with what color number?
Lee Mac came up with this lisp routine for another thread where a similar question was asked.
http://www.cadtutor.net/forum/showthread.php?43839-Lisp-to-change-all-objects-with-a-certain-color-to-another-color Try it this way instead .
(defun c:chc (/ c s i e) (if (and (setq c (acad_colordlg 256)) (progn (princ "\n Select object to change thei colors ") (setq s (ssget "_:L")) ) ) (repeat (setq i (sslength s)) (setq e (entget (ssname s (setq i (1- i))))) (entmod (append e (list (cons 62 c)))) ) ) (princ))
I does, our plot setup use color for lineweight. Often I force color on objects.
Thanks I'll check it out OK...so maybe you do.Do your colleagues know all the color numbers?
Does it make sense to override layer colors?
Great, can you make that I can type number instead and add the option for the pop up by typing "C" for if I don't remeber my color number?
If not, I'll take it like this.
Great work
Thanks a lot for the fast answers! I'd look into (acad_colordlg )
-David
They do. We have a chart and for a specific lineweight, we have ±2 color number. Steps of ±0.1.
It makes sense for us to override layer colors for hidden parts that we have to see thinner. Not everything is forced in the drawing! Wouldn't it make more sense to have a layer called Hidden with an assigned color like grey for example? This... ?
(defun c:chc (/ s i e) (if (not c) (setq c 1) ) (while (not (< 0 (setq c (cond ((getint (strcat "\n Specify color between ( " (itoa c) " ) : " ) ) ) (t c) ) ) 255 ) ) (princ "\n Number of color must be between ") ) (if (and c (progn (princ "\n Select object to change thei colors ") (setq s (ssget "_:L")) ) ) (repeat (setq i (sslength s)) (setq e (entget (ssname s (setq i (1- i))))) (entmod (append e (list (cons 62 c)))) ) ) (princ))
页:
[1]
2