Search the Community
Showing results for tags 'calculator'.
-
Change values of dynamic block with outcomes
Kris Malen posted a topic in AutoLISP, Visual LISP & DCL
I want to change the values of a dynamic block within a lisp. This lisp contains a calculation. I used .dcl for this. My dynamic block has 7 attributes: maaiveld, HOOGTE1, HOOGTE2, HOOGTE3, HOOGTE4, HOOGTE5 and HOOGTE6. My lisp code has 7 values: m, a, b, c, x, y and z The order of these outputs are important. a, b, and c are sewer pipes that arrive in the cewer, and x, y, and z are pipes that depart from the sewer pit. So if there are only 2 pipes, we only have to use a and x. This makes it difficult. I can't just set HOOGTE1 to a, HOOGTE2 to b, HOOGTE3 to c, etc. If I do it this way, it will leave a gap in my leader. I hope this is even possible. I provided some screenshots of my calculator and of the leader, and the problem of the gap. Maybe I just need to create a more complex dynamic block, so that I can just connect the hoogte1,2,3,... to a,b,c,... I really don't know. code: (defun c:testKRIS ( / *error* dch dcl des mv d1 d2 d3 d4 d5 d6) (defun *error* ( msg ) (if (and (= 'int (type dch)) (< 0 dch)) (unload_dialog dch) ) (if (= 'file (type des)) (close des) ) (if (and (= 'str (type dcl)) (findfile dcl)) (vl-file-delete dcl) ) (if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))) (princ (strcat "\nError: " msg)) ) (princ) ) (cond ( (not (setq dcl (vl-filename-mktemp nil nil ".dcl") des (open dcl "w") ) ) (princ "\nUnable to open DCL for writing.") ) ( (progn (foreach str '( "ed : edit_box" "{" " alignment = left;" " width = 20;" " edit_width = 10;" " fixed_width = true;" "}" "" "test : dialog" "{" " spacer;" " key = \"dcl\";" " : ed" " {" " key = \"mv\";" " label = \"MV:\";" " }" " :boxed_column { " " label = \"Diepte vd buizen\";" " :row {" " : ed" " {" " key = \"d1\";" " label = \"A:\";" " }" " : ed" " {" " key = \"d4\";" " label = \"X:\";" " }}" " :row {" " : ed" " {" " key = \"d2\";" " label = \"B:\";" " }" " : ed" " {" " key = \"d5\";" " label = \"Y:\";" " }}" " :row {" " : ed" " {" " key = \"d3\";" " label = \"C:\";" " }" " : ed" " {" " key = \"d6\";" " label = \"Z:\";" " }}" " }" " : boxed_row" " { " " label = \"BOK berekeningen\";" " :column {" " : ed { key = \"res\"; label = \"BOK:\"; is_enabled = false; }" " : ed { key = \"res2\"; label = \"BOK2:\"; is_enabled = false; }" " : ed { key = \"res3\"; label = \"BOK3:\"; is_enabled = false; }" " }" " :column{" " : ed { key = \"res4\"; label = \"BOK4:\"; is_enabled = false; }" " : ed { key = \"res5\"; label = \"BOK5:\"; is_enabled = false; }" " : ed { key = \"res6\"; label = \"BOK6:\"; is_enabled = false; }" " }" " }" " : button" " {" " key = \"cal\";" " label = \"Calculate\";" " }" " spacer;" " ok_only;" "}" ) (write-line str des) ) (setq des (close des) dch (load_dialog dcl) ) (<= dch 0) ) (princ "\nUnable to load DCL file.") ) ( (not (new_dialog "test" dch)) (princ "\nUnable to display 'test' dialog.") ) ( t (set_tile "dcl" "Calculate Area") (action_tile "mv" "(setq mv $value)") (action_tile "d1" "(setq d1 $value)") (action_tile "d2" "(setq d2 $value)") (action_tile "d3" "(setq d3 $value)") (action_tile "d4" "(setq d4 $value)") (action_tile "d5" "(setq d5 $value)") (action_tile "d6" "(setq d6 $value)") (action_tile "cal" (vl-prin1-to-string '( (lambda ( / m x y z a b c ) (set_tile "res" "") (set_tile "res2" "") (set_tile "res3" "") (set_tile "res4" "") (set_tile "res5" "") (set_tile "res6" "") (cond ( (or (not mv) (= "" mv)) (alert "Please enter a maaiveld value.") (mode_tile "mv" 2) ) ( (or (not d1) (= "" d1)) (alert "Please enter a A value.") (mode_tile "d1" 2) ) ( (or (not d2) (= "" d2)) (alert "Please enter a B value.") (mode_tile "d2" 2) ) ( (or (not d3) (= "" d3)) (alert "Please enter a C value.") (mode_tile "d3" 2) ) ( (or (not d4) (= "" d4)) (alert "Please enter a X value.") (mode_tile "d4" 2) ) ( (or (not d5) (= "" d5)) (alert "Please enter a Y value.") (mode_tile "d5" 2) ) ( (or (not d6) (= "" d6)) (alert "Please enter a Z value.") (mode_tile "d6" 2) ) ( (not (setq m (distof mv))) (alert "Het Maaiveld moet een getal zijn.") (mode_tile "mv" 2) ) ( (not (setq a (distof d1))) (alert "The A must be numerical.") (mode_tile "d1" 2) ) ( (not (setq b (distof d2))) (alert "The B must be numerical.") (mode_tile "d2" 2) ) ( (not (setq c (distof d3))) (alert "Het C moet een getal zijn.") (mode_tile "d3" 2) ) ( (not (setq x (distof d4))) (alert "The X must be numerical.") (mode_tile "d4" 2) ) ( (not (setq y (distof d5))) (alert "The Y must be numerical.") (mode_tile "d5" 2) ) ( (not (setq z (distof d6))) (alert "The Z must be numerical.") (mode_tile "d6" 2) ) ( (<= m 0.0) (alert "Het maaiveld moet groter dan nul zijn.") (mode_tile "mv" 2) ) ( (<= a 0.0) (alert "The A must be greater than zero.") (mode_tile "d1" 2) ) ( (<= b 0.0) (alert "The B must be greater than zero.") (mode_tile "d2" 2) ) ( (<= c 0.0) (alert "Het C moet groter dan nul zijn.") (mode_tile "d3" 2) ) ( (<= x 0.0) (alert "The X must be greater than zero.") (mode_tile "d4" 2) ) ( (<= y 0.0) (alert "The Y must be greater than zero.") (mode_tile "d5" 2) ) ( (<= z 0.0) (alert "The Z must be greater than zero.") (mode_tile "d6" 2) ) (t (set_tile "res" (rtos (- m a) 2)) (set_tile "res2" (rtos (- m b) 2)) (set_tile "res3" (rtos (- m c) 2)) (set_tile "res4" (rtos (- m x) 2)) (set_tile "res5" (rtos (- m y) 2)) (set_tile "res6" (rtos (- m z) 2)) ) ) ) ) ) ) (start_dialog) ) ) (*error* nil) (princ) ) The code needs work to be visually better, but I want it to work before I do that.- 6 replies
-
- dynamicblocks
- lisp
-
(and 2 more)
Tagged with:
-
customization of 'cal command
sadefa posted a topic in AutoCAD 2D Drafting, Object Properties & Interface
Hello to all. Some of you might know that whenever you might use an expression to determine the input value. For example you want a line with length of 20 you can always run command “line” and when prompted for the length write ‘cal and then 10*2. This will give line length of 20 units. What I am looking for is a way to change the ‘cal command as it’s too long for me to type it each time. Any ideas how to achieve this? -
Need help with Quick Calculator
Faouweb posted a topic in AutoCAD 2D Drafting, Object Properties & Interface
Hi Is there a way to have in the Quick Calculator the Z axis or X and Y, as shown in the picture bellow. When I need to move something I have to measure, note the dimension on paper, and then use Move , it's not professional Thank you- 4 replies
-
- calculator
- axis
-
(and 1 more)
Tagged with:
-
Hello, I’m a draftsman and I have a calculator that has feet and inches which of course makes things easy assisting in draft. I was wondering for those who do not have such calculator – I was considering creating a simple iphone app that does just that – add/substruct as well as conversion from metric to imperial and vise versa. Just gauging to see if there is interest. If there is interest, is anyone interested in beta testing such app during development? Thanks, D