[ORD SDK 2021 C#] Issue creating elements to 3D model.

I am trying to create 3D points in my dgn file's 3D model. This is the code:

      var connection = ConsensusConnectionEdit.GetActive();

      connection.StartTransientMode();

      // Approach 1 - use AlignmentEdit to create a line
      // var alignmentEdit = AlignmentEdit.CreateByLinearElement(connection, line, false); //has z coord before call to PersistTransients, becomes zero right after that.
      //alignmentEdit.SetFeatureDefinition(name);

      // Approach 2 - use PointEntity2dEdit to create a point
      var point = PointEntity2dEdit.CreateByDPoint3d(connection, dPoint3d);  //has z coord before call to PersistTransients, becomes zero right after that.
      point.SetFeatureDefinition(name);
      point.SetDetails(name, name);

      connection.PersistTransients();

I selected 3d model in my dgn file. As a result, Session.Instance.GetActiveDgnModel() returns a dgn model with is3D set to true. However, connection.GetActiveGeometricModel().DgnModel is the default model with is3d set to false. The alignmentEdit variable has z coordinate set right before call to PersistTransients(), but z coordinate becomes zero right after. This is probably because connection's dgn model is default 2d.

My question is - even though Session's active model is 3D, when I call ConsensusConnectionEdit.GetActive(), i would expect the returned connection to point to this 3D model. Looks like it doesn't. Why? Is this a bug?

I tried using PointEntity2dEdit object as well, no luck - I lose z coordinate. The elements get added to 2D model only.

Is there a workaround or solution for this?

Parents Reply Children
No Data