I prefer a solution for .NET but other Solutions are welcome too.In my DGN I created a simple square and added some XAttribute Data to it. Then i extruded this element to a cube. Calling the function GetChildren() gives me no result. I did called ExposeChildren before that but the result is false. Only when I give as reason the number 100 (cast to the enum), then I get a true as result but still no children. I did read in a different thread that Bentley doesn't show the childrens for every Element. I only want to read data from that element and change them when necessary. When scanning the whole Model, I get that element with the data. Scanning the whole Model in that case is no option.
I did looked into the examples from the SDK but I didn't found something. I have no clue what to try next. I did tried to get the information via the Interop Element but because this is no Cell (can't convert to a cell), I dont have access to the Function to get the sub elements.I mean there must be a solution to this without scanning the whole Model.
Hi Jean-Pierre,
quick thought, not any tests done:
Jean-Pierre Hundhausen said:Then i extruded this element to a cube.
Type 106 is "generic type", so I assume when you will use standard GetChildren method (I think you mean Element.GetChildren()), you will receive nothing, because by extrusion you created some 3D element with internal structure, but with no children element(s).
You should check what element type you created and to use proper ElementHandler (proper class in C#) and to check what methods are available.
Jean-Pierre Hundhausen said: I only want to read data from that element and change them when necessary.
An example of your DGN would help, because it's not clear whether attached XAttributes are atatched to "top level" element or they stayed with original element, but hidden inside the new element structure.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
test271119001.dgnI attached a dgn.The XAttributes stay with the old Element and I can access the XAttributes when getting that Element. The problem is that when I select the Element in the MicroStation, I only get the top most element, with no Information that there is more.
Jan Šlegr said:You should check what element type you created and to use proper ElementHandler (proper class in C#) and to check what methods are available.
The problem is that I won't know which Element I have there. Safely casting everything to every Element Type and check what gives me a result doesn't look right. With the Interop Element I have the functions IsCellElement() and so on to check the Element Type but with that Element, everything was false. Sure when doing something with that Element besides from accessing XAttributes and ECObject Data, then it would be necessary to get the proper Element Class. Mentioning ECObject Data, i also looked through them, if I find anything about the old Element but I had no luck.
Mit freundlichen Grüßen / Best regardsJean-Pierre Hundhausen
| AB_DATE Engineering Software | ab-date.de |
Too busy and tired this weel, so shortly...
Jean-Pierre Hundhausen said:The problem is that I won't know which Element I have there.
Use standard C# approach:
System.Type type = element.GetType(); if (element is ExtendedElementElement) { ExtendedElementElement extElem = element as ExtendedElementElement; }
Jean-Pierre Hundhausen said:if I find anything about the old Element but I had no luck.
Did you try to use ElementGraphicProcessor? But I am not sure whether it's able to provide also internal not displayed objects (profile).
Another way can be to use parametric solid classes to get original profile. LocateSubEntityTool is able to do that, but it's location tool, so it's more about to be inspired, not to use.
Jean-Pierre Hundhausen said:I attached a dgn
Use the ANALYZE ELEMENT key-in to examine your Type 106 element. You can see that it has no children, but plenty of attributes. Note the Details tab, which has the comment element data not available...
ANALYZE ELEMENT
Type 106 is a catch-all container that Bentley use to store advanced structures. The geometry may not be advanced, but the contents may be complicated. In this example, those attributes are presumably used to inform a BREP object.
Regards, Jon Summers LA Solutions
Jan Šlegr said:Did you try to use ElementGraphicProcessor? But I am not sure whether it's able to provide also internal not displayed objects (profile).
I don't know how to use it. There is no accessible Constructor and I found no function to get that Class. I searched through the SDK examples and through the docs but no helpful result.
Jan Šlegr said:Another way can be to use parametric solid classes to get original profile. LocateSubEntityTool is able to do that, but it's location tool, so it's more about to be inspired, not to use.
I didn't found anything about parametric solid. There is a Parametric Cell Element but this isn't one.
Jon Summers said:Use the ANALYZE ELEMENT key-in to examine your Type 106 element. You can see that it has no children, but plenty of attributes. Note the Details tab, which has the comment element data not available...
I used the normal Element Information and there is the old Element. Because of that structure I assumed that this is a child element.
I mean they are linked in some way and getting that information is the goal.
Jean-Pierre Hundhausen said:I don't know how to use it. There is no accessible Constructor
public abstract class ElementGraphicsProcessor
It's an abstract class ready for you to inherit to create a concrete class. Call your class from the ElementGraphicsOutput.Process method.
ElementGraphicsOutput.Process
Jean-Pierre Hundhausen said:I used the normal Element Information
You should use both the Analyze Element and the Element Information tool. Analyze Element is the older, but as you can see each tool provides a different set of information.
Jean-Pierre Hundhausen said:I assumed that this is a child element
Yes, but not a child in the sense that the API interprets a family. The API will give you geometric children of a geometric DGN element. Attributes are not children: rather, they are cousins made from data that are attached to a DGN element.
There's also some misleading info in a Type 106. The object may choose to render itself to graphics to help the user, even though the rendered graphics may not exist. It's probably not obvious in your cube, because it's a simple structure. Try extruding or rotating a curved profile to construct a more complex shape. When MicroStation renders that object, you may see lines and arcs that don't exist in the BREP but are constructed for human consumption.
Your ElementGraphicsProcessor can ask for those same data.
ElementGraphicsProcessor
Jon Summers said:It's an abstract class ready for you to inherit to create a concrete class. Call your class from the ElementGraphicsOutput.Process method.
What? I can create an empty class that inherits from ElementGraphicsProcessor. Calling ElementGraphicsOutput.Process does nothing in that context. Also Functions of the call ElementGraphicsProcessor doesn't have a function that looks promising.My expected result would be an Element or its ID. You can't tell me that it's so complicated to access these informations.
Jean-Pierre Hundhausen said:My expected result would be an Element or its ID
If that's all you need, read this article about Model Scanning and Enumeration.
The purpose of the ElementGraphicsProcessor is to harvest various information, both graphical and non-graphical, from a DGN model. It's possible that the C++ implementation is more advanced than the .NET version, because it began its life in the MicroStation V8i era. The C++ ElementGraphicsProcessor provides these methods...
Jon Summers said:If that's all you need, read this article about Model Scanning and Enumeration.
Jean-Pierre Hundhausen said:When scanning the whole Model, I get that element with the data. Scanning the whole Model in that case is no option.
This would take too long with a lot of Elements in my case. Then I still have no clue about the connection between the 2 elements. That is an important information to get the right information's about the right Element.
Jon Summers said:The purpose of the ElementGraphicsProcessor is to harvest various information, both graphical and non-graphical, from a DGN model. It's possible that the C++ implementation is more advanced than the .NET version, because it began its life in the MicroStation V8i era. The C++ ElementGraphicsProcessor provides these methods...
The .NET Methodes look similar. I don't see any Method that gives me data, except GetFacetOptions and GetDrawPurpose (C++ only). Neither of them look right.