本帖最后由 夏生生 于 2013-1-12 10:50 编辑
您这个要求相对简单,但是对于不是本专业的人,对您的要求摸不到头脑,个人认为括号应该在输入钢筋的时候就输入进去,不过按您的要求写了一个,看看是否符合
- ;;;仅针对集中标注
- ;;;对于集中标注来讲三种情况
- ;;;一只有面筋,一有分号前面就是架立筋,一有分号前面不是架立筋但必有+号
- (defun c:jlj (/ en ent str obj n m)
- (while (setq en (car (entsel)))
- (setq ent (entget en)
- str (cdr (assoc 1 ent))
- obj (vlax-ename->vla-object en)
- )
- (if (and (= "TEXT" (cdr (assoc 0 ent)))
- (vl-string-search "%%13" str)
- )
- (if (vl-string-search "(" str)
- (progn
- (while (vl-string-search "(" str) (setq str (vl-string-subst "" "(" str)))
- (while (vl-string-search ")" str) (setq str (vl-string-subst "" ")" str)))
- (vla-put-TextString obj str)
- (princ "\n您选择钢筋文字已示架立筋,默认去除,重新选择恢复")
- )
- (if (setq n (vl-string-search ";" str))
- (if (setq m (vl-string-search "+" str))
- (vla-put-TextString
- obj
- (strcat (substr str 1 (1+ m))
- "("
- (substr str (+ 2 m) (- n m 1))
- ")"
- (substr str (+ 1 n))
- )
- )
- (vla-put-TextString
- obj
- (strcat "(" (substr str 1 n) ")" (substr str (+ 1 n)))
- )
- )
- (vla-put-TextString obj (strcat "(" str ")"))
- )
- )
- (princ "\n您选择的不是钢筋文字请重新选择")
- )
- )
- (princ)
- )
|