[ORD C#] Get corridor geometry

Hello,

I am working on the exporting geometry using the ORD SDK. I could successfully get the geometry of the model, using the ElementGraphicsProcessor

            ParametricCellProcessor processor = new ParametricCellProcessor();

            DgnModel model = Session.Instance.GetActiveDgnModel();

            ModelElementsCollection elements = model.GetGraphicElements();

            foreach (Element element in elements)
            {
                {
                    ElementGraphicsOutput.Process(element, processor);
                }
            }

Separetely I export the Coridors with the corridors metadata, using the FindInstances method::

using (DgnECInstanceCollection instances = DgnECManager.Manager.FindInstances(scope, query))
            {
                foreach (var instance in instances)
                {
                    yield return instance;
                }
            }

The problem is that the Corridors are the IDgnECInstance's, while geometry are the Elements. The problem is that I could not link the Geometry Elements with the Corridor Instances. How can I get which Geometrt elements are related to the Corridor? Please advise.

Thanks,

Victor.

  • Hi Victor,

    If I understand your goal correctly, this is the approach I would take using the ORD SDK's:

    using Bentley.DgnPlatformNET;
    using Bentley.MstnPlatformNET;

    using Bentley.CifNET.SDK;
    using Bentley.CifNET.GeometryModel.SDK;
    .

    .

    .

    DgnModel activeModel = Session.Instance.GetActiveDgnModel();

    using (ConsensusConnection conConn = new ConsensusConnection(activeModel))
    {
      if (conConn != null)
      {
        GeometricModel sdkGeomModel = conConn.GetActiveGeometricModel();
        if (sdkGeomModel != null)
        {
          foreach (Alignment alignment in sdkGeomModel.Alignments)
          {
          }
          foreach (Corridor corridor in sdkGeomModel.Corridors)
          {
            Alignment corrAlign = corridor.CorridorAlignment;
          }
        }
      }
    }

    I hope this helps.