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

How to tell what .dll's Acad has loaded

18 REPLIES 18
Reply
Message 1 of 19
Anonymous
2475 Views, 18 Replies

How to tell what .dll's Acad has loaded

Is there some way to query Acad and find out what "extra" .dll's it has
loaded?
For example, Mech Desktop, acad mechanical, acad electrical, et al are
all just Acad with a boatload of other dll's loaded.
More specifically I want to know if a batch plot is in progress so I can
suspend my apps from doing things. I know that batch plotting is also
achieved through a specific dll.
Anyone have any clues on this?
Thanks, Perry
18 REPLIES 18
Message 2 of 19
Anonymous
in reply to: Anonymous

No one knows?
Message 3 of 19
Matt S
in reply to: Anonymous

I asked a similar question a while back and didn't really get a good response, although the context of my question was restricted to .NET assemblies.

http://discussion.autodesk.com/thread.jspa?messageID=5515294
Message 4 of 19
Anonymous
in reply to: Anonymous

What was wrong with that response?


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com

wrote in message news:5559650@discussion.autodesk.com...
I asked a similar question a while back and didn't really get a good response, although the context of my question was restricted to .NET assemblies.

http://discussion.autodesk.com/thread.jspa?messageID=5515294
Message 5 of 19
Anonymous
in reply to: Anonymous

Matt S wrote:
> I asked a similar question a while back and didn't really get a good response, although the context of my question was restricted to .NET assemblies.
>
> http://discussion.autodesk.com/thread.jspa?messageID=5515294

Well, at least you got SOME response!
Getting nothing here.

I tried something like...
if (Autodesk.AutoCAD.Runtime.ExtensionLoader.IsLoaded("acpublish.arx"))
Utilities.prompt("\npublish loaded");

But did not work so well, Cant seem to find anything like "listarx"
Perry
Message 6 of 19
Anonymous
in reply to: Anonymous

First, I don't always respond when the question has nothing
specifically to do with AutoCAD's .NET API (e.g., a general
.NET programming topic, which is the case here), or when it
has been answered before here, and can be found by just
searching the newsgroup.

For managed assemblies, you can use what I showed
in the answer that Matt says wasn't really good.

For all dlls, you can use:

#using System.Diagnostics

public class MyClass()
{
public static void ListModules()
{
foreach( ProcessModule m in Process.GetCurrentProcess().Modules )
{
Console.WriteLine( m.FileName );
}
}
}

Consider using other general .NET resources on the web
where you can get answers to _general_ .NET programming
questions immediately without having to wait.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com

"perry" wrote in message news:5561540@discussion.autodesk.com...
Matt S wrote:
> I asked a similar question a while back and didn't really get a good response, although the context of my question was restricted to .NET assemblies.
>
> http://discussion.autodesk.com/thread.jspa?messageID=5515294

Well, at least you got SOME response!
Getting nothing here.

I tried something like...
if (Autodesk.AutoCAD.Runtime.ExtensionLoader.IsLoaded("acpublish.arx"))
Utilities.prompt("\npublish loaded");

But did not work so well, Cant seem to find anything like "listarx"
Perry
Message 7 of 19
Matt S
in reply to: Anonymous

There was nothing wrong with your answer Tony, but the intent of my original quwestion was to learn if AutoCAD had a built in utility, simmilar to appload, that displayed loaded .NET assemblies.

Apparently it doesn't, and I have to resort to using the method you provided.
Message 8 of 19
Anonymous
in reply to: Anonymous

Tony Tanzillo wrote:
> First, I don't always respond when the question has nothing
> specifically to do with AutoCAD's .NET API (e.g., a general
> .NET programming topic, which is the case here), or when it
> has been answered before here, and can be found by just
> searching the newsgroup.
>
> For managed assemblies, you can use what I showed
> in the answer that Matt says wasn't really good.
>
> For all dlls, you can use:
>
> #using System.Diagnostics
>
> public class MyClass()
> {
> public static void ListModules()
> {
> foreach( ProcessModule m in Process.GetCurrentProcess().Modules )
> {
> Console.WriteLine( m.FileName );
> }
> }
> }
>
> Consider using other general .NET resources on the web
> where you can get answers to _general_ .NET programming
> questions immediately without having to wait.
>
This WAS a specific Acad api question.
There is a handy "ListArx" function in vb/a which I had hoped made it
into the .net api (or something similar). It would appear it has not,
and I DID search the ng looking for such.
What you have shown here Tony will indeed give the answer to "what is
loaded", and as you stated this implementation is obviously much more
generic, having nothing at all to do with Acad's api. And, yes, I could
have found something like this by searching other web assets. Just
wanted to know if there was an Acad way of doing such without listing
every single running process. But if thats what I have to do then I
guess thats what I have to do.
Would really like to have an event I could listen for telling me if an
arx has been loaded, just like the VB example shown in the docs but in C#

