当前位置: 首页>>代码示例>>C#>>正文


C# DxfDocument.Save方法代码示例

本文整理汇总了C#中netDxf.DxfDocument.Save方法的典型用法代码示例。如果您正苦于以下问题:C# DxfDocument.Save方法的具体用法?C# DxfDocument.Save怎么用?C# DxfDocument.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在netDxf.DxfDocument的用法示例。


在下文中一共展示了DxfDocument.Save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteDxfFile


//.........这里部分代码省略.........
            polyline2d.Layer = new Layer("polyline2d");
            polyline2d.Layer.Color.Index = 5;
            polyline2d.Normal = new Vector3(1, 1, 1);
            polyline2d.Elevation = 100.0f;
            dxf.AddEntity(polyline2d);

            //lightweight polyline
            LwPolylineVertex lwVertex;
            List<LwPolylineVertex> lwVertexes = new List<LwPolylineVertex>();
            lwVertex = new LwPolylineVertex(new Vector2(-25, -25));
            lwVertex.StartWidth = 2;
            lwVertexes.Add(lwVertex);
            lwVertex = new LwPolylineVertex(new Vector2(25, -25));
            lwVertex.StartWidth = 1;
            lwVertexes.Add(lwVertex);
            lwVertex = new LwPolylineVertex(new Vector2(25, 25));
            lwVertex.Bulge = 1;
            lwVertexes.Add(lwVertex);
            lwVertex = new LwPolylineVertex(new Vector2(-25, 25));
            lwVertexes.Add(lwVertex);
            LwPolyline lwPolyline = new LwPolyline(lwVertexes, true);
            lwPolyline.Layer = new Layer("lwpolyline");
            lwPolyline.Layer.Color.Index = 5;
            lwPolyline.Normal = new Vector3(1, 1, 1);
            lwPolyline.Elevation = 100.0f;
            dxf.AddEntity(lwPolyline);

            // polyfaceMesh
            List<PolyfaceMeshVertex> meshVertexes = new List<PolyfaceMeshVertex>
                                                    {
                                                        new PolyfaceMeshVertex(0, 0, 0),
                                                        new PolyfaceMeshVertex(10, 0, 0),
                                                        new PolyfaceMeshVertex(10, 10, 0),
                                                        new PolyfaceMeshVertex(5, 15, 0),
                                                        new PolyfaceMeshVertex(0, 10, 0)
                                                    };
            List<PolyfaceMeshFace> faces = new List<PolyfaceMeshFace>
                                                {
                                                    new PolyfaceMeshFace(new short[] {1, 2, -3}),
                                                    new PolyfaceMeshFace(new short[] {-1, 3, -4}),
                                                    new PolyfaceMeshFace(new short[] {-1, 4, 5})
                                                };

            PolyfaceMesh mesh = new PolyfaceMesh(meshVertexes, faces);
            mesh.Layer = new Layer("polyfacemesh");
            mesh.Layer.Color.Index = 104;
            dxf.AddEntity(mesh);

            //line
            Line line = new Line(new Vector3(0, 0, 0), new Vector3(10, 10, 10));
            line.Layer = new Layer("line");
            line.Layer.Color.Index = 6;
            dxf.AddEntity(line);

            //3d polyline
            PolylineVertex vertex;
            List<PolylineVertex> vertexes = new List<PolylineVertex>();
            vertex = new PolylineVertex(new Vector3(-50, -50, 0));
            vertexes.Add(vertex);
            vertex = new PolylineVertex(new Vector3(50, -50, 10));
            vertexes.Add(vertex);
            vertex = new PolylineVertex(new Vector3(50, 50, 25));
            vertexes.Add(vertex);
            vertex = new PolylineVertex(new Vector3(-50, 50, 50));
            vertexes.Add(vertex);
            Polyline polyline = new Polyline(vertexes, true);
            polyline.Layer = new Layer("polyline3d");
            polyline.Layer.Color.Index = 24;
            dxf.AddEntity(polyline);

            //block definition
            Block block = new Block("TestBlock");
            block.Entities.Add(new Line(new Vector3(-5, -5, 5), new Vector3(5, 5, 5)));
            block.Entities.Add(new Line(new Vector3(5, -5, 5), new Vector3(-5, 5, 5)));
           
            //insert
            Insert insert = new Insert(block, new Vector3(5, 5, 5));
            insert.Layer = new Layer("insert");
            insert.Layer.Color.Index = 4;
            dxf.AddEntity(insert);

            //text
            TextStyle style=new TextStyle("True type font","Arial.ttf");
            Text text = new Text("Hello world!", Vector3.Zero, 10.0f,style);
            text.Layer = new Layer("text");
            text.Layer.Color.Index = 8;
            text.Alignment = TextAlignment.TopRight;
            dxf.AddEntity(text);

            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2010;
            dxf.Save("AutoCad2010.dxf");
            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save("AutoCad2007.dxf");
            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2004;
            dxf.Save("AutoCad2004.dxf");
            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2000;
            dxf.Save("AutoCad2000.dxf");
            dxf = DxfDocument.Load("AutoCad2000.dxf");
            dxf.Save("AutoCad2000 result.dxf");
        }
