/// <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) { bool run = false; Model input = null; MeshUtil.GmshParams gmshParams = null; DA.GetData(0, ref run); DA.GetData(1, ref input); DA.GetData(2, ref gmshParams); RhinoDoc doc = RhinoDoc.ActiveDoc; GH_Document GrasshopperDocument = this.OnPingDocument(); if (undoGH) { Rhino.RhinoApp.RunScript("_undo", false); undoGH = false; done = true; } if (run && !done) { model = input.Clone() as Model; model.BuildGmshFile(doc, gmshParams); undoGH = true; GrasshopperDocument.ScheduleSolution(0, ScheduleCallback); } else if (!run) { done = false; } DA.SetData(0, model); if (model != null) { DA.SetData(1, model.GetModelFilePath(GuanacoUtil.FileType.geo)); } }
/// <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) { bool run = false; Model input = null; MeshUtil.GmshParams gmshParams = null; bool reducedIntegration = false; DA.GetData(0, ref run); DA.GetData(1, ref input); DA.GetData(2, ref gmshParams); DA.GetData(3, ref reducedIntegration); RhinoDoc doc = RhinoDoc.ActiveDoc; GH_Document GrasshopperDocument = this.OnPingDocument(); if (undoGH) { Rhino.RhinoApp.RunScript("_undo", false); undoGH = false; done = true; } if (run && !done) { model = input.Clone() as Model; model.MeshModel(doc, gmshParams, GHUtil.GmshPath(GrasshopperDocument), reducedIntegration); undoGH = true; GrasshopperDocument.ScheduleSolution(0, ScheduleCallback); } else if (!run) { done = false; } DA.SetData(0, model); }