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


C# netDxf.DxfDocument类代码示例

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


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

示例1: ReadDrawing

        public Drawing ReadDrawing(string dxfFileName, Canvas canvas)
        {
            doc = new DxfDocument();
            doc.Load(dxfFileName);

            drawing = new Drawing(canvas);

            ReadLines();
            ReadPolylines();
            ReadArcs();
            ReadCircles();
            ReadInserts();

            drawing.Recalculate();
            return drawing;
        }
开发者ID:wcatykid,项目名称:GeoShader,代码行数:16,代码来源:DXFDrawingDeserializer.cs

示例2: Add

        private void Add(DxfDocument dxf, Core2D.Project.XDocument document)
        {
            foreach (var page in document.Pages)
            {
                var layout = new Layout(page.Name)
                {
                    PlotSettings = new PlotSettings()
                    {
                        PaperSizeName = $"{page.Template.Name}_({page.Template.Width}_x_{page.Template.Height}_MM)",
                        LeftMargin = 0.0,
                        BottomMargin = 0.0,
                        RightMargin = 0.0,
                        TopMargin = 0.0,
                        PaperSize = new Vector2(page.Template.Width, page.Template.Height),
                        Origin = new Vector2(0.0, 0.0),
                        PaperUnits = PlotPaperUnits.Milimeters,
                        PaperRotation = PlotRotation.NoRotation
                    }
                };
                dxf.Layouts.Add(layout);
                dxf.ActiveLayout = layout.Name;

                Add(dxf, page);
            }
        }
开发者ID:Core2D,项目名称:Core2D,代码行数:25,代码来源:DxfRenderer.IProjectExporter.cs

示例3: Draw

        /// <summary>
        /// 绘制风扇
        /// </summary>
        /// <param name="dxf"></param>
        /// <param name="startPoint">风扇起点,如果为横置,由左向右;如果为竖置,由下到上</param>
        /// <param name="endPoint">风扇终点,如果为横置,由左向右;如果为竖置,由下到上</param>
        /// <param name="pointerLocation">箭头位置,默认=0为无,=1代表箭头在中间,=2代表箭头在底部</param>
        public static void Draw(DxfDocument dxf, Vector3f startPoint, Vector3f endPoint,int pointerLocation=0)
        {
            Layer layer = new Layer("line");
            Line line = new Line(startPoint, endPoint);
            line.Layer = layer;
            dxf.AddEntity(line);

            //如果为横置
            if (startPoint.Y == endPoint.Y)
            {
                float segment = (endPoint.X - startPoint.X) / 4;
                Slash.Draw(dxf, new Location(startPoint.X + segment, startPoint.Y, startPoint.Z));
                Slash.Draw(dxf, new Location(startPoint.X + 2 * segment, startPoint.Y, startPoint.Z));
                Slash.Draw(dxf, new Location(startPoint.X + 3 * segment, startPoint.Y, startPoint.Z));
            }
            //如果为竖置
            else if (startPoint.X == endPoint.X)
            {
                float segment = (endPoint.Y - startPoint.Y) / 5;
                Slash.Draw(dxf, new Location(startPoint.X, startPoint.Y + segment, startPoint.Z));
                Slash.Draw(dxf, new Location(startPoint.X, startPoint.Y + 2 * segment, startPoint.Z));
                Slash.Draw(dxf, new Location(startPoint.X, startPoint.Y + 3 * segment, startPoint.Z));
                Slash.Draw(dxf, new Location(startPoint.X, startPoint.Y + 4 * segment, startPoint.Z));
                if (pointerLocation == 1)
                {
                    LinePointer.Draw(dxf,new Location(startPoint.X,(startPoint.Y+endPoint.Y)/2,startPoint.Z));
                }
                else if(pointerLocation==2)
                {
                    LinePointer.Draw(dxf, new Location(startPoint.X, startPoint.Y, startPoint.Z));
                }
            }
        }
开发者ID:Spritutu,项目名称:ntxx,代码行数:40,代码来源:Fan.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: Draw

        public static void Draw(DxfDocument dxf, Location location)
        {
            Vector3f v1 = new Vector3f(location.X - 2.0f, location.Y - 4.0f, location.Z);
            Vector3f v2 = new Vector3f(location.X + 2.0f, location.Y + 4.0f, location.Z);
            Layer layer = new Layer("line");

            Line line12 = new Line(v1, v2);
            line12.Layer = layer;
            dxf.AddEntity(line12);
        }
开发者ID:Spritutu,项目名称:ntxx,代码行数:10,代码来源:Slash.cs

