matichen 发表于 2002-8-20 18:17:00

急,刚用(entmod(subst ....))更新过的表,再assoc引用结果没更新?

前生 发表于 2002-8-20 18:35:00

程序贴一段,看看

matichen 发表于 2002-8-20 20:02:00

贴了,帮忙看看..

本帖最后由 作者 于 2002-8-20 20:02:15 编辑

;;; funtion 2
(defun th()
(setq txtent(car (entsel "\n    选择标高文字: ")))
(setq txtdata(entget txtent))
(setq txtid(cdr (assoc 10 txtdata)))
(setq txth(cdr (assoc 40 txtdata)))
(setq txtm(cdr (assoc 1 txtdata)))
(setq txt(cons 1 (strcat "(" "H" txtm ")")))
(entmod (subst txt (assoc 1 txtdata) txtdata));;;就是这段更新了txtdata表后,textbox这个表,类容是更新前的
(setq txtidx(car txtid)
        txtidy(cadr txtid)
        )
(setq tx(+ (caadr (textbox txtdata)) txtidx))
(setq ty(+ txtidy (/ txth 2)))
(setq txy(strcat (rtos tx 2 2) "," (rtos ty 2 2)))
)
;;; end funtion 2

ll_j 发表于 2002-8-21 08:18:00

因为实体更新后,变量txtdate并没有更新。

(entmod (subst txt (assoc 1 txtdata) txtdata))
这句改为:
(entmod (setq txtdate (subst txt (assoc 1 txtdata) txtdata)))
因为实体更新后,变量txtdate并没有更新。

龙龙仔 发表于 2002-8-21 08:33:00

看看...

看看..
;;; funtion 2
(defun TH ()
(setq TXTENT (car (entsel "\n择标高文字: ")))
(setq TXTDATA (entget TXTENT))
(setq TXTID (cdr (assoc 10 TXTDATA)))
(setq TXTH (cdr (assoc 40 TXTDATA)))
(setq TXTM (cdr (assoc 1 TXTDATA)))
(setq TXT (cons 1 (strcat "(" "H" TXTM ")")))
;(entmod (subst TXT (assoc 1 TXTDATA) TXTDATA))
(entmod (setq TXTDATA (subst TXT (assoc 1 TXTDATA) TXTDATA)))
;;;就是这段更新了txtdata表后,textbox这个表,类容是更新的
(setq        TXTIDX (car TXTID)
        TXTIDY (cadr TXTID)
)
(setq TX (+ (caadr (textbox TXTDATA)) TXTIDX))
(setq TY (+ TXTIDY (/ TXTH 2)))
(setq TXY (strcat (rtos TX 2 2) "," (rtos TY 2 2)))
)
;;; end funtion 2

matichen 发表于 2002-8-21 12:50:00

感谢龙龙和ll_j !!

cghdy 发表于 2023-6-13 08:08:05

ll_j 发表于 2002-8-21 08:18
(entmod (subst txt (assoc 1 txtdata) txtdata))
这句改为:
(entmod (setq txtdate (subst txt (asso ...

多谢指导
页: [1]
查看完整版本: 急,刚用(entmod(subst ....))更新过的表,再assoc引用结果没更新?