Guest Posted December 10, 2021 Posted December 10, 2021 Any idea how to overline the text ?? Thanks Quote
Guest Posted December 12, 2021 Posted December 12, 2021 Hi .I search a lot and i can not find a solution. Can any one help me ? Thansk Quote
Guest Posted January 19, 2022 Posted January 19, 2022 Hi i need a litle help with this code. I update the code but i find out that when i do the calculation the results is not all the time correct. I believe tha the code in the background calculations use more decimals than 2 so when i do the calculations with my calculatior i find the diference. Can any one help me with this ? (defun c:heron (/ tri-no p1 p2 p3 da db dc s E cp lst cnt fn fp Etotal) (vl-load-com) (setvar "OSMODE" 9) (command "_layer" "_m" "Area" "_c" "7" "" "") (defun tricent (pt1 pt2 pt3)(mapcar '(lambda (x y z) (/ (+ x y z) 3)) pt1 pt2 pt3)) (setq tri-no 0 Etotal 0) (while (and (setq p1 (getpoint "\nP1 : "))(setq p2 (getpoint "\nP2 : "))(setq p3 (getpoint "\nP3 : ")) (setq da (distance p2 p3)) (setq db (distance p3 p1)) (setq dc (distance p1 p2)) (setq s (/ (+ da db dc) 2.0) ) (setq E (sqrt (* s (- s da) (- s db) (- s dc))))) ; while valid points are given (if (assoc (setq cp (tricent p1 p2 p3)) lst) (prompt "\nPoint allready entered") (progn (setq lst (append lst (list (cons cp (list (setq tri-no (1+ tri-no)) s da db dc E ))))) (entmakex (list '(0 . "TEXT") (cons 10 cp) (cons 40 0.5) (cons 1 (strcat "E" (itoa tri-no))))) ) ) ) (if (and (vl-consp lst) (setq fn (vl-filename-mktemp ".txt"))(setq fp (open fn "w"))) (progn (foreach x lst (setq x (cdr x) tri-no (nth 0 x) s (nth 1 x) da (nth 2 x) db (nth 3 x) dc (nth 4 x) E (last x)) (write-line (strcat "r" (vl-princ-to-string tri-no) " = " "1/2" " x " "(" (vl-princ-to-string (rtos da 2 2 )) " + " (vl-princ-to-string (rtos db 2 2 )) " + " (vl-princ-to-string (rtos dc 2 2 )) " ) = " (rtos s 2 2) " m." ) fp) (write-line (strcat "E" (vl-princ-to-string tri-no) " = " "\U+221A" " " (vl-princ-to-string (rtos s 2 2 )) " x (" (vl-princ-to-string (rtos s 2 2)) " - " (vl-princ-to-string (rtos da 2 2 )) ") x (" (vl-princ-to-string (rtos s 2 2)) " - " (vl-princ-to-string (rtos db 2 2 )) ") x (" (vl-princ-to-string (rtos s 2 2)) " - " (vl-princ-to-string (rtos dc 2 2 )) ") = " (rtos E 2 2) " sq.m." ) fp) (write-line (strcat "--------------------------------------------------------------------------------------------------") fp) (setq Etotal (+ Etotal E)) ) (write-line (strcat "Eολ. = " (vl-princ-to-string (rtos Etotal 2 2)) " sq.m.") fp) (close fp) ) ) (startapp "notepad" fn) (setvar "OSMODE" 9) (princ) );close defun Quote
BIGAL Posted January 19, 2022 Posted January 19, 2022 Maybe look at 3 (lambda (x y z) (/ (+ x y z) 3)) Quote
Guest Posted January 19, 2022 Posted January 19, 2022 Hi BIGAL .I dont understand what this is 3 (lambda (x y z) (/ (+ x y z) 3)) I try to change this line (setq da (distance p2 p3)) (setq db (distance p3 p1)) (setq dc (distance p1 p2)) to this (setq da (rtos (distance p2 p3)2 2)) (setq db (rtos(distance p3 p1)2 2 )) (setq dc (rtos(distance p1 p2) 2 2)) But is not working. The idea is to round up the numbers before the calculations Can any one help. Thanks Quote
BIGAL Posted January 19, 2022 Posted January 19, 2022 You need to keep full accuracy till very last step maybe use 3.0 as sometimes a integer answer is returned when dividing. Quote
exceed Posted January 19, 2022 Posted January 19, 2022 rtos means Realnumber TO String. you cannot calculate the string. atoi needed string to integer round up http://lee-mac.com/round.html Quote
Guest Posted January 19, 2022 Posted January 19, 2022 is any way to be full calculated with 2 dec .My problem is that when i do the calculation with the calculator gimes me other results. I want when i do the calclulations to have the same results with 2 dec Quote
Guest Posted January 19, 2022 Posted January 19, 2022 Hi exceed . Thanks for the post but i dont know how to use this functions. Can you help me with the code ? Thanks 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.