Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PropertySetDefinition: get types from StringCollection AppliesToFilter

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
michal_hcz
239 Views, 3 Replies

PropertySetDefinition: get types from StringCollection AppliesToFilter

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

Labels (1)
3 REPLIES 3
Message 2 of 4
hippe013
in reply to: michal_hcz
Message 3 of 4
eirij
in reply to: michal_hcz

Maybe try with reflection.

 

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

Message 4 of 4
michal_hcz
in reply to: michal_hcz

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

 

 

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

Post to forums  

Rail Community


 

Autodesk Design & Make Report