hi @danielroure2267
As explained in PM, it’s not easy to give you proper advice since you haven’t described the data usage cycle.
The answer to your question (Do you know if it is possible to link these two pieces of information?) is probably already in my previous reply: either use a match score and/or rely on one of the UserID or Description properties, the latter allows interaction both in the table and through the API.
This code allows you to retrieve the UniqueID information from the table. It is also possible to reverse the process to extract a number contained in the text.
After running the macro, open the load table or update the table values by right-clicking.
Python
import win32com.client
def FlashLoadRecordDescription():
structure = win32com.client.Dispatch("Robot.Application").Project.Structure
cases = structure.Cases.GetMany(structure.Selections.CreatePredefined(2))
for i in range(1, cases.Count + 1):
cas = cases.Get(i)
if cas.Type != 0 or cas.AnalizeType == 11: continue
records = cas.Records
for j in range(1, records.Count + 1):
rec = records.Get(j)
rec.Description = f"UniqueID: {rec.UniqueId}".rstrip()
if __name__ == "__main__": FlashLoadRecordDescription()
C#
using static RobotOM.IRobotCaseType;
using static RobotOM.IRobotCaseAnalizeType;
using static RobotOM.IRobotPredefinedSelection;
public static void FlashLoadRecordDescription() {
var structure = new RobotApplication().Project.Structure;
var cases = structure.Cases.GetMany(structure.Selections.CreatePredefined(I_PS_CASE_SIMPLE_CASES));
for (int i = 1; i <= cases.Count; i++) { IRobotCase cas = cases.Get(i);
if (cas.Type != I_CT_SIMPLE || cas.AnalizeType == I_CAT_DYNAMIC_MODAL) continue;
var records = ((RobotSimpleCase)cas).Records;
for (int j = 1; j <= records.Count; j++) {
if (((IRobotLoadRecordCommon)records.Get(j)).IsAutoGenerated) continue;
dynamic rec = records.Get(j); rec.Description = $"UniqueID: {rec.UniqueId}";
}
}
}
C++
#include <Windows.h>
#include <iostream>
#include <comdef.h>
#include <string>
#include "x64/Debug/RobotOM.tlh"
#import "C:\Program Files\Autodesk\Robot Structural Analysis Professional 2027\Exe\RobotOM.tlb" \
no_namespace rename("LoadCase", "_LoadCase")
// Fallback for record types that do not implement IRobotLoadRecord2
static long GetUniqueIdDynamic(IDispatchPtr disp) {
DISPID dispid;
LPOLESTR name = const_cast<LPOLESTR>(L"UniqueId");
if (FAILED(disp->GetIDsOfNames(IID_NULL, &name, 1, LOCALE_USER_DEFAULT, &dispid))) return -1;
DISPPARAMS params = { nullptr, nullptr, 0, 0 };
VARIANT result;
VariantInit(&result);
disp->Invoke(dispid, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET, ¶ms, &result, nullptr, nullptr);
long val = (result.vt == VT_I4) ? result.lVal : -1; VariantClear(&result); return val;
}
int main() {
CoInitialize(NULL);
try {
IRobotApplicationPtr app; app.CreateInstance(__uuidof(RobotApplication));
IRobotStructurePtr structure = app->Project->Structure;
IRobotSelectionPtr simpleCases = structure->Selections->CreatePredefined(IRobotPredefinedSelection::I_PS_CASE_SIMPLE_CASES);
IRobotCaseCollectionPtr cases = structure->Cases->GetMany(simpleCases);
for (long i = 1; i <= simpleCases->Count; i++) {
IRobotCasePtr cas = cases->Get(i); if (cas->Type != I_CT_SIMPLE || cas->AnalizeType == I_CAT_DYNAMIC_MODAL) continue;
IRobotLoadRecordMngrPtr records = ((IRobotSimpleCasePtr)cas)->Records;
for (long j = 1; j <= records->Count; j++) {
IRobotLoadRecordPtr rec = records->Get(j); if (((IRobotLoadRecordCommonPtr)rec)->IsAutoGenerated) continue;
IRobotLoadRecord2Ptr rec2 = rec; long uid = rec2 ? rec2->UniqueId : GetUniqueIdDynamic(rec);
rec->Description = (L"UniqueID: " + std::to_wstring(uid)).c_str();
}
}
std::cout << "Done.\n";
} catch (const _com_error& e) { std::wcout << L"COM error: " << e.ErrorMessage() << L"\n"; }
CoUninitialize(); return 0;
}
VBA
Sub FlashLoadRecordDescription()
Dim Cas As IRobotCase, SimpleCas As RobotSimpleCase
Dim commonRec As IRobotLoadRecordCommon, rec As IRobotLoadRecord
With New RobotApplication
With .Project.Structure
With .Cases.GetMany(.Selections.CreatePredefined(I_PS_CASE_SIMPLE_CASES))
For i = 1 To .Count: Set Cas = .Get(i)
If Cas.AnalizeType <> I_CAT_DYNAMIC_MODAL And Cas.Type = I_CT_SIMPLE Then
Set SimpleCas = Cas
With SimpleCas.Records
For j = 1 To .Count: Set commonRec = .Get(j)
If Not commonRec.IsAutoGenerated Then
Set rec = .Get(j): rec.Description = "UniqueID :" & rec.UniqueID
End If
Next j
End With
End If
Next i
End With
End With
End With
End Sub

Best Regards
updated
Stéphane Kapetanovic
Did you find this post helpful? If it gave you one or more solutions,
don't forget to click the Accept Solution button and leave a < like !
