Hi all,
I'm looking for a way to autostart my dotnet macro according to a certain drawing opening.
I know how to auto netload my dll
I know in vba using events to start the macro when my drawing is opened :
Private Sub AcadDocument_Activate()
Start.MyVbaMacro
End Sub
But how do I manage it in DotNET? I don't want to use vbaenabler...
Thanks,
Michel
Hi,
>> I know in vba using events to start the macro when my drawing is opened
To get EventHandler defined you first have to load an application. At least within one application you don't have a chance to get loaded only for specific drawings as the descission "load the DLL or not" has to be done by a program and so it has to be loaded at least the part that defines the EventHandler.
To automatically get dotNET applications loaded look to >>>this blog<<< to see how you can load a dotNET-DLL automatically.
And one primitive method (if you don't want to make changes to the registry) could be to write a LISP-command into the ACAD.LSP so the DLL get loaded with AutoCAD-startup:
(command "_-NETLOAD" "\\mypath\\mydll.dll")
- alfred -
Thanks for the answer Alfred, the blog is helpfull...
AutoNetloading my dll is OK.
My problem is :
1) I open a specific drawing
2) my macro autostarts only when this specific drawing is opened.
In vba, I add vba code (AcadDocument_Activate) in this specific drawing, which trigger my macro.
Is it possible to add dotnet events in a spécific dwg?? It seems no... Is there another way??
Cheers,
Michel
Hi,
>> Is it possible to add dotnet events in a spécific dwg??
No, you can load your DLL with the application with a defined event handler that catches every drawing-open ... then check if the DWG is a drawing of interest or not, so run your commands for this DWG (or not).
- alfred -
You can use
public event DocumentCollectionEventHandler DocumentToBeActivated;
event of Application.DocumentManager. but you must run it in ApplicationContext.
Hummm, Lovely DotNet automations ;-(((
I don't know the name of that drawing... Perhaps the user had to rename it according to naming convention purpose...
I think I'm going to make a classic Menu Button, and check first if the drawing contains the prerequisites...
Thanks for help.
M.
if not my memory serves me wrong Database object has some fields for user defined values. you can check them also to determine if it is proper Document to process.
you are welcome.
hi. i think you can use the var USERI1, USERI2 ... 5
this saved in the drawing so you need to check a value in this var when the doc opened
Can't find what you're looking for? Ask the community or share your knowledge.