Robot API Modal Analysis -Selecting specific mode

Robot API Modal Analysis -Selecting specific mode

GGB.BHB
Advocate Advocate
1,758 Views
10 Replies
Message 1 of 11

Robot API Modal Analysis -Selecting specific mode

GGB.BHB
Advocate
Advocate

Hi

I am using the Robot API to extract modal data directly to Excel to save time.  My code selects the modal load case as below

 

RobotSelection LoadCase_selection = robot.Project.Structure.Selections.Create(IRobotObjectType.I_OT_CASE);

LoadCase_selection.AddText(Convert.ToString(ModalLoadCase));

result_params.Selection.Set(IRobotObjectType.I_OT_CASE, LoadCase_selection); //Setting Load Case to ModalLoadCase

 

Is there a similar way to call a specific mode? My code currently scrolls through rows of results till it finds the correct mode as such (which is very slow as I have many mode shapes)

while (query_return != IRobotResultQueryReturnType.I_RQRT_DONE)

{

query_return = rserver.Query(result_params, row_set);

bool ok = new bool();

ok = row_set.MoveFirst();

 

while (ok)

{

int curr_mode = (int)row_set.CurrentRow.GetParam(IRobotResultParamType.I_RPT_MODE);

if (curr_mode == Mode)

{.........

 

Many Thanks

 

 

 

 

0 Likes
Accepted solutions (1)
1,759 Views
10 Replies
Replies (10)
Message 2 of 11

Rafal.Gaweda
Autodesk Support
Autodesk Support
Public robot As RobotApplication


Private Sub CommandButton2_Click()

Dim RobApp As New RobotOM.RobotApplication

Dim Res As IRobotResultQueryReturnType
Dim RobResQueryParams As RobotResultQueryParams
Dim RobResRowSet As New RobotResultRowSet

Dim SelNode As RobotSelection
Dim SelCas As RobotSelection

Set SelNode = RobApp.Project.Structure.Selections.Create(I_OT_NODE)
Set SelCas = RobApp.Project.Structure.Selections.Create(I_OT_CASE)
SelNode.AddText ("all")
SelCas.AddText ("2")

Set RobResQueryParams = RobApp.CmpntFactory.Create(I_CT_RESULT_QUERY_PARAMS)
RobResQueryParams.Selection.Set I_OT_NODE, SelNode
RobResQueryParams.Selection.Set I_OT_CASE, SelCas

RobResQueryParams.SetParam I_RPT_MODE, 2

RobResQueryParams.ResultIds.SetSize (3)

RobResQueryParams.ResultIds.Set 1, I_EVT_MODAL_EIGENVECTOR_UX
RobResQueryParams.ResultIds.Set 2, I_EVT_MODAL_EIGENVECTOR_UY
RobResQueryParams.ResultIds.Set 3, I_EVT_MODAL_EIGENVECTOR_UZ


Dim v As Double


Do
 Res = RobApp.Project.Structure.Results.Query(RobResQueryParams, RobResRowSet)
Dim ok As Boolean
ok = RobResRowSet.MoveFirst()
While ok
UX = RobResRowSet.CurrentRow.GetValue(RobResRowSet.ResultIds.Get(1))
UY = RobResRowSet.CurrentRow.GetValue(RobResRowSet.ResultIds.Get(2))
UZ = RobResRowSet.CurrentRow.GetValue(RobResRowSet.ResultIds.Get(3))
MsgBox UX, UY, UZ
ok = RobResRowSet.MoveNext()
Wend
Loop While Res = I_RQRT_MORE_AVAILABLE


End Sub


Rafal Gaweda
0 Likes
Message 3 of 11

GGB.BHB
Advocate
Advocate

Thanks Rafal for your response.

I am working in C# and the one line I believe I was missing was

RobResQueryParams.SetParam I_RPT_MODE, 2

which I converted to

result_params.SetParam(IRobotResultParamType.I_RPT_MODE,3);

 

Unfortunately this doesn't seem to work to reduce the data flowing through.  If I set the mode to 3 (as above) I can still get the results for Mode 26

using the call later on in the script.

int curr_mode = (int)row_set.CurrentRow.GetParam(IRobotResultParamType.I_RPT_MODE);

if (curr_mode == 26)

 

Any suggestions?

Many thanks

 

 

0 Likes
Message 4 of 11

Rafal.Gaweda
Autodesk Support
Autodesk Support
Accepted solution

result_params.SetParam(IRobotResultParamType.I_RPT_MODE,3);

 

Unfortunately this doesn't seem to work to reduce the data flowing through.  If I set the mode to 3 (as above) I can still get the results for Mode 26

using the call later on in the script.

 

You are right. This line should work but it does not.

You need to add mode check, as you did in code, for now.

 

It is needed to be corrected in software

 

You may try RobotNodeDisplacementServer.DynValue(...) or RobotAdvancedResultServer.Eigenvectors.Value()  but it might be slower than queryparams

 



Rafal Gaweda
0 Likes
Message 5 of 11

GGB.BHB
Advocate
Advocate

Thank you

Gillian Browning 

0 Likes
Message 6 of 11

hvdsidf
Enthusiast
Enthusiast

Bonjour,

 

I have tried to test your code, but it doesn't work in the line:

 

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

 

It seems that you have declared the variant "Dim RobResRowSet As New RobotResultRowSet", it is not SET, isn't it?

 

The message error for the variant "RobResRowSet" is : <Variable objet ou variable de bloc With non définie>

 

 

Thanks in advance for your reponse.

 

Structure Ile-de-France

0 Likes
Message 7 of 11

Rafal.Gaweda
Autodesk Support
Autodesk Support

RobApp.Project.Structure.Results.Query does not work in VBA nor is other 32 bits builds.

You need to use VB 64 bits or C# 64 bits to create dll or exe



Rafal Gaweda
Message 8 of 11

hvdsidf
Enthusiast
Enthusiast

Hi Rafal,

 

I'm a amateur "programmer".

If I understand well your message, you mean that I need to have VISUAL STUDIO?

 

Best regards,

HVD

 

0 Likes
Message 9 of 11

Rafal.Gaweda
Autodesk Support
Autodesk Support

Exactly



Rafal Gaweda
0 Likes
Message 10 of 11

rwemay
Participant
Participant

Hey Rafal, 

 

Is the filtered mode selection fixed/enabled in the API query method now? 

 

thanks, 

 

Rob

Message 11 of 11

Rafal.Gaweda
Autodesk Support
Autodesk Support

Hi @rwemay 

 

I am sorry, I am not aware of any fixes there.



Rafal Gaweda
0 Likes