Jimmy Sean 发表于 2022-7-6 11:16:01

 
 
谢谢,我有点理解你在做什么,但我也不知道该如何使用它。

alanjt 发表于 2022-7-6 11:17:57

它的工作方式与您发布的相同。

Jimmy Sean 发表于 2022-7-6 11:21:23

好的,但对我来说不是。
 
谢谢你对我的耐心。
 
我已经在心里把你贴的Lisp程序分开了,但我无法复制我的Lisp程序在你的Lisp程序中的作用。当它运行时,我可以告诉它正在循环,我可以取消它,但它从来没有像我的一样闪烁。我看不出你的那是设定线宽。
 
“t”是一个被设置的任意变量还是其他什么,我不确定。
 
还有什么是“abs”
 
(setvar 'lwdisplay (abs (1- (getvar 'lwdisplay))))
 
谢谢
肖恩

alanjt 发表于 2022-7-6 11:26:31

abs是绝对值
 
 
它没有设定权重。它只是切换线宽显示的开/关状态。

Jimmy Sean 发表于 2022-7-6 11:29:13

经过一些尝试和错误,我得到了一些工作,不闪烁,不允许我缩放和平移时循环。有没有想过为什么我不能缩放和平移?

Jimmy Sean 发表于 2022-7-6 11:33:04

经过更多的尝试和错误,我得到了它的功能,我想除了我需要一些帮助与错误处理部分。我知道我又把它分开了,但如果它都在一个Lisp程序的地方,我就无法让它工作。它在运行时不会闪烁,也不会缩放。
 
在错误处理方面,如果它将lwdisplay重置为off,我无法使其工作,并且我还需要它将所有线宽设置回默认值。有人愿意给我一些指导吗?
 
 
什么是“uu”在延迟命令之前?
谢谢
肖恩
;;;;;;;;;;;;;;;;;;;;;;
;THIS MACRO MUST BE KEPT SEPARATE FROM LWTFLASHOFF OR IT WILL NOT RUN AND WILL NOT ALLOW ZOOMING AND PANNING WHILE FLASHING.
;;;;;;;;;;;;;;;;;;;;;;
(defun C:LWTFLASHON (/ *error* lwd)
(defun *error* (msg)
;    (and lwd (setvar 'lwdisplay lwd))
   (if (and msg (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*QUIT*,")))
   (princ (strcat "\nError: " msg))
   )
)

(setq lwd (getvar 'lwdisplay))
;(while t
;    (setvar 'lwdisplay (abs (1- (getvar 'lwdisplay))))
;    (command "_.delay" 2000)
(command "LWDISPLAY" "ON" "DELAY" "200")
(*error* nil)
(princ)
)

;;;;;;;;;;;;;;;;;;;;;;
;End Flash On
;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;;;;;;;;
;Flash OFF
;;;;;;;;;;;;;;;;;;;;;;
;THIS MACRO MUST BE KEPT SEPARATE FROM LWTFLASHOFF OR IT WILL NOT RUN AND WILL NOT ALLOW ZOOMING AND PANNING WHILE FLASHING.
;;;;;;;;;;;;;;;;;;;;;;
(defun C:LWTFLASHOFF (/ *error* lwd)
(defun *error* (msg)
;    (and lwd (setvar 'lwdisplay lwd))
   (if (and msg (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*QUIT*,")))
   (princ (strcat "\nError: " msg))
   )
)

(setq lwd (getvar 'lwdisplay))
;(while t
;    (setvar 'lwdisplay (abs (1- (getvar 'lwdisplay))))
;    (command "_.delay" 2000)
(command "LWDISPLAY" "OFF" "DELAY" "200")
(*error* nil)
(princ)
)

;;;;;;;;;;;;;;;;;;;;;;
;End Flash OFF
;;;;;;;;;;;;;;;;;;;;;;

alanjt 发表于 2022-7-6 11:34:24

想想你想重置什么。
正如我对min所做的那样,我存储了LWDisplay变量的原始状态,然后当例程退出或出错时,它会根据该状态重置它。
 
_说明语言差异(autocad以英语编写)
. 正在取消/重新定义的命令的帐户。

Jimmy Sean 发表于 2022-7-6 11:37:22

有人能解释一下这两行吗?
 
(和lwd(setvar‘lwdisplay lwd))
(if(and msg(not(wcmatch(strcase msg)”*中断*、*取消*、*退出*、“”))
 
 
我对代码的解释有什么错误吗?
      (defun c:LWT (/ *error* lwd)      ;Name of the Function(or program) and variables are local to this program
   (defun *error* (msg)   ;name of the function "error" and its argument passing variable                                                                                                                              
   (and lwd (setvar 'lwdisplay lwd))   ;not sure

   (if (and msg (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*QUIT*,")))    ; if MSG is equal to BREAK*,*CANCEL*,*QUIT*,"then?
       (princ (strcat "\nError: " msg))            ;prints message
   )
   ) ; ends the error section?

   (setq lwd (getvar 'lwdisplay))   ;assigns the lwd variable with the lwdisplay variable of 1 or 0
   (while t               ;loops the remainder of this program until T is nil
   (setvar 'lwdisplay (abs (1- (getvar 'lwdisplay))))            ;changes the lwdisplay variable from 0 to 1 or 1 to 0
   (command "_.delay" 200)
   )
   (*error* nil) ;sets error to nil
   (princ)
)

 
谢谢

Jimmy Sean 发表于 2022-7-6 11:40:44

好的,差不多了,我需要它能够在循环中缩放(用鼠标滚轮),有人知道为什么它不会?
 
这是我现在拥有的。
7

alanjt 发表于 2022-7-6 11:45:48

首先检查lwd变量是否已存储,如果已存储,则会使用它设置lwdisplay变量。
 
错误消息检查只是为了剔除是否存在实际的错误消息,如果它与三个基本错误消息不匹配,它将打印它。
 
 
 
尝试将(while T替换为(while(等式5(car(grread T 15 0)))
这样,它将允许你四处平移,一旦你点击任何键或单击鼠标,它就会退出。请记住,它只会循环打开/关闭状态等。如果您的鼠标正在移动,但由于您将四处平移,它将工作良好。
页: 1 [2]
查看完整版本: 用按钮停止lisp循环