public void ReadEntireFile() { var drawing = DwgDrawing.Load(Path.Combine("Drawings", "R14.dwg")); var line = (DwgLine)drawing.ModelSpaceBlockRecord.Entities.Single(); Assert.Equal(DwgPoint.Origin, line.P1); Assert.Equal(new DwgPoint(10.0, 10.0, 0.0), line.P2); }
public async Task <ReadDrawingResult> ReadDrawing(string fileName, Stream fileStream, Func <string, Task <byte[]> > contentResolver) { var dwgDrawing = DwgDrawing.Load(fileStream); var options = new DwgToDxfConverterOptions(DxfAcadVersion.R14); var converter = new DwgToDxfConverter(); var dxf = await converter.Convert(dwgDrawing, options); return(await DxfFileHandler.FromDxfFile(Path.ChangeExtension(fileName, ".dxf"), dxf, contentResolver)); }
public static DwgDrawing RoundTrip(DwgDrawing drawing) { using (var ms = new MemoryStream()) { drawing.Save(ms); ms.Seek(0, SeekOrigin.Begin); return(DwgDrawing.Load(ms)); } }