Jump to content

Recommended Posts

Posted

Has anyone had good success with this Event? I am trying to use this and sometimes it works, sometimes it does not. It seems to be very unreliable?

 

Maybe the way I am using it is wrong. Here is the code I pulled from the help documents.

 

 
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

 

I am firing the first procedure, using a Lisp file, on AutoCAD startup. When I open the first drawing, the BeginOpen DOES work. The problem happens when I run other code I have created.

 

The other code is a release macro that takes our stamp, which is a block, off the drawing, saves the file, closes the file down, changes the attribute to read only and reopens the file. At that point, my BeginOpen does not fire????

 

Any Ideas would be greatly appreciated.

Posted

Make sure your variable LISPINIT is set to 0 (a guess)

Posted

I can t remember if begin open only works on first dwg or all. try opening 2 or 3 files and see if it runs, W/O running the other code that crashes it

Posted

I think its the first dwg only

' This example intercepts an Application BeginOpen event

your getting acad's open on first dwg not the document open

Posted

I will try the document open and see if this helps. Thanks for all the responses!!!

Posted

Big,

You do not need the LISP routine to start a module.

In the acad.dvb file, you can use The Acadstartup module to do this.

 

If you'd like, I can send yo my code, or file.

 

I have used The BeginOpen Event as well.

 

ML

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...