;|
TRIANGLE BY LENGTH SIDE : MARCH 2021
- Enter Length Side A,B,C
- Pick Start Point
- Pick Second Point (Angle point)
|;
(defun
c:tbs ()
(setq
old_cmdecho (getvar
"cmdecho"))
(setq
old_osnap (getvar "osmode"))
(setvar
"cmdecho" 0)
;;-------------------------------------------
(or slA (setq slA 40.56))
(setq slAtemp
(getdist (strcat "\n Enter Length
A : <"
(rtos slA 2 2)
">: "
) ;_ strcat
) ;_ getdist
) ;_ setq
(and slAtemp (setq slA slAtemp));text
Height
;;-----------------------------------------------
(or slB (setq slB 38.89))
(setq slBtemp
(getdist (strcat "\n Enter Length
B : <"
(rtos slB 2 2)
">: "
) ;_ strcat
) ;_ getdist
) ;_ setq
(and slBtemp (setq slB slBtemp));text
Height
;;-----------------------------------------------
(or slC (setq slC 66.69))
(setq slCtemp
(getdist (strcat "\n Enter Length
C : <"
(rtos slC 2 2)
">: "
) ;_ strcat
) ;_ getdist
) ;_ setq
(and slCtemp (setq slC slCtemp));text
Height
;;-----------------------------------------------
(setq ang1 (arcos(/ (-(+ (expt slA 2)(expt
slC 2))(expt slB 2))(* 2 slA slC))))
(setq p1 (getpoint "\nPick Start
Point : "))
(setq p2 (getpoint p1 "\nPick Second
Point : "))
(setq pA (polar p1 (angle p1 p2) slC))
(setq ang2 (- (rtod (angle p2 p1)) (rtod
ang1)))
(setq pB (polar pA (dtor ang2) slA))
(setvar "osmode" 0)
(command "_pline" p1 pA pB
"c")
(setvar
"cmdecho" old_cmdecho)
(setvar
"osmode" old_osnap)
(princ)
)
(prompt
"\nEnter TBS to start. ")
;------------------------------------------
(defun tan (x)
(/ (sin x)(cos x))
)
(defun arsin (x)
(setq y (sqrt (- 1 (* x x))))
(atan x y)
)
(defun arcos (x)
(- (/ pi 2)(arsin x))
)
(defun rtod (x)
(/ (* x 180) pi)
)
(defun dtor (x)
(* x (/ pi 180))
)
;------------------------------------------
ไม่มีความคิดเห็น:
แสดงความคิดเห็น