Not sure if the correct variable are being passed back but you can correct them
Also I’m not sure about the format of the return answers. Are they all real numbers?
I also discovered that I was wrong in the return list. You don’t need to pass the 3 question values back if you use my solution in this post.
[font=Times New Roman][font=Times New Roman];;;;; main calling program[/font][font=Times New Roman](defun c:pkt ()[/font][font=Times New Roman](picket:DialogInput)[/font][font=Times New Roman] (princ)[/font][font=Times New Roman] );_defun[/font][font=Times New Roman](defun picket (dst1 pip1 bar1 / ret aa ab ac ad ae af ag ds1 dst2 num1 d num2 spa1 y y1 y2 y3 y4 spa2 dst3 endb endr1 endr2)[/font][font=Times New Roman] (setq dst2 (+ (- dst1 pip1) bar1)) ;dst2 is the spacing of pickets less the pipe post[/font][font=Times New Roman] (setq num1 (/ dst2 4)) ;num1 is the number of picket spaces @ exactly 4"[/font][font=Times New Roman] (setq d (fix (+ num1 0.99))) ;d is the number of spaces needed to round up[/font][font=Times New Roman] (setq num2 (- d 2)) ;num2 is the number of spacing for the middle of the rail[/font][font=Times New Roman] (setq spa1 (/ dst2 d))[/font][font=Times New Roman] (setq y (+ spa1 0.03125))[/font][font=Times New Roman] (setq y1 (* y 32))[/font][font=Times New Roman] (setq y2 (- y1 (rem y1 1)))[/font][font=Times New Roman] (setq y3 (/ y2 2))[/font][font=Times New Roman] (setq y4 (- y3 (rem y3 1)))[/font][font=Times New Roman] (setq spa2 (/ y4 16)) ;spa2 is the picket space in the middle in 16ths.[/font][font=Times New Roman] (setq dst3 (* spa2 num2)) ;dst3 is the middle dimension.[/font][font=Times New Roman] ;This is the number of spaces times the picket[/font][font=Times New Roman] ;spacing for the middle section.[/font][font=Times New Roman] (setq endb (- dst1 dst3)) [/font][font=Times New Roman] (setq endr1 (/ (* endb 16) 2))[/font][font=Times New Roman] (setq endr2 (- endr1 (rem endr1 1)))[/font][font=Times New Roman] (setq endr (/ endr2 16))[/font][font=Times New Roman] (setq endl (- endb endr)) ;endl is the left end dimension minus[/font][font=Times New Roman] ;the right end dimension.[/font][font=Times New Roman] (setq ret (list endr1 num2 spa1 endr1));_send back answers[/font][font=Times New Roman]);_defun[/font][/font]
(defun picket:DialogInput (/ dcl_id dialogloaded dialogshow userclick what_next rtvls dstx pipx barx )(setq dialogLoaded TdialogShow T) (if (= -1 (setq dcl_id (load_dialog "pickets.DCL")));_looks for and loads the dcl file(progn(princ "\nERROR: Cannot load pickets.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 "PICKETS" dcl_id));_if everything is found let the program proceeddialogLoaded) ;_ end of and(progn(princ "\nERROR: Cannot show dialog PICKETS");_error trap if there is a problem(setq dialogShow nil)) ;_ 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)2 3))(set_tile "sp" (rtos(nth 1 rtvls)2 3))(set_tile "sp2" (rtos(nth 2 rtvls)2 3))(set_tile "end2" (rtos(nth 3 rtvls)2 3)));_progn(progn(set_tile "end1" "")(set_tile "sp" "")(set_tile "sp2" "")(set_tile "end2" ""));_progn);_if (if dstx (set_tile "x" dstx)(set_tile "x" ""))(if pipx (set_tile "y" pipx)(set_tile "y" ""))(if barx (set_tile "z" barx)(set_tile "z" ""))(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 pipx (get_tile "y"))""(setq barx (get_tile "z"))""(if (not (member "" (list dstx pipx barx)))""(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 (picket (atof dstx)(atof pipx)(atof barx))));_do this if user clicks the button named qdx_wld);_end cond);_end while(unload_dialog dcl_id) ) ;_ end of defun
Hey johnM I really appreciate everything that you did and i was going to post the routine i did this weekend. It worked almost just like yours everything was the same except i would not show the result in feet and inches and after seeing this morning what you did i quickly studied it and saw the
(set_tile "xxxx" (rtos(nth 0 rtvls)2 3))
I was like thats it!
Unfortunately i saved as over it with another routine i did but i will post it shortly.
so you helped alot with your guiding info.
im sure will talk again thanks bud.
great to hear you figured it out.
so when it is finished and working like planed you should turn it into a vlx file so it will be easy to share and no one cane change it.