I am Having a problem with my Dialog box (DCL).
I run Lisp and at first it works and starts up with all the pop up filled in with the correct options,
but when I use the "select point" button all the pop-up lists get removed.
But it does fill in the co-ordinates and does what it needs to do.
So, looking online it seems like I can't use Start_dialog
I'm not sure how to explain the problem but please see below.
Please assist if you can!
Solved! Go to Solution.
Solved by komondormrex. Go to Solution.
Solved by Moshe-A. Go to Solution.
Solved by Moshe-A. Go to Solution.
@alex_mcturk hi,
when dealing with dcl, the main program should be a big while loop where you open the dialog, set your tiles default value than comes all (action_tile) calls than (start_dialog) call then a (cond) where you test what_next according (done_dialog). the while loop is continue as long as what_next is bigger than 1.
here is a dcl skeleton program how it should be done (untested)
this ensures that after you specify the point, the dialog is reopen and the tiles value will be set again 😀
enjoy
Moshe
(defun c:dclSkeleton (/ dclfname dcl_id what_next)
(if (and
(setq dclfname (findfile "SelectPoint.dcl")) ; get dcl file from supprt files search path
(setq dcl_id (load_dialog dclfname)) ; get dcl id
)
(progn
(initial) ; prepare variables before dialog open
(setq what_next 2)
(While (> what_next 1)
(if (not (new_dialog "SelectPointDialog" dcl_id "" '(-1 -1))) ; open dialog
(exit)
)
; set tiles here, list, popup_list edit_box etc...
(set_tiles_values)
(action_tile "select_point" "(done_dialog 2)")
(action_tile "accept" "(done_dialog 1)")
(action_tile "cancel" "(done_dialog 0)")
(setq what_next (start_dialog)) ; start dialog
(cond
((= what_next 2)
(setq pt (getpoint "\nSpecify point: "))
); case
((= what_next 1) ; OK
; do your job
; ......
; ......
; do clean up + save variables + exit
); case
((= what_next 0) ; Cancel
; do your job
; ......
; ......
; do clean up without saving variables + exit
); case
); cond
); while
(unload_dialog dcl_id)
); progn
); if
(princ)
); c:dclSkeleton
Thank you, this seems to work perfectly as I would like,
and I'll probably have other questions.
Am I correct with saying all the data handling and e.g. "what I want to do with this dialog box" will happen after
"" ;; Unload dialog
(unload_dialog dcl_id)
""
if i understand what you are asking the answer is: NO
in dialog program driven, all the data handling \ processing is done during the dialog is on (of course except when you temporary unload the dialog for picking points or selecting objects 😀)
at (unload_dialog dcl_id) this signal the end of program (the dcl is off memory)
of course if you want to continue after that, it is up to you but in general unloading the dialog means program is ended.
Moshe
well,
you can't assign a value-string to a list tile value like that (set_tile "belt_width_k" "1050"). it should be like (set_tile "belt_width_k" "4"), where "4" is itoa of nth of "1050" in corresponding list.
check this another one.
(defun c:SelectPointDialog (/ coordinates loop_dialog dialog_return key_list
belt_width_k ird_k trougha_k series_k VReturnA_k beltheight_k stringer_k LegSize_k
pt
)
;*******************************************************************************************************
(defun populate_list (list_key list_to_populate)
(start_list list_key)
(mapcar 'add_list list_to_populate)
(end_list)
)
;*******************************************************************************************************
(defun set_key_tile (key)
(set_tile key (itoa (vl-position (eval (read (strcat key "_set"))) (eval (read key)))))
)
;*******************************************************************************************************
(defun get_key_tile (key)
(set (read (strcat key "_set")) (nth (atoi (get_tile key)) (eval (read key))))
)
;*******************************************************************************************************
(defun action_key_tile (key)
(set (read (strcat key "_set")) (nth (atoi (get_tile key)) (eval (read key))))
)
;*******************************************************************************************************
(mapcar '(lambda (key list_) (set (read key) list_))
(setq key_list '("belt_width_k" "ird_k" "trougha_k" "series_k"
"VReturnA_k" "beltheight_k" "stringer_k" "LegSize_k")
)
'(("450" "600" "750" "900" "1050" "1200" "1350" "1500" "1800" "2100" "2400") ; belt_width_k
("127" "152") ; ird_k
("20" "35" "45") ; trougha_k
("25" "30") ; series_k
("0" "5" "10") ; VReturnA_k
("1000" "1200" "1400") ; beltheight_k
("PFC180x70" "L70x70x8" "L80x80x8" "L90x90x8" "L90x90x10" "L100x100x10") ; stringer_k
("L70x70x8" "L80x80x8" "L90x90x8" "L90x90x10" "L100x100x10") ; LegSize_k
)
)
(setq coordinates ""
loop_dialog t
belt_width_k_set (if belt_width_k_set belt_width_k_set "1050")
ird_k_set (if ird_k_set ird_k_set "127")
trougha_k_set (if trougha_k_set trougha_k_set "20")
series_k_set (if series_k_set series_k_set "25")
VReturnA_k_set (if VReturnA_k_set VReturnA_k_set "10")
beltheight_k_set (if beltheight_k_set beltheight_k_set "1200")
stringer_k_set (if stringer_k_set stringer_k_set "PFC180x70")
LegSize_k_set (if LegSize_k_set LegSize_k_set "L70x70x8")
)
(setq dialog_position (if dialog_position dialog_position (list -1 -1)))
(while loop_dialog
(if (minusp (setq dcl_id (load_dialog "SelectPoint.dcl")))
(setq loop_dialog (null (princ "\Dialog file not found")))
(if (new_dialog "SelectPointDialog" dcl_id "" dialog_position)
(progn
(set_tile "coordinates" coordinates)
(mapcar '(lambda (key) (populate_list key (eval (read key)))) key_list)
(mapcar '(lambda (key) (set_key_tile key)) key_list)
(mapcar '(lambda (key) (action_key_tile key)) key_list)
(action_tile "cancel" "(done_dialog 0)")
(action_tile "accept" "(mapcar '(lambda (key) (get_key_tile key)) key_list) (setq dialog_position (done_dialog 1))")
(action_tile "select_point" "(mapcar '(lambda (key) (get_key_tile key)) key_list) (setq dialog_position (done_dialog 2))")
(setq dialog_return (start_dialog))
(cond
((= dialog_return 0)
(setq loop_dialog nil)
(princ "\nCommand cancelled")
)
((= dialog_return 1)
(setq loop_dialog nil)
(princ (strcat "\nBelt Width: " belt_width_k_set))
(princ (strcat "\nIdler Roll Diameter: " ird_k_set))
(princ (strcat "\nTroughing Angle: " trougha_k_set))
(princ (strcat "\nSeries: " series_k_set))
(princ (strcat "\nV Return Angle: " VReturnA_k_set))
(princ (strcat "\nBelt Height: " beltheight_k_set))
(princ (strcat "\nStringer: " stringer_k_set))
(princ (strcat "\nLeg Size: " LegSize_k_set))
)
((= dialog_return 2)
(if (setq pt (getpoint "\nSelect a point: "))
(setq coordinates (strcat "X: " (rtos (car pt) 2 3)
", Y: " (rtos (cadr pt) 2 3)
", Z: " (rtos (caddr pt) 2 3)
)
)
)
)
)
(unload_dialog dcl_id)
)
)
)
)
(princ)
)
Can't find what you're looking for? Ask the community or share your knowledge.