PropertySetDefinition: get types from StringCollection AppliesToFilter

PropertySetDefinition: get types from StringCollection AppliesToFilter

michal_hcz
Enthusiast Enthusiast
1,348 Views
3 Replies
Message 1 of 4

PropertySetDefinition: get types from StringCollection AppliesToFilter

michal_hcz
Enthusiast
Enthusiast

Hi, 

I'd like to get types (or at least normal names) from string collection Autodesk.Aec.PropertyData.DatabaseServices.PropertySetDefinition.AppliesToFilter.

 

I have no idea how to convert "AcDb3dSolid, AcDbSurface, AeccDbSurfaceTin, AcDbFace, AcDbBody, AcDb3dPolyline, AeccDbFeatureLine, AeccDbAlignment, AeccDbVAlignment ..." to types Autodesk.AutoCAD.DatabaseServices.Solid3d, TinSurface, Alignment, etc.

I've tried RXObject and RXClass but they don't have methods with string.

Reflection won't help because AcDbs are internal structs. Neither removing substrings "AcDb" or "AeccDb" and trying to get the type from the assembly works.

 

michal_hcz_0-1718703251700.png

 

michal_hcz_0-1718704688135.png

 

		public static void GetPropertySets(Entity ent, Transaction tr)
		{
			ObjectIdCollection psdColl = PropertyDataServices.GetPropertySets(ent);

			foreach (ObjectId objId in psdColl)
			{
				PropertySet ps = objId.GetObject(OpenMode.ForRead) as PropertySet;
				ObjectId idDef = ps.PropertySetDefinition;

				PropertySetDefinition propSetGroup = (PropertySetDefinition)tr.GetObject(idDef, OpenMode.ForRead);

				foreach (string obj in propSetGroup.AppliesToFilter)
				{
					// get type from stirng??
				}
			}
		}

 

Thanks for help.

Michal

0 Likes
Accepted solutions (2)
1,349 Views
3 Replies
Replies (3)
Message 2 of 4

hippe013
Advisor
Advisor
Accepted solution
Message 3 of 4

eirij
Advocate
Advocate

Maybe try with reflection.

 

string objectType = "AcDb3dSolid";
Assembly asm = typeof(Solid3d).Assembly;
Type type = asm.GetType(objectType);

0 Likes
Message 4 of 4

michal_hcz
Enthusiast
Enthusiast
Accepted solution

Thank you guys. 

 

 

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);
	}
}

 

 

0 Likes