Пример #1
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            VoxelImage VoxelImage    = null;
            Point3d    Point         = new Point3d();
            int        VectorType    = 0;
            double     SegmentLength = 0.0001;
            int        Iterations    = 25000;

            if (!DA.GetData(0, ref VoxelImage))
            {
                return;
            }
            DA.GetData(1, ref Point);
            DA.GetData(2, ref VectorType);
            DA.GetData(3, ref SegmentLength);
            DA.GetData(4, ref Iterations);

            List <V2GPoint> Points      = V2GVoxel.VoxelCurvePoints(VoxelImage, V2GH.V2GPoint(Point), SegmentLength, Iterations, VectorType);
            List <Point3d>  RhinoPoints = new List <Point3d>();

            foreach (V2GPoint p in Points)
            {
                RhinoPoints.Add(new Point3d(p.X, p.Y, p.Z));
            }
            Polyline Polyline = new Polyline(RhinoPoints);

            DA.SetData(0, Polyline);
        }
Пример #2
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            VoxelImage VoxelImage = null;
            Point3d    Point      = new Point3d();

            DA.GetData(0, ref VoxelImage);
            DA.GetData(1, ref Point);

            V2GVoxelPoint VoxelPoint = new V2GVoxelPoint(VoxelImage, V2GH.V2GPoint(Point));

            DA.SetData(0, VoxelPoint);
            DA.SetData(1, V2GH.Point3d(VoxelPoint.Position));
            DA.SetData(2, VoxelPoint.FieldValue);
            DA.SetData(3, V2GH.Vector3d(VoxelPoint.ContourVector));
            DA.SetData(4, V2GH.Vector3d(VoxelPoint.GradientVector));
            DA.SetData(5, V2GH.Vector3d(VoxelPoint.ContourVector3d));
        }
Пример #3
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            List <V2GPrintPolyline>         printPolylines = new List <V2GPrintPolyline>();
            List <List <V2GPrintPosition> > Points         = new List <List <V2GPrintPosition> >();

            List <Polyline> RhinoPolyline  = new List <Polyline>();
            List <Point3d>  RhinoPositions = new List <Point3d>();
            List <double>   MaterialAmount = new List <double>();
            List <double>   Speed          = new List <double>();
            List <int>      Head           = new List <int>();
            List <double>   MixPercentage  = new List <double>();

            if (!DA.GetDataList(0, printPolylines))
            {
                return;
            }

            foreach (V2GPrintPolyline ppl in printPolylines)
            {
                Points.Add(ppl.PrintPositions);
                List <Point3d> RhinoPoints = new List <Point3d>();
                foreach (V2GPrintPosition PrintPosition in ppl.PrintPositions)
                {
                    Speed.Add(PrintPosition.Speed);
                    MaterialAmount.Add(PrintPosition.MaterialAmount);
                    Head.Add(PrintPosition.Head);
                    MixPercentage.Add(PrintPosition.MixPercentage);
                    RhinoPoints.Add(V2GH.Point3d(PrintPosition.Position));
                }
                RhinoPolyline.Add(new Rhino.Geometry.Polyline(RhinoPoints));
                // TODO: Create a GH_Tree with points
                RhinoPositions.AddRange(RhinoPoints);
            }

            DA.SetDataList(0, RhinoPolyline);
            DA.SetDataList(1, RhinoPositions);
            DA.SetDataList(2, MaterialAmount);
            DA.SetDataList(3, Speed);
            DA.SetDataList(4, Head);
            DA.SetDataList(5, MixPercentage);
        }
Пример #4
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Point3d StartPoint          = new Point3d();
            Point3d EndPoint            = new Point3d();
            bool    ShouldHeatUpOnStart = false;
            bool    ShouldCoolDownOnEnd = false;
            double  ZOffset             = 0.2;
            double  BedTemperature      = 60.0;
            double  T0Temperature       = 200.0;
            double  T1Temperature       = 200.0;
            bool    IsVerbose           = false;

            DA.GetData(0, ref StartPoint);
            DA.GetData(1, ref EndPoint);
            DA.GetData(2, ref ShouldHeatUpOnStart);
            DA.GetData(3, ref ShouldCoolDownOnEnd);
            DA.GetData(4, ref ZOffset);
            DA.GetData(5, ref BedTemperature);
            DA.GetData(6, ref T0Temperature);
            DA.GetData(7, ref T1Temperature);
            DA.GetData(8, ref IsVerbose);

            V2GSettings settings = new V2GSettings();

            settings.StartPoint          = new V2GPrintPosition(V2GH.V2GPoint(StartPoint));
            settings.EndPoint            = new V2GPrintPosition(V2GH.V2GPoint(EndPoint));
            settings.ShouldHeatUpOnStart = ShouldHeatUpOnStart;
            settings.ShouldCoolDownOnEnd = ShouldCoolDownOnEnd;
            settings.ZOffset             = ZOffset;
            settings.BedTemperature      = BedTemperature;
            settings.T0Temperature       = T0Temperature;
            settings.T1Temperature       = T1Temperature;
            settings.IsVerbose           = IsVerbose;

            DA.SetData(0, settings);
        }
Пример #5
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            List <V2GPrintPosition> PrintPoints    = new List <V2GPrintPosition>();
            List <Point3d>          InputPoints    = new List <Point3d>();
            List <double>           MaterialAmount = new List <double>();
            List <double>           Speed          = new List <double>();
            List <int>    Toolhead      = new List <int>();
            List <double> MixPercentage = new List <double>();

            if (!DA.GetDataList(0, InputPoints))
            {
                return;
            }
            if (!DA.GetDataList(1, MaterialAmount))
            {
                return;
            }
            if (!DA.GetDataList(2, Speed))
            {
                return;
            }
            if (!DA.GetDataList(3, Toolhead))
            {
                return;
            }
            if (!DA.GetDataList(4, MixPercentage))
            {
                return;
            }

            int    idx             = 0;
            double _Speed          = Speed[0];
            double _MaterialAmount = MaterialAmount[0];
            int    _Head           = Toolhead[0];
            double _MixPercentage  = MixPercentage[0];

            foreach (Point3d p in InputPoints)
            {
                if (Speed.Count - 1 >= idx)
                {
                    _Speed = Speed[idx];
                }
                if (MaterialAmount.Count - 1 >= idx)
                {
                    _MaterialAmount = MaterialAmount[idx];
                }
                if (Toolhead.Count - 1 >= idx)
                {
                    _Head = Toolhead[idx];
                }
                if (MixPercentage.Count - 1 >= idx)
                {
                    _MixPercentage = MixPercentage[idx];
                }

                V2GPrintPosition position = new V2GPrintPosition(V2GH.V2GPoint(p), _Speed, _MaterialAmount, _Head, _MixPercentage);
                PrintPoints.Add(new V2GPrintPosition(p.X, p.Y, p.Z));
                idx++;
            }

            DA.SetDataList(0, PrintPoints);
        }