(defun c:NM (/ bc cir en en1 fx i ss txt)
(setq bc (getdist "\n板材厚度:[2]"))
(setq fx (getint "\n[1-正面]/[2-反面]:[2]"))
(setq i -1)
(if (setq ss (ssget ":S"(list '(0 . "CIRCLE"))))
(while (and(setq en1 (ssname ss (setq i (1+ i)))))
(setq en (entget en1))
(setq cir (* 2 (cdr (assoc 40 en))))
(cond ((= cir 5.4) (setq txt "S-M4"))
((= cir 6.4) (setq txt "S-M5"))
((= cir 8.8) (setq txt "S-M6"))
((= cir 10.5) (setq txt "S-M8"))
(t (princ (strcat "Ф"(rtos cir) "不是压铆底孔!")))
)
(cond
((= bc nil) (setq bc 2))
((= bc 0.8) (setq bc 0))
((= bc 1) (setq bc 0))
((= bc 1.2) (setq bc 0))
((= bc 1.5) (setq bc 0))
((= bc 2) (setq bc 1))
((= bc 2.5) (setq bc 1))
((= bc 3) (setq bc 1))
(t (setq bc 2))
)
(cond ((= fx 1) (setq fx "正面"))
((= fx 2) (setq fx "反面"))
(t (setq fx "反面"))
)
(command "DIMDIAMETER"
en1
"m"
(STRCAT fx "-" txt)
PAUSE
)
(command "MATCHPROP")
)
)
(princ)
)