开发者ID:DaishiNakase,项目名称:WaveguideDesigner,代码行数:101,代码来源:Program.cs

示例2: ModifyingXData

        public static void ModifyingXData()
        {
            Line line = new Line(Vector2.Zero, Vector2.UnitX);

            ApplicationRegistry appReg = new ApplicationRegistry("netDxf");
            XData xdata = new XData(appReg);
            xdata.XDataRecord.Add(new XDataRecord(XDataCode.String, "Length"));
            line.XData.Add(xdata);

            DxfDocument doc = new DxfDocument();
            doc.AddEntity(line);

            // modifying existing extended data
            line.XData[appReg.Name].XDataRecord.Add(new XDataRecord(XDataCode.Real, Vector3.Distance(line.StartPoint, line.EndPoint)));

            // adding new extended data entry to an existing entity
            ApplicationRegistry appReg2 = new ApplicationRegistry("newXData");
            XData xdata2 = new XData(appReg2);
            xdata2.XDataRecord.Add(new XDataRecord(XDataCode.String, "XData entries"));
            line.XData.Add(xdata2);

            Debug.Assert(ReferenceEquals(line.XData[appReg2.Name].ApplicationRegistry, doc.ApplicationRegistries[appReg2.Name]));

            // deleting existing extended data
            line.XData.Remove(appReg.Name);

            // we can also change the name of the application registry name
            doc.ApplicationRegistries["newXData"].Name = "netDxfRenamed";

            doc.Save("xData.dxf");

            doc = DxfDocument.Load("xData.dxf");
        }
开发者ID:DaishiNakase,项目名称:WaveguideDesigner,代码行数:33,代码来源:Program.cs

示例3: Polyline

        private static void Polyline()
        {
            DxfDocument dxf = new DxfDocument();
            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2010;
            Polyline poly = new Polyline();
            poly.Vertexes.Add(new PolylineVertex(0, 0, 0));
            poly.Vertexes.Add(new PolylineVertex(10, 10, 0));
            poly.Vertexes.Add(new PolylineVertex(20, 0, 0));
            poly.Vertexes.Add(new PolylineVertex(30, 10, 0));
            dxf.AddEntity(poly);

            dxf.Save("polyline.dxf");

        }
开发者ID:DaishiNakase,项目名称:WaveguideDesigner,代码行数:14,代码来源:Program.cs

示例4: DxfDocument

        /// <inheritdoc/>
        void Core2D.Interfaces.IProjectExporter.Save(string path, Core2D.Project.XProject project)
        {
            _outputPath = System.IO.Path.GetDirectoryName(path);
            var dxf = new DxfDocument(DxfVersion.AutoCad2010);

            Add(dxf, project);

            dxf.Save(path);
            ClearCache(isZooming: false);
        }
