BLOACH85 Posted February 26, 2009 Posted February 26, 2009 Hey my slide works but when you click the ok button to do calculations the slide goes away. Why is this? Quote
Lee Mac Posted February 26, 2009 Posted February 26, 2009 Could you possibly post the DCL and the LISP section dealing with the DCL please, and I'll have a look Quote
BLOACH85 Posted February 26, 2009 Author Posted February 26, 2009 Hey Hows it going lee mac Here is the lisp. Hey lee I also have just encountered another problem. I have two Edit boxes to gather info. The overall dimension The object spacing Now i can enter in decimal form but we dont use decimal form is there any way to change the input in the box to feet and inches? This is suppose to be a time saver and if its in decimal then it defeats the purpose. (defun space:DialogInput (/ dcl_id dialogloaded dialogshow userclick what_next rtvls dstx spax ) (setq dialogLoaded T dialogShow T) (if (= -1 (setq dcl_id (load_dialog "SPACE.DCL")));_looks for and loads the dcl file (progn (princ "\nERROR: Cannot load space.DCL");_error trapping (setq dialogLoaded nil) ) ;_ end of progn ) ;_ end of if (setq what_next 2);_this is a variable for the loop (while (>= what_next 2);_this is the loop (if (and (not (new_dialog "space" dcl_id));_if everything is found let the program proceed dialogLoaded ) ;_ end of and (progn (princ "\nERROR: Cannot show dialog space");_error trap if there is a problem ) ;_ end of progn ) ;_ end of if (if (and dialogLoaded dialogShow) (progn ;;; below is where you assign values to tiles and other stuff (if rtvls (progn (set_tile "end1" (rtos(nth 0 rtvls)5 4)) (set_tile "sp" (rtos(nth 1 rtvls)2 0)) (set_tile "sp2" (rtos(nth 2 rtvls)4 4)) (set_tile "oa" (rtos(nth 3 rtvls)4 4)) (set_tile "end2" (rtos(nth 4 rtvls)5 4)) (set_tile "sd" (rtos(nth 5 rtvls)4 4)) );_progn (progn (set_tile "end1" "") (set_tile "sp" "") (set_tile "sp2" "") (set_tile "oa" "") (set_tile "end2" "") (set_tile "sd" "") (set_tile "ss" "") );_progn );_if (setq dialogShow nil) (setq w (dimx_tile "im1") h (dimy_tile "im1")) (slide_image 0 0 w h "space") (end_image) (if dstx (set_tile "x" dstx)(set_tile "x" "")) (if spax (set_tile "y" spax)(set_tile "y" "")) (action_tile "cancel" "(done_dialog)(setq UserClick nil) ");_if user click the cancle button make dlg go bye-bye ;;; if user clicks ok button assign tile values to variables (action_tile "accept" (strcat "(progn" "(setq dstx (get_tile \"x\"))" "(setq spax (get_tile \"y\"))" "(if (not (member \"\" (list dstx spax)))" "(progn" "(done_dialog 4)" ")" ;_progn "(alert \"Please enter values\")" ")" ;_if ")" ;_progn ) ;_end strcat ) ;_ end of action_tile (setq what_next (start_dialog)) ) ;_ end of progn ) ;_ end of if (cond ((= what_next 4) (setq rtvls (space (atof dstx)(atof spax))));_do this if user clicks the button named qdx_wld );_end cond );_end while (unload_dialog dcl_id) ) ;_ Here is the dcl space :dialog { label = "The Spacing Chart!" ; : row { :boxed_column { label = "ENTER DIMENSIONS EXACTLY"; :edit_box { key="x"; label="What is your Overall Diemsnion of Object?" ; edit_width=14; alignment=centered; } :edit_box { key="y" ; label = "What is your Desired Spacing on Object?"; edit_width=14; } } :boxed_column { :edit_box { label="Displays Overall in Feet & inches"; key="sd"; edit_width=14; alignment=centered; } }} :row { :column { width=10; alignment=centered; label="End Space 1"; :edit_box { edit_width=6; key="end1" ; } } :column { width=3;} :column { width=10; label="# of Spaces"; :edit_box { edit_width=6; key="sp"; } } :row { :column{ width=15; :text {key="tt" ; value="SPACES @"; alignment=centered;}} } :column { width=10; label="Space Size"; :edit_box { edit_width=6; key="sp2"; } } :row { :column{ width=15; :text {key="eq" ; value="EQUALS"; alignment=centered;}} } :column { width=10; label="Overall Middle"; :edit_box { edit_width=12; key="oa"; } } :column { width=3;} :column { width=10; alignment=centered; label="End Space 2"; :edit_box { key="end2" ; edit_width=6; } }} :row { :boxed_column { label="Written by: Brandon DeLoach and Joe Barrertt <2009>" ;} } : image { key = "im1"; height = 30; aspect_ratio = 1.5; color = 0; allow_accept = true; } : row { // defines the OK/Cancel button row : spacer { width = 20; } : button { // defines the OK or calculate button label = "Calculate"; is_default = true; key = "accept"; width = 8; fixed_width = true; } : button { // defines the Cancel button label = "Cancel"; is_cancel = true; key = "cancel"; width = 8; fixed_width = true; } : spacer { width = 20;} } } Quote
Lee Mac Posted February 26, 2009 Posted February 26, 2009 Just quickly glancing, I think in your LISP code, you need to include this: [b][color=Red](start_image "im1")[/color][/b] (setq w (dimx_tile "im1") h (dimy_tile "im1")) (slide_image 0 0 w h "space") (end_image) Quote
Lee Mac Posted February 26, 2009 Posted February 26, 2009 As for the edit_box situation, you will retrieve a string from the edit box and you will then need to retrieve the user input and convert it into the units you need for your program... I have two possibilities in mind... maybe two edit boxes, for feet and inches... or maybe using substr (or another function like that) to take out the ' and ". Quote
BLOACH85 Posted February 26, 2009 Author Posted February 26, 2009 so there is no way to just i guess change the rtos for that edit box and it go by that? Quote
Lee Mac Posted February 26, 2009 Posted February 26, 2009 Rtos? I think you mean "distof", The edit box returns a string, and this can be converted correctly to a real using: (distof [string] 3) Otherwise, I was thinking something along these lines: feet : dialog { label = "Edit Box Test"; : row { : edit_box { label = "Feet:"; mnemonic = "F"; key = "edit_feet"; alignment = centered; edit_limit = 3; edit_width = 3; value = "2"; } : edit_box { label = "Inches:"; mnemonic = "I"; key = "edit_inches"; alignment = centered; edit_limit = 3; edit_width = 3; value = "3"; } } ok_cancel; } Preview this in the VLIDE Quote
BLOACH85 Posted February 26, 2009 Author Posted February 26, 2009 Ok now with (distof) this will have to be on my in/out sheet right ive been trying it but its coming up with errors everytime Quote
Lee Mac Posted February 26, 2009 Posted February 26, 2009 Hmm... I don't use an "in/out" sheet, but it will need to be where you collect the value of the edit box. Quote
BLOACH85 Posted February 26, 2009 Author Posted February 26, 2009 Ive tried it and still no luck its coming up with a bad nump nil error so i will post all 3 codes and see what you can do. This is the main lisp file ; THIS PROGRAM IS TO DETERMINE SPACES AND ENDS GIVEN ; A KNOWN SPACE AND AN OVERALL DIMENSION. ; ; AN EXAMPLE IS THE SPACING OF STUDS AT 24" O.C. ; ON AN EMBED ANGLE ; ; ;Again this program is written by Joe Barrett and Brandon DeLoach, Atchley Steel's Boppsy Twins. ;on or about February 25, 2009 ; ;dst1 = end to end of material ;dst3 = initial number of spaces times the space ;dst4 = final number of spaces times the space ;endl = left end dimension ;endr = right end dimension ;num1 = initial number of spaces (exact) ;num2 = initial number of spaces minus the fraction ;num3 = initial number of spaces minus 1 plus the fraction ;num4 = final number of spaces required ;rem1 = working number to determine endspaces ;spa1 = spacing of whatever (defun c:spc () (space:DialogInput) (princ) );_defun (defun space (dst1 spa1 / dst4 endl endr num1 num2 num3 num4 rem1) (setq num1 (/ dst1 spa1)) (setq num2 (fix (+ num1 0.50))) (setq num3 (- num2 1)) (setq dst3 (* spa1 num3)) (setq rem1 (* (- num1 num2) spa1)) (if (< rem1 6) (setq num4 num3) (setq num4 num2) ) (setq dst4 (* num4 spa1)) (setq endl (/ (- dst1 dst4) 2)) (setq endr (- dst1 dst4 endl)) (setq ret (list endl num4 spa1 dst4 endr dst1 spa1)) ) This is the in/out sheet (defun space:DialogInput (/ dcl_id dialogloaded dialogshow userclick what_next rtvls w h dstx spax ) (setq dialogLoaded T dialogShow T) (if (= -1 (setq dcl_id (load_dialog "SPACE.DCL")));_looks for and loads the dcl file (progn (princ "\nERROR: Cannot load space.DCL");_error trapping (setq dialogLoaded nil) ) ;_ end of progn ) ;_ end of if (setq what_next 2);_this is a variable for the loop (while (>= what_next 2);_this is the loop (if (and (not (new_dialog "space" dcl_id));_if everything is found let the program proceed dialogLoaded ) ;_ end of and (progn (princ "\nERROR: Cannot show dialog space");_error trap if there is a problem ) ;_ end of progn ) ;_ end of if] (start_image "im1") (setq dialogShow t) (setq w (dimx_tile "im1") h (dimy_tile "im1")) (slide_image 0 0 w h "space") (end_image) (if (and dialogLoaded dialogShow) (progn ;;; below is where you assign values to tiles and other stuff (if rtvls (progn (set_tile "end1" (rtos(nth 0 rtvls)5 4)) (set_tile "sp" (rtos(nth 1 rtvls)2 0)) (set_tile "sp2" (rtos(nth 2 rtvls)4 4)) (set_tile "oa" (rtos(nth 3 rtvls)4 4)) (set_tile "end2" (rtos(nth 4 rtvls)5 4)) (set_tile "sd" (rtos(nth 5 rtvls)4 4)) );_progn (progn (set_tile "end1" "") (set_tile "sp" "") (set_tile "sp2" "") (set_tile "oa" "") (set_tile "end2" "") (set_tile "sd" "") );_progn );_if (if dstx (set_tile "x" dstx)(set_tile "x" "")) (if spax (set_tile "y" spax)(set_tile "y" "")) (action_tile "cancel" "(done_dialog)(setq UserClick nil) ");_if user click the cancle button end dialog ;;; if user clicks ok button assign tile values to variables (action_tile "accept" (strcat "(progn" "(setq dstx (get_tile \"x\"))" "(setq spax (get_tile \"y\"))" "(if (not (member \"\" (list dstx spax)))" "(progn" "(done_dialog 4)" ")" ;_progn "(alert \"Please enter values\")" ")" ;_if ")" ;_progn ) ;_end strcat ) ;_ end of action_tile (setq what_next (start_dialog)) ) ;_ end of progn ) ;_ end of if (cond ((= what_next 4) (setq rtvls (space (atof dstx)(atof spax))));_do this if user clicks the button named quit dialog );_end cond );_end while (unload_dialog dcl_id) ) ;_ end of defun This is the dcl file space :dialog { label = "The Spacing Chart!" ; : row { :boxed_column { label = "ENTER DIMENSIONS EXACTLY"; :edit_box { key="x"; label="What is your Overall Dimension of Object?" ; edit_width=14; alignment=centered; } :edit_box { key="y" ; label = "What is your Desired Spacing on Object?"; edit_width=14; } } :boxed_column { :edit_box { label="Displays Overall in Feet & inches"; key="sd"; edit_width=14; alignment=centered; } }} :row { :column { width=10; alignment=centered; label="End Space 1"; :edit_box { edit_width=6; key="end1" ; } } :column { width=3;} :column { width=10; label="# of Spaces"; :edit_box { edit_width=6; key="sp"; } } :row { :column{ width=15; :text {key="tt" ; value="SPACES @"; alignment=centered;}} } :column { width=10; label="Space Size"; :edit_box { edit_width=6; key="sp2"; } } :row { :column{ width=15; :text {key="eq" ; value="EQUALS"; alignment=centered;}} } :column { width=10; label="Overall Middle"; :edit_box { edit_width=12; key="oa"; } } :column { width=3;} :column { width=10; alignment=centered; label="End Space 2"; :edit_box { key="end2" ; edit_width=6; } }} :row { :boxed_column { label="Written by: Brandon DeLoach and Joe Barrertt <2009>" ;} } : image { key = "im1"; height = 30; aspect_ratio = 1.5; color = 0; allow_accept = true; } : row { // defines the OK/Cancel button row : spacer { width = 20; } : button { // defines the OK or calculate button label = "Calculate"; is_default = true; key = "accept"; width = 8; fixed_width = true; } : button { // defines the Cancel button label = "Cancel"; is_cancel = true; key = "cancel"; width = 8; fixed_width = true; } : spacer { width = 20;} } } Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.