Select simple cases when printing tables

Select simple cases when printing tables

Jelle.Visser
Participant Participant
1,707 Views
8 Replies
Message 1 of 9

Select simple cases when printing tables

Jelle.Visser
Participant
Participant

I'm trying to select only the simple cases before I print my reaction forces to csv.

However, reading through the documentation, I do find options to create cases, but I do not find a way to select a case for a table. I loop through the tables, and certain ones are "printed" to csv. However, now Reactions are all cases, I only want simple cases.

 

I tried to implement a solution given by @Stephane.kapetanovic

https://forums.autodesk.com/t5/robot-structural-analysis-forum/api-robot-vba-activate-or-select-load...

 

However, this does not seem to work. I would prefer to just the loadcase just for one table, because for the stresses and ratios I do want the combinations to be included.

                    Dim ViewMngr As IRobotViewMngr
                    Dim ActiveView As RobotView
                    Dim CaseSel As RobotSelection
                    Dim ActiveViewNumber As Long
                    ViewMngr = RobApp.Project.ViewMngr
                    For k = 1 To ViewMngr.ViewCount
                        If ViewMngr.GetView(k).Window.IsActive = -1 Then ActiveViewNumber = k : Exit For
                    Next k
                    ActiveView = ViewMngr.GetView(ActiveViewNumber)
                    CaseSel = ActiveView.Selection.Get(IRobotObjectType.I_OT_CASE)
                    CaseSel.FromText("Simple Cases")
                    ViewMngr.Refresh()
                    Console.WriteLine("Selected Simple Cases" & vbCrLf)

 

Now it crashes on line 10 (line 198 in the full script) with the message:

System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=RobotAPI
StackTrace:
at RobotAPI.Program.DumpTables() in C:\Users\Jelle.visser\source\repos\RobotAPI\RobotAPI\Program.vb:line 198

0 Likes
Accepted solutions (1)
1,708 Views
8 Replies
Replies (8)
Message 2 of 9

Stephane.kapetanovic
Mentor
Mentor

hi @Jelle.Visser 

the context is not the same

you confuse the selection of preliminary load cases to a parametric view with that relating to tabulated results

Best Regards

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

Jelle.Visser
Participant
Participant

Ah yes, I assumed I was doing something wrong. 
Can you point me in the right direction for selecting the active cases for tabulated results?
The documentation doesn't seem to have a clear solution, or at least I'm not seeing it. 

0 Likes
Message 4 of 9

Stephane.kapetanovic
Mentor
Mentor

@Jelle.Visser 

ok,

can you give me the full code?

The extract communicated concerns only the blocking point but it is not what you want.

Best Regards

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

Jelle.Visser
Participant
Participant

I can't paste the entire code here, that would be a bit long, but here is the repo:
https://github.com/Tebulo-Engineering/RobotAPI

The place where I tried to set the load case is line 189-201, and I print the reactions to csv on line 284 and onward

0 Likes
Message 6 of 9

Stephane.kapetanovic
Mentor
Mentor

hi @Jelle.Visser 

each RobotTable has a function Select that can accept for first IRobotSelectionType and for second parameter a string that could contain load cases
Ex : MyTable.Select I_ST_CASE, "1 2 3 ... "

Best regards

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

Jelle.Visser
Participant
Participant

Now when I add the following line after the if statement to check if it's the reactions table, it doesn't output any reaction csv anymore at all.

tf.Select(IRobotSelectionType.I_ST_CASE, "1 2 3 4 5 6 7 8")

Do note that I am programming in VB.NET, seeing your code, I assume that's vbs/vba?

The first 8 cases are the simple cases, so that's what I'd want to select, but as long as it works, it shouldn't be hard to change it.

0 Likes
Message 8 of 9

Stephane.kapetanovic
Mentor
Mentor
Accepted solution

hi @Jelle.Visser 

tf refer to RobotTableFrame  

Select method is part of IRobotTable interface

t is RobotTable and come from tf RobotTableFrame by method Get

 

Imports RobotOM.IRobotSelectionType '< at beginning
[...]
Dim t As RobotTable
Dim tf As RobotTableFrame
t = tf.Get(j)
t.Select(I_ST_CASE, "1to8") ' equivalent to IRobotSelectionType.I_ST_CASE

 

note that you can select bars by same method

 

t.Select(I_ST_BAR, "1 2 3 ...")

 

Best Regards

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

Jelle.Visser
Participant
Participant

Thank you, that works!