protected override void SolveInstance(IGH_DataAccess DA) { GsaProp2d prop = new GsaProp2d(); // element type (picked in dropdown) prop.Prop2d.Type = Property2D_Type.UNDEF; if (_mode == FoldMode.PlaneStress) { prop.Prop2d.Type = Property2D_Type.PL_STRESS; } if (_mode == FoldMode.Fabric) { prop.Prop2d.Type = Property2D_Type.FABRIC; } if (_mode == FoldMode.FlatPlate) { prop.Prop2d.Type = Property2D_Type.PLATE; } if (_mode == FoldMode.Shell) { prop.Prop2d.Type = Property2D_Type.SHELL; } if (_mode == FoldMode.CurvedShell) { prop.Prop2d.Type = Property2D_Type.CURVED_SHELL; } if (_mode == FoldMode.LoadPanel) { prop.Prop2d.Type = Property2D_Type.LOAD; } //id GH_Integer gh_ID = new GH_Integer(); DA.GetData(0, ref gh_ID); int idd = 0; GH_Convert.ToInt32_Primary(gh_ID, ref idd); prop.ID = idd; //name GH_String gh_Name = new GH_String(); DA.GetData(1, ref gh_Name); string name = ""; GH_Convert.ToString_Primary(gh_Name, ref name); prop.Prop2d.Name = name; //colour GH_Colour gh_Colour = new GH_Colour(); DA.GetData(2, ref gh_Colour); System.Drawing.Color colour = new System.Drawing.Color(); GH_Convert.ToColor_Primary(gh_Colour, ref colour); prop.Prop2d.Colour = (ValueType)colour; if (_mode != FoldMode.LoadPanel) { //axis GH_Integer gh_Axis = new GH_Integer(); DA.GetData(3, ref gh_Axis); int axis = 0; GH_Convert.ToInt32_Primary(gh_Axis, ref axis); prop.Prop2d.AxisProperty = axis; if (_mode != FoldMode.Fabric) { //Material type GH_ObjectWrapper gh_typ = new GH_ObjectWrapper(); MaterialType matType = MaterialType.CONCRETE; if (DA.GetData(4, ref gh_typ)) { if (gh_typ.Value is MaterialType) { gh_typ.CastTo(ref matType); } if (gh_typ.Value is GH_String) { string typ = "CONCRETE"; GH_Convert.ToString_Primary(gh_typ, ref typ); if (typ.ToUpper() == "STEEL") { matType = MaterialType.STEEL; } if (typ.ToUpper() == "CONCRETE") { matType = MaterialType.CONCRETE; } if (typ.ToUpper() == "FRP") { matType = MaterialType.FRP; } if (typ.ToUpper() == "ALUMINIUM") { matType = MaterialType.ALUMINIUM; } if (typ.ToUpper() == "TIMBER") { matType = MaterialType.TIMBER; } if (typ.ToUpper() == "GLASS") { matType = MaterialType.GLASS; } if (typ.ToUpper() == "FABRIC") { matType = MaterialType.FABRIC; } if (typ.ToUpper() == "GENERIC") { matType = MaterialType.GENERIC; } } } prop.Prop2d.MaterialType = matType; //thickness GH_Number gh_THK = new GH_Number(); double thickness = 0.2; if (DA.GetData(7, ref gh_THK)) { GH_Convert.ToDouble_Primary(gh_THK, ref thickness); } //prop.Prop2d.Thickness = thickness; } else { prop.Prop2d.MaterialType = MaterialType.FABRIC; } //handle that the last two inputs are at different -1 index for fabric mode int fab = 0; if (_mode == FoldMode.Fabric) { fab = 1; } //grade GH_Integer gh_grd = new GH_Integer(); DA.GetData(5 - fab, ref gh_grd); int grade = 1; GH_Convert.ToInt32_Primary(gh_grd, ref grade); prop.Prop2d.MaterialGradeProperty = grade; //analysis GH_Integer gh_anal = new GH_Integer(); DA.GetData(6 - fab, ref gh_anal); int analysis = 1; GH_Convert.ToInt32_Primary(gh_anal, ref analysis); prop.Prop2d.MaterialAnalysisProperty = analysis; } DA.SetData(0, new GsaProp2dGoo(prop)); }