public static List <FEMResult> Results(List <Bar> bars, List <PointLoad> loads, Vector <double> es, Matrix <double> ed) { int nEL = bars.Count; List <FEMResult> outResults = new List <FEMResult>(); for (int i = 0; i < nEL; i++) { FEMResult outResult1 = new FEMResult(); BarDeformation barDef1 = new BarDeformation(); BarDisplacement barDisp1 = new BarDisplacement(); BarForce barForce1 = new BarForce(); BarStrain barStrain1 = new BarStrain(); BarStress barStress1 = new BarStress(); barDisp1.UX = ed[i, 0]; barDisp1.UY = ed[i, 1]; barDisp1.UZ = ed[i, 2]; barDisp1.ObjectId = bars[i].Name; barDisp1.ResultCase = loads[0].Loadcase.Number; barDisp1.Position = 0; barDisp1.Divisions = 2; barForce1.FX = es[i]; barForce1.ObjectId = bars[i].Name; barForce1.ResultCase = loads[0].Loadcase.Number; barForce1.Position = 0; barForce1.Divisions = 2; outResult1.barDisplacement = barDisp1; outResult1.barForce = barForce1; FEMResult outResult2 = new FEMResult(); BarDeformation barDef2 = new BarDeformation(); BarDisplacement barDisp2 = new BarDisplacement(); BarForce barForce2 = new BarForce(); BarStrain barStrain2 = new BarStrain(); BarStress barStress2 = new BarStress(); barDisp2.UX = ed[i, 3]; barDisp2.UY = ed[i, 4]; barDisp2.UZ = ed[i, 5]; barDisp2.ObjectId = bars[i].Name; barDisp2.ResultCase = loads[0].Loadcase.Number; barDisp2.Position = 1; barDisp2.Divisions = 2; barForce2.FX = es[i]; barForce2.ObjectId = bars[i].Name; barForce2.ResultCase = loads[0].Loadcase.Number; barForce2.Position = 1; barForce2.Divisions = 2; outResult2.barDisplacement = barDisp2; outResult2.barForce = barForce2; outResults.Add(outResult1); outResults.Add(outResult2); } return(outResults); }
/***************************************************/ private IEnumerable <IResult> ExtractBarStress(List <int> ids, List <int> loadcaseIds) { List <BarStress> barStresses = new List <BarStress>(); IFView view = m_LusasApplication.getCurrentView(); IFResultsContext resultsContext = m_LusasApplication.newResultsContext(view); string entity = "Stress - Thick 3D Beam"; string location = "Feature extreme"; foreach (int loadcaseId in loadcaseIds) { IFLoadset loadset = d_LusasData.getLoadset(loadcaseId); if (!loadset.needsAssociatedValues()) { resultsContext.setActiveLoadset(loadset); } IFUnitSet unitSet = d_LusasData.getModelUnits(); double forceSIConversion = 1 / unitSet.getForceFactor(); double lengthSIConversion = 1 / unitSet.getLengthFactor(); List <string> components = new List <string>() { "Sx(Fx)" }; d_LusasData.startUsingScriptedResults(); Dictionary <string, IFResultsComponentSet> resultsSets = GetResultsSets(entity, components, location, resultsContext); foreach (int barId in ids) { Dictionary <string, double> featureResults = GetFeatureResults(components, resultsSets, unitSet, barId, "L", 6); double axial = 0; featureResults.TryGetValue("Sx(Fx)", out axial); //TODO: resolve below identifiers extractable through the API int mode = -1; double timeStep = 0; double position = 0; int divisions = 0; BarStress barStress = new BarStress( barId, Adapters.Lusas.Convert.GetName(loadset.getName()), mode, timeStep, position, divisions, axial * forceSIConversion * lengthSIConversion * lengthSIConversion, 0, 0, 0, 0, 0, 0, 0, 0); barStresses.Add(barStress); } d_LusasData.stopUsingScriptedResults(); d_LusasData.flushScriptedResults(); } BH.Engine.Base.Compute.RecordWarning("Please note only axial strains will be returned when pulling BarStress results."); return(barStresses); }