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

Programatically loading .NET Assemblies (no Lisp, no Registry)

8 REPLIES 8
Reply
Message 1 of 9
Anonymous
1147 Views, 8 Replies

Programatically loading .NET Assemblies (no Lisp, no Registry)


Dear all,

 

Is there a way to programatically load .NET
assembly, beside executing it (netload) from Lisp
or demand-loading it via Registry setting? What ObjectARX mechanism is
hidden behind NETLOAD command? Is there any example or tip of loading .NET
assembly via P/Invoke?

 

I'm trying to create a clean (as possible)
startup module that fires ACAD up and loads necessary assemblies. Doing it
via .LSP module is really messy approach. Setting Registry values that
load them on-demand is a heavy task having in mind that we have
installer routine. Installer should: 1) determine ACAD version(s), 2) let the
user select one of them, 3) perform Registry settings... An
overkill.


size=2>
 

Regards,

Maksim Sestic
8 REPLIES 8
Message 2 of 9
Anonymous
in reply to: Anonymous

Perhaps I'm not clear on your question.

What do you mean by 'programatically load' ?

Load it programmatically from what?

E.g., from LISP code, ARX code, VBA code, etc?

You don't need to use P/Invoke to load an assembly
from managed code, which is why I"m not all that
clear on what you need to do?

Are you just trying to avoid having to do the registry
business during install?


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Maksim Sestic" wrote in message news:4959553@discussion.autodesk.com...
Dear all,

Is there a way to programatically load .NET assembly, beside executing it (netload) from Lisp or demand-loading it via Registry setting? What ObjectARX mechanism is hidden behind NETLOAD command? Is there any example or tip of loading .NET assembly via P/Invoke?

I'm trying to create a clean (as possible) startup module that fires ACAD up and loads necessary assemblies. Doing it via .LSP module is really messy approach. Setting Registry values that load them on-demand is a heavy task having in mind that we have installer routine. Installer should: 1) determine ACAD version(s), 2) let the user select one of them, 3) perform Registry settings... An overkill.

Regards,
Maksim Sestic
Message 3 of 9
Anonymous
in reply to: Anonymous

Tony,

Oh, now I see 🙂 What an expression 🙂 What I really ment is loading a
.NET assembly out of external startup module also written in .NET. What I
need to achieve is:

1) User starts an .EXE (startup) module that fires up ACAD. Startup module
is written in VB.NET.
2) Startup module waits for ACAD to finish initialization
3) Startup module loads a .NET DLL assembly into ACAD

I'm trying to avoid using Lisp's (netload) in step 3). I am also trying to
avoid assembly demand-loading via registry settings during application
installation.


Regards,
Maksim Sestic



"Tony Tanzillo" wrote in message
news:4959607@discussion.autodesk.com...
Perhaps I'm not clear on your question.

What do you mean by 'programatically load' ?

Load it programmatically from what?

E.g., from LISP code, ARX code, VBA code, etc?

You don't need to use P/Invoke to load an assembly
from managed code, which is why I"m not all that
clear on what you need to do?

Are you just trying to avoid having to do the registry
business during install?


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Maksim Sestic" wrote in message
news:4959553@discussion.autodesk.com...
Dear all,

Is there a way to programatically load .NET assembly, beside executing it
(netload) from Lisp or demand-loading it via Registry setting? What
ObjectARX mechanism is hidden behind NETLOAD command? Is there any example
or tip of loading .NET assembly via P/Invoke?

I'm trying to create a clean (as possible) startup module that fires ACAD up
and loads necessary assemblies. Doing it via .LSP module is really messy
approach. Setting Registry values that load them on-demand is a heavy task
having in mind that we have installer routine. Installer should: 1)
determine ACAD version(s), 2) let the user select one of them, 3) perform
Registry settings... An overkill.

Regards,
Maksim Sestic
Message 4 of 9
Anonymous
in reply to: Anonymous

I guess it has something to do with Reflection... but I'm not completely
clear about that 🙂

"Tony Tanzillo" wrote in message
news:4959607@discussion.autodesk.com...
Perhaps I'm not clear on your question.

What do you mean by 'programatically load' ?

Load it programmatically from what?

E.g., from LISP code, ARX code, VBA code, etc?

You don't need to use P/Invoke to load an assembly
from managed code, which is why I"m not all that
clear on what you need to do?

Are you just trying to avoid having to do the registry
business during install?


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Maksim Sestic" wrote in message
news:4959553@discussion.autodesk.com...
Dear all,

Is there a way to programatically load .NET assembly, beside executing it
(netload) from Lisp or demand-loading it via Registry setting? What
ObjectARX mechanism is hidden behind NETLOAD command? Is there any example
or tip of loading .NET assembly via P/Invoke?

I'm trying to create a clean (as possible) startup module that fires ACAD up
and loads necessary assemblies. Doing it via .LSP module is really messy
approach. Setting Registry values that load them on-demand is a heavy task
having in mind that we have installer routine. Installer should: 1)
determine ACAD version(s), 2) let the user select one of them, 3) perform
Registry settings... An overkill.

Regards,
Maksim Sestic
Message 5 of 9
Anonymous
in reply to: Anonymous


Let me explain the problem a bit more
precise:
I need to load .NET DLL into
running ACAD application namespace, but externally - out of another process
(Startup module, source excerpt below). How possibly can I get it
working?

 

Startup module (that fires ACAD up) references
following libs found in GAC:

