(defun mainprocess (stringinput / j k len_l num_l num_r pos stringlen
				stringlst strinput
		   )
  (setq strinput stringinput)
  (if (/= strinput nil)
    (progn
      (setq pos (vl-string-search ".." strinput))
      (if (/= pos nil)
	(progn
	  (setq stringlst (vl-string->list strinput))
	  (setq stringlen (1- (length stringlst))
		j (+ pos 2)
		num_r ""
	  )
	  (while (<= j stringlen)
	    (setq num_r (strcat num_r (chr (nth j stringlst))))
	    (setq j (1+ j))
	  )
	  (if (<= (atoi num_r) 50)
	    (progn
	      (setq k 0
		    len_l (1- pos)
		    num_l ""
	      )
	      (while (<= k len_l)
		(setq num_l (strcat num_l (chr (nth k stringlst))))
		(setq k (1+ k))
	      )
	      (setq strinput (vl-string-subst "%%132" ".." strinput))
	    )
	    (progn
	      (setq k 0
		    len_l (1- pos)
		    num_l ""
	      )
	      (while (<= k len_l)
		(setq num_l (strcat num_l (chr (nth k stringlst))))
		(setq k (1+ k))
	      )
	      (setq strinput (strcat "%%132" num_l "@" num_r))
	    )
	  )
	)
	(progn
	  (setq pos (vl-string-search "." strinput))
	  (setq stringlst (vl-string->list strinput))
	  (setq stringlen (1- (length stringlst))
		j (+ pos 1)
		num_r ""
	  )
	  (while (<= j stringlen)
	    (setq num_r (strcat num_r (chr (nth j stringlst))))
	    (setq j (1+ j))
	  )
	  (if (<= (atoi num_r) 50)
	    (progn
	      (setq k 0
		    len_l (1- pos)
		    num_l ""
	      )
	      (while (<= k len_l)
		(setq num_l (strcat num_l (chr (nth k stringlst))))
		(setq k (1+ k))
	      )
	      (if (>= (atoi num_r) 12)
		(setq strinput (vl-string-subst "%%131" "." strinput))
		(setq strinput (vl-string-subst "%%130" "." strinput))
	      )
	    )
	    (progn
	      (setq k 0
		    len_l (1- pos)
		    num_l ""
	      )
	      (while (<= k len_l)
		(setq num_l (strcat num_l (chr (nth k stringlst))))
		(setq k (1+ k))
	      )
	      (if (>= (atoi num_l) 12)
		(setq strinput (strcat "%%131" num_l "@" num_r))
		(setq strinput (strcat "%%130" num_l "@" num_r))
	      )
	    )
	  )
	)			       ;  progn2 end
      )
    )
  )
)
(defun c:reinforce_input (/ entname i newstr ss sslen strinput)
  (vl-load-com)
  (setq ss (ssget '((0 . "TEXT"))))
  (if (/= ss nil)
    (progn
      (setq strinput (getstring T "\n请输入钢筋字符串(xxx.xxx表示一二级钢筋 xxx..xxx表示三级钢 同时支持+号):"))
      (if (/= strinput "")
	(progn
	  (setq i 0
		sslen (1- (sslength ss))
	  )
	  (if (= (vl-string-search "+" strinput) nil)
	    (setq newstr (mainprocess strinput))
	    (setq newstr (add_process strinput))
	  )
	  (setq newstr (vl-string-subst "(6)" "***" newstr)
		newstr (vl-string-subst "(4)" "**" newstr)
		newstr (vl-string-subst "(2)" "*" newstr)
	  )
	  (while (<= i sslen)
	    (setq entname (cdr (assoc -1 (entget (ssname ss i)))))
	    (sub_upd entname 1 newstr)
	    (setq i (1+ i))
	  )
	)
	(progn
	  (setq strinput (getstring T "\n请输入任意字符串:"))
	  (setq newstr strinput)
	  (setq i 0
		sslen (1- (sslength ss))
	  )
	  (while (<= i sslen)
	    (setq entname (cdr (assoc -1 (entget (ssname ss i)))))
	    (sub_upd entname 1 newstr)
	    (setq i (1+ i))
	  )
	)
      )
    )
  )
  (print)
)
;;; _______________________________________________________________________
;;; _
;;; ______________
(defun add_process (strinput_out / j k len_l num_l num_r pos stringlen
				 stringlst strinput
		   )
  (setq strinput strinput_out)
  (setq pos (vl-string-search "+" strinput))
  (setq stringlst (vl-string->list strinput))
  (setq stringlen (1- (length stringlst))
	j (+ pos 1)
	num_r ""
  )
  (while (<= j stringlen)
    (setq num_r (strcat num_r (chr (nth j stringlst))))
    (setq j (1+ j))
  )
  (setq k 0
	len_l (1- pos)
	num_l ""
  )
  (while (<= k len_l)
    (setq num_l (strcat num_l (chr (nth k stringlst))))
    (setq k (1+ k))
  )
  (strcat (mainprocess num_l) "+" (mainprocess num_r))
)
;;; ___________________________________________________________
(defun sub_upd (ename code newvalue)
  (entmod (subst
	    (cons code newvalue)
	    (assoc code (entget ename))
	    (entget ename)
	  )
  )
  (entupd ename)
)
;;; ____________________________________________________________
(print "本程序作者: 超越极至 BY 老虎空间. 更多作品请访问:http://www.tigerspace.net/")
(print "本程序属老虎空间原创,转贴请注明出处、作者.")
(print "程序启动命令:reinforce_input")
(print)