开发者ID:Core2D,项目名称:Core2D,代码行数:11,代码来源:DxfRenderer.IProjectExporter.cs

示例5: HatchTest3

        private static void HatchTest3()
        {
            DxfDocument dxf = new DxfDocument();

            LwPolyline poly = new LwPolyline();
            poly.Vertexes.Add(new LwPolylineVertex(-10, -10));
            poly.Vertexes.Add(new LwPolylineVertex(10, -10));
            poly.Vertexes.Add(new LwPolylineVertex(10, 10));
            poly.Vertexes.Add(new LwPolylineVertex(-10, 10));
            poly.Vertexes[2].Bulge = 1;
            poly.IsClosed = true;

            Ellipse ellipse = new Ellipse(Vector3.Zero, 16, 10);
            ellipse.Rotation = 0;
            ellipse.StartAngle = 0;
            ellipse.EndAngle = 180;

            LwPolyline poly2 = new LwPolyline();
            poly2.Vertexes.Add(new LwPolylineVertex(-8, 0));
            poly2.Vertexes.Add(new LwPolylineVertex(0, -4));
            poly2.Vertexes.Add(new LwPolylineVertex(8, 0));

            //Arc arc = new Arc(Vector3.Zero,8,180,0);
            //Line line =new Line(new Vector3(8,0,0), new Vector3(-8,0,0));

            List<HatchBoundaryPath> boundary = new List<HatchBoundaryPath>{
                                                                            new HatchBoundaryPath(new List<EntityObject>{poly}),
                                                                            new HatchBoundaryPath(new List<EntityObject>{poly2, ellipse})
                                                                            };

            Hatch hatch = new Hatch(HatchPattern.Line, boundary, true);
            hatch.Pattern.Angle = 45;
            //dxf.AddEntity(poly);
            //dxf.AddEntity(ellipse);
            ////dxf.AddEntity(arc);
            ////dxf.AddEntity(line);
            //dxf.AddEntity(poly2);
            dxf.AddEntity(hatch);


            dxf.Save("hatchTest3.dxf");
        }
开发者ID:DaishiNakase,项目名称:WaveguideDesigner,代码行数:42,代码来源:Program.cs

示例6: getOffsets


