Example #1
0
        public MarkGeometryPoint(netDxf.Vector3 p)
            : base()
        {
            X = p.X;
            Y = p.Y;
            Z = p.Z;

            Update();
        }
Example #2
0
            public SvgLine xxx(netDxf.Vector3 startPoint, netDxf.Vector3 endPoint)
            {
                // Transform
                netDxf.Vector3 vecStart = startPoint - TopLeft;
                netDxf.Vector3 vecEnd   = endPoint - TopLeft;

                vecStart.Y *= -1;
                vecEnd.Y   *= -1;
                // End Transform


                // Margin
                vecStart.X += 10;
                vecEnd.X   += 10;

                vecStart.Y += 10;
                vecEnd.Y   += 10;

                return(new SvgLine(vecStart, vecEnd));
            }
Example #3
0
 public System.Xml.XmlElement CreateLine(netDxf.Vector3 p1, netDxf.Vector3 p2)
 {
     return(CreateLine((int)p1.X, (int)p1.Y, (int)p2.X, (int)p2.Y));
 }
Example #4
0
 public System.Xml.XmlNode AddLine(netDxf.Vector3 p1, netDxf.Vector3 p2)
 {
     System.Xml.XmlElement e = CreateLine(p1, p2);
     return(this.RootNode.AppendChild(e));
 }
Example #5
0
 public SvgLine(netDxf.Vector3 pStartPoint, netDxf.Vector3 pEndPoint)
 {
     this.StartPoint = pStartPoint;
     this.EndPoint   = pEndPoint;
 }
Example #6
0
        public static void Convert()
        {
            string file = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

            file = System.IO.Path.Combine(file, "..");
            file = System.IO.Path.Combine(file, "..");

            // file = System.IO.Path.Combine (file, "Zimmertyp_1_.dxf");
            // file = System.IO.Path.Combine(file, "drawing.dxf");

            file = System.IO.Path.Combine(file, "../DwgToSvgConverter/0001_GB01_OG14_0000_Aperture_dxf13.dxf");



            // D:\Stefan.Steiger\Documents\Visual Studio 2013\Projects\SvgConverter\SvgConverter\drawing.dxf

            file = System.IO.Path.GetFullPath(file);

            // file = @"D:\stefan.steiger\Downloads\7602_GB01_OG01_0000_Aperture.dxf";

#if true
            // InfoDump.DumpFile (file);

            // DxfDocument doc = Test(file, "output.log");
            // DxfDocument doc = Test(file);
            netDxf.DxfDocument doc = netDxf.DxfDocument.Load(file);


            //  foreach (string ln in doc.Layers.Names) System.Console.WriteLine (ln);


            System.Console.WriteLine("\t{0}; count: {1}", netDxf.Entities.EntityType.Line, doc.Lines.Count);

            // https://www.alt-soft.com/tutorial/svg_tutorial/file_struct.html

            // <?xml version="1.0" standalone="no"?>
            // <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
            // <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/PR-SVG-20010719/DTD/svg10.dtd">


            // https://books.google.de/books?id=YemMcMyMIgEC&pg=PA115&lpg=PA115&source=bl&ots=-Uryzwrz1F&sig=vGiu9s87qjMXai0mV0TcVNiXmE4&hl=en&sa=X&ei=kqISVffTK8vtUomlhJAF&redir_esc=y#v=onepage&q&f=false


            // xmlns:dc="http://purl.org/dc/elements/1.1/"
            // xmlns:cc="http://creativecommons.org/ns#"
            // xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
            // xmlns:svg="http://www.w3.org/2000/svg"

            cSVG SVG = new cSVG();

            netDxf.Vector3 TopLeft = new netDxf.Vector3()
            {
                X = 0, Y = 0, Z = 0
            };
            netDxf.Vector3 BottomRight = new netDxf.Vector3()
            {
                X = 0, Y = 0, Z = 0
            };



            /*
             * foreach(netDxf.Blocks.Block x in doc.Blocks)
             * {
             * }
             */

            foreach (netDxf.Entities.LwPolyline x in doc.LwPolylines)
            {
                if (System.StringComparer.OrdinalIgnoreCase.Equals("FM_OBJEKT_RAUM", x.Layer.Name))
                {
                    System.Console.WriteLine(x.Layer.Name);
                }
            }

            foreach (netDxf.Entities.EntityObject dim in doc.Dimensions)
            {
                System.Console.WriteLine(dim);
            }

            foreach (netDxf.Entities.Line l in doc.Lines)
            {
                TopLeft.X = System.Math.Min(TopLeft.X, l.StartPoint.X);
                TopLeft.X = System.Math.Min(TopLeft.X, l.EndPoint.X);

                TopLeft.Y = System.Math.Max(TopLeft.Y, l.StartPoint.Y);
                TopLeft.Y = System.Math.Max(TopLeft.Y, l.EndPoint.Y);

                BottomRight.X = System.Math.Max(BottomRight.X, l.StartPoint.X);
                BottomRight.X = System.Math.Max(BottomRight.X, l.EndPoint.X);

                BottomRight.Y = System.Math.Min(BottomRight.Y, l.StartPoint.Y);
                BottomRight.Y = System.Math.Min(BottomRight.Y, l.EndPoint.Y);
            }

            foreach (netDxf.Entities.Line l in doc.Lines)
            {
                long handle = System.Convert.ToInt64(l.Handle, 16);

                // System.Console.WriteLine( l.Handle );
                System.Console.WriteLine(handle);
                System.Console.WriteLine(l.StartPoint);
                System.Console.WriteLine(l.EndPoint);

                // Transform
                netDxf.Vector3 vecStart = l.StartPoint - TopLeft;
                netDxf.Vector3 vecEnd   = l.EndPoint - TopLeft;

                vecStart.Y *= -1;
                vecEnd.Y   *= -1;
                // End Transform


                // Margin
                vecStart.X += 10;
                vecEnd.X   += 10;

                vecStart.Y += 10;
                vecEnd.Y   += 10;
                // End Margin


                //SVG.AddLine(l.StartPoint, l.EndPoint);
                SVG.AddLine(vecStart, vecEnd);
            }             // Next l


            SVG.Save(ToSvgFile(file));
#endif

            // CreateSampleDocument();


            // https://www.alt-soft.com/tutorial/svg_tutorial/file_struct.html
            // http://commons.wikimedia.org/wiki/SVG_examples

            // https://code.google.com/p/opus/source/browse/#svn%2Fbranches%2Fsvg%2FOpus.Core%2FSVG
            // https://code.google.com/p/opus/source/browse/branches/svg/Opus.Core/SVG/SVG.cs

            // http://kooboo.codeplex.com/


            // http://www.java2s.com/Tutorial/CSharp/0540__XML/GetNamespaceURIPrefixandLocalName.htm
            // Console.WriteLine(doc.DocumentElement.NamespaceURI);
            // Console.WriteLine(doc.DocumentElement.Prefix);
            // Console.WriteLine(doc.DocumentElement.LocalName);
        }