RSA 2024 API connection fault

RSA 2024 API connection fault

kmmdD66ZQ
Contributor Contributor
160 Views
8 Replies
Message 1 of 9

RSA 2024 API connection fault

kmmdD66ZQ
Contributor
Contributor

Hi 

I have an issue when trying to work with RSA 2024 through the API in both VBA

 

kmmdD66ZQ_0-1756112122437.png

kmmdD66ZQ_2-1756112282692.png

 

 

and in Python.

kmmdD66ZQ_1-1756112206541.png

 

This issue does not persist en either 2022/2023 and 2025 version?

 

Are there any known issues with 2024 ?

 

The issue is comes when trying to access anything under app.Project...

 

@Rafal.Gaweda 

 

 

 

0 Likes
161 Views
8 Replies
Replies (8)
Message 2 of 9

Stephane.kapetanovic
Mentor
Mentor

Hi @kmmdD66ZQ,

I think your questions are more directed to the support team, but I’d still like to raise a few doubts. For example, could you run this VBA code with Robot closed?

This example creates a cantilever column with a head load and retrieves the axial force and moment values at its midpoint

Sub CreateProjectAndCalculate()
  Dim RobApp As RobotApplication: Set RobApp = New RobotApplication
  With RobApp.Project
    .New I_PT_FRAME_3D
    With .Structure
      With .Nodes
        .Create 1, 0, 0, 0: .Get(1).SetLabel I_LT_SUPPORT, "Encastrement" ' replace by defaut fixed support name
        .Create 2, 0, 0, 6
      End With
      With .Bars
        .Create 1, 1, 2:    .Get(1).SetLabel I_LT_BAR_SECTION, "IPE 100" ' replace by defaut section
      End With
      With .Cases
        .CreateSimple 1, "Force", I_CN_EXPLOATATION, I_CAT_STATIC_LINEAR
        With .Get(1).Records.Create(I_LRT_NODE_FORCE)
          .Objects.FromText "2": .SetValue I_NFRV_FZ, -5000: .SetValue I_NFRV_FX, 500
        End With
      End With
    End With
    .CalcEngine.Calculate
    With .Structure.Results.Bars.Forces.Value(1, 1, 0.5) 'Results at midpoint
       Debug.Print .FX, .MY
    End With
  End With
  Set RobApp = Nothing
End Sub

And the result is:

 5000         -1500 

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 !
EESignature
0 Likes
Message 3 of 9

Stephane.kapetanovic
Mentor
Mentor

Your code cannot run correctly if robot is not started and a project is not loaded.

Dim RobApp As RobotApplication: Set RobApp = New RobotApplication
RobApp.Project.CalcEngine.Calculate
Set RobApp = Nothing

Stephanekapetanovic_1-1756206570246.png  < message obtained while it is not version 2024

if you want to start a new project, although there is nothing to calculate this code does not give an error ↓

Sub StartRobotAndCalculate()
  Dim RobApp As RobotApplication: Set RobApp = New RobotApplication
  RobApp.Visible = -1
  RobApp.Project.New I_PT_FRAME_3D
  RobApp.Project.CalcEngine.Calculate
  Set RobApp = Nothing
End Sub

If you think that some API functions are not correctly installed, you can also try through the kernel.

RobApp.Kernel.Project.CalcEngine.Calculate

 

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 !
EESignature
0 Likes
Message 4 of 9

Stephane.kapetanovic
Mentor
Mentor

hi @kmmdD66ZQ 

For the Python code, I will refrain from answering, as it depends on your specific installation and configuration. The error message you observed is more likely due to an improperly loaded referenced library or Python’s interpretation of COM functions, rather than an actual problem in the API itself.

The errors you encountered both stopped at the same point but for different reasons: in VBA, due to a possible missing project definition blocking the calculations, and in Python, because RobotApplication was not correctly instantiated, preventing any further execution.

After consulting with another expert, it appears that the Robot API has not been rewritten for version 2024. If the error persists, you may try migrating to a newer release.

However, if your intention is to develop programs that can run on different machines regardless of the installed Robot version, It is often better to target an older version of the API, as this usually ensures forward compatibility with newer versions.

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 !
EESignature
0 Likes
Message 5 of 9

kmmdD66ZQ
Contributor
Contributor

I am aware of that I cannot run calculation if nothing is open and loaded.

 

I run the second code snippet you have here in debug mode I see in my excel that "Project" is not available to step into. even though I have the correct reference to 2024.

 

kmmdD66ZQ_0-1756367733513.png

 

0 Likes
Message 6 of 9

kmmdD66ZQ
Contributor
Contributor

This code snippet works, but even though I tick of reference in excel to be ROBOT 2024 it forces itself to open 2025.

 

kmmdD66ZQ_1-1756368019295.png

 

0 Likes
Message 7 of 9

kmmdD66ZQ
Contributor
Contributor

In the case of Python I believe I will work with 2025 instead.

0 Likes
Message 8 of 9

Stephane.kapetanovic
Mentor
Mentor

hi @kmmdD66ZQ 

try reinstalling your sdk or an earlier version

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 !
EESignature
0 Likes
Message 9 of 9

Stephane.kapetanovic
Mentor
Mentor

I do not recommend working with multiple versions of the API in VBA.

Yes, even if you choose version 2024 in references, it is possible that your machine will point to version 2025.

A test could be to uninstall versions other than 2024 and restart the programs.

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 !
EESignature
0 Likes