(defun c:reinforce_classes_check (/ entname i num1 num2 rnfpos1 rnfpos2
				    slength ss text
				 )
  (setq count 0)
  (setq ss nil)
  (setq ss (ssget '((-4 . "<OR") (-4 . "<AND")
		   (0 . "TEXT")
		   (1 . "*;*")
		   (-4 . "AND>")

		   (-4 . "<AND")
		   (0 . "TEXT")
		   (1 . "*;*")
		   (-4 . "AND>")
		   (-4 . "OR>")
		  )
	   )
  )
  (if (/= ss nil)
    (progn
      (command "undo" "group")
      (setq slength (1- (sslength ss)))
      (setq i 0)
      (repeat (sslength ss)
	(setq entname (ssname ss i))
	(setq i (1+ i))
	(command "_change" entname "" "P" "c" "bylayer" "")



      )
      (setq i 0)

      (while (<= i slength)
	(setq entname (ssname ss i))
	(setq i (1+ i))
	(setq text (cdr (assoc 1 (entget entname))))
	(setq rnfpos1 (+ 5 (vl-string-search "%%13" text)))
	(setq rnfpos2 (+ 5 (vl-string-search "%%13" text rnfpos1)))
	(setq num1 (strcat (chr (vl-string-elt text rnfpos1)) (chr
								   (vl-string-elt text
										  (1+ rnfpos1)
								   )
							      )
		   )
	)
	(setq num2 (strcat (chr (vl-string-elt text rnfpos2)) (chr
								   (vl-string-elt text
										  (1+ rnfpos2)
								   )
							      )
		   )
	)
	(if (>= (abs (- (atof num1) (atof num2))) 6)
	  (progn
	    (print "change color.")
	    (command "_change" entname "" "P" "c" "6" "")
	    (setq count (1+ count))
	  )

	)




      )
      (command "undo" "end")
    )
    (print "所选择的范围内没有符合条件的pkpm平法钢筋文本实体.")
  )
  (print (strcat "本次操作共处理" (itoa count)
		 "个钢筋级别相差2级以上的平法文本,并以6号颜色突显"
	 )
  )
  (print)
)
;;; (c:reinforce_classes_check)
(print "本程序作者: 超越极至 BY 老虎空间. 更多作品请访问:http://www.tigerspace.net/")
(print "本程序属老虎空间原创,转贴请注明出处、作者.")

(print "程序启动命令:reinforce_classes_check")
(print)
