至今没学会 发表于 2023-6-26 17:06:48

求大佬改下这个LSP

此为沉头孔插件,改成非标和国标的都能用,包括椭圆孔,麻烦大佬们帮忙改下,谢谢!




(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)
)

ssyfeng 发表于 2023-6-27 13:20:06

你这说的太专业,不是你们行业的都听不懂。
页: [1]
查看完整版本: 求大佬改下这个LSP