Hello to All, I am having issues with ScanCriteria scanning and finding elements, I have attached the code below:
Any help would be appreciated. In vb.net coding I used the Bentley.Interop.MicroStationDGN assembly which is a different scan process. I would like to use the Bentley.DgnPlatformNET assembly in my C# programming.
Thank you, Donna Rodrick
using Bentley.DgnPlatformNET; using Bentley.DgnPlatformNET.Elements; namespace SheetManager { public partial class CtSheetManager : Form { //other code List<BDPN.Elements.Element> scanEls = new List<BDPN.Elements.Element>(); scanEls.Capacity = 100; using (ScanCriteria scanC = new ScanCriteria()) { List<MSElementType> elementTypes = new List<MSElementType> { MSElementType.Text }; scanC.AddElementTypes(elementTypes); elementTypes.Clear(); List<DgnElementClass> classTypes = new List<DgnElementClass> { DgnElementClass.Construction }; scanC.AddClassTypes(classTypes); classTypes.Clear(); scanEls = scanC.Scan(dgnModel); } //more code
Hi Donna,
Donna Rodrick said:I am having issues with ScanCriteria
What your issue is? You posted some code, but you did not explain what it does not do and what you want to achieve.
BTW When you need to scan elements using simple filter, it's better (and probably faster) to iterate element cache directly using ModelElementsCollection.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Hi Jan,
I will try the ModelElementsCollection in my program.
Thank you!
Donna Rodrick said:I will try the ModelElementsCollection in my program.
Not tested (only that it can be compiled ;-):
DgnModel dgnModel = Session.Instance.GetActiveDgnModel(); ModelElementsCollection graphicElements = dgnModel.GetGraphicElements(); List<TextElement> texts = new List<TextElement>(); foreach (Element el in graphicElements) { if (el is TextElement) { ElementPropertiesGetter properties = new ElementPropertiesGetter(el); if (properties.ElementClass == DgnElementClass.Construction) { texts.Add(el as TextElement); } } }
Jan Šlegr said:Not tested
I found few minute to test it and it works :-)
Regards,