- 积分
- 1742
- 明经币
- 个
- 注册时间
- 2015-2-2
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
;*****************************************************************************
;1、闸阀
(defun c:XTT_zf(/ os pw cc LT oh sc sc2 DN DN2 ps pdr aa pt1 pt2 pe pmd pmd1 pmd2 ptx pt3 pt4 ee txt)
(setvar "cmdecho" 0)
(setvar "blipmode" 0)
(setq os (getvar "osmode"))
(setq pw (getvar "plinewid"))
(setq cc (getvar "cecolor"))
(setq LT (getvar "celtype"))
(setq oh (getvar "ORTHOMODE"))
(setvar "ORTHOMODE" 1)
(setvar "plinewid" 0)
(setvar "CELTYPE" "continuous")
(prompt "\n首次运行必须输入出图比例!!!")
(setq sc (getstring "\n出图比例<默认值>:" ))
(if (= sc "") (setq sc1 sc1)(setq sc1 sc))
(setq sc2 sc1)
(setq sc2 (atof sc2))
(prompt "\n首次运行必须输入阀门公称尺寸!!!")
(setq DN (getstring "\n阀门公称尺寸[10,15,20.....]<默认值>:" ))
(if (= DN "") (setq DN1 DN1)(setq DN1 DN))
(setq DN2 DN1)
(setvar "osmode" 547)
(setq ps (getpoint "\n插入点:"))
(setq pdr (getpoint ps "\n方向:"))
(setq aa (angle ps pdr))
(setvar "osmode" 0)
(if (null ang4) (sanjiao))
(setq pt1 (polar ps (+ aa ang2) (* sc2 1.5)))
(setq pt2 (polar ps (+ aa ang4) (* sc2 1.5)))
(setq pmd (polar ps (+ aa ang1) (* sc2 4)))
(setq pmd1 (polar pmd (+ aa ang2) (* sc2 1.5)))
(setq pmd2 (polar pmd (+ aa ang4) (* sc2 1.5)))
(if (= aa ang1)
(setq ptx (polar pmd (+ aa ang2) (* sc2 2.0)))
)
(if (= aa ang3)
(setq ptx (polar pmd (+ aa ang4) (* sc2 6.0)))
)
(if (= aa ang2)
(setq ptx (polar pmd (+ aa ang3) (* sc2 2.0)))
)
(if (= aa ang4)
(setq ptx (polar pmd (+ aa ang1) (* sc2 6.0)))
)
(setq pe (polar ps (+ aa ang1) (* sc2 8)))
(setq pt3 (polar pe (+ aa ang2) (* sc2 1.5)))
(setq pt4 (polar pe (+ aa ang4) (* sc2 1.5)))
(setq ee (ssget ps pe))
(if (/= ee nil) ;;判断线条是否存在,若存在则将其打断
(command "break" ps pe)
)
(command "pline" pt1 pt2 pt3 pt4 "CL")
(command "pline" pmd1 pmd2 "")
(setvar "cecolor" "1" )
(setq txt (strcat "DN" DN2))
(if (= aa ang1)
(progn
(setq ptx (polar pmd ang2 (* sc2 2)))
(command "text" "J" "BC" ptx (* sc2 3) 0 txt)
)
)
(if (= aa ang3)
(progn
(setq ptx (polar pmd ang2 (* sc2 2)))
(command "text" "J" "BC" ptx (* sc2 3) 0 txt)
)
)
(if (= aa ang2)
(progn
(setq ptx (polar pmd ang3 (* sc2 2)))
(command "text" "J" "BC" ptx (* sc2 3) 90 txt)
)
)
(if (= aa ang4)
(progn
(setq ptx (polar pmd ang3 (* sc2 2)))
(command "text" "J" "BC" ptx (* sc2 3) 90 txt)
)
)
(if (and (> aa ang1)(< aa ang2))
(progn
(setq ptx (polar pmd (+ aa ang2) (* sc2 2)))
(command "text" "J" "BC" ptx (* sc2 3) (rtod (+ aa ang1)) txt)
)
)
(if (and (> aa ang2)(< aa ang3))
(progn
(setq ptx (polar pmd (+ aa ang4) (* sc2 2)))
(command "text" "J" "BC" ptx (* sc2 3) (rtod (+ aa ang1 ang3)) txt)
)
)
(if (and (> aa ang3)(< aa ang4))
(progn
(setq ptx (polar pmd (- aa ang2) (* sc2 2)))
(command "text" "J" "BC" ptx (* sc2 3) (rtod (+ (- aa ang1) ang3)) txt)
)
)
(if (and (> aa ang4)(< aa (* 2 PI)))
(progn
(setq ptx (polar pmd (+ aa ang2) (* sc2 2)))
(command "text" "J" "BC" ptx (* sc2 3) (rtod aa) txt)
)
)
(setvar "cecolor" cc)
(setvar "plinewid" pw)
(setvar "osmode" os)
(setvar "CELTYPE" LT)
(setvar "ORTHOMODE" oh)
(prin1)
)
|
|