im running into a problem im hoping someone could help clarify for me.
im trying to get a custom item type that is attached to a placed Drainage Conduit pipe. This Link was placed using the Drainage and Utilities Place Conduit tool.
Here is some sample of my code.
BD.DgnModel m_activeModel = Bentley.MstnPlatformNET.Session.Instance.GetActiveDgnModel(); using (ConsensusConnection conConn = new ConsensusConnection(m_activeModel)) { if (conConn != null) { GeometricModel sdkGeomModel = conConn.GetActiveGeometricModel(); if (sdkGeomModel != null) { foreach (FeaturizedModelEntity curFD in sdkGeomModel.FeaturizedModelEntities) { if (curFD.DgnECInstance.ClassDefinition.Name == "Link") { if (curFD.Name == "D-1A") { //now see if item is attached BD.Elements.Element test = curFD.Element; BD.CustomItemHost host = new BD.CustomItemHost(test, true); IList<BD.DgnEC.IDgnECInstance> ItemTypes = host.CustomItems; foreach (BD.DgnEC.IDgnECInstance curItemType in ItemTypes) {//do stuff } } } } } } }
the problem is the custom item host is saying there are no custom items.
i did some more testing and it appears to be around the Drainage and Utilities Features. I tested changing the code to do the same thing but get an alignment Feature instead and was able to get the custom item type. So I'm trying to figure out what is different which these drainage and utility features and how to get the Items attached to them.
Hi John,
be aware this is general programming forum. Because your question is about ORD, I recommend to move it to civil programming group.
Without seeing some DGN example, it's hard to say why the code does not work.
ORD creates complex data structures to represent civil features, and a question is to what element the custom Item Type is attached to during the placement, versus what element is accessed using ORD API.
Can be standard Item Types API used there instead of ORD API?
In addition to providing simple test case, I recommend to add Item Type expression to display host element ID (I did not test it, but I guess it should be possible ;-) to receive an information what the host element is.
Regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
how do i move it. or do i just delete this post and post it over there?
and i did some more digging and found that this drainage stuff is handled in a way i do not know the ins and outs of just yet. the element my code returns is different from if i just query up all instances of the item type. So behind the scenes there are different elements for the same thing.
i can go standard item type API. its probably faster to loop specific Item type instances then looping the civil features to find the element i want anyways.
John Drsek said:how do i move it. or do i just delete this post and post it over there?
Use More > Move tool, available in menu under your original post; choose or type in the name of the target forum. To delete the post is not always possible I think.
John Drsek said:So behind the scenes there are different elements for the same thing.
I do not know civil data model in detail, but internally, complex data structure (using EC data) is created for every feature posted. So there is no simple 1:1 relationship that displayed graphical element is the feature.
John Drsek said:i can go standard item type API. its probably faster to loop specific Item type instances then looping the civil features to find the element i want anyways.
I am not sure whether it's faster, I think the difference is that MicroStation API works primarily with elements, whereas ORD API is based on concept of features. So the returned element can be different.