Robot Structural Analysis Forum
Welcome to Autodesk’s Robot Structural Analysis Forums. Share your knowledge, ask questions, and explore popular Robot Structural Analysis topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Time History analysis and API

14 REPLIES 14
SOLVED
Reply
Message 1 of 15
ivanwouts
879 Views, 14 Replies

Time History analysis and API

Dear all,

 

For Robot Structural, I am trying to automatize Time History Analysis with VBA and API. The purpose is to model a running train at different speeds on a bridge.

I have found example of code to export THA results to Excel, but no example on how to code the THA load case and the time functions. The "Robot API.pdf" is sometimes difficult to understand and simple examples would be very useful and time saving. Are there code examples available?

 

Thank you in advance, Ivan Wouts

 

14 REPLIES 14
Message 2 of 15
Rafal.Gaweda
in reply to: ivanwouts

       Dim r As New RobotOM.RobotApplication
        Dim sc As RobotOM.RobotSimpleCase
        sc = r.Project.Structure.Cases.CreateSimple(2, "time", RobotOM.IRobotCaseNature.I_CN_EXPLOATATION, RobotOM.IRobotCaseAnalizeType.I_CAT_TIME_HISTORY)
        Dim thfl As RobotOM.RobotTimeHistoryFunctionList
        thfl = r.Project.Structure.Cases.TimeHistoryFunctions
        Dim thpc As RobotOM.RobotTimeHistoryPointsCollection
        thpc = thfl.Create()
        thpc.Add(0, 0)
        thpc.Add(1, 1)
        thpc.Add(2, 0)
        thfl.Store("a_function", thpc)
        Dim p As RobotOM.RobotTimeHistoryAnalysisParams
        p = sc.GetAnalysisParams()
        p.Set(-1, "a_function", 1, 1)
        sc.SetAnalysisParams(p)

 Another example attached



Rafal Gaweda
Message 3 of 15
ivanwouts
in reply to: Rafal.Gaweda

Thank you very much for your prompt answer. It is much appreciated.

 

 

Message 4 of 15
jkn
Participant
in reply to: Rafal.Gaweda

Hi Rafal

 

I am looking into the excel file THA creationex and getting an error, when trying to use it.

Could you maybe attach a robot-file, where the excel/vba code work on, so I can figure out, where the error in my file is?

 

The error is

Run-time error '-2147467259 (80004005)':

Method 'Get' of object 'IRobotTimehistoryAnalysisParams' failed

 

Best Regards

Jakob Nielsen

Message 5 of 15
jkn
Participant
in reply to: jkn

Hi Rafal

 

And maybe also a Robot-file where the "Time history point collection" code works in.

 

Best Regards

Jakob Nielsen

Message 6 of 15
Rafal.Gaweda
in reply to: jkn

Example attached.



Rafal Gaweda
Message 7 of 15
jkn
Participant
in reply to: Rafal.Gaweda

Thank you very much.

Message 8 of 15
jkn
Participant
in reply to: Rafal.Gaweda

Hi Rafal

 

I am trying to use the code, where you are making a pointcollection.

But am getting an error at the following line

"thpc.Add(0,0)"

 

If you get the time, please send an example?

Best Regards

Jakob

Message 9 of 15
marcinrakus
in reply to: jkn

Hi,

 

If You are using VBA try without brackets.

 

Regrads,

Marcin

Message 10 of 15
jkn
Participant
in reply to: marcinrakus

Thanks!

That helped.

 

But now I get another error

"Object variable or With block not set"

 

This line is highlighted in the vba code

        sc = r.Project.Structure.Cases.CreateSimple(2, "time", RobotOM.IRobotCaseNature.I_CN_EXPLOATATION, RobotOM.IRobotCaseAnalizeType.I_CAT_TIME_HISTORY)

 

 

Sub test()
       Dim r As New RobotOM.RobotApplication
        Dim sc As RobotOM.RobotSimpleCase
        sc = r.Project.Structure.Cases.CreateSimple(2, "time", RobotOM.IRobotCaseNature.I_CN_EXPLOATATION, RobotOM.IRobotCaseAnalizeType.I_CAT_TIME_HISTORY)
        Dim thfl As RobotOM.RobotTimeHistoryFunctionList
        thfl = r.Project.Structure.Cases.TimeHistoryFunctions
        Dim thpc As RobotOM.RobotTimeHistoryPointsCollection
        thpc = thfl.Create()
        thpc.Add 0, 0
        thpc.Add 1, 1
        thpc.Add 2, 0
        thfl.Store "a_function", thpc
        Dim p As RobotOM.RobotTimeHistoryAnalysisParams
        p = sc.GetAnalysisParams()
        p.Set -1, "a_function", 1, 1
        sc.SetAnalysisParams (p)
End Sub

 

Best Regards

Jakob

Message 11 of 15
marcinrakus
in reply to: jkn

Hi,

 

In VBA in front of every variable that is an object You have to write Set.

 

So, in Your case it would be:

Set sc = r.Project.Structure.Cases.CreateSimple(2, "time", RobotOM.IRobotCaseNature.I_CN_EXPLOATATION, RobotOM.IRobotCaseAnalizeType.I_CAT_TIME_HISTORY)

 

Regards,

Marcin

Message 12 of 15
jkn
Participant
in reply to: marcinrakus

Thanks a bunch!

Message 13 of 15
SPadID02
in reply to: Rafal.Gaweda

Hi Rafal

 

Would it be possible to get these results using the results query approach to speed up the process?

 

I am trying to tweak your code from this post https://forums.autodesk.com/t5/robot-structural-analysis-forum/api-is-there-a-way-to-get-results-fas...  but in the process of trying to run the original I am getting a 'Class not registered' error for

 

Res = RobApp.Project.Structure.Results.Query(RobResQueryParams, RobResRowSet)

 

which appears to be in relation to the 'RobResRowSet' part and so before I try to fix this error I want to make sure it is a possibility.

 

Of course if it is possible any code adjustments would be much appreciated! And also a fix for the Class error but I have seen a few posts for similar issues so will try those.

 

Thanks

Message 14 of 15
Rafal.Gaweda
in reply to: SPadID02

Hi @SPadID02 

 

Results.Query is only 64bit service.

Compile  \ build your app as (with) 64 bit app \ dll.

 



Rafal Gaweda
Message 15 of 15
fareed12
in reply to: SPadID02

Is possible to calculate Torsional Amplification factor (Ax ) by dynamic forces from (Response Spectrum Analysis) or need to make procedures to do it?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report