Some classes in this code snippets may not exist in Robot but it will give you idea how to do it
protected RobotResultQueryParams CreateQueryParamsForSurfacesValues(List<SdxData.EPhysical> results, bool forAbsoluteMaximum)
{
RobotResultQueryParams queryParams = (RobotResultQueryParams)this.RobotKernel.CmpntFactory.Create(IRobotComponentType.I_CT_RESULT_QUERY_PARAMS);
queryParams.ResultIds.SetSize(results.Count);
for (int i = 0; i < results.Count; i++)
{
int id = (int)results[i];
queryParams.ResultIds.Set(i + 1, id);
}
queryParams.Selection.Set(IRobotObjectType.I_OT_CASE, this.CreateSelectionLoadCase());
queryParams.SetParam(IRobotResultParamType.I_RPT_MULTI_THREADS, true);
queryParams.SetParam(IRobotResultParamType.I_RPT_THREAD_COUNT, 4);
queryParams.SetParam(IRobotResultParamType.I_RPT_SMOOTHING, IRobotFeResultSmoothing.I_FRS_SMOOTHING_WITHIN_A_PANEL);
queryParams.SetParam(IRobotResultParamType.I_RPT_LAYER, forAbsoluteMaximum ? 6 : (int)IRobotFeLayerType.I_FLT_MIDDLE);
queryParams.SetParam(IRobotResultParamType.I_RPT_DIR_X_DEFTYPE, IRobotObjLocalXDirDefinitionType.I_OLXDDT_CARTESIAN);
queryParams.SetParam(IRobotResultParamType.I_RPT_DIR_X, new double[] { 0, 0, 0 });
return queryParams;
}
protected RobotSelection CreateSelectionLoadCase()
{
RobotSelection selector = this.RobotKernel.Structure.Selections.Create(IRobotObjectType.I_OT_CASE);
foreach (string id in this.Header.LoadCaseNotEmptyIndices)
{
selector.AddText(id);
}
return selector;
}
Getting results:
RobotResultQueryParams queryParams = this.CreateQueryParamsForSurfacesValues(results, forAbsoluteMaximum);
RobotResultRowSet rowSet = new RobotResultRowSet();
IRobotResultQueryReturnType ret = IRobotResultQueryReturnType.I_RQRT_MORE_AVAILABLE;
bool anythingCalculated = false;
while (ret != IRobotResultQueryReturnType.I_RQRT_DONE)
{
ret = this.RobotKernel.Structure.Results.Query(queryParams, rowSet);
bool isOk = anythingCalculated = rowSet.MoveFirst();
while (isOk)
{
RobotResultRow row = rowSet.CurrentRow;
int nodeId = (int)row.GetParam(IRobotResultParamType.I_RPT_NODE);
int panelId = (int)row.GetParam(IRobotResultParamType.I_RPT_PANEL);
string idCase = ((int)row.GetParam(KernelOM.IRobotResultParamType.I_RPT_LOAD_CASE)).ToString();
foreach (SdxData.EPhysical item in results)
{
int id = (int)item;
if (row.IsAvailable(id))
{
double value = (double)row.GetValue(id);
}
else
{
throw new Exception(string.Format(Properties.Resources.Error_ReadingElemNode, panelId, nodeId));
}
}
}
isOk = rowSet.MoveNext();
}
}
Rafal Gaweda