Back to Model....
DCL Model - AutoLisp Coding
(defun C:lisp51 ()
;define function - variables have been left as local
;for inspection purposes.
;;;**************************************************************
;;;This section assigns all the default values of the dialogue
;;;box into their relevant variables.
(setq names '("50 NB" "60 NB" "70 NB" "80 NB" "90 NB"
"100 NB" "125 NB" "150 NB" "200 NB" "250 NB"))
;default list for pipe diameter list box
(setq rad "Long")
;set default for radius radio buttons
(setq schedule "40")
;set default pipe schedule for edit box
(setq index "3")
;set default pipe size index
;;;**************************************************************
;;;This section loads the relevant DCL file containing the
;;;dialogue box definition.
(setq dcl_id (load_dialog "lisp51.dcl"))
;load dialog
;;;**************************************************************
;;;This section loads the particular dialogue box definition
;;;contained within the DCL file. It first checks that the
;;;DCL file has been loaded.
(if (not (new_dialog "lisp51" dcl_id)
;test for dialog
);not
(exit)
;exit if no dialog
);if
;;;**************************************************************
;;;This section initializes the dialogue box tiles.
;;;It fills the list box, pre-selects an item in the
;;;list box, switches on the default radio button and
;;;puts a default value into the edit box.
(start_list "lb1")
;open the list box
(mapcar 'add_list names)
;add the names to the list box
(end_list)
;end the list box
(set_tile "lb1" "3")
;select 4th item in list box
(set_tile "rb1" "1")
;switch on radio button No 1
(set_tile "eb1" "40")
;set default pipe schedule
;;;***************************************************************
;;;This section retrieves the values that the user selects
;;;or inputs. In effect, what we are saying here is :
;;;"Remember the coding that is in this section. When start_dialog
;;;is called, and a tile is selected, proceed with the relevant
;;;coding.
(action_tile "rb1"
;if radio button No 1 selected
"(setq rad \"Long\")
;store radius
(mode_tile \"eb1\" 2)"
;set focus to edit box
);action_tile
(action_tile "rb2"
;if radio button No 2 selected
"(setq rad \"Medium\")
;store radius
(mode_tile \"eb1\" 2)"
;set focus to edit box
);action_tile
(action_tile "rb3"
;if radio button No 3 selected
"(setq rad \"Short\")
;store radius
(mode_tile \"eb1\" 2)"
;set focus to edit box
);action_tile
(action_tile
"accept"
;if O.K. pressed
"(setq schedule (get_tile \"eb1\"))
;get the schedule entered
(setq index (atof (get_tile \"lb1\")))
;get the index of the pipe diameter entered
(done_dialog) (setq userclick T)"
;close dialog, set flag
);action tile
(action_tile
"cancel"
;if cancel button pressed
"(done_dialog) (setq userclick nil)"
;close dialog, lower flag
);action_tile
-
;;;*******************************************************************
;;;This section displays the dialogue box and waits for user input
(start_dialog)
;start dialog
;;;*******************************************************************
;;;done_dialogue has been called, so the dialogue can be unloaded
(unload_dialog dcl_id)
;unload
;;;********************************************************************
;;;If the O.K. tile was selected, process the users input values.
(if userclick
;if OK selected
(progn
;do the following
(setq index (fix index))
;convert index to integer
(setq size (nth index names))
;get the pipe size from the list
(alert (strcat "You Choose a : " size"\n"
rad " : Radius" "\n"
"Sched : " schedule " Pipe Bend"))
;string the results together and display them to the user
);progn
);if
;;;*******************************************************************
(princ)
;finish clean
);defun
(princ)
;load clean
;;;********************************************************************
|