(defun c:rcc ( / entname i num1 num2 rnfpos1 rnfpos2 slength ss text )
  (print "\n本程序作者: 超越极至 BY 老虎空间. 更多作品请访问:http://www.tigerspace.net/")
  (print "\n本程序属老虎空间原创,转贴请注明出处、作者.")
  (princ "\n检查钢筋级差是否超过2级")
  (setq ss (ssget '((0 . "TEXT") (8 . "水平钢筋,垂直钢筋") (1 . "*+*"))))
  (if (not ss) (progn (print "所选择的范围内没有符合条件的pkpm平法钢筋文本实体.")(exit)))
  (command "_.change" ss "" "P" "c" "bylayer" "")
  (setq slength (sslength ss)
        i 0
        count 0
  )
  (while (< i slength)
	(setq entname (ssname ss i)
	      i (1+ i)
	      text (cdr (assoc 1 (entget entname)))
	      rnfpos1 (+ 5 (vl-string-search "%%13" text))
	      rnfpos2 (+ 5 (vl-string-search "%%13" text rnfpos1))
	      num1 (strcat (chr (vl-string-elt text rnfpos1))
	                   (chr (vl-string-elt text (1+ rnfpos1)))
		       )
	      num2 (strcat (chr (vl-string-elt text rnfpos2))
	                   (chr (vl-string-elt text (1+ rnfpos2)))
		       )
	)
	(if (>= (abs (- (atof num1) (atof num2))) 6)
	    (progn
	       (command "_.change" entname "" "P" "c" "6" "")
	       (setq count (1+ count))
	    )
	)
  )
  (print (strcat "本次操作共处理" (itoa count)
		         "个钢筋级别相差2级以上的平法文本,并以6号颜色突显"
	     )
  )
)
