Hello!
Is there any way to retrieve all the objects that are listed in the "Applies to" tab, where the property sets can be defined?
I tried to do it in C#, but I just could not figure out where they are stored...
In the image below I have marked the elements I am talking about.
Thanks in advance!
I am curious about this shared function from the PropertyDataServices. It appears to provide what you are describing.
Dim names() As String = PropertyDataServices.FindEligibleClassNames()
Thanks @hippe013 , this is somewhat what I was looking for! Is there a way to retrieve the class of the classname? because my Civil3D is in german, so I want to get the german names/display names as well and this function returns me a list, but all the entries also include the aec/aecmap, etc prefixes
I am not certain as to how to retrieve the localized (German) class names. However, the list of classes that are returned from the FindEligibleClassNames function are the C++ classes. I am not even certain as to how to retrieve the displayed name as shown in the AppliesTo tab, but retrieving the runtime Type gets us a little closer to a solution. You can use the SystemObjects.ClassDictionary to retrieve the RxClass of each C++ class in the returned list. Then using the RxClass you can get the Runtime Type. I was able to return the Runtime Type of each of the C++ Classes except for one. Trying to get the runtime type of the DMLEGEND (dxf name) gave me a System.AccessViolationException so I exclude that one.
In the following example I am building a list of classes for display in a window. I have a custom class ClassNameModel to hold the various names. The ClassNameModel has three properties, the class name (C++), the DXF Name, and the Runtime Type Name. Note how I skip over the "DMLEGEND" class.
Dim dxf As String
Dim runtimeTypeName As String
Dim dict = SystemObjects.ClassDictionary
Dim names() As String = PropertyDataServices.FindEligibleClassNames()
For Each name As String In names
Dim rxc As RXClass = dict.Item(name)
dxf = rxc.DxfName
If dxf = "DMLEGEND" Then
runtimeTypeName = "<<< AccessViolationException >>>"
Else
Dim tp As Type = rxc.GetRuntimeType
runtimeTypeName = tp.Name
End If
_classes.Add(New ClassNameModel(name, dxf, runtimeTypeName))
Next
I hope that this helps!
Thanks @hippe013 !
I have converted it to C# code and created a list with all the RXClass names:
List<string> rxClassNames = new List<string>();
var dict = SystemObjects.ClassDictionary;
string[] eligibleClassNames = PropertyDataServices.FindEligibleClassNames();
foreach (string className in eligibleClassNames)
{
if (dict.Contains(className))
{
RXClass cl = (RXClass) dict[className];
rxClassNames.Add(cl.DxfName);
}
}
I am now trying to retrieve the display names… If I find something/figure it out, I'll post it here
Can't find what you're looking for? Ask the community or share your knowledge.