.NET
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Demand Load of .Net Applicatio n
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
177 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.Ini tialize
Dim oAcadDB As Database
Debug.WriteLine("Transactions after PlotFormats.Initialize : " & CStr(Application.DocumentManager.MdiActiveDocument .Database.TransactionManager.NumberOfActiveTransac tions))
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.DatabaseIOEventA rgs)
Public Sub Terminate() Implements Autodesk.AutoCAD.Runtime.IExtensionApplication.Ter minate
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.NumberOfActiveTransac tions))
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"
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.Ini
Dim oAcadDB As Database
Debug.WriteLine("Transactions after PlotFormats.Initialize : " & CStr(Application.DocumentManager.MdiActiveDocument
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.DatabaseIOEventA
Public Sub Terminate() Implements Autodesk.AutoCAD.Runtime.IExtensionApplication.Ter
End Sub
Public Sub New()
End Sub
End Class
Public Class BallPlotCommands
Debug.WriteLine("Transactions after PlotFormats.PSB : " & CStr(Application.DocumentManager.MdiActiveDocument
Dim oPSBPlotProcess As New CreatePlot(eDeviceType.PDF)
oPSBPlotProcess = Nothing
End Sub
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
"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
"PDF"="PDF"
[HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R16.2
"BallPlotCommands"="BallPlotCommands"
"AcadPlotApp"="AcadPlotApp"
Re: Demand Load of .Net Applicatio n
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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.
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.
