wang8091 发表于 2016-7-25 01:37:49

(求助)属性块文字直接替换

有没有一个办法在属性块里,我只要输入B1 他就将附档机种里的ABC值替换成123,输入B2他就换成456,求大神帮帮忙设定一下。。谢谢啦












lishucheng96 发表于 2016-7-26 03:08:44

本帖最后由 lishucheng96 于 2016-8-5 13:53 编辑

(DEFUN CHATTRIB (OLDATT NEWATT)
(IF (AND (PRINC "\nSelect Block with attribute 选择带属性图块 :")
          (SETQ SS (SSGET '((0 . "INSERT") (66 . 1))))) (PROGN
(SETQ I -1)
(REPEAT (SSLENGTH SS)
   (SETQ ENT (ENTGET (SSNAME SS (SETQ I (1+ I))))
         ENT1 ENT)
   (WHILE (= (CDR (ASSOC 0 (SETQ ENT1 (ENTGET (ENTNEXT (CDR (ASSOC -1 ENT1))))))) "ATTRIB")
    (IF (= (CDR (ASSOC 1 ENT1)) OLDATT) (PROGN
(SETQ ENT1 (SUBST (CONS 1 NEWATT) (ASSOC 1 ENT1) ENT1))
(ENTMOD ENT1)
(ENTMOD ENT)
))
   )
)
))
(PRINC)
)
(DEFUN C:A11 (/ input)
(setq input (getstring "\输入b1/b2<b1>:"))
(if (= input "")
      (setq input "b1")
)
(IF (= input "b1")
      (SETQ OATT "ABC" NATT "123")
      (SETQ NATT "ABC" NATT "456")
)
(CHATTRIB OATT NATT)

(PRINC)

magicheno 发表于 2023-3-21 14:22:59

感谢大佬分享

书院扫地僧 发表于 2023-3-29 16:42:04

感谢!!!!!!!!!!
页: [1]
查看完整版本: (求助)属性块文字直接替换