示例6: Draw

        /// <summary>
        /// 风向绘制
        /// </summary>
        /// <param name="dxf"></param>
        /// <param name="location"></param>
        /// <param name="isRight"></param>
        public static void Draw(DxfDocument dxf, Location location, bool isRight)
        {
            float factor = 0.5f;
            Vector3f v1 = new Vector3f();
            Vector3f v2 = new Vector3f();
            Vector3f v3 = new Vector3f();
            Vector3f v4 = new Vector3f();
            Vector3f v5 = new Vector3f();
            Vector3f v6 = new Vector3f();
            Vector3f v7 = new Vector3f();
            if (isRight)
            {
                v1 = new Vector3f(10*factor + location.X, location.Y, location.Z);
                v2 = new Vector3f(location.X, location.Y + 10 * factor, location.Z);
                v3 = new Vector3f(location.X + 10 * factor, location.Y + 10 * factor, location.Z);
                v4 = new Vector3f(location.X + 20 * factor, location.Y + 15 * factor, location.Z);
                v5 = new Vector3f(location.X, location.Y + 20 * factor, location.Z);
                v6 = new Vector3f(location.X + 10 * factor, location.Y + 20 * factor, location.Z);
                v7 = new Vector3f(location.X + 10 * factor, location.Y + 30 * factor, location.Z);
            }
            else
            {
                v1 = new Vector3f(10 * factor + location.X, location.Y, location.Z);
                v2 = new Vector3f(location.X + 20 * factor, location.Y + 10 * factor, location.Z);
                v3 = new Vector3f(location.X + 10 * factor, location.Y + 10 * factor, location.Z);
                v4 = new Vector3f(location.X, location.Y + 15 * factor, location.Z);
                v5 = new Vector3f(location.X + 20 * factor, location.Y + 20 * factor, location.Z);
                v6 = new Vector3f(location.X + 10 * factor, location.Y + 20 * factor, location.Z);
                v7 = new Vector3f(location.X + 10 * factor, location.Y + 30 * factor, location.Z);
            }
            Layer layer = new Layer("line");
            Line line23 = new Line(v2, v3);
            line23.Layer = layer;
            dxf.AddEntity(line23);

            Line line56 = new Line(v5, v6);
            line56.Layer = layer;
            dxf.AddEntity(line56);

            Line line14 = new Line(v1, v4);
            line14.Layer = layer;
            dxf.AddEntity(line14);

            Line line74 = new Line(v7, v4);
            line74.Layer = layer;
            dxf.AddEntity(line74);

            Line line25 = new Line(v2, v5);
            line25.Layer = layer;
            dxf.AddEntity(line25);

            Line line71 = new Line(v7, v1);
            line71.Layer = layer;
            dxf.AddEntity(line71);
        }
开发者ID:Spritutu,项目名称:ntxx,代码行数:61,代码来源:Wind.cs

示例7: TopViewConfigure

 public TopViewConfigure(List<PictureBoxInfo> imageNameList, DxfDocument dxf, string[] text, float height, float width, float outer_mid_space, float outer_in_space, float barHeight, float barWidth)
 {
     this.imageNameList = imageNameList;
     this.dxf = dxf;
     this.text = text;
     this.height = height;
     this.width = width;
     this.outer_mid_space = outer_mid_space;
     this.outer_in_space = outer_in_space;
     this.barHeight = barHeight;
     this.barWidth = barWidth;
 }
开发者ID:Spritutu,项目名称:ntxx,代码行数:12,代码来源:TopViewConfigure.cs

示例8: Draw

        public static void Draw(DxfDocument dxf, Location location,List<string> configurations)
        {
            Vector3f confStrVector3f = new Vector3f(location.X + 5.0f, location.Y - 5.0f, location.Z);
            TextStyle style = new TextStyle("True type font", "Arial.ttf");
            Text text1 = new Text("CONFIGURATION:                   NOTE:  Assembly drawing for overall dimesions,  actual door size and handle position may vary",
                confStrVector3f, 2.0f, style);
            Layer layer = new Layer("text");
            text1.Layer = layer;
            //text1.Layer.Color.Index = 8;
            text1.Alignment = TextAlignment.TopLeft;
            dxf.AddEntity(text1);

            for (int i = 0; i < configurations.Count(); i++)
            {
                Vector3f confVector3f = new Vector3f(location.X+10.0f, location.Y - 5.0f * (i + 2), location.Z);
                Text text = new Text(configurations[i], confVector3f, 2.0f, style);
                text.Layer = layer;
                //text.Layer.Color.Index = 8;
                text.Alignment = TextAlignment.TopLeft;
                dxf.AddEntity(text);
            }
        }