perry
Message 9 of 19
Anonymous
in reply to: Anonymous

There is an AutoCAD API method to list loaded
arx libraries:

DynamicLinker.GetLoadedModules()

There are also events on the same object that
notify when modules are loaded/unloaded.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com

"perry" wrote in message news:5562508@discussion.autodesk.com...
Tony Tanzillo wrote:
> First, I don't always respond when the question has nothing
> specifically to do with AutoCAD's .NET API (e.g., a general
> .NET programming topic, which is the case here), or when it
> has been answered before here, and can be found by just
> searching the newsgroup.
>
> For managed assemblies, you can use what I showed
> in the answer that Matt says wasn't really good.
>
> For all dlls, you can use:
>
> #using System.Diagnostics
>
> public class MyClass()
> {
> public static void ListModules()
> {
> foreach( ProcessModule m in Process.GetCurrentProcess().Modules )
> {
> Console.WriteLine( m.FileName );
> }
> }
> }
>
> Consider using other general .NET resources on the web
> where you can get answers to _general_ .NET programming
> questions immediately without having to wait.
>
This WAS a specific Acad api question.
There is a handy "ListArx" function in vb/a which I had hoped made it
into the .net api (or something similar). It would appear it has not,
and I DID search the ng looking for such.
What you have shown here Tony will indeed give the answer to "what is
loaded", and as you stated this implementation is obviously much more
generic, having nothing at all to do with Acad's api. And, yes, I could
have found something like this by searching other web assets. Just
wanted to know if there was an Acad way of doing such without listing
every single running process. But if thats what I have to do then I
guess thats what I have to do.
Would really like to have an event I could listen for telling me if an
arx has been loaded, just like the VB example shown in the docs but in C#

perry
Message 10 of 19
Anonymous
in reply to: Anonymous

Tony Tanzillo wrote:
> There is an AutoCAD API method to list loaded
> arx libraries:
>
> DynamicLinker.GetLoadedModules()
>
> There are also events on the same object that
> notify when modules are loaded/unloaded.
>
Yep, found it.
I was looking in all the wrong places !
Also an example of this on the ObjectArx SDK (eventswather)
works like a charm 😉
Perry
Message 11 of 19
mahersy
in reply to: Anonymous

Just looking around and noticed that you where still looking around for the event for when publishing is fired.
I am not that experienced with .net but have picked up on some of the bits i need to know. I found some code that can watch events from the publisher.

Public Class PublishEvents
Private Shared m_pb As Publisher = Nothing
Private m_bDone As Boolean

Public Sub New()
m_bDone = False
m_pb = Autodesk.AutoCAD.ApplicationServices.Application.Publisher
StartWatch()
End Sub

Public Sub StartWatch()
' Only plant it once.
If m_bDone = False Then
m_bDone = True
Else
Return
End If

Try
m_pb = Autodesk.AutoCAD.ApplicationServices.Application.Publisher
AddHandler m_pb.AboutToBeginBackgroundPublishing, AddressOf callback_AboutToBeginBackgroundPublishingEventHandler
AddHandler m_pb.AboutToBeginPublishing, AddressOf callback_AboutToBeginPublishingEventHandler
AddHandler m_pb.AboutToEndPublishing, AddressOf callback_AboutToEndPublishingEventHandler

Catch ex As System.Exception
Msgbox(ex.Message)
End Try
End Sub

Public Sub StopWatch()
If m_pb Is Nothing Or m_bDone = False Then
Return
End If

Try
RemoveHandler m_pb.AboutToBeginBackgroundPublishing, AddressOf callback_AboutToBeginBackgroundPublishingEventHandler
RemoveHandler m_pb.AboutToBeginPublishing, AddressOf callback_AboutToBeginPublishingEventHandler
RemoveHandler m_pb.AboutToEndPublishing, AddressOf callback_AboutToEndPublishingEventHandler
m_pb = Nothing
Catch ex As System.Exception
msgbox(ex.Message)
End Try

m_bDone = False
End Sub

' ...... Event Code here...

