The DgnPlatformNet API helps developers wanting to create custom applications for MicroStation® from Bentley Systems. We create a MicroStation application as a DLL, written using C# and built with the Microsoft tools provided with Visual Studio.
CurveVector
is a .NET class in the Bentley Geometry API.
It has many uses, particularly when assembling a collection of CurvePrimitive
objects.
I was interested in CurveVector.CloneWithFillets
, it turns out for the wrong reasons.
After a hint by
Brien Bastings,
I learned a good reason to use that method.
Brien wrote: Try CloneWithFillets on something like a rectangle.
The curve primitives in your path should be ordered head to tail
(gaps are ok, primitives & segments are trimmed/extended as needed).
The angle between their start and end tangents at the point of intersection should be > 0 and < π.
The fillet radius also needs to be small enough to not fully consume any segment.
Taking Brien's advice, I wrote this example to illustrate the use of CurveVector.CloneWithFillets
…
using Bentley.GeometryNET; using Bentley.DgnPlatformNET; using Bentley.DgnPlatformNET.Elements; using Bentley.MstnPlatformNET;
void CreateFilletedRectangle () { DgnModel model = Session.Instance.GetActiveDgnModel(); double uors = model.GetModelInfo().UorPerMaster; // Create four line segments LineElement l1 = MakeLineElement(uors, 0.0, 0.0, 10.0, 0.0); l1.AddToModel(); LineElement l2 = MakeLineElement(uors, 10.0, 0.0, 10.0, 5.0); l2.AddToModel(); LineElement l3 = MakeLineElement(uors, 10.0, 5.0, 0.0, 5.0); l3.AddToModel(); LineElement l4 = MakeLineElement(uors, 0.0, 5.0, 0.0, .0); l4.AddToModel(); // Add lines to a CurveVector CurveVector result = new CurveVector(CurveVector.BoundaryType.Outer); result.Add(l1.GetCurveVector().GetPrimitive(0)); result.Add(l2.GetCurveVector().GetPrimitive(0)); result.Add(l3.GetCurveVector().GetPrimitive(0)); result.Add(l4.GetCurveVector().GetPrimitive(0)); // Extract a filletted version of the CurveVector CurveVector fillet = result.CloneWithFillets(2 * uors); ComplexStringElement filletElement = new ComplexStringElement(model, null); filletElement.SetCurveVector(fillet); filletElement.AddToModel(); }
LineElement MakeLineElement (double uors, double x0, double y0, double x1, double y1) { DSegment3d s = new DSegment3d(new DPoint3d(x0 * uors, y0 * uors), new DPoint3d(x1 * uors, y1 * uors)); return new LineElement(Session.Instance.GetActiveDgnModel(), null, s); }
Post questions about C# and the DgnPlatformNet API to the MicroStation Programming Forum.