Author Topic: acad_colordlg  (Read 3891 times)

0 Members and 1 Guest are viewing this topic.

rude dog

  • Guest
acad_colordlg
« on: October 03, 2004, 01:16:09 AM »
Is it possible to have the color dialog box pop during a routine....
In other words what can you type in to get the color dialog box to pop up?

Crank

  • Water Moccasin
  • Posts: 1503
acad_colordlg
« Reply #1 on: October 03, 2004, 05:09:24 AM »
(acad_colordlg color [flag])

If [flag] is set to nil, it disables the ByLayer and ByBlock buttons. Omitting the flag argument or setting it to a non-nil value enables the buttons.

A colornum value of 0 defaults to ByBlock, and a value of 256 defaults to ByLayer.

Example:
Code: [Select]

(setq layername "TESTLAYER" col nil linet "HIDDEN" defaultcol 3)
(while (not col)
(setq col (acad_colordlg defaultcol nil))
(if (not col)(alert "You must choose a color for this new layer!!!"))
)
(command ".layer" "m" layername "c" (itoa col) "" "l" linet "" "")
Vault Professional 2023     +     AEC Collection

rude dog

  • Guest
acad_colordlg
« Reply #2 on: October 03, 2004, 01:51:58 PM »
Cool Avatar
What I was trying to do is have a routine that stops in the middle of the program and forces the color dialog box to pop up and wait for you to select a color....and after that..... close the dialog box and make its way back into the routine....I never can remember certain color numbers....Thats why I wanted to pick the color visually:
Here is what I have been using still needs honing......
Code: [Select]

(defun c:mkl ()
(while (/= "" (strcase (setq lyyn (getstring "\nType in name for new layer:<Enter to exit> "))))
(setq lstmem lyyn)
(setq no (getint "\nEnter Color # for that layer (Primary Colors Listed for Ref.) : <1-red> <2-yellow> <3-green> <4-cyan> <5-blue> <6-magenta> <7-white> <8-dkgray> <9-ltgray> "))
(setq ltyp (getstring "\nSpecify Linetype: <Enter for Continuous> : <Center> <Dashed> <Hidden>: "))
(if (= ltyp "")
(setq ltyp "Continuous"))
(command "-layer" "n" (print lyyn) "c" (print no) (print lyyn) "lt" (print ltyp) (print lyyn) "")
);while
(setq lyynset (getstring "\nWhich layer would you like set as current: "))
(if (= lyynset "") (setq lyynset lstmem))
(command "_layer" "set" (print lyynset) "")
)
(princ)
(princ "\n---->Layer Creator Loaded Type <MKL> To Run<-----")

rude dog

  • Guest
acad_colordlg
« Reply #3 on: October 05, 2004, 09:38:50 PM »
Is it possible to build my own dialog box with all the colors.. and when a color is choosen it references up the integer of the color and the routine continues....
Is this a waste of time?...probably be a good excercise for me anyhow......but is it workable? :?:

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
acad_colordlg
« Reply #4 on: October 05, 2004, 11:45:40 PM »
RudeDog, you could not get this to work?
Code: [Select]
(defun c:mkl ()
  (while (/= ""
             (strcase
               (setq lyyn (getstring "\nType in name for new layer:<Enter to exit> "))
             )
         )
    (setq lstmem lyyn)

    (while (not col)
      (setq col (acad_colordlg 5 nil))
      (if (not col)
        (alert "You must choose a color for this new layer!!!")
      )
    )

    (setq ltyp (getstring
                 "\nSpecify Linetype: <Enter for Continuous> : <Center> <Dashed> <Hidden>: "
               )
    )
    (if (= ltyp "")
      (setq ltyp "Continuous")
    )
    (command "-layer" "n" lyyn "c" col lyyn "lt" ltyp lyyn "")
  ) ;while
  (setq lyynset (getstring "\nWhich layer would you like set as current: "))
  (if (= lyynset "")
    (setq lyynset lstmem)
  )
  (command "_layer" "set" (print lyynset) "")
)
(princ)
(princ "\n---->Layer Creator Loaded Type <MKL> To Run<-----")
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

rude dog

  • Guest
acad_colordlg
« Reply #5 on: October 06, 2004, 06:40:26 AM »
Quote

Omitting the flag argument or setting it to a non-nil value enables the buttons.
Read over this.....
Dammit......
And I see now Cab, you assign it the default value of color five which enables the buttons....thanks
(setq col (acad_colordlg 5 nil))

Thanks Crack & Cab