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();
You can use the MS method to put the point element into the curvector,and then,convert curvector to element.
I am able to create points this way:
var connection = ConsensusConnectionEdit.GetActive();
connection.StartTransientMode(); var point = PointEntity2dEdit.CreateByDPoint3d(connection, point1); point.SetFeatureDefinition(name); point.SetDetails(description, name); connection.PersistTransients();
Answer Verified By: Yongan.Fu
excellent!