示例#1
0
文件: MSTLSlice.cs 项目: AdilGM/2DCAD
        /// <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));
        }
示例#2
0
文件: MSTLSlice.cs 项目: AdilGM/2DCAD
        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));
        }