//.........这里部分代码省略.........
                            ((MAVLink.mavlink_raw_imu_t)packet).xmag - offset.Item1,
                            ((MAVLink.mavlink_raw_imu_t)packet).ymag - offset.Item2,
                            ((MAVLink.mavlink_raw_imu_t)packet).zmag - offset.Item3)
                            );
                        vertexes.Add(vertex);

                        // for old method
                        setMinorMax(((MAVLink.mavlink_raw_imu_t)packet).xmag - offset.Item1, ref minx, ref maxx);
                        setMinorMax(((MAVLink.mavlink_raw_imu_t)packet).ymag - offset.Item2, ref miny, ref maxy);
                        setMinorMax(((MAVLink.mavlink_raw_imu_t)packet).zmag - offset.Item3, ref minz, ref maxz);

                        // for new lease sq
                        string item = (int)(((MAVLink.mavlink_raw_imu_t)packet).xmag / div) + "," +
                            (int)(((MAVLink.mavlink_raw_imu_t)packet).ymag / div) + "," +
                            (int)(((MAVLink.mavlink_raw_imu_t)packet).zmag / div);

                        if (filter.ContainsKey(item))
                        {
                            filter[item] = (int)filter[item] + 1;

                            if ((int)filter[item] > 3)
                                continue;
                        }
                        else
                        {
                            filter[item] = 1;
                        }

                        data.Add(new Tuple<float, float, float>(
                            ((MAVLink.mavlink_raw_imu_t)packet).xmag - offset.Item1,
                            ((MAVLink.mavlink_raw_imu_t)packet).ymag - offset.Item2,
                            ((MAVLink.mavlink_raw_imu_t)packet).zmag - offset.Item3));

                    }

                }

                log.Info("Log Processed " + DateTime.Now);

                Console.WriteLine("Extracted " + data.Count + " data points");
                Console.WriteLine("Current offset: " + offset);

                mine.logreadmode = false;
                mine.logplaybackfile.Close();
                mine.logplaybackfile = null;

                if (data.Count < 10)
                {
                    CustomMessageBox.Show("Log does not contain enough data");
                    throw new Exception("Not Enough Data");
                }

                data.Sort(
                    delegate(Tuple<float, float, float> d1, Tuple<float, float, float> d2)
                    {
                        // get distance from 0,0,0
                        double ans1 = Math.Sqrt(d1.Item1 * d1.Item1 + d1.Item2 * d1.Item2+ d1.Item3 * d1.Item3);
                        double ans2 = Math.Sqrt(d2.Item1 * d2.Item1 + d2.Item2 * d2.Item2+ d2.Item3 * d2.Item3);
                        if (ans1 > ans2)
                            return 1;
                        if (ans1 < ans2)
                            return -1;
                        return 0;
                    }
                    );

                data.RemoveRange(data.Count - (data.Count / 16), data.Count / 16);

                double[] x = LeastSq(data);

                System.Console.WriteLine("Old Method {0} {1} {2}", -(maxx + minx) / 2, -(maxy + miny) / 2, -(maxz + minz) / 2);

                log.Info("Least Sq Done " + DateTime.Now);

                // create a dxf for those who want to "see" the calibration
                DxfDocument dxf = new DxfDocument();

                Polyline3d polyline = new Polyline3d(vertexes, true);
                polyline.Layer = new Layer("polyline3d");
                polyline.Layer.Color.Index = 24;
                dxf.AddEntity(polyline);

                Point pnt = new Point(new Vector3f(-offset.Item1, -offset.Item2, -offset.Item3));
                pnt.Layer = new Layer("old offset");
                pnt.Layer.Color.Index = 22;
                dxf.AddEntity(pnt);

                pnt = new Point(new Vector3f(-(float)x[0], -(float)x[1], -(float)x[2]));
                pnt.Layer = new Layer("new offset");
                pnt.Layer.Color.Index = 21;
                dxf.AddEntity(pnt);

                dxf.Save("magoffset.dxf", DxfVersion.AutoCad2000);

                log.Info("dxf Done " + DateTime.Now);

                Array.Resize<double>(ref x, 3);

                return x;
        }
开发者ID:jplumpto,项目名称:KatanaFlightTesting,代码行数:101,代码来源:MagCalib.cs

示例7: DimensionUserText

        public static void DimensionUserText()
        {
            DxfDocument dxf = new DxfDocument(DxfVersion.AutoCad2010);

            Vector3 p2 = new Vector3(0, 0, 0);
            Vector3 p1 = new Vector3(5, 0, 0);

            Line line1 = new Line(p1, p2)
            {
                Layer = new Layer("Reference line")
                {
                    Color = AciColor.Green
                }
            };
            dxf.AddEntity(line1);

            DimensionStyle style = new DimensionStyle("MyStyle");

            double offset = 0.75;
            LinearDimension dim = new LinearDimension(line1, offset, 0, style);
            dim.UserText = null;    // 5.00 (this is the default behavior)
            dxf.AddEntity(dim);

            dim = new LinearDimension(line1, 2 * offset, 0, style);
            dim.UserText = string.Empty;    // 5.00 (same behavior as null)
            dxf.AddEntity(dim);

            dim = new LinearDimension(line1, 3 * offset, 0, style);
            dim.UserText = " ";    // No dimension text will be drawn (one blank space)
            dxf.AddEntity(dim);

            dim = new LinearDimension(line1, 4 * offset, 0, style);
            dim.UserText = "<>";    // 5.00 (the characters <> will be substituted with the style.DIMPOST property)
            dxf.AddEntity(dim);

            dim = new LinearDimension(line1, 5 * offset, 0, style);
            dim.UserText = "Length: <> mm"; // Length: 5.00 mm (the characters <> will be substituted with the style.DIMPOST property)
            dxf.AddEntity(dim);

            dim = new LinearDimension(line1, 6 * offset, 0, style);
            dim.UserText = "User text"; // User text
            dxf.AddEntity(dim);

            dxf.Save("DimensionUserText.dxf");

        }
