//-------------------------------------------------------------------------------------------------- void _ImportLwPolyline(DxfDomLwPolyline dxfPolyline) { if (dxfPolyline.Points.Length == 0) { return; } var startIndex = _AddPoint(dxfPolyline.Points[0]); for (int i = 1; i < dxfPolyline.Points.Length; i++) { var endIndex = _AddPoint(dxfPolyline.Points[i]); _Segments.Add(new SketchSegmentLine(startIndex, endIndex)); startIndex = endIndex; } }
//-------------------------------------------------------------------------------------------------- void _AddPolygonCurve(Geom2d_Curve curve) { var converter = new Geom2dConvert_ApproxCurve(curve, _Precision, GeomAbs_Shape.GeomAbs_C0, 500, 1); if (!(converter.IsDone() && converter.HasResult())) { Messages.Error($"Cannot tesselate curve to polyline."); return; } var approx = converter.Curve(); var points = new Pnt2d[approx.NbPoles()]; for (int i = 0; i < points.Length; i++) { points[i] = approx.Pole(i + 1); } var entity = new DxfDomLwPolyline("0", points); _Document.Entities.Add(entity); }