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

Check if ARX is loaded

5 REPLIES 5
Reply
Message 1 of 6
karl.sch1983
387 Views, 5 Replies

Check if ARX is loaded

I am trying 

Autodesk.AutoCAD.Runtime.SystemObjects.DynamicLinker.IsModuleLoaded("Test.arx");

to determine if Test.ARX is loaded, but it keeps returning false. I know for a fact that Test.ARX is loaded. Maybe this function is not the right one to use. Is there another function to find out if a particular ARX is loaded? Thanks for your help.

5 REPLIES 5
Message 2 of 6
Gepaha
in reply to: karl.sch1983

What happens if you include the path?

try
{
   if (!SystemObjects.DynamicLinker.IsModuleLoaded (Path.Combine("YourPath", "Test.arx")))
   {                    
      SystemObjects.DynamicLinker.LoadModule(Path.Combine("YourPath", "Test.arx"), false, true);
   } 
}
catch (Exception ex)
{
   // ...
}
Message 3 of 6
SENL1362
in reply to: karl.sch1983

try this:

...
var amAcad = loadedAssemblies.Keys.Where(n => n.StartsWith("AMACAD", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
...

//Returns both *.dll and *.arx
public static Dictionary<string,Assembly> GetLoadedAssemblies()
{
var assemblies = new Dictionary<string, Assembly>(StringComparer.OrdinalIgnoreCase);
foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
{
var assyName = assembly.GetName().Name;
assemblies[assyName] = assembly;
}
return assemblies;
}
Message 4 of 6
karl.sch1983
in reply to: Gepaha

Unfortunately, still does not work with full path.

Message 5 of 6
karl.sch1983
in reply to: SENL1362

Seems like this can find all the managed assemblies. It does not list any arx files.

Message 6 of 6
SENL1362
in reply to: karl.sch1983

This is my output, definitely showing a arx files in the list:

SENL1362_0-1669618664949.png

 

You could also find arx modules querying the Current Process, like so:

var modules = Process.GetCurrentProcess().Modules.OfType<ProcessModule>()
.Where(x => x.FileName.EndsWith(".arx", StringComparison.CurrentCultureIgnoreCase))
.ToList();

 

SENL1362_1-1669618870688.png

 

 

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report