Example #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)
        {
            Brep                b            = null;
            ISolver3D           solver       = new ISolver3D();
            IField              field        = null;
            List <IConstraint>  constraints  = new List <IConstraint>();
            List <ITransfinite> transfinites = new List <ITransfinite>();

            DA.GetData(0, ref b);
            DA.GetData(1, ref field);
            DA.GetDataList(2, constraints);
            DA.GetDataList(3, transfinites);
            DA.GetData(4, ref solver);

            if (b.IsSolid)
            {
                string logInfo;
                GH_Structure <IEntityInfo> entities;
                IMesh mesh = IKernel.IMeshingKernel.CreateVolumeMeshFromBrep(b, solver, out logInfo, out entities, constraints, transfinites, field);

                DA.SetData(0, mesh);
                DA.SetDataTree(1, entities);
                DA.SetData(2, logInfo);
            }
            else
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Brep should be closed.");
            }
        }
        /// <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)
        {
            Brep                geom          = null;
            ISolver3D           solver        = new ISolver3D();
            List <IConstraint>  constraints   = new List <IConstraint>();
            List <ITransfinite> transfinites  = new List <ITransfinite>();
            List <int>          excludeSrfTag = new List <int>();
            IField              field         = null;

            DA.GetData(0, ref geom);
            DA.GetData(1, ref offset);
            DA.GetData(2, ref cut);
            DA.GetDataList(3, excludeSrfTag);
            DA.GetData(4, ref field);
            DA.GetDataList(5, constraints);
            DA.GetDataList(6, transfinites);
            DA.GetData(7, ref solver);

            if (geom.IsSolid)
            {
                string logInfo;
                GH_Structure <IEntityInfo> entities;
                IMesh mesh = IKernel.IMeshingKernel.CreateVolumeMeshFromThickSolid(geom, excludeSrfTag, offset, cut, solver, out logInfo, out entities, constraints, transfinites, field);

                DA.SetData(0, mesh);
                DA.SetDataTree(1, entities);
                DA.SetData(2, logInfo);
            }
            else
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Brep should be closed.");
            }
        }
Example #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)
        {
            ISolver3D solver = new ISolver3D();

            DA.GetData(0, ref p);
            DA.GetData(1, ref r);
            DA.GetData(2, ref solver);

            IMesh mesh = IKernel.IMeshingKernel.CreateVolumeMeshFromSphere(p, r, solver);

            DA.SetData(0, mesh);
        }
Example #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)
        {
            ISolver3D solver = new ISolver3D();

            DA.GetData(0, ref plane);
            DA.GetData(1, ref r);
            DA.GetData(2, ref ang);
            DA.GetData(3, ref solver);

            IMesh mesh = IKernel.IMeshingKernel.CreateVolumeMeshFromCylinder(plane, r, ang, solver);

            DA.SetData(0, mesh);
        }
        /// <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)
        {
            MeshSolvers3D solver = MeshSolvers3D.Delaunay;
            ISolver3D     solverOpt = new ISolver3D();
            double        maxSize = 1, minSize = 1;

            DA.GetData(1, ref minSize);
            DA.GetData(2, ref maxSize);
            DA.GetData(3, ref adaptive);
            DA.GetData(4, ref minElemPerTwoPi);
            DA.GetData(5, ref optimization);
            DA.GetData(6, ref qualityType);
            DA.GetData(7, ref qualityThreshold);

            if (minSize < 0.1 && MassiveRefinement == false)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, solverOpt.MinSizeWarning);
                minSize = 0.1;
            }

            double size = (maxSize + minSize) / 2;

            DA.GetData(0, ref size);

            solverOpt.MeshingAlgorithm                  = solver;
            solverOpt.CharacteristicLengthMin           = minSize;
            solverOpt.CharacteristicLengthMax           = maxSize;
            solverOpt.CharacteristicLengthFromCurvature = adaptive;
            solverOpt.OptimizeThreshold                 = qualityThreshold;
            solverOpt.Subdivide = false;
            solverOpt.Size      = size;

            if (optimization != 0 || optimization != 1)
            {
                optimization = 0;
            }
            solverOpt.OptimizationMethod = optimization;

            string method = Enum.GetName(typeof(ElementQualityType), qualityType);

            if (method != null)
            {
                qualityType = 2;
            }
            solverOpt.QualityType = qualityType;

            DA.SetData(0, solverOpt);

            this.Message = "4Tetra+6Prism";
        }
Example #6
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)
        {
            ISolver3D solver = new ISolver3D();

            DA.GetData(0, ref plane);
            DA.GetData(1, ref r1);
            DA.GetData(2, ref r2);
            DA.GetData(3, ref ang);
            DA.GetData(4, ref solver);

            IMesh mesh = IKernel.IMeshingKernel.CreateVolumeMeshFromCone(plane, r1, r2, ang * Math.PI / 180, solver);

            DA.SetData(0, mesh);
        }
