| dhy 发表于 2014-11-4 11:17  请问公差里面,明明是输入了+号的,为什么不显示+号呢,-号就有显示
再改一下
  (defun C:G5 ()
 (if (and 
      (if (setq t11 (getreal
        (strcat "\n请指定上限公差值+" (if t1 (strcat "<" (rtos t1 2) ">: ") ": "))))
       (setq t1 t11) t1
      )
      (if (setq t21 (getreal
                    (strcat "\n请指定下限公差值-" (if t2 (strcat "<" (rtos t2 2) ">: ") ": "))))
       (setq t2 t21) t2
      )
      (princ "\n选择尺寸: ")
      (setq ss (ssget '((0 . "DIMENSION")))))
 (progn
  (setq t1f (if (> t1 0) "+" ""))
  (setq t2f (if (> t2 0) "+" ""))
  (if (equal t1 t2 1e-6)
   (setq txt (strcat "<>%%P" (rtos t1 2)))
   (setq txt (strcat "<>{\\H0.7x;\\S" t1f (rtos t1 2) "^" t2f (rtos t2 2) ";}"))
  )
  (repeat (setq i (sslength ss))
   (setq ent (entget(ssname ss (setq i (1- i)))))
   (entmod (subst (cons 1 txt) (assoc 1 ent) ent))
  )
 ))
 (princ)
)
 |