燃烧 发表于 2016-9-19 21:39:00

沉头孔标注

上班太闲了,做了个沉头孔标注小程序,分享给大家!

(defun c:dw (/ en_data en txt diam v1 v2 v3)
(setq v1 (getvar "dimtoh"))
(setq v2 (getvar "dimtih"))
(setq v3 (getvar "dimtad"))
(setq en (entsel "\n选择孔!")
en_data (entget (car en))
)
(setq diam (* 2 (cdr (assoc 40 en_data))))
(cond ((equal diam 5.0 0.05)
(setq txt
"\\pxsm1.05,qc;2-%%C5\\P{\\Fgdt|c134;\\W0.7;\\Ov\\Fgbenor,gbcbig|c134;\\W1;%%C8\\Fgdt|c134;x\\Fgbenor,gbcbig|c134;4.5}"
)
)
((equal diam 6.0 0.05)
(setq txt
"\\pxsm1.05,qc;2-%%C6\\P{\\Fgdt|c134;\\W0.7;\\Ov\\Fgbenor,gbcbig|c134;\\W1;%%C10\\Fgdt|c134;x\\Fgbenor,gbcbig|c134;6}"
)
)
((equal diam 7.0 0.05)
(setq txt
"\\pxsm1.05,qc;2-%%C7\\P{\\Fgdt|c134;\\W0.7;\\Ov\\Fgbenor,gbcbig|c134;\\W1;%%C11\\Fgdt|c134;x\\Fgbenor,gbcbig|c134;7}"
)
)
((equal diam 9.0 0.05)
(setq txt
"\\pxsm1.05,qc;2-%%C9\\P{\\Fgdt|c134;\\W0.7;\\Ov\\Fgbenor,gbcbig|c134;\\W1;%%C14\\Fgdt|c134;x\\Fgbenor,gbcbig|c134;9}"
)
)
((equal diam 3.5 0.05)
(setq txt
"\\pxsm1.05,qc;2-%%C3.5\\P{\\Fgdt|c134;\\W0.7;\\Ov\\Fgbenor,gbcbig|c134;\\W1;%%C6.5\\Fgdt|c134;x\\Fgbenor,gbcbig|c134;3.5}"
)
)
((equal diam 11 0.05)
(setq txt
"\\pxsm1.05,qc;2-%%C11\\P{\\Fgdt|c134;\\W0.7;\\Ov\\Fgbenor,gbcbig|c134;\\W1;%%C17\\Fgdt|c134;x\\Fgbenor,gbcbig|c134;11}"
)
)
((equal diam 14 0.05)
(setq txt
"\\pxsm1.05,qc;2-%%C14\\P{\\Fgdt|c134;\\W0.7;\\Ov\\Fgbenor,gbcbig|c134;\\W1;%%C20\\Fgdt|c134;x\\Fgbenor,gbcbig|c134;14}"
)
)
((equal diam 18 0.05)
(setq txt
"\\pxsm1.05,qc;2-%%C14\\P{\\Fgdt|c134;\\W0.7;\\Ov\\Fgbenor,gbcbig|c134;\\W1;%%C28\\Fgdt|c134;x\\Fgbenor,gbcbig|c134;18}"
)
)
)
(setvar "dimtih" 0)
(setvar "dimtoh" 1)
(setvar "dimtad" 0)
(command "dimdiameter" en "m" txt pause)
(setvar "dimtih" v1)
(setvar "dimtoh" v2)
(setvar "dimtad" v3)
(princ)
)

F4164789 发表于 2016-9-20 15:25:39

点赞感谢楼主,明经有你更精彩

至今没学会 发表于 2023-5-22 08:15:03

大哥,这个反面沉头的怎么标注啊,另外这个都是只能自动显示2个呀,得手工更改数量,能优化下嘛

shirker 发表于 7 天前

谢谢分享,学习
页: [1]
查看完整版本: 沉头孔标注