Esempio n. 1
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            GH_Program             program    = null;
            GH_ExtrusionAttributes attributes = null;
            bool isWorld  = false;
            int  segments = 0;

            if (!DA.GetData(0, ref program))
            {
                return;
            }
            if (!DA.GetData(1, ref attributes))
            {
                return;
            }
            if (!DA.GetData(2, ref isWorld))
            {
                return;
            }
            if (!DA.GetData(3, ref segments))
            {
                return;
            }

            if (_visualizer == null || _visualizer.Program != program.Value)
            {
                _visualizer = new ExtrusionVisualizer(program.Value, attributes.Value.BeadWidth, attributes.Value.LayerHeight, attributes.Value.ExtrusionZone.Distance, isWorld, segments);
            }

            _visualizer.Update();

            DA.SetDataList(0, _visualizer.ExtrudedContours);
        }
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            var locationsGH = new GH_Structure <GH_Plane>();
            var lengthsGH   = new GH_Structure <GH_Number>();

            GH_ExtrusionAttributes attributes = null;
            double factor = 0, suckBack = 0, loop = 0, startDistance = 0;

            if (!DA.GetDataTree(0, out locationsGH))
            {
                return;
            }
            if (!DA.GetDataTree(1, out lengthsGH))
            {
                return;
            }
            if (!DA.GetData(2, ref attributes))
            {
                return;
            }
            if (!DA.GetData(3, ref factor))
            {
                return;
            }
            if (!DA.GetData(4, ref suckBack))
            {
                return;
            }
            if (!DA.GetData(5, ref startDistance))
            {
                return;
            }
            if (!DA.GetData(6, ref loop))
            {
                return;
            }

            var locations = locationsGH.Branches.Select(b => b.Select(p => p.Value).ToList()).ToList();
            var lengths = lengthsGH.Branches.Select(b => b.Select(p => p.Value).ToList()).ToList();

            var toolpath = new ExternalExtrusionToolpath(locations, lengths, attributes.Value, factor, suckBack, startDistance, loop);

            DA.SetData(0, toolpath);
            DA.SetDataList(1, toolpath.SubPrograms);
        }
Esempio n. 3
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            var paths = new List <Curve>();
            GH_ExtrusionAttributes attributes = null;
            double factor = 0, suckBack = 0, loop = 0, startDistance = 0;

            if (!DA.GetDataList(0, paths))
            {
                return;
            }
            if (!DA.GetData(1, ref attributes))
            {
                return;
            }
            if (!DA.GetData(2, ref factor))
            {
                return;
            }
            if (!DA.GetData(3, ref suckBack))
            {
                return;
            }
            if (!DA.GetData(4, ref startDistance))
            {
                return;
            }
            if (!DA.GetData(5, ref loop))
            {
                return;
            }

            var polylines = paths
                            .Where(p => p.IsPolyline())
                            .Select(p => { p.TryGetPolyline(out Polyline pl); return(pl); })
                            .ToList();

            var toolpath = new ExternalExtrusionToolpath(polylines, attributes.Value, factor, suckBack, startDistance, loop);

            DA.SetData(0, toolpath);
            DA.SetDataList(1, toolpath.SubPrograms);
        }