pzweng
发表于 2022-6-1 11:35:59
本帖最后由 pzweng 于 2022-6-1 11:37 编辑
xiaocainiao 发表于 2022-6-1 10:30
你这个相当于先全部显示所有图形、然后执行命令、最后再恢复到上一个视图、反正不管怎么弄、都得让图形先 ...
(defun c:ms (/ e doc ctab state ss sc _dxf id dic xre sca sdat)
(defun _dxf (c e) (cdr (assoc c (entget e))))
(if (and
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(= (getvar 'tilemode) 0)
(setq ctab (getvar 'ctab))
(setq state (vla-get-mspace doc))
(null (vla-put-mspace doc :vlax-false))
(setq ss (ssget "X" '((0 . "VIEWPORT"))))
(setq sc "1:50")
)
(progn
(setq lst (read (vl-string-subst " " ":" (strcat "(" sc ")"))))
(repeat (setq i (sslength ss))
(setq e (ssname ss (setq i (1- i))))
(if (and (/= 1 (setq id (_dxf 69 e))) (= (_dxf 410 e) ctab))
(progn
(setq dic (_dxf 360 e))
(setq xre (_dxf 360 dic))
(setq sca (_dxf 340 xre))
(setq sdat (entget sca))
(mapcar '(lambda (a b) (entmod (subst (cons a b) (assoc a sdat) sdat)))
'( 140 141 300)
(append lst (list sc))
)
;;; (entmod (subst (cons 300 sc) (assoc 300 sdat) sdat))
;;; (entmod (subst (cons 140 (car lst)) (assoc 140 sdat) sdat))
;;; (entmod (subst (cons 141 (cadr lst)) (assoc 141 sdat) sdat))
)
)
)
)
)
(vla-put-mspace doc state)
(princ)
)
自己再调试下
xiaocainiao
发表于 2022-6-1 12:17:53
pzweng 发表于 2022-6-1 11:35
(defun c:ms (/ e doc ctab state ss sc _dxf id dic xre sca sdat)
(defun _dxf (c e) (cdr (assoc c ...
谢谢、有时间我再试一下
yefei812678
发表于 2024-2-25 17:36:38
错误信息错误信息