/// <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) { ghdoc = this.OnPingDocument(); ghdoc.ContextChanged += new GH_Document.ContextChangedEventHandler(CheckDisplay); Model model = null; DA.GetData(0, ref model); if (model.Mesh == null) { return; } bool showNds, showThk, showEdgs, showLCS, showLoads, showSupports, showCNs, showNNs, showENs, showLVals; showNds = showThk = showEdgs = showLCS = showLoads = showSupports = showCNs = showNNs = showENs = showLVals = false; double TFactor, GFactor; TFactor = GFactor = 0; DA.GetData(1, ref showNds); DA.GetData(2, ref showThk); DA.GetData(3, ref showEdgs); DA.GetData(4, ref showLCS); DA.GetData(5, ref showLoads); DA.GetData(6, ref showSupports); DA.GetData(7, ref showCNs); DA.GetData(8, ref showNNs); DA.GetData(9, ref showENs); DA.GetData(10, ref showLVals); DA.GetData(11, ref TFactor); DA.GetData(12, ref GFactor); List <int> panelIds = new List <int>(); List <int> barIds = new List <int>(); DA.GetDataList(13, barIds); DA.GetDataList(14, panelIds); double[] sizeFactors = model.sizeFactors(); double EFactor = sizeFactors[0]; double FFactor = sizeFactors[1]; m_display = new Rhino.Display.CustomDisplay(!this.Hidden); HashSet <int> nodeIds = new HashSet <int>(); HashSet <int> barNodeIds; HashSet <int> panelNodeIds; m_display.AddBarPreview(model, barIds, out barNodeIds, GFactor, EFactor, TFactor, showCNs, showENs, showLCS, showThk); m_display.AddPanelPreview(model, panelIds, out panelNodeIds, GFactor, EFactor, TFactor, FFactor, showCNs, showENs, showLCS, showLoads, showLVals, showEdgs, showThk); nodeIds.UnionWith(panelNodeIds); nodeIds.UnionWith(barNodeIds); m_display.AddNodePreview(model, nodeIds, GFactor, EFactor, TFactor, FFactor, showNds, showNNs, showLoads, showLVals); if (showSupports) { m_display.AddSupportPreview(model, nodeIds, EFactor, GFactor); } }
/// <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) { ghdoc = this.OnPingDocument(); ghdoc.ContextChanged += new GH_Document.ContextChangedEventHandler(CheckDisplay); Model input = null; DA.GetData(0, ref input); if (input.Mesh == null) { return; } Model model = input.Clone() as Model; Grasshopper.Kernel.Types.GH_ObjectWrapper type0D = null; Grasshopper.Kernel.Types.GH_ObjectWrapper type1D = null; Grasshopper.Kernel.Types.GH_ObjectWrapper type2D = null; DA.GetData(1, ref type0D); DA.GetData(2, ref type1D); DA.GetData(3, ref type2D); type0D.Value.CheckResultDimension(0); type1D.Value.CheckResultDimension(1); type2D.Value.CheckResultDimension(2); string nodeResultType = type0D.ToString(); string barResType = type1D.ToString(); string panelResType = type2D.ToString(); bool showVals, showNds, showEdgs, deformed, showLCS, showLoads, showSupports, showCNs, showNNs, showENs, showLVals; showVals = showNds = showEdgs = deformed = showLCS = showLoads = showSupports = showCNs = showNNs = showENs = showLVals = false; double TFactor, GFactor, Dfactor; TFactor = GFactor = Dfactor = 0; DA.GetData(4, ref showVals); DA.GetData(5, ref showNds); DA.GetData(6, ref showEdgs); DA.GetData(7, ref deformed); DA.GetData(8, ref showLCS); DA.GetData(9, ref showLoads); DA.GetData(10, ref showSupports); DA.GetData(11, ref showCNs); DA.GetData(12, ref showNNs); DA.GetData(13, ref showENs); DA.GetData(14, ref showLVals); DA.GetData(15, ref TFactor); DA.GetData(16, ref GFactor); DA.GetData(17, ref Dfactor); List <int> panelIds = new List <int>(); List <int> barIds = new List <int>(); DA.GetDataList(18, barIds); DA.GetDataList(19, panelIds); double[] sizeFactors = model.sizeFactors(); double EFactor = sizeFactors[0]; double FFactor = sizeFactors[1]; if (deformed) { model.Mesh.Deform(Dfactor); } m_display = new Rhino.Display.CustomDisplay(!this.Hidden); Grasshopper.GUI.Gradient.GH_Gradient gradient = PreviewUtil.CreateStandardGradient(); HashSet <int> nodeIds = new HashSet <int>(); HashSet <int> barNodeIds; HashSet <int> panelNodeIds; m_display.AddBarPreview(model, barIds, out barNodeIds, GFactor, EFactor, TFactor, showCNs, showENs, showLCS, false, barResType, showVals); m_display.AddPanelPreview(model, panelIds, out panelNodeIds, GFactor, EFactor, TFactor, FFactor, showCNs, showENs, showLCS, showLoads, showLVals, showEdgs, false, gradient, panelResType, showVals); nodeIds.UnionWith(panelNodeIds); nodeIds.UnionWith(barNodeIds); m_display.AddNodePreview(model, nodeIds, GFactor, EFactor, TFactor, FFactor, showNds, showNNs, showLoads, showLVals, gradient, nodeResultType, showVals); if (showSupports) { m_display.AddSupportPreview(model, nodeIds, EFactor, GFactor); } }