- Autodesk.AutoCAD.Interop.dll

-
Autodesk.AutoCAD.Interop.Common.dll


size=2>
 


size=2>Imports

Autodesk.AutoCAD.Interop

 

''' Startup
module that fires up ACAD
 


size=2>Module
Startup

 
Sub
Main()

 

   
color=#008080>''' Start ACAD the easy way... No error
checking...
 


size=2>    Dim
oACAD
color=#0000ff size=2>As

Autodesk.AutoCAD.Interop.AcadApplication

    oACAD =
New
Autodesk.AutoCAD.Interop.AcadApplication

 


   
color=#008080>''' >>> I simply don't want to load assembly
via Lisp here.

    '''
>>> I've been thinking of using P/Invoke, still don't know what
set of

    ''' >>>
acad.exe functions is responsible for netload-ing an assembly.

    ''' >>>
Using a bit more managed approach is even more welcome
:-)
   
oACAD.ActiveDocument.SendCommand( _

    "(command "
+ Chr(34) + _

    "NETLOAD" +
Chr(34) + " " + Chr(34) + _

   
"TCGDotNet16.dll" + Chr(34) + ")" + vbLf)

 
End

size=2>Sub


color=#0000ff size=2>End

color=#0000ff size=2>Module


color=#0000ff size=2>
 


color=#0000ff size=2>Thanks for any
suggestion on that matter.


color=#0000ff size=2>
 


color=#0000ff size=2>
color=#000000>Regards,


color=#0000ff size=2>Maksim
Sestic
 
Message 6 of 9
Anonymous
in reply to: Anonymous


It seems like me talking to myself... Anyway,
after many hours of browsing the docs/internet it turns
out that I need to write a plug-in assembly that gets initialized
within AutoCAD application namespace, out of external process. Am I wrong about
that presumption?

 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">


Let me explain the problem a bit more
precise:
I need to load .NET DLL into
running ACAD application namespace, but externally - out of another process
(Startup module, source excerpt below). How possibly can I get it
working?

 

Startup module (that fires ACAD up) references
following libs found in GAC:

- Autodesk.AutoCAD.Interop.dll

-
Autodesk.AutoCAD.Interop.Common.dll


size=2>
 


size=2>Imports

Autodesk.AutoCAD.Interop

 


color=#008080>''' Startup module that fires up
ACAD
 


size=2>Module
Startup

 
Sub
Main()

 

   
color=#008080>''' Start ACAD the easy way... No error
checking...
 


size=2>    Dim
oACAD
color=#0000ff size=2>As

Autodesk.AutoCAD.Interop.AcadApplication

    oACAD =
New
Autodesk.AutoCAD.Interop.AcadApplication

 


   
color=#008080>''' >>> I simply don't want to load assembly
via Lisp here.

    '''
>>> I've been thinking of using P/Invoke, still don't know what
set of

    '''
>>> acad.exe functions is responsible for netload-ing an
assembly.

    '''
>>> Using a bit more managed approach is even more welcome
🙂
   
oACAD.ActiveDocument.SendCommand( _

    "(command
" + Chr(34) + _

    "NETLOAD"
+ Chr(34) + " " + Chr(34) + _

   
"TCGDotNet16.dll" + Chr(34) + ")" + vbLf)

 
End

size=2>Sub


color=#0000ff size=2>End

color=#0000ff size=2>Module


color=#0000ff size=2>
 


color=#0000ff size=2>Thanks for any
suggestion on that matter.


color=#0000ff size=2>
 


color=#0000ff size=2>
color=#000000>Regards,


color=#0000ff size=2>Maksim
Sestic
 
Message 7 of 9
karenina
in reply to: Anonymous

Hello.

Did you manage to solve that problem? I am having almost the same one. I am trying to write a plugin for AutoCAD 2006 that is supposed to add a new toolbar (in .NET C#).
I am having difficulties at loading my assembly to AutoCAD. Last year I wrote some plugin for AutoCAD2005, but the connection part was written in C++. I was creating an arx file and then load set the AutoCAD start in to the arx path.
I didn't like the solution then, but I was short on time so I had no choice.
So ... did you find anything on loading a .NET dll to AutoCAD?
You said something about registry ... can you be more specific?

Thank you for your time,

Roxana.
Message 8 of 9
Anonymous
in reply to: Anonymous

Hi Roxana,

Yes, autoloading managed modules on startup (via Registry setting) was the
only viable solution. Just check the following link:
http://discussion.autodesk.com/thread.jspa?messageID=4531456

Regards,
Maksim Sestic


wrote in message news:5116709@discussion.autodesk.com...
Hello.

Did you manage to solve that problem? I am having almost the same one. I am
trying to write a plugin for AutoCAD 2006 that is supposed to add a new
toolbar (in .NET C#).
I am having difficulties at loading my assembly to AutoCAD. Last year I
wrote some plugin for AutoCAD2005, but the connection part was written in
C++. I was creating an arx file and then load set the AutoCAD start in to
the arx path.
I didn't like the solution then, but I was short on time so I had no choice.
So ... did you find anything on loading a .NET dll to AutoCAD?
You said something about registry ... can you be more specific?

Thank you for your time,

Roxana.
Message 9 of 9
karenina
in reply to: Anonymous

Thanks a lot. That really helped.
I did not know that it was possible to set a dll as loader.

Now it works fine.

All my best,

Roxana

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