/// <summary> /// Saves the contours and hatches in layers corresponding to its tile /// </summary> /// <param name="outputDirectory"></param> /// <param name="outputName"></param> /// <returns></returns> public bool ExportAsDXF(string outputDirectory, string outputName) { var outputFilePath = Path.Combine(outputDirectory, outputName); var document = new DxfDocument(new HeaderVariables()); // combine geometries var geometries = HatchLines.Concat(ContourLines).ToArray(); // clip geometries in tiles and results to dxf layer for (int i = 0; i < Tiles.Count; i++) { for (int j = 0; j < geometries.Length; j++) { var results = GeometricArithmeticModule.ClipGeometry( geometries[j], Tiles[i] ); for (int k = 0; k < results?.Count; k++) { document.AddEntity( results[k].GetAsDXFEntity( $"Tile {i}" ) ); } } } document.Save(outputFilePath); return(File.Exists(outputFilePath)); }
public bool SaveAsDXF(string outputFilePath) { var document = new DxfDocument(new HeaderVariables()); // combine contour and hatches foreach (var geometry in HatchLines.Concat(ContourLines)) { document.AddEntity( geometry.GetAsDXFEntity() ); } document.Save(outputFilePath); return(File.Exists(outputFilePath)); }