I'm not sure about I've used right formula
because of don't understand what you exactly mean
Better yet attach a picture with resulting text
Say,
Cilinder diameter = 10.0
Werkdruk =5.0
What is the text should on screen?
(defun edit_action (val why)
(if (or (= why 1) (= why 2))
(set_tile "Edit3" val)
)
)
(defun c:cil (/ Dcl_Id% Edit1$ Edit2$ Edit3$ Return#)
(princ "\n >> cil")
(princ)
; Set Default Variables
(if (not *cil@) ;Unique global variable name to store dialog info
(setq *cil@ (list nil "" "" ""))
) ;if
(setq Edit1$ (nth 1 *cil@)
Edit2$ (nth 2 *cil@)
Edit3$ (nth 3 *cil@)
) ;setq
; Load Dialog
(setq Dcl_Id% (load_dialog "cil.dcl"))
(new_dialog "cil" Dcl_Id%)
; Set Dialog Initial Settings
(set_tile "Title" "Cilinder berekening")
(set_tile "Text1" "Cilinder diameter")
(set_tile "Edit1" Edit1$)
(set_tile "Text2" "Werkdruk");;pressure
(set_tile "Edit2" Edit2$)
(set_tile "Text3" "Diameter zuigerstang") ;;stiffners diameter
(set_tile "Edit3" Edit3$)
; Dialog Actions
(action_tile "Edit1" "(setq Edit1$ $value)")
(action_tile
"Edit2"
(strcat
"(progn "
"(setq Edit2$ $value)"
"(edit_action (rtos (/ (atof Edit2$) (/ (* pi (expt (atof Edit1$) 2)) 4) ) 2 3) $reason)"
"(mode_tile \"\" 2))"))
(action_tile
"accept"
(strcat "(progn "
"(setq Edit1$ (get_tile \"Edit1\"))"
"(setq Edit2$ (get_tile \"Edit2\"))"
"(setq Edit3$ (get_tile \"Edit3\"))"
"(done_dialog 777))"))
(setq Return# (start_dialog))
; Unload Dialog
(unload_dialog Dcl_Id%)
(if (= 777 Return#)
(progn
(setq pt (getpoint "\n >> Pick insertion point of text >>"))
(entmakex (list (cons 0 "TEXT")
(cons 10 pt)
(cons 40
(if (zerop (getvar "TEXTSIZE"))
2.0;<--- default text size, change to suit
(getvar "TEXTSIZE"))
)
(cons 1
(strcat (rtos (atof Edit2$) 2 3)
" / "
(rtos (/ (* pi (expt (atof Edit1$) 2)) 4)2 3)
" = "
(rtos (atof Edit3$) 2 4)))
)
)
)
)
(setq *cil@ (list nil Edit1$ Edit2$ Edit3$))
(princ)
);defun c:cil
~'J'~