开发者ID:Spritutu,项目名称:ntxx,代码行数:22,代码来源:Configuration.cs

示例9: DrawEllipseInternal

        private void DrawEllipseInternal(DxfDocument doc, Layer layer, bool isFilled, bool isStroked, Test2d.BaseStyle style, ref Test2d.Rect2 rect)
        {
            var dxfEllipse = CreateEllipse(rect.X, rect.Y, rect.Width, rect.Height);

            if (isFilled)
            {
                var fill = GetColor(style.Fill);
                var fillTransparency = GetTransparency(style.Fill);

                // TODO: The netDxf does not create hatch for Ellipse with end angle equal to 360.
                var bounds =
                    new List<HatchBoundaryPath>
                    {
                        new HatchBoundaryPath(
                            new List<EntityObject>
                            {
                                (Ellipse)dxfEllipse.Clone()
                            })
                    };

                var hatch = new Hatch(HatchPattern.Solid, bounds, false);
                hatch.Layer = layer;
                hatch.Color = fill;
                hatch.Transparency.Value = fillTransparency;

                doc.AddEntity(hatch);
            }

            if (isStroked)
            {
                var stroke = GetColor(style.Stroke);
                var strokeTansparency = GetTransparency(style.Stroke);
                var lineweight = ThicknessToLineweight(style.Thickness);

                dxfEllipse.Layer = layer;
                dxfEllipse.Color = stroke;
                dxfEllipse.Transparency.Value = strokeTansparency;
                dxfEllipse.Lineweight.Value = lineweight;

                doc.AddEntity(dxfEllipse);
            }
        }
开发者ID:gitter-badger,项目名称:Test2d,代码行数:42,代码来源:DxfRenderer.cs

示例10: Add

        /// <summary>
        /// 
        /// </summary>
        /// <param name="doc"></param>
        /// <param name="container"></param>
        private void Add(DxfDocument doc, Test2d.Container container)
        {
            _pageWidth = container.Width;
            _pageHeight = container.Height;

            if (container.Template != null)
            {
                Draw(doc, container.Template, container.Properties, null);
            }

            Draw(doc, container, container.Properties, null);
        }
开发者ID:gitter-badger,项目名称:Test2d,代码行数:17,代码来源:DxfRenderer.cs

示例11: Save

 /// <summary>
 /// 
 /// </summary>
 /// <param name="path"></param>
 /// <param name="container"></param>
 public void Save(string path, Test2d.Container container)
 {
     _outputPath = System.IO.Path.GetDirectoryName(path);
     var doc = new DxfDocument(DxfVersion.AutoCad2010);
     Add(doc, container);
     doc.Save(path);
     ClearCache(isZooming: false);
 }
开发者ID:gitter-badger,项目名称:Test2d,代码行数:13,代码来源:DxfRenderer.cs

示例12: DrawRectangleInternal

        private void DrawRectangleInternal(DxfDocument doc, Layer layer, bool isFilled, bool isStroked, Test2d.BaseStyle style, ref Test2d.Rect2 rect)
        {
            double x = rect.X;
            double y = rect.Y;
            double w = rect.Width;
            double h = rect.Height;

            var dxfLine1 = CreateLine(x, y, x + w, y);
            var dxfLine2 = CreateLine(x + w, y, x + w, y + h);
            var dxfLine3 = CreateLine(x + w, y + h, x, y + h);
            var dxfLine4 = CreateLine(x, y + h, x, y);

            if (isFilled)
            {
                var fill = GetColor(style.Fill);
                var fillTransparency = GetTransparency(style.Fill);

                var bounds =
                    new List<HatchBoundaryPath>
                    {
                        new HatchBoundaryPath(
                            new List<EntityObject>
                            {
                                (Line)dxfLine1.Clone(),
                                (Line)dxfLine2.Clone(),
                                (Line)dxfLine3.Clone(),
                                (Line)dxfLine4.Clone()
                            })
                    };

                var hatch = new Hatch(HatchPattern.Solid, bounds, false);
                hatch.Layer = layer;
                hatch.Color = fill;
                hatch.Transparency.Value = fillTransparency;

                doc.AddEntity(hatch);
            }

            if (isStroked)
            {
                var stroke = GetColor(style.Stroke);
                var strokeTansparency = GetTransparency(style.Stroke);
                var lineweight = ThicknessToLineweight(style.Thickness);

                dxfLine1.Layer = layer;
                dxfLine1.Color = stroke;
                dxfLine1.Transparency.Value = strokeTansparency;
                dxfLine1.Lineweight.Value = lineweight;

                dxfLine2.Layer = layer;
                dxfLine2.Color = stroke;
                dxfLine2.Transparency.Value = strokeTansparency;
                dxfLine2.Lineweight.Value = lineweight;

                dxfLine3.Layer = layer;
                dxfLine3.Color = stroke;
                dxfLine3.Transparency.Value = strokeTansparency;
                dxfLine3.Lineweight.Value = lineweight;

                dxfLine4.Layer = layer;
                dxfLine4.Color = stroke;
                dxfLine4.Transparency.Value = strokeTansparency;
                dxfLine4.Lineweight.Value = lineweight;

                doc.AddEntity(dxfLine1);
                doc.AddEntity(dxfLine2);
                doc.AddEntity(dxfLine3);
                doc.AddEntity(dxfLine4);
            }
        }
