.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Demand Load of .Net Application

1 REPLY 1
Reply
Message 1 of 2
Anonymous
430 Views, 1 Reply

Demand Load of .Net Application

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"
1 REPLY 1
Message 2 of 2
ChrisArps
in reply to: Anonymous

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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost