Author Topic: Lisp/DCL Question..  (Read 2266 times)

0 Members and 1 Guest are viewing this topic.

V-Man

  • Bull Frog
  • Posts: 343
  • I exist therefore I am! Finally Retired!
Lisp/DCL Question..
« on: December 14, 2004, 11:58:24 AM »
I need a little assistance. I have a dialog box with radio buttons and 1 poplist. Depending on what radio button is selected, I want it to load a different list of options. and vice versa if another radio button is selected, then load the other list. How do I approach this?

See code below. There is 2 lists below

Code: [Select]

(setq Drsizes '("1-6" "2-0" "2-2" "2-4" "2-6" "2-8" "2-10" "3-0" "3-2" "3-4"
"3-6" "3-8" "3-10" "4-0"))

      (start_list "selections")
      (mapcar 'add_list Drsizes)
      (end_list)


(setq DDrsizes '("4-0" "5-0" "5-4" "6-0" "7-0" "8-0"))

      (start_list "selections")
      (mapcar 'add_list DDrsizes)
      (end_list)
AutoCAD 9 - 2023, AutoCADMap 2008 - 2010, Revit 2012 - 2022, Autocad Civil 3D 2023

Ron Heigh

  • Guest
Lisp/DCL Question..
« Reply #1 on: December 15, 2004, 08:49:05 AM »
In your lisp, define your functions:

Code: [Select]

(defun dcl:drsizes ()
       (setq dcl:sizes '("1-6" "2-0" "2-2" "2-4" "2-6" "2-8" "2-10" "3-0" "3-2" "3-4" "3-6" "3-8" "3-10" "4-0")
                dcl:option "1")

      (start_list "selections")
      (mapcar 'add_list dcl:sizes)
      (end_list)
)
(defun dcl:ddrsizes ()
      (setq dcl:sizes '("4-0" "5-0" "5-4" "6-0" "7-0" "8-0")
               dcl:option "2")

      (start_list "selections")
      (mapcar 'add_list dcl:sizes)
      (end_list)
)


In the lisp portion where you call your dialog:

Code: [Select]
(ACTION_TILE "drsizes" "(drsizes)")
(ACTION_TILE "ddrsizes" "(ddrsizes)")
(ACTION_TILE
    "selections"
    "(setq dcl:sheetsize (get_tile \"selections\"))"
  )


Name your radio buttons "drsizes" & "ddrsizes".

*This is untested, might need some tweaking***

V-Man

  • Bull Frog
  • Posts: 343
  • I exist therefore I am! Finally Retired!
Lisp/DCL Question..
« Reply #2 on: December 15, 2004, 10:18:10 AM »
Thanks for the help. That's just what i was looking for. One more thing if I may, Once i initial the command to pull up the dialog box, I have 1 radio button set to "is_enabled" and in the "selection" pop_list where the sizes show up, it shows the 1st size in the list. I want the routine to automatically use those values as a default if the user does not select anything. How do I do this? Anyone..

I have been trying various "IF" statements with no luck. See below.

Code: [Select]

(action_tile "rb1" "(setq DoorType \"LH\")(drsizes)")
(action_tile "selections" "(setq Doorsize (nth (atoi $value) sizes))")





Code: [Select]

(setq Selv (atoi (get_tile "rb1")));get radio button value
  (setq Selv (rtos Selv 2 0))
  (if(= "0" (get_tile "rb1"))
  (progn
  (setq DoorType "LH")
  )


Code: [Select]

(defun drsizes ()
       (setq sizes '("1-6" "2-0" "2-2" "2-4" "2-6" "2-8" "2-10" "3-0" "3-2" "3-4" "3-6" "3-8" "3-10" "4-0")
                dcl:option "1")
      (start_list "selections")
      (mapcar 'add_list sizes)
      (end_list)
)
AutoCAD 9 - 2023, AutoCADMap 2008 - 2010, Revit 2012 - 2022, Autocad Civil 3D 2023

Ron Heigh

  • Guest
Lisp/DCL Question..
« Reply #3 on: December 15, 2004, 11:47:15 AM »
At the very beginning of the code that loads your dcl you can preload the variables that your dcl sets for you.
These should be preloaded to match the default settings that are shown when the dcl loads.
This way, if not ACTIONS are committed on your dcl, the setq has already initialized the correct values.