bigr1822 发表于 2022-7-6 17:04:15

开始事件

有谁在这次活动中取得了成功吗?我试着用这个,有时有效,有时无效。这似乎很不可靠?
 
也许我使用它的方式是错误的。这是我从帮助文档中提取的代码。
 

Public WithEvents ACADApp As AcadApplication    ' Use with Application Event Examples

Sub Example_AcadApplication_Events()    ' This example intializes the public variable (ACADApp) which will be used    ' to intercept AcadApplication Events    '    ' The VBA WithEvents statement makes it possible to intercept an generic object    ' with the events associated with that object.    '    ' Before you will be able to trigger any of the AcadApplication events,    ' you will first need to run this procedure.      ' We could get the application from the ThisDocument object, but that would    ' require having a drawing open, so we grab it from the system.    Set ACADApp = GetObject(, "AutoCAD.Application.16")End Sub

Private Sub ACADApp_BeginOpen(FileName As String)    ' This example intercepts an Application BeginOpen event.    '    ' This event is triggered when a drawing is opened by AutoCAD.    '    ' To trigger this example event:    '   1) Make sure to run the example that initializes    '   the public variable (named ACADApp) linked to this event.    '    '   2) Use AutoCAD to open an existing drawing    ' Use the "FileName" variable to determine which drawing file is being opened    MsgBox "A drawing is about to be loaded from: " & FileNameEnd Sub
 
我在AutoCAD启动时使用Lisp文件启动第一个过程。当我打开第一个图形时,BeginOpen确实起作用。当我运行我创建的其他代码时,就会出现问题。
 
另一个代码是一个release宏,它从图形中取下图章(一个块),保存文件,关闭文件,将属性更改为只读,然后重新打开文件。在那一点上,我的BeginOpen没有开火????
 
如果您有任何想法,我们将不胜感激。

borgunit 发表于 2022-7-6 17:21:59

确保变量LISPINIT设置为0(猜测)

CmdrDuh 发表于 2022-7-6 17:37:40

我记不起“开始打开”是仅适用于第一个dwg还是所有dwg。尝试打开2或3个文件,看看它是否运行,而不运行导致崩溃的其他代码

CmdrDuh 发表于 2022-7-6 17:51:13

我认为这只是第一张图纸
在第一个dwg上打开acad,而不是打开文档

bigr1822 发表于 2022-7-6 17:52:28

我将尝试打开文档,看看这是否有帮助。感谢所有回复!!!

ML0940 发表于 2022-7-6 18:09:34

大的
启动模块不需要LISP例程。
在acad中。dvb文件,您可以使用Acadstartup模块来执行此操作。
 
如果你愿意,我可以把我的代码或文件发给你。
 
我也使用了BeginOpen事件。
 
毫升
页: [1]
查看完整版本: 开始事件