protected override void SolveInstance(IGH_DataAccess DA) { // get input FemDesign.Loads.LoadCategory obj = null; if (!DA.GetData(0, ref obj)) { return; } if (obj == null) { return; } // return DA.SetData(0, obj.Name); DA.SetData(1, obj.Country); DA.SetData(2, obj.Psi0); DA.SetData(3, obj.Psi1); DA.SetData(4, obj.Psi2); }
protected override void SolveInstance(IGH_DataAccess DA) { FemDesign.Loads.LoadCategoryDatabase loadCategoryDatabase = null; string loadCategoryName = null; if (!DA.GetData(0, ref loadCategoryDatabase)) { return; } if (!DA.GetData(1, ref loadCategoryName)) { return; } if (loadCategoryDatabase == null || loadCategoryName == null) { return; } FemDesign.Loads.LoadCategory loadCategory = loadCategoryDatabase.LoadCategoryByName(loadCategoryName); DA.SetData(0, loadCategory); }
protected override void SolveInstance(IGH_DataAccess DA) { // get data string name = null; double gamma_d = 0, unfavourableSafetyFactor = 0, favourableSafetyFactor = 0, unfavourableSafetyFactorAccidental = 0, favourableSafetyFactorAccidental = 0, xi = 0.89; int loadCaseRelation = 0, type = 0, potentiallyLeadingAction = 1; List <FemDesign.Loads.LoadCase> loadCases = new List <FemDesign.Loads.LoadCase>(); FemDesign.Loads.LoadCategory psi = null; if (!DA.GetData(0, ref name)) { return; } DA.GetData(1, ref type); if (!DA.GetDataList(2, loadCases)) { return; } DA.GetData(3, ref psi); if (!DA.GetData(4, ref unfavourableSafetyFactor)) { return; } DA.GetData(5, ref favourableSafetyFactor); DA.GetData(6, ref unfavourableSafetyFactorAccidental); DA.GetData(7, ref favourableSafetyFactorAccidental); if (!DA.GetData(8, ref loadCaseRelation)) { return; } if (!DA.GetData(9, ref xi)) { if (type == 0) { throw new System.ArgumentException("Must provide Xi value for permanent load group"); } } if (!DA.GetData(10, ref potentiallyLeadingAction)) { if (type == 1) { throw new System.ArgumentException("Must specify if group is potentially leading action for temporary load group"); } } if (name == null) { if (psi == null || type != 0) { return; } } if (loadCaseRelation == 1 && type == 0) { throw new System.ArgumentException("Alternative relationsship not yet implemented for permanent groups!"); } // Convert the load case relation to an enum Loads.ELoadGroupRelationship loadCaseRelationEnum = Loads.ELoadGroupRelationship.Entire; if (loadCaseRelation == 0) { loadCaseRelationEnum = Loads.ELoadGroupRelationship.Entire; } else if (loadCaseRelation == 1) { loadCaseRelationEnum = Loads.ELoadGroupRelationship.Alternative; } // Convert 0 and 1 to booleans Boolean potentiallyLeadingActionBool = true; if (potentiallyLeadingAction == 0) { potentiallyLeadingActionBool = false; } // Create load group object Loads.LoadGroupBase obj = null; if (type == 0) { obj = new Loads.LoadGroupPermanent(favourableSafetyFactor, unfavourableSafetyFactor, favourableSafetyFactorAccidental, unfavourableSafetyFactorAccidental, loadCases, loadCaseRelationEnum, xi, name); } else if (type == 1) { obj = new Loads.LoadGroupTemporary(unfavourableSafetyFactor, psi.Psi0, psi.Psi1, psi.Psi2, potentiallyLeadingActionBool, loadCases, loadCaseRelationEnum, name); } else { throw new System.ArgumentException("Load group type not yet implemented"); } Loads.ModelGeneralLoadGroup loadGroup = new Loads.ModelGeneralLoadGroup(obj); // return DA.SetData(0, loadGroup); }