/***************************************************/ /**** Private Methods ****/ /***************************************************/ private IEnumerable <IResult> ExtractNodeReaction(List <int> ids, List <int> loadcaseIds) { List <NodeReaction> nodeReactions = new List <NodeReaction>(); IFView view = m_LusasApplication.getCurrentView(); IFResultsContext resultsContext = m_LusasApplication.newResultsContext(view); string entity = "Reaction"; string location = "Nodal"; 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>() { "Fx", "Fy", "Fz", "Mx", "My", "Mz" }; d_LusasData.startUsingScriptedResults(); Dictionary <string, IFResultsComponentSet> resultsSets = GetResultsSets(entity, components, location, resultsContext); foreach (int nodeId in ids) { Dictionary <string, double> featureResults = GetFeatureResults(components, resultsSets, unitSet, nodeId, "P", 6); double fX = 0; double fY = 0; double fZ = 0; double mX = 0; double mY = 0; double mZ = 0; featureResults.TryGetValue("Fx", out fX); featureResults.TryGetValue("Fy", out fY); featureResults.TryGetValue("Fz", out fZ); featureResults.TryGetValue("Mx", out mX); featureResults.TryGetValue("My", out mY); featureResults.TryGetValue("Mz", out mZ); List <double> results = new List <double>(); //TODO: resolve below identifiers extractable through the API int mode = -1; double timeStep = 0; NodeReaction nodeReaction = new NodeReaction( nodeId, Adapters.Lusas.Convert.GetName(loadset.getName()), mode, timeStep, oM.Geometry.Basis.XY, fX * forceSIConversion, fY * forceSIConversion, fZ * forceSIConversion, mX * forceSIConversion * lengthSIConversion, mY * forceSIConversion * lengthSIConversion, mZ * forceSIConversion * lengthSIConversion ); nodeReactions.Add(nodeReaction); } d_LusasData.stopUsingScriptedResults(); d_LusasData.flushScriptedResults(); } return(nodeReactions); }
/***************************************************/ /**** Private Methods ****/ /***************************************************/ private IEnumerable <IResult> ExtractBarForce(List <int> ids, List <int> loadcaseIds) { List <BarForce> barForces = new List <BarForce>(); IFView view = m_LusasApplication.getCurrentView(); IFResultsContext resultsContext = m_LusasApplication.newResultsContext(view); string entity = "Force/Moment - 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>() { "Fx", "Fy", "Fz", "Mx", "My", "Mz" }; 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 fX = 0; double fY = 0; double fZ = 0; double mX = 0; double mY = 0; double mZ = 0; featureResults.TryGetValue("Fx", out fX); featureResults.TryGetValue("Fy", out fY); featureResults.TryGetValue("Fz", out fZ); featureResults.TryGetValue("Mx", out mX); featureResults.TryGetValue("My", out mY); featureResults.TryGetValue("Mz", out mZ); //TODO: resolve below identifiers extractable through the API int mode = -1; double timeStep = 0; double position = 0; int divisions = 0; BarForce barForce = new BarForce( barId, Adapters.Lusas.Convert.GetName(loadset.getName()), mode, timeStep, position, divisions, fX * forceSIConversion, fY * forceSIConversion, fZ * forceSIConversion, mX * forceSIConversion * lengthSIConversion, mY * forceSIConversion * lengthSIConversion, mZ * forceSIConversion * lengthSIConversion ); barForces.Add(barForce); } d_LusasData.stopUsingScriptedResults(); d_LusasData.flushScriptedResults(); } return(barForces); }
private IEnumerable <IResult> ExtractNodeDisplacement(List <int> ids, List <int> loadcaseIds) { List <NodeDisplacement> nodeDisplacements = new List <NodeDisplacement>(); IFView view = m_LusasApplication.getCurrentView(); IFResultsContext resultsContext = m_LusasApplication.newResultsContext(view); string entity = "Displacement"; string location = "Nodal"; 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>() { "DX", "DY", "DZ", "THX", "THY", "THZ" }; d_LusasData.startUsingScriptedResults(); Dictionary <string, IFResultsComponentSet> resultsSets = GetResultsSets(entity, components, location, resultsContext); foreach (int nodeId in ids) { Dictionary <string, double> featureResults = GetFeatureResults(components, resultsSets, unitSet, nodeId, "P", 6); double uX = 0; double uY = 0; double uZ = 0; double rX = 0; double rY = 0; double rZ = 0; featureResults.TryGetValue("DX", out uX); featureResults.TryGetValue("DY", out uY); featureResults.TryGetValue("DZ", out uZ); featureResults.TryGetValue("THX", out rX); featureResults.TryGetValue("THY", out rY); featureResults.TryGetValue("THZ", out rZ); //TODO: resolve below identifiers extractable through the API int mode = -1; double timeStep = 0; NodeDisplacement nodeDisplacement = new NodeDisplacement( nodeId, Adapters.Lusas.Convert.GetName(loadset.getName()), mode, timeStep, oM.Geometry.Basis.XY, uX * lengthSIConversion, uY * lengthSIConversion, uZ * lengthSIConversion, rX, rY, rZ ); nodeDisplacements.Add(nodeDisplacement); } d_LusasData.stopUsingScriptedResults(); d_LusasData.flushScriptedResults(); } return(nodeDisplacements); }
/***************************************************/ private IEnumerable <IResult> ExtractBarStrain(List <int> ids, List <int> loadcaseIds) { List <BarStrain> barStrains = new List <BarStrain>(); IFView view = m_LusasApplication.getCurrentView(); IFResultsContext resultsContext = m_LusasApplication.newResultsContext(view); string entity = "Strain - 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>() { "Ex", "Ey", "Ez", "Bx", "By", "Bz" }; 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); List <string> keys = featureResults.Keys.ToList(); double eX = 0; double eY = 0; double eZ = 0; double bX = 0; double bY = 0; double bZ = 0; featureResults.TryGetValue("Ex", out eX); featureResults.TryGetValue("Ey", out eY); featureResults.TryGetValue("Ez", out eZ); featureResults.TryGetValue("Bx", out bX); featureResults.TryGetValue("By", out bY); featureResults.TryGetValue("Bz", out bZ); //TODO: resolve below identifiers extractable through the API int mode = -1; double timeStep = 0; double position = 0; int divisions = 0; BarStrain barStrain = new BarStrain( barId, Adapters.Lusas.Convert.GetName(loadset.getName()), mode, timeStep, position, divisions, eX, eY, eZ, 0, 0, 0, 0, 0, 0); BH.Engine.Base.Compute.RecordWarning("Please note only axial and shear strains will be returned when pulling BarStrain results."); barStrains.Add(barStrain); } d_LusasData.stopUsingScriptedResults(); d_LusasData.flushScriptedResults(); } return(barStrains); }