Realy In C # get list of all the elements of the model and the properties of each element?
Hi,
I assume you thought "How to get...".
To get list of all elements in a model you have to create ElementEnumerator using Scan method. It's pretty the same concept as in MicroStation VBA, so I recommend to read MicroStation VBA help and included examples, there are several about scanning models there.
The second part of your question cannot be answer in a simple way, because each element has different properties. I think the most of them (at least in the case of 2D elements) are implemented as class properties, so you should have not big problems to obtain them.
BTW You should post your question to Programming Forum, because this forum is focuse on MicroStation VBA only.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
You could use the PropertyHandler to get the properties for each element. I think that will give you everything that might be necessary.
HTH,
mark anderson [Bentley]
Visit me at https://communities.bentley.com/communities/other_communities/bentley_innovation/default.aspx
I want to get a description of the property "Class" for the elements of the model, how to describe the output? I know there prop.GetDisplayString (), but if it is, how to handle that?
MicroStationDGN.ElementScanCriteria scan = new MicroStationDGN.ElementScanCriteria();
scan.IncludeOnlyVisible();
MicroStationDGN.ElementEnumerator enumer = micro.ActiveDesignFile.DefaultModelReference.Scan(scan);
designFile.Models[1].Activate();
while (enumer.MoveNext())
{
MicroStationDGN._Element sourceElem = enumer.Current;
MicroStationDGN.PropertyHandler prop = micro.CreatePropertyHandler(sourceElem);
prop.SelectByAccessString("Class");
...
}
Ostanin said:prop.SelectByAccessString("Class")
The Element class is the base class of all other elements. You can obtain the MicroStation Class directly:
MsdElementClass elemClass = sourceElem.Class;
Ostanin said:I want to get a description of the property "Class"
See VBA help about MsdElementClass. A user can classify an element as Primary or Construction. There are other classes assigned usually by MicroStation. Primary class elements are those that a user draws normally. Construction class elements are also user-drawn but have the default property that they are not printed. In other words, construction class elements are a framework on which normal elements are drawn.
Regards, Jon Summers LA Solutions
Thank you, very helpful, but there is a general class that would have access to all properties( Start Point, Level Name, Material and other) of the tab "Properties"?
Attached is a sample that demonstrates using the PropertyHandler to inspect elements. The documentation has some really good source code and description on this class.
Look in the VBA help for the Element object.
All graphic elements inherit from Element, but not all elements have all the properties you want to see. All graphic elements have a class and level, for example, but not all elements have a StartPoint.
There is no VBA API for materials. To handle material information, you must use MDL.
Thanks you!