[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
  • Hi SM,

    please be aware this is general Developers and Programming forum, where your questions sounds like related to some civil product.

    At first, please read and follow general communities best practices, as well as MicroStation Programming forum. After that, I recommend to add mandatory information (product, exact version, used API/language), preferably through standardized subject format. In my opinion necessary is also to move the post to proper forum. If your question is about e.g. OpenRoads Designer, move it to Civil Programming forum.

    To move existing discussion, use More > Move tool, available under your original post. Do not ask again, because it leads to duplicated posts.

    I am trying to create 3D points in my dgn file's 3D model.

    Do you want to create DGN point element type (line with 0 length) or some civil feature?

    This is the code:

    Please, always use  tool, when you want to share code snippet (even one line only).

    Is there a workaround or solution for this?

    It is not clear what exactly you want to do and in what context: Alignment is expected to be in 2D model, as well as horizontal profile (stored in another 2D model). So why you want to create 3D points?

    With regards,

      Jan

Reply
  • Hi SM,

    please be aware this is general Developers and Programming forum, where your questions sounds like related to some civil product.

    At first, please read and follow general communities best practices, as well as MicroStation Programming forum. After that, I recommend to add mandatory information (product, exact version, used API/language), preferably through standardized subject format. In my opinion necessary is also to move the post to proper forum. If your question is about e.g. OpenRoads Designer, move it to Civil Programming forum.

    To move existing discussion, use More > Move tool, available under your original post. Do not ask again, because it leads to duplicated posts.

    I am trying to create 3D points in my dgn file's 3D model.

    Do you want to create DGN point element type (line with 0 length) or some civil feature?

    This is the code:

    Please, always use  tool, when you want to share code snippet (even one line only).

    Is there a workaround or solution for this?

    It is not clear what exactly you want to do and in what context: Alignment is expected to be in 2D model, as well as horizontal profile (stored in another 2D model). So why you want to create 3D points?

    With regards,

      Jan

Children