I am trying to create a PointEntity2d object so that I can draw a point through Bentley SDK in OpenRoadsDesigner. I see CreateFromElement static method, but which element should I create first to call this method? For e.g., will this work? Or is there a better way to do this? I can't find anything in the SDK examples.
var connection = ConsensusConnectionEdit.GetActive(); var ptt = new BeGeoNET.DPoint3d(pt.X * uerToMeter, pt.Y * uerToMeter, pt.Z * uerToMeter);
var line = new LineElement(currentModel, null, new BeGeoNET.DSegment3d(ptt, ptt)); // create a line with same point for start and end Element elem = line;
BeGeoNET.DPoint3d[] points = { ptt };
connection.StartTransientMode(); elem.AddToModel(); PointEntity2d d2d = PointEntity2d.CreateFromElement(connection, elem); d2d.Element.AddToModel(); connection.PersistTransients();
Pointentity2d is internal code and is not public, so you can't use it.
Thanks. Then what can I use to draw points? I tried using PointEntity2dEdit as below, but that doesn't draw points either. I have bunch of coordinates, and I would like to draw points with help of SDK.
connection.StartTransientMode(); var point = PointEntity2dEdit.CreateByDPoint3d(connection, ptt);connection.PersistTransients();
There is a limitation in above code. After the call to PersistTransients(), the z coordinate of the point becomes zero. I am not sure how to retain z coordinate. I tried searching as much as I can, no luck. If anyone knows, please let me know.
You created a 2D element,try using 3D point objects.
If I don't use AlignmentEdit or PointEntity2dEdit or other *Edit classes, then the created element doesn't get added to ConsensusConnection's ActiveGeometricModel. I don't see a PointEntity3dEdit class in Bentley SDK.
As you said, there is only this class, so the object is 2D.
Thanks. And there are no plans to expose some SDK methods to draw 3D points?