马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
分享一个快速绘制水管弯头的工具,适用于带中线的双线管道,可以自定义半径曲率,分长半径和短半径两种。用于画水管图很方便!
- ;**用于双线表示的管道长弯头的画法,
- ;;;方法:两点确定管道直径DN,依次由内往外点击弯头内圆。
- ; HoonsyBai
- ;双线弯头
- (defun c:ww( )
- (print "Create by HoonsyBai" )
- (vl-load-com)
- (setvar "cmdecho" 0)
- (setq #lay (getvar "clayer")) ;;取得当前图层
- (setq #os (getvar "osmode"))
- (initget "W E")
- (setq #k
- (getkword "\n请选择弯头类型:[长半径弯头(W)/短半径弯头(E)]")
- )
- (if (= #k nil) (setq #k "W"))
- (if *D* (setq ds (getdist (strcat "测量管道直径或输入:<" (rtos *D* 2 2) ">:")))
- (setq ds (getdist "测量管道直径或输入:"))
- )
- (if (null ds) (setq ds *D*) (setq *D* ds))
- (princ ds)
- (cond ((= #k "W") (progn (setq ds1 ds) (setq ds2 (* ds 1.5)) (setq ds3 (* ds 2))))
- ((= #k "E") (progn (setq ds1 (* ds 0.5)) (setq ds2 ds) (setq ds3 (* ds 1.5))))
- )
- (command "fillet" "r" (rtos ds1))
- (command "fillet" (setq e1(sqx)) (setq e2(sqx))) ;画内倒圆角
- (setq yh(entget(entlast)))
- (command "fillet" "r" (rtos ds2))
- (command "fillet" (sqx) (sqx)) ;画中倒圆角
- (command "fillet" "r" (rtos ds3))
- (command "fillet" (setq e3(sqx)) (setq e4(sqx))) ;画外倒圆角
- (setq ly (cdr (assoc 8 (entget (car e4)))))
- (setvar "osmode" 0)
- (setvar "clayer" ly)
- (setq pc (cdr (assoc 10 yh))) ;获取圆弧的圆心点
- (setq pt1 (vlax-curve-getclosestpointto (car e1) pc t))
- (setq pt2 (vlax-curve-getclosestpointto (car e2) pc t))
- (setq pt3 (vlax-curve-getclosestpointto (car e3) pc t))
- (setq pt4 (vlax-curve-getclosestpointto (car e4) pc t)) ;获得圆心到所选取直线的垂足点
- (if (< (abs (- ds (distance pt1 pt3))) 1) (setq ptt1 pt3 ptt2 pt4) (setq ptt1 pt4 ptt2 pt3))
- (setvar "osmode" 0)
- (command "line" pt1 ptt1 "")
- (command "line" pt2 ptt2 "")
- (setvar "osmode" #os)
- (setvar "clayer" #lay)
- (princ) ;静默退出
- )
- (defun sqx()
- (setq ent nil)
- (while (= ent nil)
- (setq ent (entsel "\n 输入边:"))
- )
- )
|