當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。