protected override void SolveInstance(IGH_DataAccess DA)
        {
            // --- Input

            var mesh = default(Mesh);
            var countA = default(int);
            var countZ = default(int);
            var thickness = default(double);
            var plane = default(Plane);
            var radius = default(double);
            var deeper = default(double);
            var project = default(bool);
            var projectDistance = default(double);

            DA.GetData(0, ref mesh);
            DA.GetData(1, ref countA);
            DA.GetData(2, ref countZ);
            DA.GetData(3, ref thickness);
            DA.GetData(4, ref plane);
            DA.GetData(5, ref radius);
            DA.GetData(6, ref deeper);
            DA.GetData(7, ref project);
            DA.GetData(8, ref projectDistance);


            // --- Execute

            var unit = DocumentTolerance();

            var result = Radial.Create(mesh, plane, thickness, deeper, radius, countA, countZ, unit, project, projectDistance);


            // --- Output

            DA.SetEnum2D(0, result.CurvesA);
            DA.SetEnum2D(1, result.CurvesZ);
            DA.SetEnum1D(2, result.PlanesA);
            DA.SetEnum1D(3, result.PlanesZ);
        }
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // --- Input

            var mesh            = default(Mesh);
            var countA          = default(int);
            var countZ          = default(int);
            var thickness       = default(double);
            var plane           = default(Plane);
            var radius          = default(double);
            var deeper          = default(double);
            var project         = default(bool);
            var projectDistance = default(double);

            DA.GetData(0, ref mesh);
            DA.GetData(1, ref countA);
            DA.GetData(2, ref countZ);
            DA.GetData(3, ref thickness);
            DA.GetData(4, ref plane);
            DA.GetData(5, ref radius);
            DA.GetData(6, ref deeper);
            DA.GetData(7, ref project);
            DA.GetData(8, ref projectDistance);


            // --- Execute

            var unit = DocumentTolerance();

            var result = Radial.Create(mesh, plane, thickness, deeper, radius, countA, countZ, unit, project, projectDistance);


            // --- Output

            DA.SetEnum2D(0, result.CurvesA);
            DA.SetEnum2D(1, result.CurvesZ);
            DA.SetEnum1D(2, result.PlanesA);
            DA.SetEnum1D(3, result.PlanesZ);
        }
Exemple #3
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // --- Input

            var mesh = default(Mesh);
            var thickness = default(double);
            var plane = default(Plane);
            var border = default(double);

            DA.GetData(0, ref mesh);
            DA.GetData(1, ref thickness);
            DA.GetData(2, ref plane);
            DA.GetData(3, ref border);


            // --- Check

            if (thickness <= 0)
                throw new Exception(@"Thickness must be a positive value!");

            if (border < 0)
                throw new Exception(@"Border must be a positive value!");

            if (!mesh.IsValid)
                throw new Exception(@"Mesh is not valid!");

            if (!mesh.IsClosed)
                throw new Exception(@"Mesh is not closed!");


            // --- Execute

            var unit = DocumentTolerance();

            var box = mesh.Box(plane);

            var corners = box.GetCorners();

            var origin = corners[0];
            var unitX = box.Plane.XAxis;
            var unitY = box.Plane.YAxis;
            var unitZ = box.Plane.ZAxis;

            var layerCount = (int)Math.Round(box.Z.Length / thickness);

            var olines = new List<List<IntPoint>>[layerCount];
            var offset = new List<List<IntPoint>>[layerCount];
            var ilines = new List<List<IntPoint>>[layerCount];
            var planes = new Plane[layerCount];

            for (int i = 0; i < layerCount; i++)
            {
                var z = (i + 0.5) * thickness;

                var sectionOrigin = origin + z * unitZ;
                var sectionPlane = new Plane(sectionOrigin, unitZ);

                planes[i] = sectionPlane;

                olines[i] = mesh.Section(sectionPlane, unit);
                offset[i] = Offset(olines[i], -border / unit);
            }

            if (border > 0)
            {
                ilines[0] = new List<List<IntPoint>>();

                for (int i = 1; i < layerCount - 1; i++)
                    ilines[i] = Intersect(Intersect(offset[i], offset[i - 1]), offset[i + 1]);

                ilines[layerCount - 1] = new List<List<IntPoint>>();
            }


            // --- Output

            DA.SetEnum2D(0, olines.Select((o, i) => o.ToCurves(planes[i], unit)));
            if (border > 0) DA.SetEnum2D(1, ilines.Select((o, i) => o.ToCurves(planes[i], unit)));
            DA.SetEnum1D(2, planes);
        }
Exemple #4
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // --- Input

            var mesh      = default(Mesh);
            var thickness = default(double);
            var plane     = default(Plane);
            var border    = default(double);

            DA.GetData(0, ref mesh);
            DA.GetData(1, ref thickness);
            DA.GetData(2, ref plane);
            DA.GetData(3, ref border);


            // --- Check

            if (thickness <= 0)
            {
                throw new Exception(@"Thickness must be a positive value!");
            }

            if (border < 0)
            {
                throw new Exception(@"Border must be a positive value!");
            }

            if (!mesh.IsValid)
            {
                throw new Exception(@"Mesh is not valid!");
            }

            if (!mesh.IsClosed)
            {
                throw new Exception(@"Mesh is not closed!");
            }


            // --- Execute

            var unit = DocumentTolerance();

            var box = mesh.Box(plane);

            var corners = box.GetCorners();

            var origin = corners[0];
            var unitX  = box.Plane.XAxis;
            var unitY  = box.Plane.YAxis;
            var unitZ  = box.Plane.ZAxis;

            var layerCount = (int)Math.Round(box.Z.Length / thickness);

            var olines = new List <List <IntPoint> > [layerCount];
            var offset = new List <List <IntPoint> > [layerCount];
            var ilines = new List <List <IntPoint> > [layerCount];
            var planes = new Plane[layerCount];

            for (int i = 0; i < layerCount; i++)
            {
                var z = (i + 0.5) * thickness;

                var sectionOrigin = origin + z * unitZ;
                var sectionPlane  = new Plane(sectionOrigin, unitZ);

                planes[i] = sectionPlane;

                olines[i] = mesh.Section(sectionPlane, unit);
                offset[i] = Offset(olines[i], -border / unit);
            }

            if (border > 0)
            {
                ilines[0] = new List <List <IntPoint> >();

                for (int i = 1; i < layerCount - 1; i++)
                {
                    ilines[i] = Intersect(Intersect(offset[i], offset[i - 1]), offset[i + 1]);
                }

                ilines[layerCount - 1] = new List <List <IntPoint> >();
            }


            // --- Output

            DA.SetEnum2D(0, olines.Select((o, i) => o.ToCurves(planes[i], unit)));
            if (border > 0)
            {
                DA.SetEnum2D(1, ilines.Select((o, i) => o.ToCurves(planes[i], unit)));
            }
            DA.SetEnum1D(2, planes);
        }