[ORD 10.10 C#] How to get getting custom item type assigned to Link (Drainage conduit).

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.

Parents Reply Children
  • 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.

  • 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.

    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.

    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.

    Regards,

      Jan