//-------------------------------------------------------------------------------------------------- void _ReadFromBytes(byte[] bytes, Sketch sketch, bool replace) { Assert.IsTrue(SvgSketchImporter.Import(new MemoryStream(bytes), out var points, out var segments)); if (replace && points?.Count > 0) { sketch.Clear(); } sketch.AddElements(points, null, segments, null); }
//-------------------------------------------------------------------------------------------------- bool ISketchImporter.DoImport(Clipboard clipboard, out IDictionary <int, Pnt2d> points, out IDictionary <int, SketchSegment> segments, out IEnumerable <SketchConstraint> constraints) { points = null; segments = null; constraints = null; bool result = false; using (new ProcessingScope(null, "Importing sketch from SVG")) { if (_ReadFromClipboard(clipboard, out var content)) { result = SvgSketchImporter.Import(content, out points, out segments); } } return(result); }