Zorg 发表于 2022-7-6 12:55:43

你能修理这个吗?

(command "-scalelistedit" "reset" "y" "e")
( / slist rlist drac csobj entlst entnm)
(vl-load-com)
(setvar "cmdecho" 0)
(setq slist '("1:1" "1:20" "1:50" "1:100"))
(setq csobj (vlax-ename->vla-object (cdar (dictsearch (namedobjdict) "ACAD_SCALELIST")))
   drac 0)
(repeat (vla-get-count csobj)
   (if (not (member (cdr (assoc 300 (entget (setq entnm (vlax-vla-object->ename (vlax-invoke-method csobj 'item drac)))))) slist))
   (setq entlst (append (list entnm) entlst)))
   (setq drac (1+ drac)))
(mapcar 'entdel entlst)
(setvar "cmdecho" 1)
(princ)
 
我想不出为什么它不会加载:/有人能帮忙吗?可能很简单:眨眼:
 
提前感谢

flowerrobot 发表于 2022-7-6 13:24:21

是这样的吗?
仅移动和删除简单的局部变量
 
(defun c:tt ( / slist rlist drac csobj entlst entnm)
(vl-load-com)
(setvar "cmdecho" 0)
(command "-scalelistedit" "reset" "y" "e")
(setq slist '("1:1" "1:20" "1:50" "1:100"))
(setq csobj (vlax-ename->vla-object (cdar (dictsearch (namedobjdict) "ACAD_SCALELIST")))
   drac 0)
(repeat (vla-get-count csobj)
   (if (not (member (cdr (assoc 300 (entget (setq entnm (vlax-vla-object->ename (vlax-invoke-method csobj 'item drac)))))) slist))
   (setq entlst (append (list entnm) entlst)))
   (setq drac (1+ drac)))
(mapcar 'entdel entlst)
(setvar "cmdecho" 1)
(princ)
)

Zorg 发表于 2022-7-6 13:37:17

我最初卸下了defun不得不在开机时执行。为此,剧本需要做很多修改吗?

flowerrobot 发表于 2022-7-6 13:46:31

不,一点也不
 
然而,我会保留它一个defun&只是为它添加初始化,我发现以后更容易跟踪事情。如果没有,只需删除第一行和结束行
 
(defun ScaleListCreater ( / slist rlist drac csobj entlst entnm)
(vl-load-com)
(setvar "cmdecho" 0)
(command "-scalelistedit" "reset" "y" "e")
(setq slist '("1:1" "1:20" "1:50" "1:100"))
(setq csobj (vlax-ename->vla-object (cdar (dictsearch (namedobjdict) "ACAD_SCALELIST")))
   drac 0)
(repeat (vla-get-count csobj)
   (if (not (member (cdr (assoc 300 (entget (setq entnm (vlax-vla-object->ename (vlax-invoke-method csobj 'item drac)))))) slist))
   (setq entlst (append (list entnm) entlst)))
   (setq drac (1+ drac)))
(mapcar 'entdel entlst)
(setvar "cmdecho" 1)
(princ)
)
(ScaleListCreater)

Zorg 发表于 2022-7-6 14:09:06

干杯伙计!
页: [1]
查看完整版本: 你能修理这个吗?