I am looking for a way to use the EndOpen AutoCAD event in VB 6.0 (not VBA).
I have read the Help file on this, and it mentions use in VB, but I cannot
figure out the syntax. Is this possible?
Thanks,
Christy Bailey
Management, Information Systems Assistant
DAY BROWN RICE, inc.
9990 Richmond Ave.
South Building, Suite 300
Houston, Texas 77042
Phone: 713.914.0888
Fax: 713.914.0886
Email: cba...@dbrinc.com
Website: www.dbrinc.com
Hi Christy,
in your form or class module, add the following to the declares
Option Explicit
Private WithEvents ThisDrawing As AcadDocument
Now in the Object pulldown you have thisdrawing listed, and in the
procedures pull down, all of the events ( including EndOpen )
did I answer the question, or did I miss?
Randall Rath
Set ThisDrawing = acad.ActiveDocument
I get the following error message:
"Class does not support Automation or does not support expected interface."
However, if I set a different variable to the active document, say Doc, as
follows:
Dim Doc as AcadDocument
Set Doc = acad.ActiveDocument 'Sets doc to current dwg
and then I use a different variable (ThisDrawing) as you have outlined, the
program never goes to the line:
Private Sub ThisDrawing_EndOpen(ByVal FileName As String)
What am I missing?
(I hope this makes sense.)
Thanks,
Christy Bailey
Management, Information Systems Assistant
DAY BROWN RICE, inc.
9990 Richmond Ave.
South Building, Suite 300
Houston, Texas 77042
Phone: 713.914.0888
Fax: 713.914.0886
Email: cba...@dbrinc.com
Website: www.dbrinc.com
Randall Rath wrote in message <7if63h$en...@adesknews2.autodesk.com>...
Hi Christy,
You had the right track, ThisDrawing ( or whatever you call the document
,like acadDoc ) must be declared as the active document try the code below:
Option Explicit
Dim WithEvents ThisDrawing As AcadDocument
Dim AcadApp As AcadApplication
Private Sub Form_Load()
Set AcadApp = GetObject(, "Autocad.application")
Set ThisDrawing = AcadApp.ActiveDocument
End Sub
Private Sub ThisDrawing_BeginSave(ByVal FileName As String)
AppActivate Me.Caption
MsgBox AcadApp.FullName & "Is being saved"
End Sub
If this is the same as what you have tried ( notice I switched events ) or
you try this and it does not work, I know the problem, and have several idea
you can try...
Randall Rath
"Class does not support Automation or does not support expected interface."
on the
"Set ThisDrawing = AcadApp.ActiveDocument"
line. I read in the VB help file under the "Dim" statement that
"WithEvents" is only valid in Class Modules. But I don't know much about
class modules. Is this my problem, or is it something else?
Thanks,
Christy
Randall Rath wrote in message <7ik8qd$po...@adesknews2.autodesk.com>...
I am running AutoCAD version 14.01.
I want to use VB over VBA because I am writing a VB application that I'm
calling a Project Manager. The user will be able to search for a project
and select it from Project Manager, and then they will have access to all
the project's files (dwg, doc, xls, etc.). Project Manager can open
drawings in AutoCAD and several other applications. Currently I am trying
to create a Batch plot that users can use from within my Project Manager.
It opens each drawing the user selects and then plots it. My problem is
that sometimes the "plot" command is sent before a drawing is finished
regenerating, so it doesn't plot and I end up with a blank screen. So I
figured if I could put the plot command in the EndOpen event, it would never
be sent before the drawing was completely opened. Does this make sense?
I'm out tomorrow, and won't be back until next Tuesday, but I'll definitely
check back then. Have a nice holiday, and thanks for all the help.
Christy Bailey
Randall Rath wrote in message <7ikbdc$po...@adesknews2.autodesk.com>...