Active Contributor
Chris Ludtke
Posts: 44
Registered: ‎04-12-2005
Message 1 of 2 (203 Views)

Demand Load of .Net Application

203 Views, 1 Replies
09-12-2005 03:41 PM
I have an operational application that plots drawings and manages a "Version" property that is incremented every time the drawing is saved. This application uses the .beforesave event from the AutoCAD application

This application appears to work well when operating through the Visual Studio editor.

I compiled the code and added information to the registry that automatically loads.

When I compile this appliciation and run it outside of visual studio, the application loads correctly when the commands are entered on the command line. It actually works real slick.

My problem is that somehow I am not able to capture the .beginsave event when I am outside of the development suite.

Here is a "Snippet" of the code that will give you an idea of how I have organized my application. I have also added the registry keys that demand load a part of the application.

One further question : What does the term "Group" mean when used in the registry key?


Namespace PlotFormats
Public Class AcadPlotApp
Implements Autodesk.AutoCAD.Runtime.IExtensionApplication
Public Sub Initialize() Implements Autodesk.AutoCAD.Runtime.IExtensionApplication.Initialize
Dim oAcadDB As Database
Debug.WriteLine("Transactions after PlotFormats.Initialize : " & CStr(Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.NumberOfActiveTransactions))
oAcadDB = HostApplicationServices.WorkingDatabase()
AddHandler oAcadDB.BeginSave, New DatabaseIOEventHandler(AddressOf IncrementVersionCounter)
oAcadDB = Nothing
End Sub
Private Sub IncrementVersionCounter(ByVal o As Object, ByVal e As Autodesk.AutoCAD.DatabaseServices.DatabaseIOEventArgs)
Public Sub Terminate() Implements Autodesk.AutoCAD.Runtime.IExtensionApplication.Terminate
End Sub

Public Sub New()

End Sub
End Class
Public Class BallPlotCommands
Public Sub PSB()
Debug.WriteLine("Transactions after PlotFormats.PSB : " & CStr(Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.NumberOfActiveTransactions))
Dim oPSBPlotProcess As New CreatePlot(eDeviceType.PDF)
oPSBPlotProcess = Nothing
End Sub
Public Sub pdf()
Dim oPDFPlotProcess As New CreatePlot(eDeviceType.PDF)
oPDFPlotProcess = Nothing
End Sub
End Class
Windows Registry Editor Version 5.00

Registry Information

"DESCRIPTION"="Ball PDF Plot Creator"
"LOADER"="C:\\Program Files\\Autodesk\\MDT 2006\\user\\vb\\AutoCADPlot\\bin\\BallAcadPlot.dll"


Distinguished Contributor
Posts: 311
Registered: ‎07-29-2004
Message 2 of 2 (203 Views)

Re: Demand Load of .Net Application

09-14-2005 07:19 AM in reply to: Chris Ludtke
Adding the eventhandler one time is not going to be enough.
The current database changes as files are opened and closed.

Check out the events sample in the Autocad dotnet samples, it shows how to track multiple databases and maintain the event handlers as the documents open and close.

It would be VERY nice if some of the database level events
were exposed via the application.

Example : Give me a command started/ended event on the application that passes the current database. Then I would not have to have all this dynamic event code to track a simple command in MDI.
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.