开发者ID:gitter-badger,项目名称:Test2d,代码行数:70,代码来源:DxfRenderer.cs

示例13: doDXF

        static void doDXF(List<Polyline3dVertex> vertexes, double[] x)
        {
            // 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);

            var 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);
        }
开发者ID:ans10528,项目名称:MissionPlanner-MissionPlanner1.3.34,代码行数:19,代码来源:MagCalib.cs

示例14: writeRepresentDoorBarRectangle

        //画表示门闩的小矩形
        public static void writeRepresentDoorBarRectangle(DxfDocument doc, Location location, string[] text, float height, float width, float outer_mid_space, float outer_in_space, float barHeight, float barWidth)
        {
            Layer representDoorBarRectangleLayer = new Layer("RepresentDoorBarRectangle");
            Line bottomLine = new Line(new Vector3f(location.X, location.Y, location.Z), new Vector3f(location.X + barWidth, location.Y, location.Z));
            bottomLine.Layer = representDoorBarRectangleLayer;
            Line leftLine = new Line(new Vector3f(location.X, location.Y, location.Z), new Vector3f(location.X, location.Y + barHeight, location.Z));
            leftLine.Layer = representDoorBarRectangleLayer;
            Line topLine = new Line(new Vector3f(location.X, location.Y + barHeight, location.Z), new Vector3f(location.X + barWidth, location.Y + barHeight, location.Z));
            topLine.Layer = representDoorBarRectangleLayer;
            Line rightLine = new Line(new Vector3f(location.X + barWidth, location.Y + barHeight, location.Z), new Vector3f(location.X + barWidth, location.Y, location.Z));
            rightLine.Layer = representDoorBarRectangleLayer;

               //内部折线
            Line upLine = new Line(new Vector3f(location.X + barWidth / 2-(outer_in_space-outer_mid_space)/2, location.Y + barHeight, location.Z), new Vector3f(location.X + barWidth / 2-(outer_in_space-outer_mid_space)/2, location.Y + barHeight / 2, location.Z));
            upLine.Layer = representDoorBarRectangleLayer;
            Line midLine = new Line(new Vector3f(location.X + barWidth / 2 - (outer_in_space - outer_mid_space) / 2, location.Y + barHeight / 2, location.Z), new Vector3f(location.X + barWidth / 2 + (outer_in_space - outer_mid_space) / 2,location.Y+barHeight/2,location.Z));
            midLine.Layer = representDoorBarRectangleLayer;
            Line downLine = new Line(new Vector3f(location.X + barWidth / 2 + (outer_in_space - outer_mid_space) / 2, location.Y + barHeight / 2, location.Z), new Vector3f(location.X+barWidth/2+(outer_in_space-outer_mid_space)/2, location.Y, location.Z));
            downLine.Layer = representDoorBarRectangleLayer;
            doc.AddEntity(bottomLine);
            doc.AddEntity(leftLine);
            doc.AddEntity(topLine);
            doc.AddEntity(rightLine);
            doc.AddEntity(upLine);
            doc.AddEntity(midLine);
            doc.AddEntity(downLine);
        }
开发者ID:Spritutu,项目名称:ntxx,代码行数:28,代码来源:DoorRectangle.cs

