Esempio n. 1
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            List <Mesh> Geo   = new List <Mesh>();
            List <Mesh> Stock = new List <Mesh>();
            string      debug = "";

            if (!DA.GetData("Workplane", ref Workplane))
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Workplane missing. Default used (WorldXY).");
            }

            if (!DA.GetData("MachineTool", ref Tool))
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "MachineTool missing. Default used.");
            }

            if (!DA.GetDataList("Geometry", Geo))
            {
                return;
            }
            if (!DA.GetDataList("Stock", Stock))
            {
                return;
            }

            if (Geo == null || Stock == null)
            {
                return;
            }

            debug += "Creating Area Clearance strategy...\n";
            Toolpath_AreaClearance ac = new Toolpath_AreaClearance(Geo, Stock, Tool);

            if (ac.Tool.StepOver > ac.Tool.Diameter)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Stepover exceeds tool diameter!");
            }

            ac.Workplane         = Workplane;
            ac.RestHorizontal    = 0.0;
            ac.RestVertical      = 0.0;
            ac.CheckForUndercuts = true;
            ac.Calculate();
            var paths = ac.GetPaths();

            DA.SetDataList("Paths", GH_tasPath.MakeGoo(paths));
            //DA.SetData("debug", debug);
        }
Esempio n. 2
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            if (!DA.GetData("Workplane", ref Workplane))
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Workplane missing. Default used (WorldXY).");
            }

            if (!DA.GetData("MachineTool", ref Tool))
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "MachineTool missing. Default used.");
            }

            _curves = new List <Curve>();

            if (DA.GetDataList("Curves", this._curves))
            {
                DA.GetData("Depth", ref this._depth);
                bool facing = false;
                DA.GetData("Face", ref facing);

                _debug = "";

                Toolpath_Pocket pocket = new Toolpath_Pocket(_curves, 0.01, facing);
                pocket.Tool      = Tool;
                pocket.Workplane = Workplane;
                pocket.Depth     = _depth;
                //pocket.MaxDepth = 30.0;

                pocket.Calculate();
                _paths = pocket.GetPaths();

                if (_paths != null)
                {
                    DA.SetDataList("Paths", GH_tasPath.MakeGoo(this._paths));
                }
            }
        }
Esempio n. 3
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Curve       boundary  = null;
            double      tolerance = 0.01;
            List <Brep> Surfaces  = new List <Brep>();

            if (!DA.GetData("Workplane", ref Workplane))
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Workplane missing. Default used (WorldXY).");
            }

            if (!DA.GetData("MachineTool", ref Tool))
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "MachineTool missing. Default used.");
            }

            DA.GetDataList("Surfaces", Surfaces);
            DA.GetData("Boundary", ref boundary);
            DA.GetData("ZigZag", ref ZigZag);
            DA.GetData("Tolerance", ref tolerance);

            int Switch = 0;

            DA.GetData("Direction", ref Switch);

            bool UV, StartEnd;

            UV       = (Switch & 1) == 1;
            StartEnd = (Switch & (1 << 1)) == 2;

            if (Surfaces.Count < 1)
            {
                return;
            }

            List <Path> Paths = new List <Path>();

            for (int i = 0; i < Surfaces.Count; ++i)
            {
                Toolpath_Flowline2 fl = new Toolpath_Flowline2(Surfaces[i], UV, boundary);
                fl.StartEnd  = StartEnd;
                fl.Tool      = Tool;
                fl.Tolerance = tolerance;
                fl.Workplane = Workplane;

                //fl.MaxDepth = 30.0;

                fl.Calculate();

                List <Path> paths = fl.GetPaths();
                if (ZigZag)
                {
                    Path zz_path = new Path();
                    for (int j = 0; j < paths.Count; ++j)
                    {
                        if (j.Modulus(2) > 0)
                        {
                            paths[j].Reverse();
                        }
                        zz_path.AddRange(paths[j]);
                    }
                    Paths.Add(zz_path);
                }
                else
                {
                    Paths.AddRange(paths);
                }
            }

            if (Paths != null)
            {
                DA.SetDataList("Paths", GH_tasPath.MakeGoo(Paths));
            }
            //DA.SetData("debug", "");
        }