/// <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) { //Initialize Input Variables, Persistent in ComponentChange. //Excute Instruction ///If Component is set as Instruction. if (isInstruction) { //this.Message = ""; DA.SetData("Instr", new Instruction.Instr_GrayScale()); } else ///If Component is set to StandAlone. { ///Initialize PointCloud Input Variable. GH_Cloud pointCloud = null; if (!DA.GetData("Cloud", ref pointCloud)) { return; } ///Duplicate GH Cloud. GH_Cloud newGHCloud = pointCloud.DuplicateCloud(); PointCloud newCloud = newGHCloud.Value; ///Execute Instruction. Instruction.Instr_GrayScale inst = new Instruction.Instr_GrayScale(); Boolean Result = inst.Execute(ref newCloud); ///Set New Output Cloud newGHCloud.Value = newCloud; DA.SetData("Cloud", newGHCloud); //Add RuntimeMessage: ComponentChange. AddRuntimeMessage(GH_RuntimeMessageLevel.Remark, "'Right Click' to Switch between StandAlone and Instruction Component."); } }
/// <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) { //Initialize Input Variables, Persistent in ComponentChange. Type_KDTree KDTree = null; int Amount = 1; Vector3d GV = Vector3d.ZAxis; Boolean GS = true; if (!DA.GetData("Number of Neighbors", ref Amount)) { return; } if (!DA.GetData("Guide Vector", ref GV)) { return; } if (!DA.GetData("GuideStyle", ref GS)) { return; } //Excute Instruction ///If Component is set as Instruction. if (isInstruction) { //this.Message = ""; DA.SetData("Instr", new Instruction.Instr_KDTree_Normals(null, GV, GS, Amount, colorize)); } else ///If Component is set to StandAlone. { if (!DA.GetData("KDTree", ref KDTree)) { return; } ///Initialize PointCloud Input Variable. GH_Cloud pointCloud = KDTree.Value.Item2; //if (!DA.GetData("Cloud", ref pointCloud)) return; ///Duplicate GH Cloud. GH_Cloud newGHCloud = pointCloud.DuplicateCloud(); PointCloud newCloud = newGHCloud.Value; ///Execute Instruction. Instruction.Instr_KDTree_Normals inst = new Instruction.Instr_KDTree_Normals(KDTree.Value.Item1, GV, GS, Amount, colorize); Boolean Result = inst.Execute(ref newCloud); ///Set New Output Cloud newGHCloud.Value = newCloud; Type_KDTree newKDTree = new Type_KDTree(KDTree.Value.Item1, newGHCloud); DA.SetData("KDTree", newKDTree); //Add RuntimeMessage: ComponentChange. AddRuntimeMessage(GH_RuntimeMessageLevel.Remark, "'Right Click' to Switch between StandAlone and Instruction Component."); } }
/// <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) { //Initialize Input Variables, Persistent in ComponentChange. Plane Plane = Plane.Unset; string Key = string.Empty; if (!DA.GetData("Plane", ref Plane)) { return; } if (!DA.GetData("Key", ref Key)) { return; } //Excute Instruction ///If Component is set as Instruction. if (isInstruction) { //this.Message = ""; DA.SetData("Instr", new Instruction.Instr_PlaneCompare(Plane, Key, colorize)); } else ///If Component is set to StandAlone. { ///Initialize PointCloud Input Variable. GH_Cloud pointCloud = null; if (!DA.GetData("Cloud", ref pointCloud)) { return; } ///Duplicate GH Cloud. GH_Cloud newGHCloud = pointCloud.DuplicateCloud(); PointCloud newCloud = newGHCloud.Value; ///Execute Instruction. Instruction.Instr_PlaneCompare inst = new Instruction.Instr_PlaneCompare(Plane, Key, colorize); Boolean Result = inst.Execute(ref newCloud); ///Display ColorRange //if (colorize) { this.Message = String.Format("Blue:{0} to Red:{1}\nmultiplePC?\nengineDisp?", Math.Round(inst.colorValues.First(), 2), Math.Round(inst.colorValues.Last(), 2)); } //else { this.Message = ""; } ///Set New Output Cloud newGHCloud.Value = newCloud; DA.SetData("Cloud", newGHCloud); //Add RuntimeMessage: ComponentChange. AddRuntimeMessage(GH_RuntimeMessageLevel.Remark, "'Right Click' to Switch between StandAlone and Instruction Component."); } }
/// <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) { //Initialize Input Variables, Persistent in ComponentChange. Mesh Mesh = null; Vector3d Vector = Vector3d.Zero; string Key = string.Empty; if (!DA.GetData("Mesh", ref Mesh)) { return; } if (!DA.GetData("Vector", ref Vector)) { return; } if (!DA.GetData("Key", ref Key)) { return; } //Excute Instruction ///If Component is set as Instruction. if (isInstruction) { //this.Message = ""; DA.SetData("Instr", new Instruction.Instr_MeshRay(Mesh, Vector, Key, colorize)); } else ///If Component is set to StandAlone. { ///Initialize PointCloud Input Variable. GH_Cloud pointCloud = null; if (!DA.GetData("Cloud", ref pointCloud)) { return; } ///Duplicate GH Cloud. GH_Cloud newGHCloud = pointCloud.DuplicateCloud(); PointCloud newCloud = newGHCloud.Value; ///Execute Instruction. Instruction.Instr_MeshRay inst = new Instruction.Instr_MeshRay(Mesh, Vector, Key, colorize); Boolean Result = inst.Execute(ref newCloud); ///Set New Output Cloud newGHCloud.Value = newCloud; DA.SetData("Cloud", newGHCloud); //Add RuntimeMessage: ComponentChange. AddRuntimeMessage(GH_RuntimeMessageLevel.Remark, "'Right Click' to Switch between StandAlone and Instruction Component."); } }
/// <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) { //Initialize Input Variables, Persistent in ComponentChange. List <double> pars = new List <double>(); List <Color> cols = new List <Color>(); string strdc = null; double colPct = 0.00; double step = 0.0; if (!DA.GetData("Key", ref strdc)) { return; } if (!DA.GetDataList("Values", pars)) { return; } if (!DA.GetDataList("Colors", cols)) { return; } if (!DA.GetData("BlendPct", ref colPct)) { return; } DA.GetData("StepSize", ref step); if (colPct > 1.00) { this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Color Blending Percentage cannot be above 1.00."); } //Excute Instruction ///If Component is set as Instruction. if (isInstruction) { DA.SetData("Instr", new Instruction.Instr_Dict_Color(strdc, pars, cols, step, colPct)); } else ///If Component is set to StandAlone. { ///Initialize PointCloud Input Variable. GH_Cloud pointCloud = null; if (!DA.GetData("Cloud", ref pointCloud)) { return; } ///Duplicate GH Cloud. GH_Cloud newGHCloud = pointCloud.DuplicateCloud(); PointCloud newCloud = newGHCloud.Value; ///Execute Instruction. Instruction.Instr_Dict_Color inst = new Instruction.Instr_Dict_Color(strdc, pars, cols, step, colPct); Boolean Result = inst.Execute(ref newCloud); ///Set New Output Cloud newGHCloud.Value = newCloud; DA.SetData("Cloud", newGHCloud); //Add RuntimeMessage: ComponentChange. AddRuntimeMessage(GH_RuntimeMessageLevel.Remark, "'Right Click' to Switch between StandAlone and Instruction Component."); } }
/// <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) { //Initialize Input Variables, Persistent in ComponentChange. List <Mesh> cMeshList = new List <Mesh>(); Boolean InsideBool = true; if (!DA.GetDataList("Mesh", cMeshList)) { return; } if (!DA.GetData("Leave", ref InsideBool)) { return; } //Prepare Input for Instruction //and write ErrorMessages ///Initialize list of Boxes ///Loop through Input Meshes ///and test for face planarity and vertice count to determine if Box. foreach (Mesh cMesh in cMeshList) { cMesh.FaceNormals.ComputeFaceNormals(); ///Write ErrorMessage. if (!cMesh.IsClosed) { this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Are you sure it's a closed mesh?"); return; } } //Excute Instruction ///If Component is set as Instruction. if (isInstruction) { DA.SetData("Instr", new Instruction.Instr_MeshCrop(cMeshList, InsideBool)); } else ///If Component is set to StandAlone. { ///Initialize PointCloud Input Variable. GH_Cloud pointCloud = null; if (!DA.GetData("Cloud", ref pointCloud)) { return; } ///Duplicate GH Cloud. GH_Cloud newGHCloud = pointCloud.DuplicateCloud(); PointCloud newCloud = newGHCloud.Value; ///Execute Instruction. Instruction.Instr_MeshCrop inst = new Instruction.Instr_MeshCrop(cMeshList, InsideBool); Boolean Result = inst.Execute(ref newCloud); ///Set New Output Cloud newGHCloud.Value = newCloud; DA.SetData("Cloud", newGHCloud); //Add RuntimeMessage: ComponentChange. AddRuntimeMessage(GH_RuntimeMessageLevel.Remark, "'Right Click' to Switch between StandAlone and Instruction Component."); } }
/// <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) { //Initialize Input Variables, Persistent in ComponentChange. List <Brep> cboxlist = new List <Brep>(); Boolean InsideBool = true; if (!DA.GetDataList("Box", cboxlist)) { return; } if (!DA.GetData("Leave", ref InsideBool)) { return; } //Prepare Input for Instruction //and write ErrorMessages ///Initialize list of Boxes List <Box> boxList = new List <Box>(); ///Loop through Input Boxes ///and test for face planarity and vertice count to determine if Box. foreach (Brep cbox in cboxlist) { BrepFace bf = cbox.Faces[0]; Plane thisplane = new Plane(); ///Write ErrorMessage eles add box to Box List. if (!bf.TryGetPlane(out thisplane, Rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance)) { this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Are you sure it's a box?"); return; } if (cbox.DuplicateVertices().Length != 8) { this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Are you sure it's a box?"); return; } boxList.Add(new Box(thisplane, cbox)); } //Excute Instruction ///If Component is set as Instruction. if (isInstruction) { DA.SetData("Instr", new Instruction.Instr_BoxCrop(boxList, InsideBool)); } else ///If Component is set to StandAlone. { ///Initialize PointCloud Input Variable. GH_Cloud pointCloud = null; if (!DA.GetData("Cloud", ref pointCloud)) { return; } ///Duplicate GH Cloud. GH_Cloud newGHCloud = pointCloud.DuplicateCloud(); PointCloud newCloud = newGHCloud.Value; ///Execute Instruction. Instruction.Instr_BoxCrop inst = new Instruction.Instr_BoxCrop(boxList, InsideBool); Boolean Result = inst.Execute(ref newCloud); ///Set New Output Cloud newGHCloud.Value = newCloud; DA.SetData("Cloud", newGHCloud); //Add RuntimeMessage: ComponentChange. AddRuntimeMessage(GH_RuntimeMessageLevel.Remark, "'Right Click' to Switch between StandAlone and Instruction Component."); } }
/// <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) { //Initialize Input Variables, Persistent in ComponentChange. List <Point3d> CenterList = new List <Point3d>(); List <double> RadiusList = new List <double>(); Boolean InsideBool = true; if (!DA.GetDataList("Center", CenterList)) { return; } if (!DA.GetDataList("Radius", RadiusList)) { return; } if (!DA.GetData("Leave", ref InsideBool)) { return; } //Prepare Input for Instruction //and write ErrorMessages ///Loop through Input Centers and Radiuses ///and test for equal count or single count. if (CenterList.Count > 1 & RadiusList.Count == 1) { for (int i = 1; i < CenterList.Count; i++) { RadiusList.Add(RadiusList[0]); } } if (RadiusList.Count > 1 & CenterList.Count == 1) { for (int i = 1; i < RadiusList.Count; i++) { CenterList.Add(CenterList[0]); } } else if (CenterList.Count != RadiusList.Count) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Need equal amount of CenterPoints and Radius'. Or single of one of them."); return; } //Excute Instruction ///If Component is set as Instruction. if (isInstruction) { DA.SetData("Instr", new Instruction.Instr_SphereCrop(CenterList, RadiusList, InsideBool)); } else ///If Component is set to StandAlone. { ///Initialize PointCloud Input Variable. GH_Cloud pointCloud = null; if (!DA.GetData("Cloud", ref pointCloud)) { return; } ///Duplicate GH Cloud. GH_Cloud newGHCloud = pointCloud.DuplicateCloud(); PointCloud newCloud = newGHCloud.Value; ///Execute Instruction. Instruction.Instr_SphereCrop inst = new Instruction.Instr_SphereCrop(CenterList, RadiusList, InsideBool); Boolean Result = inst.Execute(ref newCloud); ///Set New Output Cloud newGHCloud.Value = newCloud; DA.SetData("Cloud", newGHCloud); //Add RuntimeMessage: ComponentChange. AddRuntimeMessage(GH_RuntimeMessageLevel.Remark, "'Right Click' to Switch between StandAlone and Instruction Component."); } }