Example #7
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)
        {
            ISolver3D solver = new ISolver3D();

            DA.GetData(0, ref pt);
            DA.GetData(1, ref r1);
            DA.GetData(2, ref r2);
            DA.GetData(3, ref ang);
            DA.GetData(4, ref solver);

            IMesh mesh = IKernel.IMeshingKernel.CreateVolumeMeshFromTorus(pt, r1, r2, ang, solver);

            DA.SetData(0, mesh);
        }
Example #8
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)
        {
            Box       box    = new Box();
            ISolver3D solver = new ISolver3D();

            DA.GetData(0, ref box);
            DA.GetData(1, ref u);
            DA.GetData(2, ref v);
            DA.GetData(3, ref w);
            DA.GetData(4, ref solver);

            IMesh mesh = IKernel.IMeshingKernel.CreateVolumeMeshFromBox(box, u, v, w, solver);

            DA.SetData(0, mesh);
        }
Example #9
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)
        {
            ISolver3D solver = new ISolver3D();
            Plane     pl     = new Plane();
            Interval  x      = new Interval();
            Interval  y      = new Interval();
            Interval  z      = new Interval();

            DA.GetData(0, ref pl);
            DA.GetData(1, ref x);
            DA.GetData(2, ref y);
            DA.GetData(3, ref z);
            DA.GetData(4, ref u);
            DA.GetData(5, ref v);
            DA.GetData(6, ref w);
            DA.GetData(4, ref solver);

            IMesh mesh = IKernel.IMeshingKernel.CreateVolumeMeshFromBox(pl, x, y, z, u, v, w, solver);

            DA.SetData(0, mesh);
        }
Example #10
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)
        {
            ISolver3D           solver = new ISolver3D();
            IField              field = null;
            Curve               profCrv = null, extrCrv = null;
            List <IConstraint>  constraints  = new List <IConstraint>();
            List <ITransfinite> transfinites = new List <ITransfinite>();

            DA.GetData(0, ref profCrv);
            DA.GetData(1, ref extrCrv);
            DA.GetData(2, ref field);
            DA.GetDataList(3, constraints);
            DA.GetDataList(4, transfinites);
            DA.GetData(5, ref solver);

            string logInfo;
            GH_Structure <IEntityInfo> entities;
            IMesh mesh = IKernel.IMeshingKernel.CreateVolumeMeshFromPipe(profCrv, extrCrv, solver, out logInfo, out entities, constraints, transfinites, field);

            DA.SetData(0, mesh);
            DA.SetDataTree(1, entities);
            DA.SetData(2, logInfo);
        }
Example #11
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>        crv          = new List <Curve>();
            ISolver3D           solver       = new ISolver3D();
            IField              field        = null;
            List <ITransfinite> transfinites = new List <ITransfinite>();
            List <IConstraint>  constraints  = new List <IConstraint>();

            DA.GetDataList(0, crv);
            DA.GetData(1, ref field);
            DA.GetDataList(2, constraints);
            DA.GetDataList(3, transfinites);
            DA.GetData(4, ref solver);

            // Extract required data from base surface
            string logInfo;
            GH_Structure <IEntityInfo> entities;
            IMesh mesh = IKernel.IMeshingKernel.CreateVolumeMeshFromCurveLoft(crv, solver, out logInfo, out entities, constraints, transfinites, field);

            DA.SetData(0, mesh);
            DA.SetDataTree(1, entities);
            DA.SetData(2, logInfo);
        }
        /// <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)
        {
            Brep                b            = null;
            Vector3d            dir          = new Vector3d();
            List <double>       lengths      = new List <double>();
            List <int>          divisions    = new List <int>();
            IField              field        = null;
            ISolver3D           solver       = new ISolver3D();
            List <IConstraint>  constraints  = new List <IConstraint>();
            List <ITransfinite> transfinites = new List <ITransfinite>();

            DA.GetData(0, ref b);
            DA.GetData(1, ref dir);
            DA.GetDataList(2, lengths);
            DA.GetDataList(3, divisions);
            DA.GetData(4, ref field);
            DA.GetDataList(5, constraints);
            DA.GetDataList(6, transfinites);
            DA.GetData(7, ref solver);

            // Extract required data from base surface
            if (!b.IsSolid && b.Faces.Count == 1)
            {
                string logInfo;
                GH_Structure <IEntityInfo> entities;
                IMesh mesh = IKernel.IMeshingKernel.CreateVolumeMeshFromSurfaceExtrusion(b, dir, divisions, lengths, solver, out logInfo, out entities, constraints, transfinites, field);

                DA.SetData(0, mesh);
                DA.SetDataTree(1, entities);
                DA.SetData(2, logInfo);
            }
            else
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Brep should be closed.");
            }
        }