.NET

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

Demand Load of .Net Application

201 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?

:::::::::::::::::::::::::::::::::::::::::::::
CODE
::::::::::::::::::::::::::::::::::::::::::::

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
::::::::::::::::::::::::::::::::::::::::::::

[HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R16.2\ACAD-4003:409\Applications\BallAcadPlot]
"DESCRIPTION"="Ball PDF Plot Creator"
"LOADER"="C:\\Program Files\\Autodesk\\MDT 2006\\user\\vb\\AutoCADPlot\\bin\\BallAcadPlot.dll"
"LOADCTRLS"=dword:0000000e
"MANAGED"=dword:00000001

[HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R16.2\ACAD-4003:409\Applications\BallAcadPlot\Commands]
"PDF"="PDF"

[HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R16.2\ACAD-4003:409\Applications\BallAcadPlot\Groups]
"BallPlotCommands"="BallPlotCommands"
"AcadPlotApp"="AcadPlotApp"
Distinguished Contributor
ChrisArps
Posts: 311
Registered: ‎07-29-2004
Message 2 of 2 (201 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.
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

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