CLR References full list

Hello, dear professionals
I am looking for a full list of available clr references that can be added to a python script.
From time to time I bump onto new clr references over and over again. For example:

import clr
clr.AddReference(‘DynamoRevitDS’)

Is it possible to find the full information of all available references with their description ??
Or maybe we all have to expect surprises from autodesk everyday

@m.shcheblykin ,

import sys
import clr
from clr import *

OUT = dir(clr)


you mean like this?

2 Likes

you can get assemblies that have been loaded into the current domain
(which are loadable via clr.AddReference())

2 Likes

hi
yes, is there description of those anywhere ?

hi
is there description of those anywhere ?

@m.shcheblykin ,

there are so called magic methodes of python
some of them are listet there

The description for each assembly?

yes, I would like to check how those clr references can be used. What can be achieved with them or which information they can provide

Some assemblies have description you can try to get them

import sys
import clr
import System

dict_out = {}

for asm in System.AppDomain.CurrentDomain.GetAssemblies():
	descriptionAttribute = asm.GetCustomAttributes(System.Reflection.AssemblyDescriptionAttribute, False)
	if len(descriptionAttribute) > 0:
		dict_out[asm.GetName().Name] = descriptionAttribute[0].Description
	else:
		dict_out[asm.GetName().Name] = "No Description"
	
OUT = dict_out

The list of available assemblies you can reference indirectly will shift constantly. This isn’t a Dynamo thing or an Autodesk thing, but a .Net thing. The applications you’re using will determine what has been loaded into the system, and as such some assemblies could require first appending to the sys paths to ensure that they are visible in the current context. Granted all of these aren’t required for typical Dynamo efforts, but it’s worth noting that it’s possible to attain them.

If the scope of what you’re seeing using the GetAssemblies method is a bit overwhelming it’d be understandable. There are 100’s of libraries in there which aren’t necessarily pertinent to what you’re after. As such it’s likely best to limit the scope and explore the content associated with a given directory directly. Conveniently Both the Dynamo Sandbox or Dynamo for Revit assemblies can reviewed by checking for .dll files in the respective program folders. Exactly what assemblies are available will vary by release, and not all libraries are intended for public use. So before going too far, it’s best to cover a few things:

  1. If you start poking at these, don’t be surprised when things get unstable - not all code is intended to be accessed in an open context.
  2. If you find something which works for you today, know that a future release may break the methods you’re calling. Internal APIs are a common example of tools which could change without notice between releases.
  3. Documentation on these assemblies may be missing, outdated, or inaccurate - you may be on your own for deciphering what the uses are.
  4. You may be breaking the terms of your license by accessing the application this way. Staying in the confines of licensing is up to you as a developer/ programmer/ tool author.

As you explore, know that the documentation around interactions may not be as clean as you’d like, this is because you’re accessing the content in what is likely an unintended way (via Python), and because the assembly authors may not have understood that you would have a need/use for the tool as you’re attempting to use it.

Enjoy the exploration. :slight_smile:

2 Likes