private void Calculate_Click(object sender, System.EventArgs e) { Pach_GetModel_Command Model = new Pach_GetModel_Command(); Source[] Source; if (PachydermAc_PlugIn.Instance.Source(out Source) && !object.ReferenceEquals(FileLocation.SelectedPath, "")) Rhino.RhinoApp.WriteLine("Model geometry not specified... Exiting calculation..."); ParticleRays[] RTParticles = new ParticleRays[Source.Length]; Calculate.Enabled = false; PachydermAc_PlugIn plugin = PachydermAc_PlugIn.Instance; Scene Sc; if (PachydermAc_PlugIn.Instance.Geometry_Spec() == 0) Sc = PachTools.Get_NURBS_Scene(0, (double)Air_Temp.Value, 0, 0, false); else Sc = PachTools.Get_Poly_Scene(0, (double)Air_Temp.Value, 0, 0, false); for (int i = 0; i < Source.Length; i++) { if (Source != null) { List<Point3d> L = new List<Point3d>(); List<Rhino.Geometry.Point3d> L_RC = new List<Rhino.Geometry.Point3d>(); for (int j = 0; j < Source.Length; j++) { L.Add(Source[j].Origin()); L_RC.Add(new Rhino.Geometry.Point3d(Source[j].Origin().X, Source[j].Origin().Y, Source[j].Origin().Z)); } if (plugin.Geometry_Spec() == 0) { Sc.partition(L_RC, 15); RTParticles[i] = new ParticleRays(Source[i], Sc, (int)RT_Count.Value, CutOffLength()); } else if (plugin.Geometry_Spec() == 1) { Sc.partition(L, 15); RTParticles[i] = new ParticleRays(Source[i], Sc, (int)RT_Count.Value, CutOffLength()); } RTParticles[i].Begin(); } else { Rhino.RhinoApp.WriteLine("Model geometry not specified... Exiting calculation..."); } Pachyderm_Acoustic.Visualization.Phonon P; if (ParticleChoice.SelectedIndex == 0) { P = new Tetrahedron(); } else if (ParticleChoice.SelectedIndex == 1) { P = new Icosahedron(); } else { P = new Geodesic_sphere(); } RenderParticles(RTParticles, (double)(Frame_Rate.Value * Seconds.Value), P); Rhino.RhinoDoc.ActiveDoc.Views.Redraw(); } Calculate.Enabled = true; }
private void Calculate_Click(object sender, System.EventArgs e) { Pach_GetModel_Command Model = new Pach_GetModel_Command(); Source[] Source; if (PachydermAc_PlugIn.Instance.Source(out Source) && !object.ReferenceEquals(FileLocation.SelectedPath, "")) { Rhino.RhinoApp.WriteLine("Model geometry not specified... Exiting calculation..."); } ParticleRays[] RTParticles = new ParticleRays[Source.Length]; Calculate.Enabled = false; PachydermAc_PlugIn plugin = PachydermAc_PlugIn.Instance; Scene Sc; if (PachydermAc_PlugIn.Instance.Geometry_Spec() == 0) { Sc = PachTools.Get_NURBS_Scene(0, (double)Air_Temp.Value, 0, 0, false); } else { Sc = PachTools.Get_Poly_Scene(0, (double)Air_Temp.Value, 0, 0, false); } for (int i = 0; i < Source.Length; i++) { if (Source != null) { List <Point3d> L = new List <Point3d>(); List <Rhino.Geometry.Point3d> L_RC = new List <Rhino.Geometry.Point3d>(); for (int j = 0; j < Source.Length; j++) { L.Add(Source[j].Origin()); L_RC.Add(new Rhino.Geometry.Point3d(Source[j].Origin().X, Source[j].Origin().Y, Source[j].Origin().Z)); } if (plugin.Geometry_Spec() == 0) { Sc.partition(L_RC, 15); RTParticles[i] = new ParticleRays(Source[i], Sc, (int)RT_Count.Value, CutOffLength()); } else if (plugin.Geometry_Spec() == 1) { Sc.partition(L, 15); RTParticles[i] = new ParticleRays(Source[i], Sc, (int)RT_Count.Value, CutOffLength()); } RTParticles[i].Begin(); } else { Rhino.RhinoApp.WriteLine("Model geometry not specified... Exiting calculation..."); } Pachyderm_Acoustic.Visualization.Phonon P; if (ParticleChoice.SelectedIndex == 0) { P = new Tetrahedron(); } else if (ParticleChoice.SelectedIndex == 1) { P = new Icosahedron(); } else { P = new Geodesic_sphere(); } RenderParticles(RTParticles, (double)(Frame_Rate.Value * Seconds.Value), P); Rhino.RhinoDoc.ActiveDoc.Views.Redraw(); } Calculate.Enabled = true; }
private void Preview_Click(object sender, EventArgs e) { Loop.Enabled = false; ForwButton.Enabled = false; BackButton.Enabled = false; PachydermAc_PlugIn plugin = PachydermAc_PlugIn.Instance; if (PreviewDisplay != null) { PreviewDisplay.Enabled = false; } max = (int)(Frame_Rate.Value * Seconds.Value); Point3d[] SPT; if (!plugin.SourceOrigin(out SPT)) { Rhino.RhinoApp.WriteLine("Model geometry not specified... Exiting calculation..."); return; } if (T != null && T.ThreadState == System.Threading.ThreadState.Running) { T.Abort(); } PreviewDisplay = null; Pach_GetModel_Command Model = Pach_GetModel_Command.Instance; if (object.ReferenceEquals(RoomSelection.SelectedItem, "Use Entire Model")) { Model.Rel_Humidity = 50; //(double)Rel_Humidity.Value; Model.Air_Temp = (double)Air_Temp.Value; Model.Atm_pressure = 1000; //(double)Air_Pressure.Value; Model.Atten_Choice = 0; //Atten_Method.SelectedIndex; Rhino.RhinoApp.RunScript("GetModel", false); } plugin.Source(out Source); if (MeshWave) { for (int i = 0; i < Source.Length; i++) { Source[i] = new GeodesicMeshSource(plugin.GetSourceSWL(i), Source[i].Origin(), (int)RT_Count.Value, i); } } ParticleRays[] RTParticles = new ParticleRays[Source.Length]; List <Point3d> L = new List <Point3d>(); for (int i = 0; i < Source.Length; i++) { L.Add(Source[i].Origin()); } for (int j = 0; j < Source.Length; j++) { if (plugin.Geometry_Spec() == 0) { Model.Ret_NURBS_Scene.partition(L); RTParticles[j] = new ParticleRays(Source[j], Model.Ret_NURBS_Scene, (int)RT_Count.Value, CutOffLength()); } else { Model.Ret_Mesh_Scene.partition(L); RTParticles[j] = new ParticleRays(Source[j], Model.Ret_Mesh_Scene, (int)RT_Count.Value, CutOffLength()); } RTParticles[j].Begin(); } PreviewDisplay = new WaveConduit(RTParticles, scale, new double[2] { (double)Param_Min.Value, (double)Param_Max.Value }, Model.Ret_Mesh_Scene); ForwButton.Enabled = true; BackButton.Enabled = true; Loop.Enabled = true; Loop.Text = "Stop"; FC = new ForCall(Forw_proc); System.Threading.ParameterizedThreadStart St = new System.Threading.ParameterizedThreadStart(delegate { LoopStart((int)(this.Frame_Rate.Value * Seconds.Value)); }); T = new System.Threading.Thread(St); T.Start(); }