标注粗糙度的实用小程序
加载后,输入CCD命令,可以直接标注粗糙度。很好用的,大家试试看(defun ccd_err(s)
(if (/= s "function cancelled")
(princ (strcat "\nError: " s))
)
(setvar "osmode" os)
(setvar "CLAYER" clay)
(setvar "TEXTSTYLE" ttp)
(command "_.UNDO" "_E")
)
;====================Main program========================
(defun c:ccd (/ os clay ttp pt1 sa sh scl pt2 pt3 pt4 pt5 ww )
(setq *error* ccd_err)
(setq os (getvar "osmode")
clay (getvar "CLAYER")
ttp (getvar "TEXTSTYLE"))
(if (null (tblsearch "LAYER" "7标注层"))
(command "_layer" "_m" "7标注层" "_c" 4 ""
"_lt" "continuous" "" "")
)
(if (null (tblsearch "LAYER" "6文字层"))
(command "_layer" "_m" "6文字层" "_c" 3 "" "")
)
(command "_style" "gbeitc" "gbeitc.shx" "" "0.9" "" "" "" "")
(setvar "osmode" 512)
(setq pt1 (getpoint "\n放置位置: ")
sa (getangle pt1 "\n角度(可以选择点决定角度):")
scl (getvar "DIMSCALE")
)
(if (= scl 0.0) (setq scl 1.0))
(setq pt2 (polar pt1 (+ (/ pi 3.0) sa) (* scl 7.5))
pt3 (polar pt1 (+ (/ pi 3.0) sa) (* scl 4.0))
pt4 (polar pt3 (+ pi sa) (* scl 4.0))
pt5 (polar pt1 (+ (/ pi 2.0) sa) (* scl 5.0)))
(setvar "osmode" 0)
(command "_.layer" "S" "7标注层" "")
(command "pline" pt2 "w" "0.0" "" pt1 pt4 pt3 "")
(if (and (> sa (* pi 0.5)) (<= sa (* pi 1.5))) (setq sa (- sa pi)))
(setq ww (getstring (strcat "\n粗糙度(1.6,3.2,6.3, 12.5,25) < 6.3 > : ")))
(if (= "" ww) (setq ww "6.3"))
(setq sa (* sa (/ 180 pi)))
(command "_.layer" "S" "6文字层" "")
(command "_.text" "_middle" pt5 (* scl 3.5) saww)
(setvar "osmode" os)
(setvar "CLAYER" clay)
(setvar "TEXTSTYLE" ttp)
(princ)
)
;==============================================================
怎么加载?? 试试看如何 加载不了啊,请教教我吧!谢谢啊!!! 谢谢了。 谢谢, 很好用正需要,谢谢.赞!
页:
[1]