Re: [八六] 借我放
(defun C:UJ3d (/ ip r r1 D H1 H2 Thick W)
(graphscr)
(if (null finddat) (load "util"))
(command "ucs" "w")
(command "osnap" "none")
(if (and (setq ip(getpoint "\nInput the Insertion Point:"))
(setq r (getreal "\nInput the Rod Radius:"))
(setq r1(getreal "\nInput the Hole radius:"))
(setq D (getreal "\nInput D:"))
(setq W (getreal "\nInput W:"))
(setq H1(getreal "\nInput H1:"))
(setq H2(getreal "\nInput H2:"))
(setq Thick(getreal "\nInput Thickness:"))
)
(progn (UJ3d ip r r1 D H1 H2 Thick W)
)
)
(princ)
)
(defun UJ3d (ip r r1 D H1 H2 Thick W /)
(command "ucs" "o" ip)
(setq ip2 '(0 0 0))
(UJ3D-head ip2 r H2)
(setq e1 (entlast))
(UJ3D-body ip2 r1 D H1 H2 Thick W)
(command "subtract" e1 "" (entlast) "")
(uj3d-body ip2 r1 d h1 h2 thick W)
(command "ucs" "p")
(command "zoom" "E" "" "0.8x")
(princ)
)
(defun uj3d-head (ip r H2 / )
(setq p1 (rpoint3d ip 10 0 0)
p2 (rpoint3d ip 0 0 -10)
)
(command "ucs" "3p" ip p1 p2)
(setq a (- (/ W 2.0) (/ thick 2.0)))
(setq ip (rpoint3d ip 0 0 a))
(command "ucs" "move" ip)
(setq p0 '(0 0 0))
(command "circle" p0 r)
(command "extrude" (entlast) "" (- h2 (/ thick 2.0) (- (/ W 2.0) thick)) "")
(command "ucs" "w")
(princ)
)
(defun uj3d-body (ip r1 D h1 H2 thick w /)
(setq a (- (+ h1 (/ D 2.0)))
b (- (/ d 2.0))
)
(setq ip (rpoint3d ip 0 a b))
(command "ucs" "move" ip)
(setq p0 '(0 0 0)
p1 (polar p0 0.0 (- (/ W 2.0 ) thick))
p2 (polar p1 0.0 thick)
p3 (polar p0 pi (- (/ w 2.0) thick))
p4 (polar p3 pi thick)
p5 (polar p3 (/ pi 2.0) (+ H1 (/ D 2.0)))
p6 (polar p1 (/ pi 2.0) (+ h1 (/ D 2.0)))
p7 (polar p2 (/ pi 2.0) (+ h1 (/ D 2.0)))
p8 (polar p4 (/ pi 2.0) (+ h1 (/ D 2.0)))
)
(command "pline" p1 p2 p7 "ARC" p8 "L" p4 p3 p5 "Arc" p6 "l" p1 "")
(command "extrude" (entlast) "" D "")
(setq e3 (entlast))
(command "ucs" "P")
(setq ip2 '(0 0 0)
ip2 (rpoint3d ip2 (- (/ W 2.0)) (- h1) 0)
)
(command "ucs" "move" ip2)
(setq ip3 '(0 0 0))
(command "ucs" "3p" ip3 (rpoint3d ip3 0 0 10) (rpoint3d ip3 0 (- 10) 0))
(command "Circle" ip3 r1)
(command "extrude" (entlast) "" W "")
(setq e4 (entlast))
(command "subtract" e3 "" e4 "")
(setq p1 (polar ip3 0.0 (/ D 2.0))
p2 (polar p1 (/ pi 2.0) (+ (/ D 2.0) 1))
p3 (polar p2 pi D)
p4 (polar p3 (-(/ pi 2.0)) (+ (/ D 2.0) 1))
)
(command "pline" p4 p3 p2 p1 "A" "CE" ip3 p4 "CL")
(command "extrude" (entlast) "" W "")
(setq e5 (entlast))
(command "subtract" e3 "" e5 "")
(command "ucs" "w")
(princ)
)
--
失敗做
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.46.19
討論串 (同標題文章)
完整討論串 (本文為第 7 之 8 篇):
八六