Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
 public static DwgDrawing RoundTrip(DwgDrawing drawing)
 {
     using (var ms = new MemoryStream())
     {
         drawing.Save(ms);
         ms.Seek(0, SeekOrigin.Begin);
         return(DwgDrawing.Load(ms));
     }
 }