End Class

This might help you out on watching for publishing events in Autocad.... null
Message 12 of 19
Anonymous
in reply to: Anonymous

Mahersy wrote:
> Just looking around and noticed that you where still looking around for the event for when publishing is fired.
> I am not that experienced with .net but have picked up on some of the bits i need to know. I found some code that can watch events from the publisher.
>
> Public Class PublishEvents
> Private Shared m_pb As Publisher = Nothing
> Private m_bDone As Boolean
>
> Public Sub New()
> m_bDone = False
> m_pb = Autodesk.AutoCAD.ApplicationServices.Application.Publisher
> StartWatch()
> End Sub
>
> Public Sub StartWatch()
> ' Only plant it once.
> If m_bDone = False Then
> m_bDone = True
> Else
> Return
> End If
>
> Try
> m_pb = Autodesk.AutoCAD.ApplicationServices.Application.Publisher
> AddHandler m_pb.AboutToBeginBackgroundPublishing, AddressOf callback_AboutToBeginBackgroundPublishingEventHandler
> AddHandler m_pb.AboutToBeginPublishing, AddressOf callback_AboutToBeginPublishingEventHandler
> AddHandler m_pb.AboutToEndPublishing, AddressOf callback_AboutToEndPublishingEventHandler
>
> Catch ex As System.Exception
> Msgbox(ex.Message)
> End Try
> End Sub
>
> Public Sub StopWatch()
> If m_pb Is Nothing Or m_bDone = False Then
> Return
> End If
>
> Try
> RemoveHandler m_pb.AboutToBeginBackgroundPublishing, AddressOf callback_AboutToBeginBackgroundPublishingEventHandler
> RemoveHandler m_pb.AboutToBeginPublishing, AddressOf callback_AboutToBeginPublishingEventHandler
> RemoveHandler m_pb.AboutToEndPublishing, AddressOf callback_AboutToEndPublishingEventHandler
> m_pb = Nothing
> Catch ex As System.Exception
> msgbox(ex.Message)
> End Try
>
> m_bDone = False
> End Sub
>
> ' ...... Event Code here...
>
> End Class
>
> This might help you out on watching for publishing events in Autocad....
>
> null

Hey thanks Mahersy, thats excellent !
Sorry I hadn't responded sooner, my news reader is not so good a
flagging new posts.
As you seen above, I finally figured out how to find if the background
plotting .dll was loaded but I really needed more, cuz once this .dll is
loaded, it stays loaded until Acad restarts. So it really was not the
check I needed in order to "turn off" my app. What I really needed to
know what is a background plot was actually in progress (or starting).
It looks like the code you posted will do the trick. I'll convert it
over to C# and give it a whirl.
Thanks again
Perry
Message 13 of 19
mahersy
in reply to: Anonymous

If you want the C# look here
http://discussion.autodesk.com/thread.jspa?threadID=463871
Message 14 of 19
perry59
in reply to: Anonymous

You Da Man !
Message 15 of 19
mahersy
in reply to: Anonymous

How did you go? Got around to having a look at this today but i keep getting Fatal error:
FATAL ERROR: Unhandled e0434f4dh Exception at 7c812a5bh
When i plot instead of publish.
Looked at the documentation and it says to make sure acpublish.arx is load but i get this error even when it is loaded. works fine when publishing though.... 😞
And intermittently for plot after publishing....
Tried it on 06 and 07 same result?
Message 16 of 19
tommy.yang
in reply to: Anonymous

if (Autodesk.AutoCAD.Runtime.ExtensionLoader.IsLoaded(moduleName) == false)
{
Autodesk.AutoCAD.Runtime.ExtensionLoader.Load(moduleName);
}
Message 17 of 19
perry59
in reply to: Anonymous

Yes, I got fatal errors with it also so I stripped out everything but the
"beginbackgroundpublish" which is what I really wanted.
Don't know who originally authored this code (Adesk?), but its buggered.
Perry
Message 18 of 19
mahersy
in reply to: Anonymous

Guess you saw the post I put up. Where in OZ are you, slang gave it away? I am from Newcastle. Evan
Message 19 of 19
mahersy
in reply to: Anonymous

For what you want to do you can add BeginPot and EndPlot handles from the PlotReactorManager to turn the publisher watch off when ploting and turn it back on at the end so it doesn't fall over during the plot command. You will need to test is though, I have found doing things like that tend to come back to you later with interest.. because relying on event order can be inherently buggy.

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