ORD | 2021 release 2 update 10 | 10.10.21.04In Ord, each element has a feature definition. Is there a way to get the feature definition for each element?I have a list of IDgnECInstance. I need to get their feature definition and descriptionmore code:
public IEnumerable<Instance> Scan(string schemaName) { var instances = GetInstances(GetSearchClasses(schemaName)); foreach (var instance in instances) { yield return new Instance() { ElementId = instance.Element.ElementId.ToString(), ClassDefinitionDisplayLabel = instance.ClassDefinition.DisplayLabel, FeatureDefinition = instance.Element.FeatureDefinition // this field doesn`t exist }; } } private IQueryable<IDgnECInstance> GetInstances(IECClass[] classes) { var query = new ECQuery(classes) { SelectClause = { SelectAllProperties = true } }; var manager = DgnECManager.Manager; var scopeOptions = new FindInstancesScopeOption(DgnECHostType.Element, true); var dgnFile = _dgnFileProvider.GetActiveDgnFile(); if (dgnFile == null) return null; var scope = FindInstancesScope.CreateScope(dgnFile, scopeOptions); var instances = manager.FindInstances(scope, query); return instances.AsQueryable(); } private IECClass[] GetSearchClasses(string schemaName) { var scopeOptions = new FindInstancesScopeOption(DgnECHostType.All, true); var scope = FindInstancesScope.CreateScope(Session.Instance.GetActiveDgnFile(), scopeOptions); return DgnECManager.Manager.LocateSchemaInScope(scope, schemaName, 1,0,SchemaMatchType.Latest).GetClasses(); }
Ivan Petrov said:In Ord, each element has a feature definition. Is there a way to get the feature definition for each element?
The feature definition is presumably supplied by the ORD schema (XML file). An element has an Item instance, which is data. An element doesn't have the definition — only those data that were created in accordance with the definition.
Regards, Jon Summers LA Solutions
Jon Summers said:The feature definition is presumably supplied by the ORD schema (XML file).
Yes, but it is not one definition in one schema. The feature definition represents tree structure of different definitions (how feature is represented in different views/plans/sections, how every such representation is annotated, where every annotation consists potentially from many definitions etc.). So to reconstruct the whole definition is complex task (I spent days and days to understand some aspects of the civil mode, to be able to obtain data I need).
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point