hi @miguel_paulinoY2Y8C
For once, here’s a C# interpretation of the original VBA code.
Compared to Excel, displaying results in the console allows you to divide the execution time by 2.
You can save another 30-50% by using classes, and even more if you reduce the output to a simple data table for plotting.

public static void PrintCQCResultsForForum(string panels, string cases) {
if (string.IsNullOrEmpty(panels) || string.IsNullOrEmpty(cases)) return;
RobotApplication RobApp = new RobotApplication();
if (RobApp.Visible != -1 || RobApp.Project.IsActive != -1 ||
!new[] { I_PT_PLATE, I_PT_SHELL, I_PT_BUILDING }.Contains(RobApp.Project.Type) ||
RobApp.Project.Structure.Results.Available != -1) return;
RobotStructure Structure = RobApp.Project.Structure;
RobotSelectionFactory Selections = Structure.Selections;
RobotSelection ps = Selections.Create(I_OT_PANEL); ps.FromText(panels); if (ps.Count == 0) return;
RobotSelection cs = Selections.Create(I_OT_CASE); cs.FromText(cases); if (cs.Count == 0) return;
int wl = RobApp.Preferences.GetLanguage(I_L_WORK); var symbols = new[] { "+", "-" };
var feStrings = ps.ToArray(wl).Select(p => ((RobotObjObject)Structure.Objects.Get(p)).FiniteElems);
int[] FEsNumbers = string.Join(" ", feStrings).ToArray(wl),
CaseNumbers = cs.ToArray(wl);
RobotFeResultServer FeRS = Structure.Results.FiniteElems;
RobotFeResultParams FePrms = new() { Layer = IRobotFeLayerType.I_FLT_MIDDLE };
FePrms.SetDirX(IRobotObjLocalXDirDefinitionType.I_OLXDDT_CARTESIAN, 1, 0, 0);
static string GetFormatedValues(IRobotFeResultComplex c, IRobotFeResultDetailed d)
=> string.Concat(new[] { d.QXX, d.QYY, c.MXX_TOP, c.MXX_BOTTOM, c.MYY_TOP, c.MYY_BOTTOM }
.Select(v => $"{v,15:F2}"));
void Print(string name, RobotFeResultParams Params) =>
WriteLine($"{name,-15}{GetFormatedValues(FeRS.Complex(Params), FeRS.Detailed(Params))}");
string main = "FE / Case";
string[] headers = ["QXX", "QYY", "MXX_TOP", "MXX_BOTTOM", "MYY_TOP", "MYY_BOTTOM"];
WriteLine("Project: " + RobApp.Project.Name);
WriteLine(main.PadRight(15) + string.Concat(headers.Select(h => h.PadLeft(15))));
foreach (int FeNo in FEsNumbers) { FePrms.Element = FeNo;
foreach (int CasNo in CaseNumbers) { FePrms.Case = CasNo;
IRobotCase cas = Structure.Cases.Get(CasNo); if (symbols.Any(cas.Name.Contains)) continue;
switch (cas.Type) {
case IRobotCaseType.I_CT_SIMPLE:
case IRobotCaseType.I_CT_COMBINATION:
if (cas.AnalizeType == IRobotCaseAnalizeType.I_CAT_DYNAMIC_SEISMIC)
FePrms.ModeCmb = IRobotModeCombinationType.I_MCT_CQC;
Print($"{FeNo} / {CasNo}", FePrms); break;
case IRobotCaseType.I_CT_MOBILE: FePrms.Case = CasNo;
IRobotMobileCaseComponentMngr Components = ((IRobotMobileCase)cas).Components;
for (int k = 1; k <= Components.Count; k++) {
FePrms.CaseCmpnt = Components.Get(k).Point; Print($"{FeNo} / {CasNo} / {FePrms.CaseCmpnt}", FePrms);
}
break;
}
}
}
}
see also Parse robot text lists into arrays of integers (offline)
Best Regards
Stéphane Kapetanovic
Did you find this post helpful? If it gave you one or more solutions,
don't forget to accept the solution and leave a < like !
