Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            DXFLibrary.Document doc = new DXFLibrary.Document();

            DXFLibrary.Tables tables = new DXFLibrary.Tables();
            doc.SetTables(tables);

            DXFLibrary.Table layers = new DXFLibrary.Table("LAYER");
            tables.addTable(layers);

            DXFLibrary.Layer layerDoors;
            layerDoors = new DXFLibrary.Layer("Doors", 30, "CONTINUOUS");
            layers.AddTableEntry(layerDoors);

            DXFLibrary.Circle cc = new DXFLibrary.Circle(5, 5, 0.1d, "PartialHeightDoors");
            doc.add(cc);

            DXFLibrary.Line line1 = new DXFLibrary.Line("Doors", 0, 0, 0, 10);
            doc.add(line1);
            DXFLibrary.Line line2 = new DXFLibrary.Line("Doors", 0, 0, 10, 0);
            doc.add(line2);
            DXFLibrary.Line line3 = new DXFLibrary.Line("Doors", 10, 10, 0, 10);
            doc.add(line3);
            DXFLibrary.Line line4 = new DXFLibrary.Line("Doors", 10, 10, 10, 0);
            doc.add(line4);

            DXFLibrary.Line3D line5 = new DXFLibrary.Line3D("Doors", 2, 2, 0, 5, 5, 10);
            doc.add(line5);

            FileStream f1 = new FileStream("test2.dxf", System.IO.FileMode.Create);

            DXFLibrary.Writer.Write(doc, f1);
            f1.Close();
        }
Ejemplo n.º 2
0
        //**CONSTRUCTOR
        internal ExportLinesToDXF(List<PolyCurve[]> polycurves, string filename)
        {
            DXFLibrary.Document dxf = new DXFLibrary.Document();
            DXFLibrary.Tables tables = new DXFLibrary.Tables();
            dxf.SetTables(tables);
            DXFLibrary.Table layers = new DXFLibrary.Table("LAYER");
            tables.addTable(layers);
            DXFLibrary.Layer layer = new DXFLibrary.Layer("PROFILES", 30, "CONTINUOUS");
            layers.AddTableEntry(layer);

            List<Curve> Curves = new List<Curve>();
            for (int i = 0; i < polycurves.Count; i++) for (int j = 0; j < polycurves[i].Length; j++) for (int k = 0; k < polycurves[i][j].Curves().Length; k++)
                Curves.AddRange(polycurves[i][j].Curves()[k].ApproximateWithArcAndLineSegments());
            for (int i = 0; i < Curves.Count; i++)
            {
                DXFLibrary.Line line = new DXFLibrary.Line(
                    "PROFILES",
                    Curves[i].StartPoint.X,
                    Curves[i].StartPoint.Y,
                    Curves[i].StartPoint.Z,
                    Curves[i].EndPoint.X,
                    Curves[i].EndPoint.Y,
                    Curves[i].EndPoint.Z);
                dxf.add(line);
            }
            Curves.ForEach(c => c.Dispose());
            using (FileStream f1 = new FileStream(filename, FileMode.Create))
            {
                DXFLibrary.Writer.Write(dxf, f1);
                f1.Close();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 绘制运行图
        /// </summary>
        public void DrawDiagram()
        {
            /*调用DXFLiabrary类库进行DXF文件生成*/
            DXFLibrary.Document doc = new DXFLibrary.Document();

            DXFLibrary.Tables tables = new DXFLibrary.Tables();
            doc.SetTables(tables);

            DXFLibrary.Table layers = new DXFLibrary.Table("LAYER");
            tables.addTable(layers);

            DrawStations(doc, layers); /*绘制车站线*/
            DrawTimeLine(doc, layers); /*绘制时间线*/
            DrawTrains(doc, layers);   /*绘制列车运行线*/

            System.IO.FileStream fs = new System.IO.FileStream(this.Title + ".dxf", System.IO.FileMode.Create);
            DXFLibrary.Writer.Write(doc, fs);/*文件流输出*/
            fs.Close();
        }
Ejemplo n.º 4
0
 //**CONSTRUCTOR
 internal ExportToDXF()
 {
     // dxflibrary document implementation
     dxf = new DXFLibrary.Document();
     tables = new DXFLibrary.Tables();
     dxf.SetTables(tables);
     layers = new DXFLibrary.Table("LAYER");
     tables.addTable(layers);
     layerNames = new List<string>();
     DXFLibrary.Layer layer = new DXFLibrary.Layer("0", 7, "CONTINUOUS");
     layers.AddTableEntry(layer);
     layerNames.Add("0");
 }