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(); }
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(); }