Exemple #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)
        {
            Rhino.Geometry.Mesh inputMesh = null;
            DroidVolume         vol       = null;
            double x = new double();
            double y = new double();

            if (!DA.GetData(0, ref inputMesh))
            {
                return;
            }
            if (!DA.GetData(1, ref vol))
            {
                return;
            }
            if (!DA.GetData(2, ref x))
            {
                return;
            }
            if (!DA.GetData(3, ref y))
            {
                return;
            }

            Vector3d normal  = new Vector3d(0, 0, 1);
            Plane    worldXY = new Plane(Point3d.Origin, normal);

            Vector3d trans = new Vector3d(x, y, 0);

            Rhino.Geometry.Mesh _inputMesh = new Rhino.Geometry.Mesh();

            if (vol.volumeOutline.Length == 2)
            {
                _inputMesh = inputMesh;
                BoundingBox bbx    = _inputMesh.GetBoundingBox(worldXY);
                Point3d     cnr    = bbx.Corner(true, true, true);
                Point3d     center = bbx.Center;
                center.Z = cnr.Z;
                Vector3d toMiddle = new Vector3d((Point3d.Origin - center + trans));
                _inputMesh.Transform(Transform.Translation(toMiddle));
            }
            if (vol.volumeOutline.Length == 6)
            {
                _inputMesh = inputMesh;
                BoundingBox bbx    = _inputMesh.GetBoundingBox(worldXY);
                Point3d     cnr    = bbx.Corner(true, true, true);
                Point3d     center = bbx.Center;
                center.Z = cnr.Z;
                Point3d  middle   = new Point3d((vol.size[0] / 2), (vol.size[1] / 2), 0);
                Vector3d toMiddle = new Vector3d((middle - center + trans));
                _inputMesh.Transform(Transform.Translation(toMiddle));
            }

            DroidMesh dMesh = new DroidMesh(_inputMesh);

            DA.SetData(0, dMesh);
            DA.SetData(1, _inputMesh);
        }
Exemple #2
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object can be used to retrieve data from input parameters and
        /// to store data in output parameters.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // Inputs
            List <Mesh>     dSlice = new List <Mesh>();
            DroidVolume     vol    = null;
            DroidParameters para   = null;

            if (!DA.GetDataList(0, dSlice))
            {
                return;
            }
            if (!DA.GetData(1, ref para))
            {
                return;
            }
            if (!DA.GetData(2, ref vol))
            {
                return;
            }

            // Initialise
            Polylines[]        brimSkirtPaths;
            Polylines[]        contourPaths;
            Polylines[]        shellPaths;
            List <Polylines[]> fillCapPaths;
            DroidMesh          dMesh;

            foreach (Mesh x in dSlice)
            {
                if (x == null)
                {
                    return;
                }
            }

            dMesh = new DroidMesh();
            dMesh.AssignParameters(para.layerHeight, para.scale, para.nozzle);

            contourPaths   = dMesh.Contour(dSlice);
            shellPaths     = dMesh.Offset(para.shellNumber);
            brimSkirtPaths = dMesh.BrimSkirt(para.brimSkirtInt, para.brimSkirt);
            fillCapPaths   = dMesh.DroidBoolPaths(para.infillPercent, para.capTopThickness, para.capBotThickness, para.shellNumber);

            // Initialising Wrapper
            DroidPaths myDroid = new DroidPaths(contourPaths, shellPaths, fillCapPaths[0], brimSkirtPaths, fillCapPaths[1]);

            // Output
            DA.SetData(0, myDroid);
            DA.SetDataList(1, myDroid.wrapperList[1]);
            DA.SetDataList(2, myDroid.wrapperList[2]);
            DA.SetDataList(3, myDroid.wrapperList[3]);
            DA.SetDataList(4, myDroid.wrapperList[0]);
            DA.SetDataList(5, myDroid.wrapperList[4]);
        }
Exemple #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)
        {
            double diameter = new double();
            double z        = new double();

            if (!DA.GetData(0, ref diameter))
            {
                return;
            }
            if (!DA.GetData(1, ref z))
            {
                return;
            }

            DroidVolume vol = new DroidVolume(diameter, z);

            DA.SetData(0, vol);
            DA.SetDataList(1, vol.volumeOutline);
        }
Exemple #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)
        {
            List <Curve> contour = new List <Curve>();
            bool         sort    = new bool();
            DroidVolume  dv      = new DroidVolume();

            if (!DA.GetDataList(0, contour))
            {
                return;
            }
            if (!DA.GetData(1, ref sort))
            {
                return;
            }
            if (!DA.GetData(2, ref dv))
            {
                return;
            }

            DroidPaths myDroid = new DroidPaths(contour, sort, dv);

            DA.SetData(0, myDroid);
        }