每次畫長圓孔都必須搞個好幾筆動作才可完成
我今天提供一個簡單又快速的程式讓大家快速畫完橢圓孔
希望大家在製圖界工作愉快
(setq g 0)
(defun c:ted13(/ p1 p2 p3 p4 p5 p6 p7 p8 s pc v w1 L1 g1 OS)
(setq OS(getvar "OSMODE"))
(setvar "cmdecho" 0)
(setq v (getvar "clayer"))
(setq w1 w)(setq L1 L)(setq g1 g)
(setvar "OSMODE" 1207)
(setq pc(getpoint "長圓孔中心點:"))(terpri)
(prompt "寬度<")(princ w)(prompt ">:")(setq w (getdist pc))(terpri)
(if (= w nil) (setq w w1))
(prompt "長度<")(princ L)(prompt ">:")(setq L (getdist pc))(terpri)
(if (= L nil) (setq L L1))
(prompt "角度<")(princ (/ (* g 180.0) pi))(prompt ">:")(setq g (getangle pc))(terpri)
(if (= g nil) (setq g g1))
(setq s (* (getvar "dimlfac") 1.5))
(setq p1(polar pc (+ g (/ pi 2)) (+ (/ w 2) s)))
(setq p2(polar pc (- g (/ pi 2)) (+ (/ w 2) s)))
(setq p3(polar pc g (+ (/ L 2) s)))
(setq p4(polar pc (+ g pi) (+ (/ L 2) s)))
(setq p5(polar pc (+ (atan (/ w 2) (/ (- L w) 2)) g)
(expt (+ (expt (/ (- L w) 2) 2) (expt (/ w 2) 2)) 0.5)))
(setq p6(polar p5 (+ g pi) (- L w)))
(setq p7(polar p6 (- g (/ pi 2)) w))
(setq p8(polar p5 (- g (/ pi 2)) w))
(setvar "OSMODE" 0)
(setvar "CLAYER" "0")
(command "arc" p6 "E" p7 "R" (/ w 2))
(command "arc" p8 "E" p5 "R" (/ w 2))
(command "line" p5 p6 "")
(command "line" p7 p8 "")
(setvar "CLAYER" V)
(setvar "OSMODE" OS)
(princ)
)
沒有留言:
張貼留言