วันอาทิตย์ที่ 26 กรกฎาคม พ.ศ. 2563

breakpipe

breakpipe

(defun c:breakpipe ()

(setq old_cmdecho  (getvar "cmdecho"))

(setq old_osnap (getvar "osmode"))

(setq pe (getvar 'PEDITACCEPT))

(setvar 'PEDITACCEPT 1)

(setvar "cmdecho" 0)

(setvar "osmode" 1)

(while (setq p1 (getpoint "\nPick Frist Point :"))

              (setq p2 (getpoint p1 "\nPick Second Point :"))

(setvar "osmode" 0)

       (setq ang(angle p1 p2)

                dis (distance p1 p2)

                dis2 (/ dis 2.0)

                dis4 (/ dis 4.0)

                dis8 (/ dis 8.0)

       )

       (setq p3 (polar p1 ang dis2)

                p3a (polar p1 ang dis4)

                p3b (polar p3 ang dis4)

                p4 (polar p3a (+ ang 1.5708) dis8); 1.5708 = 90.0 dreegee to radial

                p5 (polar p3b (+ ang 1.5708) dis8)

                p6 (polar p3b (- ang 1.5708) dis8)

       )

       (command "_arc" p1 p4 p3)

       (setq ss1 (ssget "L"))

       (command "_arc" p3 p5 p2)

       (setq ss2 (ssget "L"))

       (command "_arc" p3 p6 p2)

       (setq ss3 (ssget "L"))

       (command "_.pedit" "_M" ss1 ss2 ss3 "" "_J" "" "")

(setvar "osmode" 1)

);while

(setvar "cmdecho" old_cmdecho)

(setvar "osmode" old_osnap)

(setvar 'PEDITACCEPT pe)

(princ)

);end