开发者ID:DaishiNakase,项目名称:WaveguideDesigner,代码行数:46,代码来源:Program.cs

示例8: ModifyingDimensionGeometryAndStyle

        public static void ModifyingDimensionGeometryAndStyle()
        {
            DimensionStyle style = new DimensionStyle("MyStyle");
            Vector3 p1 = new Vector3(-2.5, 0, 0);
            Vector3 p2 = new Vector3(2.5, 0, 0);

            LinearDimension dim = new LinearDimension(p1, p2, 4, 0, style);

            // This is illegal. Trying to rebuild the dimension block before it has been added to a document will throw an exception
            //dim.RebuildBlock();

            DxfDocument doc = new DxfDocument();
            doc.AddEntity(dim);

            // modifying the dimension style
            dim.Style.DIMBLK = DimensionArrowhead.ArchitecturalTick;
            // if we make any change to the dimension style, we need to manually call the RebuildBlock method to reflect the new changes
            // since we will also modify the geometry of the dimension we will rebuild the block latter
            //dim.RebuildBlock();

            // the same kind of procedure needs to be done when modifying the geometry of a dimension
            dim.FirstReferencePoint = new Vector3(-5.0, 0, 0);
            dim.SecondReferencePoint = new Vector3(5.0, 0, 0);
            // now that all necessary changes has been made, we will rebuild the block.
            // this is an expensive operation, use it only when need it.

            dim.Style.DIMBLK = DimensionArrowhead.Box;
            dim.Style.DIMBLK = DimensionArrowhead.ArchitecturalTick;
            Debug.Assert(ReferenceEquals(dim.Style.DIMBLK, doc.Blocks[dim.Style.DIMBLK.Name]), "References are not equal.");
            Debug.Assert(ReferenceEquals(style.DIMBLK, doc.Blocks[style.DIMBLK.Name]), "References are not equal.");
            //dim.Style.DIMBLK = null;

            // VERY IMPORTANT: If any change is made to the dimension geometry and/or its style, we need to rebuild the drawing representation
            // so the dimension block will reflect the new changes. This is only necessary for dimension that already belongs to a document.
            // This process is automatically called when a new dimension is added to a document.
            dim.Update();
            Debug.Assert(ReferenceEquals(dim.Block, doc.Blocks[dim.Block.Name]));

            doc.Save("dimension.dxf");
            Test("dimension.dxf");

        }
开发者ID:DaishiNakase,项目名称:WaveguideDesigner,代码行数:42,代码来源:Program.cs

