本帖最后由 Gu_xl 于 2011-2-12 13:22 编辑
;;花季20110212
http://hi.baidu.com/123523058/home
 - (defun C:XS ()
- (XS)
- )
- (defun xs ()
- (setq a (ssget '((0 . "TEXT"))))
- (setq m (getint "输入小数位数: "))
- (if a
- (progn
- (setq i 0)
- (setq n (sslength a))
- (while (< i n)
- (setq e (ssname a i))
- (setq eb (entget e))
- (setq eb0 (cdr (assoc 1 eb)))
- (setq eb0 (atof eb0))
- (setq eb0 (rtos eb0 2 m))
- (setq eb2 (str_xsws eb0 m))
- (setq eb (subst (cons 1 eb2) (assoc 1 eb) eb))
- (entmod eb)
- (setq i (1+ i))
- )
- )
- )
- )
- (defun str_xsws (str xsws / lst xs n bw)
- (if (/= (vl-string-position (ascii ".") str) nil)
- (progn (setq lst (HJ-read->biao str "."))
- (setq xs (cadr lst))
- (setq n (strlen xs))
- (if (< n xsws)
- (progn
- (setq bw (- xsws n))
- (repeat bw
- (setq xs (strcat xs "0"))
- )
- )
- )
- (setq str (strcat (car lst) "." xs))
- )
- (if (/= xsws 0)
- (progn
- (setq str (strcat str "."))
- (repeat xsws
- (setq str (strcat str "0"))
- )
- )
- )
- )
- str
- )
- (defun HJ-READ->BIAO (str fgf / biao s1 i)
- (setq biao nil)
- (setq i (vl-string-search fgf str))
- (while i
- (setq s1 (substr str 1 i))
- (setq str (substr str (+ 2 i)))
- (setq biao (append biao (list s1)))
- (setq i (vl-string-search fgf str))
- )
- (append biao (list str))
- )
|