示例15: Draw

        /// <summary>
        /// 绘制左下角区域的Section块
        /// </summary>
        /// <param name="dxf"></param>
        /// <param name="location"></param>
        /// <param name="configurations"></param>
        public static void Draw(DxfDocument dxf, Location location,SectionEntity sectionEntity)
        {
            float factor=0.6f;
            Vector3f v1 = new Vector3f(location.X, location.Y + 40.0f*factor, location.Z);
            Vector3f v2 = new Vector3f(location.X + 50.0f * factor, location.Y + 40.0f * factor, location.Z);
            Vector3f v3 = new Vector3f(location.X + 90.0f * factor, location.Y + 40.0f * factor, location.Z);
            Vector3f v4 = new Vector3f(location.X + 140.0f * factor, location.Y + 40.0f * factor, location.Z);

            Vector3f v5 = new Vector3f(location.X, location.Y + 50.0f * factor, location.Z);
            Vector3f v6 = new Vector3f(location.X + 140.0f * factor, location.Y + 50.0f * factor, location.Z);

            Vector3f v7 = new Vector3f(location.X, location.Y + 60.0f * factor, location.Z);
            Vector3f v8 = new Vector3f(location.X + 140.0f * factor, location.Y + 60.0f * factor, location.Z);

            Vector3f v9 = new Vector3f(location.X, location.Y + 70.0f * factor, location.Z);
            Vector3f v10 = new Vector3f(location.X + 50.0f * factor, location.Y + 70.0f * factor, location.Z);
            Vector3f v11 = new Vector3f(location.X + 90.0f * factor, location.Y + 70.0f * factor, location.Z);
            Vector3f v12 = new Vector3f(location.X + 140.0f * factor, location.Y + 70.0f * factor, location.Z);

            Layer layer = new Layer("line");

            //横向四道
            Line line14 = new Line(v1, v4);
            line14.Layer = layer;
            dxf.AddEntity(line14);

            Line line56 = new Line(v5, v6);
            line56.Layer = layer;
            dxf.AddEntity(line56);

            Line line78 = new Line(v7, v8);
            line78.Layer = layer;
            dxf.AddEntity(line78);

            Line line912 = new Line(v9, v12);
            line912.Layer = layer;
            dxf.AddEntity(line912);

            //纵向四道
            Line line91 = new Line(v9, v1);
            line91.Layer = layer;
            dxf.AddEntity(line91);

            Line line210 = new Line(v2, v10);
            line210.Layer = layer;
            dxf.AddEntity(line210);

            Line line311 = new Line(v3, v11);
            line311.Layer = layer;
            dxf.AddEntity(line311);

            Line line412 = new Line(v4, v12);
            line412.Layer = layer;
            dxf.AddEntity(line412);

            TextStyle style = new TextStyle("True type font", "Arial.ttf");
            Vector3f vt1 = new Vector3f(v1.X+1.0f, v1.Y+2.5f, v1.Z);
            Text t1 = new Text("COIL", vt1, 2.0f, style);
            t1.Layer = layer;
            t1.Alignment = TextAlignment.TopLeft;
            dxf.AddEntity(t1);

            Vector3f vt2 = new Vector3f(v2.X + 1.0f, v2.Y + 2.5f, v2.Z);
            Text t2 = new Text("CLF", vt2, 2.0f, style);
            t2.Layer = layer;
            t2.Alignment = TextAlignment.TopLeft;
            dxf.AddEntity(t2);

            Vector3f vt3 = new Vector3f(v3.X + 1.0f, v3.Y + 2.5f, v3.Z);
            Text t3 = new Text(sectionEntity.CoolValue, vt3, 2.0f, style);
            t3.Layer = layer;
            t3.Alignment = TextAlignment.TopLeft;
            dxf.AddEntity(t3);

            Vector3f vt4 = new Vector3f(v5.X + 1.0f, v5.Y + 2.5f, v5.Z);
            Text t4 = new Text("FILTER", vt4, 2.0f, style);
            t4.Layer = layer;
            t4.Alignment = TextAlignment.TopLeft;
            dxf.AddEntity(t4);

            Vector3f vt5 = new Vector3f(v2.X + 1.0f, v5.Y + 2.5f, v5.Z);
            Text t5 = new Text("FTA", vt5, 2.0f, style);
            t5.Layer = layer;
            t5.Alignment = TextAlignment.TopLeft;
            dxf.AddEntity(t5);

            Vector3f vt6 = new Vector3f(v3.X + 1.0f, v5.Y + 2.5f, v5.Z);
            Text t6 = new Text(sectionEntity.FilterValue, vt6, 2.0f, style);
            t6.Layer = layer;
            t6.Alignment = TextAlignment.TopLeft;
            dxf.AddEntity(t6);

            Vector3f vt7 = new Vector3f(v7.X + 1.0f, v7.Y + 2.5f, v7.Z);
            Text t7 = new Text("SECTION", vt7, 2.0f, style);
//.........这里部分代码省略.........
开发者ID:Spritutu,项目名称:ntxx,代码行数:101,代码来源:Section.cs


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