示例9: ModifyingBlockProperties

        public static void ModifyingBlockProperties()
        {
            DxfDocument doc = new DxfDocument();
            doc.DrawingVariables.InsUnits = DrawingUnits.Centimeters;
            Line existingLine = new Line(new Vector2(-10, 10), new Vector2(10, -10));
            doc.AddEntity(existingLine);

            AttributeDefinition attDef4 = new AttributeDefinition("MyAttribute4");
            attDef4.Value = "MyValue4";
            attDef4.Alignment = TextAlignment.TopCenter;
            Block block = new Block("MyBlock", null, new List<AttributeDefinition>{attDef4});
            block.Record.Units = DrawingUnits.Millimeters;

            // this is incorrect we cannot add an entity that belongs to a document when the block does not belong to anyone.
            //block.Entities.Add(existingLine);
            doc.Blocks.Add(block);
            // when the block and the entity that is being added belong to the same document, the entity will be removed from its current layout and added to the block
            // you cannot add an entity that belongs to a different document or block. Clone it instead.
            block.Entities.Add(existingLine);

            // now we can modify the block properties even if it has been already added to the document
            Line line = new Line(new Vector2(-10, -10), new Vector2(10, 10));

            // when new entities that do not belong to anyone are added to an existing block, they will also be added to the document
            block.Entities.Add(line);

            DxfDocument doc2 = new DxfDocument();
            Circle circle = new Circle(Vector2.Zero, 5);
            doc2.AddEntity(circle);

            // this is incorrect the circle already belongs to another document
            //block.Entities.Add(circle);
            // we need to clone it first
            Circle circle2 = (Circle) circle.Clone();
            circle2.Radius = 2.5;
            block.Entities.Add(circle2);

            //you could also remove circle2 from doc2 and add it to the block
            doc2.RemoveEntity(circle);
            block.Entities.Add(circle);

            AttributeDefinition attDef = new AttributeDefinition("MyAttribute1");
            attDef.Value = "MyValue1";
            block.AttributeDefinitions.Add(attDef);

            // the same that is applicable to entities is also true to attribute definitions
            AttributeDefinition attDef2 = new AttributeDefinition("MyAttribute2");
            attDef2.Value = "MyValue2";
            attDef2.Alignment = TextAlignment.BaselineRight;
            block.AttributeDefinitions.Add(attDef2);

            Insert ins = new Insert(block);
            doc.AddEntity(ins);

            // if the insert has been added to a document, any new attribute definitions added to the block will not be reflected in the insert
            // this mimics the behavior in AutoCad
            AttributeDefinition attDef3 = new AttributeDefinition("MyAttribute3");
            attDef3.Value = "MyValue3";
            attDef3.Alignment = TextAlignment.TopCenter;
            block.AttributeDefinitions.Add(attDef3);
            ins.Rotation = 30;

            // to update the insert attributes call the method Sync, this method will also call the method TransformAttributes
            ins.Sync();

            // the ins2 will have all three attributes
            Insert ins2 = new Insert(block, new Vector2(20,0));
            doc.AddEntity(ins2);

            doc.Save("Test.dxf");

            block.Name = "MyBlockRenamed";

            doc.Save("BlockRename.dxf");

            doc = Test("BlockRename.dxf");
        }
开发者ID:DaishiNakase,项目名称:WaveguideDesigner,代码行数:77,代码来源:Program.cs

示例10: Ellipse

        private static void Ellipse()
        {
           
            DxfDocument dxf = new DxfDocument();

            //Line line = new Line(new Vector3(0, 0, 0), new Vector3(2 * Math.Cos(Math.PI / 4),2 * Math.Cos(Math.PI / 4), 0));

            //dxf.AddEntity(line);

            //Line line2 = new Line(new Vector3(0, 0, 0), new Vector3(0, -2, 0));
            //dxf.AddEntity(line2);

            //Arc arc=new Arc(Vector3.Zero,2,45,270);
            //dxf.AddEntity(arc);

            Ellipse ellipse = new Ellipse(new Vector3(2,2,0), 5,3);
            ellipse.Rotation = 30;
            ellipse.Normal=new Vector3(1,1,1);
            ellipse.Thickness = 2;
            dxf.AddEntity(ellipse);

            Ellipse ellipseArc = new Ellipse(new Vector3(2, 10, 0), 5, 3);
            ellipseArc.StartAngle = -45;
            ellipseArc.EndAngle = 45;
            dxf.AddEntity(ellipseArc);

            dxf.Save("ellipse.dxf");
            dxf = new DxfDocument();
            dxf = DxfDocument.Load("ellipse.dxf");

            DxfDocument load = DxfDocument.Load("test ellipse.dxf");
            load.Save("saved test ellipse.dxf");

        }
开发者ID:DaishiNakase,项目名称:WaveguideDesigner,代码行数:34,代码来源:Program.cs

示例11: Face3d

        private static void Face3d()
        {

            DxfDocument dxf = new DxfDocument();

            Face3d face3d = new Face3d();
            face3d.FirstVertex = new Vector3(0, 0, 0);
            face3d.SecondVertex = new Vector3(1, 0, 0);
            face3d.ThirdVertex = new Vector3(1, 1, 0);
            face3d.FourthVertex = new Vector3(0, 1, 0);
            dxf.AddEntity(face3d);

            dxf.Save("face.dxf");
            dxf = DxfDocument.Load("face.dxf");
            dxf.Save("face return.dxf");

        }
