วันเสาร์ที่ 5 กุมภาพันธ์ พ.ศ. 2565

irregular quadrilateral


|;

       irregular quadrilateral

       by Lengths and angle

       - Enter length 4 side and one angle

       - Create and Design by Songkhran Jongkul 04-02-2022

|;

       (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))

       )

(defun c:irrq ()

(setq old_cmdecho  (getvar "cmdecho"))

(setq old_osnap (getvar "osmode"))

 

(setvar "cmdecho" 0)

(setvar "osmode" 0)

       (or la (setq la 138.82))     

       (setq latemp (getdist (strcat "\nLength A <" (rtos la 2 2) ">: ")))

       (if (not latemp)(setq latemp la)

              (setq la latemp)

       )

       (or lb (setq lb 83.88))     

       (setq lbtemp (getdist (strcat "\nLength B <" (rtos lb 2 2) ">: ")))

       (if (not lbtemp)(setq lbtemp b)

              (setq lb lbtemp)

       )

       (or lc (setq lc 104.10))    

       (setq lctemp (getdist (strcat "\nLength C <" (rtos lc 2 2) ">: ")))

       (if (not lctemp)(setq lctemp lc)

              (setq lc lctemp)

       )

       (or ld (setq ld 74.7))

       (setq ldtemp (getdist (strcat "\nLength D <" (rtos ld 2 2) ">: ")))

       (if (not ldtemp)(setq ldtemp ld)

              (setq ld ldtemp)

       )

       (or anga (setq anga 88.53)) 

       (setq angatemp (getdist (strcat "\nAngle A <" (rtos anga 2 2) "\U+00B0>: ")))

       (if (not angatemp)(setq angatemp anga)

              (setq anga angatemp)

       )

;----------Calculator length and angle inside--------------------------------

       (setq bd (sqrt(-(+(expt la 2)(expt lb 2))(* 2 la lb (cos (dtor anga))))))

       (setq angd  (rtod(arcos(/(-(+(expt bd 2)(expt la 2))(expt lb 2))(* 2 la bd))))

                angd2 (rtod(arcos(/(-(+(expt ld 2)(expt bd 2))(expt lc 2))(* 2 ld bd))))

                angadc (+ angd angd2)

                angb  (- 180.0(+ anga angd))

                angb2 (rtod(arcos(/(-(+(expt lc 2)(expt bd 2))(expt ld 2))(* 2 lc bd))))

                angabc (+ angb angb2)

                angbcd (- 360.0(+ anga angabc angadc))

       )

;----------------Draw irregular quadrilateral -------------------------------

       (setq pa (getpoint "\n Pick a point a :"))

       (setq pb (polar pa (dtor anga) lb)

                pd (polar pa 0 la)

                pc (polar pd (dtor (- 180.0 angadc)) ld)

       )

       (command "_pline" pa pd pc pb "c")

(setvar "cmdecho" old_cmdecho)

(setvar "osmode" old_osnap)

(princ)

)

(prompt "\nEnter IRRQ to start irregular quadrilateral")

(prompt "\nCreate and Design by Songkhran Jongkul 04-02-2022")


ไม่มีความคิดเห็น:

แสดงความคิดเห็น