本帖最后由 simon8001 于 2011-6-22 11:14 编辑
我查了些资料,手上也有一些这方面的程序,可是对与批量修改定义的属性块这里还不是很清楚,以前insert的都是不用修改的死的块,最近弄的程序里需要编辑这种定义的属性块了,遇到了一些问题,希望得到你们的帮助!!
我要插入的是一个带有12个属性定义的块(看附件),其属性定义的格式为WZ1(1是序号),需要把他们改成("2" "1" "4" "5" "6" "7" "8" "9" "11" "12" "3" ""))
下面是我编的一部分程序,希望你们帮我修改和补充一下!!

- (defun c:qr()
- (setvar "cmdecho" 0)
- (setvar "osmode" 0)
- (initpath-2qrpzh)
- (setq sa-pt '(0 0))
- (setq z-2 (list"2" "1" "4" "5" "6" "7" "8" "9" "11" "12" "3" ""))
- (setq path-blk (strcat path-current-crk "QJ-1"))
- (command "insert" path-blk sa-pt 1 1 0)
- (setq att-n 0)
- (setq crjs-n 1)
- (command (strcat "QZ" (itoa (1+ crjs-n))))
- (repeat 12;12个ATTDEF属性值
- (setq att-txt (nth att-n z-2))
- (command att-txt)
- (setq att-n (1+ att-n))
- )
- (setq en (entlast))
- (repeat 12
- (setq data (entget en))
- (setq ysatt (cdr (assoc 2 data)));群码值可能不对
- (setq fzatt (cdr (assoc 1 data))) ;我我还没有去查这个群码
- ::到这里应该在写修改的东西 我试过一些总是出错
- )
- )
- (defun initpath-2qrpzh()
- (setq path-current (getvar "DWGPREFIX"))
- (setq path-dwg (strcat path-current "ST\" cz "\"))
- (setq path-data-out (strcat path-current "ST\" cz "\" "TM\"))
- (setq path-data-out2 (strcat path-current "ST\" cz "\"))
- (setq path-data-in (strcat path-current "ST\" cz "\" "US\"))
- (setq path-data-in2 (strcat path-current "ST\" cz "\"))
- )
-
|