Example #1
0
        private void openSTLToolStripMenuItem_Click(object sender, EventArgs e)
        {
            System.Console.WriteLine("opening STL");
            System.IO.StreamReader rdr = file_open();
            STLSurf s = null;

            if (rdr != null)
            {
                s = STL.Load(rdr);
            }

            if (s != null)
            {
                addGeom(s);
            }
            else
            {
                System.Console.WriteLine("loading STL file failed. no geometry created.");
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            GeoCollection g = new GeoCollection();

            System.Console.WriteLine("MonoCAM 2008 Mar 03");

            // load an STL file
            System.String FileName = "Demo1.stl";
            System.Console.WriteLine("opening STL file {0}", FileName);
            System.IO.StreamReader rdr = file_open(FileName);
            STLSurf s = null;

            if (rdr != null)
            {
                s = STL.Load(rdr);
            }
            if (s != null)
            {
                g.add(s);
            }
            else
            {
                System.Console.WriteLine("loading STL file failed. no geometry created.");
            }


            WriteGeoColl(g);

            // try a cam operation
            camtest.run(g);

            //WriteGeoColl(g);

            // test kd-tree
            // kdtree.spread(s.tris, cutdim.MINUS_X);



            //kdtree.PrintKdtree(root);

            /*
             * Cutter c = new Cutter(1.5, 0);
             * Point p = new Point(0, 0, 0);
             * List<Tri> tris = new List<Tri>();
             * kdtree.search_kdtree(tris, p, c, root);
             * System.Console.WriteLine("found {0} triangles!", tris.Count);
             * System.Console.WriteLine("ns={0}",kdtree.ns);
             * if (tris.Count <= 10)
             * {
             *  foreach (Tri t in tris)
             *  {
             *      Console.WriteLine("x: " + t.bb.minx + " / " + t.bb.maxx + " " + (p.x - c.R) + "to" + (p.x + c.R));
             *      Console.WriteLine("y: " + t.bb.miny + " / " + t.bb.maxy + " " + (p.y - c.R) + "to" + (p.y + c.R));
             *  }
             * }
             */

            // display the kd_tree

            //kdtree.PrintKdtree(root);

            // wait for user to end program
            System.Console.WriteLine("Press any key to end");
            System.Console.ReadKey();
        }