2004年的老程序了。没什么错。下面是修改过的:
可否在里面再加条中心线。这样更完美。 参数化管道绘制http://video.weibo.com/show?fid=1034:4307473645959467 会被捕捉干扰,需要优化才得 本帖最后由 ZZXXQQ 于 2021-11-4 14:06 编辑
;管线绘制 ZZXXQQ 2004/11/11 2021/11/3
(defun c:drawpipe ()
(setvar "CMDECHO" 0)
(setq OLDOS (getvar "OSMODE"))
(setvar "OSMODE" 0)
(setq D (getdist "\n输入管子外径 D= <20>")
D (if (not D) 20 D)
D5 (* D 0.5)
R (getreal (strcat "\n输入管子弯曲半径 <大于" (rtos D5 2 1) "> R= "))
R (if (not R) D5 R)
R (if (> D5 R) D5 R)
RS (- R D5)
RD (+ R D5)
PT (getpoint "\n管线起点 <0,0>: ")
PT (if (/= PT nil) PT (list 0 0))
AL1 (/ PI 2) AL2 (- AL1)
PT1 (getpoint PT "\n管线下一点 :")
A (angle PT PT1) A1 (+ A AL1) A2 (+ A AL2)
DS (distance PT1 PT)
P1 (polar PT A1 D5)
P2 (polar PT A2 D5)
P3 (polar P1 A (- DS R))
P4 (polar P2 A (- DS R)))
(entmake (list '(0 . "LINE") (cons 10 PT) (cons 11 PT1) '(8 . "CEN")))
(setq S5 (entlast))
(command "_.LINE" P3 P1 "") (setq S1 (entlast))
(command "_.LINE" P1 P2 P4 "") (setq S2 (entlast))
(setq PT PT1 FIR P3 SEC P4)
(while (setq PT1 (getpoint PT "\n管线下一点 :"))
(entmake (list '(0 . "LINE") (cons 10 PT) (cons 11 PT1) '(8 . "CEN")))
(setq S6 (entlast))
(setq A0 (angle PT PT1) A1 (+ A0 AL1) A2 (+ A0 AL2)
DS (distance PT1 PT)
P1 (polar (polar PT A1 D5) A0 R)
P2 (polar (polar PT A2 D5) A0 R)
P3 (polar P1 A0 (- DS R R))
P4 (polar P2 A0 (- DS R R)))
(command "_.LINE" P1 P3 "") (setq S3 (entlast))
(command "_.LINE" P2 P4 "") (setq S4 (entlast))
(command "_.FILLET" "R" R "_.FILLET" S5 S6)
(if (> (distance P1 FIR) (distance P2 SEC))
(command "_.FILLET" "R" RS "_.FILLET" S2 S4
"_.FILLET" "R" RD "_.FILLET" S1 S3)
(command "_.FILLET" "R" RD "_.FILLET" S2 S4
"_.FILLET" "R" RS "_.FILLET" S1 S3)
)
(setq A A0 PT PT1 S1 S3 S2 S4 FIR P3 SEC P4 S5 S6)
)
(setq P1 (polar P3 A0 R) P2 (polar P4 A0 R))
(command "STRETCH" "C" P3 P3 "" P3 P1 "STRETCH" "C" P4 P4 "" P4 P2)
(command "LINE" P1 P2 "")
(setvar "OSMODE" OLDOS)
(setvar "CMDECHO" 1)
(princ)
)
(prompt "\nDRAWPIPE 加载成功。")
(princ)
ZZXXQQ 发表于 2008-2-25 21:28
2004年的老程序了。没什么错。下面是修改过的:
(DEFUN C<img src="static/image/smiley/default/biggrin.gif" smilieid="3" border="0" alt="" />RAWPIPE ()
这行要改为
(DEFUN C:DRAWPIPE () 我想找个双线的用来画钣金 进来学学习一下,看看怎么用的的
页:
1
[2]