开发者ID:DaishiNakase,项目名称:WaveguideDesigner,代码行数:17,代码来源:Program.cs

示例12: Solid

        private static void Solid()
        {

            DxfDocument dxf = new DxfDocument();

            Solid solid = new Solid();
            solid.FirstVertex=new Vector2(0,0);
            solid.SecondVertex  = new Vector2(1, 0);
            solid.ThirdVertex  = new Vector2(0, 1);
            solid.FourthVertex  = new Vector2(1, 1);
            dxf.AddEntity(solid);

            dxf.Save("solid.dxf");
            //dxf = DxfDocument.Load("solid.dxf");
            //dxf.Save("solid.dxf");

        }
开发者ID:DaishiNakase,项目名称:WaveguideDesigner,代码行数:17,代码来源:Program.cs

示例13: LwPolyline

        private static void LwPolyline()
        {
            DxfDocument dxf = new DxfDocument();

            LwPolyline poly = new LwPolyline();
            poly.Vertexes.Add(new LwPolylineVertex(0, 0));
            poly.Vertexes.Add(new LwPolylineVertex(10, 10));
            poly.Vertexes.Add(new LwPolylineVertex(20, 0));
            poly.Vertexes.Add(new LwPolylineVertex(30, 10));
            poly.SetConstantWidth(2);
            //poly.IsClosed = true;
            dxf.AddEntity(poly);

            dxf.Save("lwpolyline.dxf");

            dxf = DxfDocument.Load("lwpolyline.dxf");
        }
开发者ID:DaishiNakase,项目名称:WaveguideDesigner,代码行数:17,代码来源:Program.cs

示例14: Dxf2000

        private static void Dxf2000()
        {
            DxfDocument dxf = new DxfDocument();
            //line
            Line line = new Line(new Vector3(0, 0, 0), new Vector3(5, 5, 5));
            line.Layer = new Layer("line");
            line.Layer.Color.Index = 6;

            dxf.AddEntity(line);

            dxf.Save("test2000.dxf");
        }
开发者ID:DaishiNakase,项目名称:WaveguideDesigner,代码行数:12,代码来源:Program.cs

示例15: HatchTest4

        private static void HatchTest4()
        {
            DxfDocument dxf = new DxfDocument(DxfVersion.AutoCad2010);

            LwPolyline poly = new LwPolyline();
            poly.Vertexes.Add(new LwPolylineVertex(-10, -10));
            poly.Vertexes.Add(new LwPolylineVertex(10, -10));
            poly.Vertexes.Add(new LwPolylineVertex(10, 10));
            poly.Vertexes.Add(new LwPolylineVertex(-10, 10));
            poly.IsClosed = true;

            List<HatchBoundaryPath> boundary = new List<HatchBoundaryPath>() { new HatchBoundaryPath(new List<EntityObject>()) }; ;
            //List<HatchBoundaryPath> boundary = new List<HatchBoundaryPath> {new HatchBoundaryPath(new List<Entity> {poly})};
            HatchGradientPattern pattern = new HatchGradientPattern(AciColor.Yellow, AciColor.Blue, HatchGradientPatternType.Linear);
            pattern.Origin = new Vector2(120, -365);
            Hatch hatch = new Hatch(pattern, boundary, true);
            dxf.AddEntity(hatch);
            dxf.AddEntity(hatch.CreateBoundary(true));
            
            dxf.Save("HatchTest4.dxf");
            dxf = DxfDocument.Load("HatchTest4.dxf");
            dxf.Save("HatchTest4 copy.dxf");

        }
开发者ID:DaishiNakase,项目名称:WaveguideDesigner,代码行数:24,代码来源:Program.cs


注:本文中的netDxf.DxfDocument.Save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。