Author Topic: App Events not working  (Read 9748 times)

0 Members and 1 Guest are viewing this topic.

ML

  • Guest
Re: App Events not working
« Reply #45 on: July 24, 2007, 03:52:42 PM »

Hummmm

Interesting point:  :?
If I am correct, you are saying if the event can be handled at document level, then that should be the first line of attack as the documnet level events take precedence over application level. Is this what you are saying Bry?

If that is the case, then i should do some experimenting

For instance, we know the appactivate is definetely an app level event so there "should" be no conflict but I can see the save and plot events occuring in both drawing and app level.

Thank you

Mark

ML

  • Guest
Re: App Events not working
« Reply #46 on: July 24, 2007, 03:59:17 PM »

That is in The Thisdrawing (document object) of the acad.dvb file correct?
I think I just stated the obvious.   ;-)

Bryco

  • Water Moccasin
  • Posts: 1849
Re: App Events not working
« Reply #47 on: July 24, 2007, 09:30:56 PM »
Quote
Re-open AutoCAD, note that no events fire as the first drawing is already open by the time the VBA environment initializes
This is interesting Keith and sounds pretty good.
However I find it difficult to get any application events to work on a newly opened autocad session. I find the thisdrawing is fine but the app link is broken.
After new or open resetting the link, all is fine. I can imagine the app link is set then the new drawing opens up and breaks it.

Ml, yes use the lower level when you can.

ML

  • Guest
Re: App Events not working
« Reply #48 on: July 25, 2007, 10:02:30 AM »

Thanks Bry

Now let me ask (Bry) you this:

How are you initializing VBA on startup?

I use the acad.rx file to call the acadvba.arx, which then initializes VBA on startup.

If you don't have an acad.rx file, just create it with a text file, type in the text file acadvba.arx, save as acad.rx and you should be good to go.

Now, I had this discussion with Keith in the past but being the absent minded person that I can be at times, I forget whether or not The acad.rx and the acadvba.arx files need to be in the same directory.

Mark


ML

  • Guest
Re: App Events not working
« Reply #49 on: July 25, 2007, 11:11:32 AM »

He is a pretty good post page that I just got done reading. Interesting, I think it was Bryco that suggested putting the acadstartup routine in The Thisdrawing Object? That is what this guy is suggesting but I very much like the way Jeff set me up. This guy gives a very good explanation of using the acad.rx, acad.dvb and acad (ac) vba.arx files in conjunction to achieve the same goal we are discussing here.   :lol:

Mark


http://www.cadalyst.com/cadalyst/article/articleDetail.jsp?id=122827

ML

  • Guest
Re: App Events not working
« Reply #50 on: July 25, 2007, 11:17:50 AM »

Another question; if you guys would be so kind?

This was a little joke I played on a fellow co-worked that kind of ticked me off at my last position.
However, it is rather harmless  :-)    LOL

Code: [Select]
Private Sub AcadDocument_BeginCommand(ByVal CommandName As String)
  If UCase(CommandName) = "LINE" Then
    MsgBox " We apologize for the inconvenience but AutoCAD has ran out of lines", vbCritical
  End If

The question I have asked in the past but never got a good answer on is:
After he gets the message "We apologize for the inconvenience but AutoCAD has ran out of lines"
and he clicks OK, how do I iniate an Esc Esc?

Anyone like to try?

Thanks
Mark

deegeecees

  • Guest
Re: App Events not working
« Reply #51 on: July 25, 2007, 11:52:35 AM »
Use boolean with a counter...

if linejoke = 0 then
..blah
set linejoke = 1
end if

... of sorts

ML

  • Guest
Re: App Events not working
« Reply #52 on: July 25, 2007, 12:06:20 PM »

Hey deegeecees

I'm not sure how I would integrate that in with my code?  :-(

Jeff_M

  • King Gator
  • Posts: 3945
  • C3D user & customizer
Re: App Events not working
« Reply #53 on: July 25, 2007, 12:10:30 PM »
Like so....
Code: [Select]
        MsgBox " We apologize for the inconvenience but AutoCAD has ran out of lines", vbCritical
        SendKeys "^C"

ML

  • Guest
Re: App Events not working
« Reply #54 on: July 25, 2007, 12:16:50 PM »

Jeff

The result I am getting with that is :

Command: _copybase Specify base point:

??????

deegeecees

  • Guest
Re: App Events not working
« Reply #55 on: July 25, 2007, 12:17:33 PM »
Keep in mind I'm a bit rusty in this dept...

This way will should (untested) work once per session:

Code: [Select]
Private Sub AcadDocument_BeginCommand(ByVal CommandName As String) as
Dim linjok as int
  if linjok = 0 then
     If UCase(CommandName) = "LINE" Then
       MsgBox " We apologize for the inconvenience but AutoCAD has ran out of lines", vbCritical
       set linjok = 1
     end if
  End If
end sub

I think Jeff is heading down the right path...

ML

  • Guest
Re: App Events not working
« Reply #56 on: July 25, 2007, 12:41:46 PM »

Hey  Deegeecees 

I'm afraid that did not work, I tired a few things with it    :-(
 
 

deegeecees

  • Guest
Re: App Events not working
« Reply #57 on: July 25, 2007, 12:45:51 PM »

Hey  Deegeecees 

I'm afraid that did not work, I tired a few things with it    :-(


Well, someone with a bit more experience will prolly come along. Keep on truckin!

deegeecees

  • Guest
Re: App Events not working
« Reply #58 on: July 25, 2007, 12:58:55 PM »
Ok, it works now.

Code: [Select]
Private Sub AcadDocument_BeginCommand(ByVal CommandName As String)
Dim linjok As Integer
  If linjok = 0 Then
     If UCase(CommandName) = "LINE" Then
       MsgBox " We apologize for the inconvenience but AutoCAD has ran out of lines", vbCritical
     End If
  End If
linjok = 1
End Sub

ML

  • Guest
Re: App Events not working
« Reply #59 on: July 25, 2007, 01:21:59 PM »

No it doesn't LOL but Thank you

It still keeps me in the line command


WAIT! I got it!
Going back to Jeff's send keys idea.

I may just need to find the ascii equivalent to ESC (i.e chr94)

Hummmmmmm :-o