home *** CD-ROM | disk | FTP | other *** search
- ;;; CHROMA.lsp
- ;;; ¬⌐┼v (C) 1991 Autodesk ñ╜Ñq
- ;;;
- ;;; Ñ╗│n┼ΘºK╢O¿╤▒z╢iªµÑ⌠ª≤Ñ╬│~╗▌¿D¬║½■¿⌐íB¡╫º∩ñ╬╡oªµ, ª²¼O░╚╜╨┐φ┤`ñU¡z
- ;;; ¡∞½h :
- ;;;
- ;;; 1) ñWªC¬║¬⌐┼v│qºi░╚╗▌ÑX▓{ªb¿Cñ@Ñ≈½■¿⌐∙╪íC
- ;;; 2) ¼█├÷¬║╗í⌐·ñσÑ≤ñ]Ñ▓╢╖⌐·╕ⁿ¬⌐┼v│qºiñ╬Ñ╗╢╡│\Ñi│qºiíC
- ;;;
- ;;; Ñ╗│n┼Θ╢╚┤ú¿╤º@¼░└│Ñ╬ñW¬║░╤ª╥, ª╙Ñ╝┴n⌐·⌐╬┴⌠ºtÑ⌠ª≤½O├╥; ╣∩⌐≤Ñ⌠ª≤»S«φ
- ;;; Ñ╬│~ñº╛A║┘⌐╩, ÑHñ╬░╙╖~╛P░Γ⌐╥┴⌠ºtÑX¿π¬║½O├╥, ªbª╣ñ@╖ºñ⌐ÑHº_╗{íC
- ;;;
- ;;;
- ;;;----------------------------------------------------------------------------
- ;;; DESCRIPTION
- ;;;
- ;;; Chromatic Pallete style color selection dialog.
- ;;;
- ;;; Globals:
- ;;;
- ;;; chroma_color - Integer color index. The last value selected
- ;;; by the user in chroma dialog. It is not cleared or reset
- ;;; by a cancel. Only used for communication between callback
- ;;; functions and the (chroma) funciton.
- ;;;
- ;;; Depends on the definitions for the dialog provided in chroma.dcl.
- ;;;
-
- ;;;
- ;;; C:COLOR -- Replacement for built-in command COLOR
- ;;; Uses the chroma pallete style color selector.
- ;;;
- (defun c:color (/ co_oce clrx co_err co_oer)
- (setq co_oer *error* *error* co_err)
- (setq co_oce (getvar "cmdecho"))
- (setvar "cmdecho" 0)
- ;;
- ;; Internal error handler defined locally
- ;;
-
- (defun co_err (s) ; error catcher
- (if (/= s "Function cancelled")
- (if (= s "quit / exit abort")
- (princ)
- (princ (strcat "\n┐∙╗~: " s))))
- (if co_oer ; If an old error routine exists
- (setq *error* co_oer)) ; then, reset it
-
- ;; Reset command echoing on error
- (if co_oce (setvar "cmdecho" co_oce))
- (if term (term_dialog))
- (princ)
- )
-
- (graphscr)
-
- ;; Call the dialog here...
- (setq clr (acad_colordlg (cstoci (getvar "cecolor"))))
-
- (if clr
- (command "_.COLOR" (citocs clr)))
-
- (setq *error* co_oer)
- (setvar "cmdecho" co_oce)
- (princ)
- )
-
- ;;;
- ;;; CSTOCI -- Color string to color index
- ;;; Convert an arbitrary case string into a color index.
- ;;; Returns nil if string is not a valid color.
- ;;;
- (defun cstoci (str)
- (setq str (strcase str))
- (cond
- ((= str "RED") 1)
- ((= str "YELLOW") 2)
- ((= str "GREEN") 3)
- ((= str "CYAN") 4)
- ((= str "BLUE") 5)
- ((= str "MAGENTA") 6)
- ((= str "WHITE") 7)
- ((= str "BYLAYER") 256)
- ((= str "BYBLOCK") 0)
- ((= str "BY LAYER") 256)
- ((= str "BY BLOCK") 0)
- ((and (< 0 (atoi str)) (> 256 (atoi str))) (atoi str))
- (nil))
- )
-
-
- ;;;
- ;;; CITOCS -- Convert color index into standard color name.
- ;;; Will return the standard and logical color names as text
- ;;; strings. Returns nil for out-of-range color indicies.
- ;;;
- (defun citocs(i)
- (cond
- ((= i 0) "BYBLOCK")
- ((= i 1) "red")
- ((= i 2) "yellow")
- ((= i 3) "green")
- ((= i 4) "cyan")
- ((= i 5) "blue")
- ((= i 6) "magenta")
- ((= i 7) "white")
- ((= i 256) "BYLAYER")
- ((and (< 0 i) (> 256 i)) (itoa i))
- (nil))
- )
-
- (command "_.UNDEFINE" "COLOR")
- (defun c:co () (c:color))
- (princ "\n\tíuC:COlorívñw╕ⁿñJ; ╜╨┴ΣñJ CO ⌐╬ COLOR ¿╙┐∩╛▄├CªΓíC")
- (princ)