Announcements

Community notifications may experience intermittent interruptions between 10–12 November during scheduled maintenance. We appreciate your patience.

Export results ARSA via API

Export results ARSA via API

Anonymous
Not applicable
15,937 Views
74 Replies
Message 1 of 75

Export results ARSA via API

Anonymous
Not applicable

Hi,

 

I would like to export the results of efforts with VBA in excel files like in the video attached.

 

Can you help me ?

 

Export result

0 Likes
Accepted solutions (3)
15,938 Views
74 Replies
Replies (74)
Message 21 of 75

Rafal.Gaweda
Autodesk Support
Autodesk Support

First remark - something is wrong with cases loop if you have more than 1 case selected.

 



Rafal Gaweda
0 Likes
Message 22 of 75

Rafal.Gaweda
Autodesk Support
Autodesk Support

Take a look at green code below. 

This sub should work fine.

 

Sub extraction_resultats_cas()

 

Range("A13", "F25000").Clear
Range("B5").Clear

Set RobApp = New RobotApplication

If Not RobApp.Visible Then
Set RobApp = Nothing
MsgBox "Open Robot and load Model", vbOKOnly, "ERROR"
Exit Sub
Else
' If (RobApp.Project.Type <> I_PT_FRAME_3D) And (RobApp.Project.Type <> I_PT_SHELL) Then
' MsgBox "Structure Type should be FRAME 3D or SHELL", vbOKOnly, "ERROR"
' Exit Sub
' End If
Cells(5, 1) = "Project"
Cells(5, 2) = RobApp.Project.Name

'selection des barres

'If CheckBox1 = True Then

'Dim BarCol As RobotBarCollection
'Set BarCol = RobApp.Project.Structure.Bars.GetAll

'Else

Dim RSelection As RobotSelection
Set RSelection = RobApp.Project.Structure.Selections.Get(I_OT_BAR)
Dim BarCol As RobotBarCollection
Set BarCol = RobApp.Project.Structure.Bars.GetMany(RSelection)
Dim num_bar As String

' If (BarCol.Count = 0) Then c'est un test de selection du modele
' If (MsgBox("No bars selected in Robot. Do you want to import results for all bars?", vbYesNo, "Warning") = vbYes) Then
num_bar = Cells(8, 2)
If num_bar = "" Then
If (MsgBox("Pas de numéro de barres indiqué ! Voulez-vous selectionner toutes les barres?", vbYesNo, "Warning") = vbYes) Then
RSelection.FromText "all"
RSelection.AddText "tous"
Set BarCol = RobApp.Project.Structure.Bars.GetMany(RSelection)
Else
Set BarCol = Nothing
Exit Sub
End If
' ajout condition pour rentrer soi-meme les numéros de barres
Else
RSelection.FromText num_bar
Set BarCol = RobApp.Project.Structure.Bars.GetMany(RSelection)
End If

'End If


Set RSelection = RobApp.Project.Structure.Selections.Get(I_OT_CASE)
Dim CaseCol As RobotCaseCollection
Set CaseCol = RobApp.Project.Structure.Cases.GetMany(RSelection)
Dim num_cas As String

num_cas = Cells(9, 2)

' If (CaseCol.Count = 0) Then
If num_cas = "" Then
If (MsgBox("Pas de cas ou combinaisons indiqué ! Voulez-vous importer les résultats de tous les cas ?", vbYesNo, "Warning") = vbYes) Then
RSelection.FromText "all"
RSelection.AddText "tous"
Set CaseCol = RobApp.Project.Structure.Cases.GetMany(RSelection)
Else
Set CaseCol = Nothing
Exit Sub
End If
Else
RSelection.FromText num_cas
Set CaseCol = RobApp.Project.Structure.Cases.GetMany(RSelection)
End If

Cells(9, 2) = RSelection.ToText

NumberOfPoints = Int(Cells(10, 2).Value)

If (NumberOfPoints < 2) Then
MsgBox "Number of points along the bar must be greater or equal to 2", vbOKOnly, "Error"
Exit Sub
End If

'Sleep 10000

Row = 12
' Cells(Row, 1) = "Barre"
' Cells(Row, 2) = "Noeud"
' Cells(Row, 3) = "Cas (/ Composante)"
'
' Cells(Row, 4) = "FX [kN]"
' Cells(Row, 5) = "FZ [kN]"
' Cells(Row, 6) = "MY [kN.m]"

Cells(19, 9) = "Progression"

For i = 1 To BarCol.Count
Cells(20, 9) = Str(i) + " / " + Str(BarCol.Count)


Dim RBar As RobotBar
Set RBar = BarCol.Get(i)

BarNumber = RBar.Number
BarStr = Str(BarNumber)
OriNodeStr = Str(RBar.StartNode)
EndNodeStr = Str(RBar.EndNode)



Dim BFD As RobotBarForceData
Dim Icomp As Integer

Dim BarForceServer As RobotBarForceServer
Set BarForceServer = RobApp.Project.Structure.Results.Bars.Forces

Dim Point As Double
Dim Step As Double

Point = 0#
Step = 1# / (NumberOfPoints - 1)

For ii = 1 To NumberOfPoints

For j = 1 To CaseCol.Count


AT = CaseCol.Get(j).AnalizeType

If AT <> I_CAT_COMB_CODE _
And AT <> I_CAT_COMB _
And AT <> I_CAT_COMB_NONLINEAR _
And AT <> I_CAT_STATIC_LINEAR _
And AT <> I_CAT_STATIC_NONLINEAR Then
MsgBox "This macro works only for simple load cases, combinations and automatic combinations", vbOKOnly, "Error"
Exit Sub
End If

UNC = CaseCol.Get(j).Number
CaseStr = Str(UNC)
If CaseCol.Get(j).Type = I_CT_CODE_COMBINATION Then ' pour les combinaisons

Dim CCount As Integer
CCount = CaseCol.Get(j).Components.Count
Dim StrCC As String
StrCC = Str(CCount)

If InStr(CaseCol.Get(j).Name, "+") <> 4 And InStr(CaseCol.Get(j).Name, "-") <> 4 And InStr(CaseCol.Get(j).Name, "+") <> 8 And InStr(CaseCol.Get(j).Name, "-") <> 8 Then
For Icomp = 1 To CCount

CompStr = " / " + Str(Icomp)

Row = Row + 1

If ii = 1 Then
Cells(Row, 1) = BarStr
Cells(Row, 2) = OriNodeStr
Cells(Row, 3) = CaseStr + CompStr
ElseIf ii = NumberOfPoints Then
Cells(Row, 1) = BarStr
Cells(Row, 2) = EndNodeStr
Cells(Row, 3) = CaseStr + CompStr
Else
Cells(Row, 1) = BarStr + Str(ii) + " /" + Str(NumberOfPoints) + " / " + CaseStr + CompStr
End If

Set BFD = BarForceServer.ValueEx(BarNumber, UNC, Icomp, Point)
Cells(Row, 4) = BFD.FX * 0.001
Cells(Row, 5) = BFD.FZ * 0.001
Cells(Row, 6) = BFD.MY * 0.001

Set BFD = Nothing
Next Icomp
End If
Else ' pour les cas simples
Row = Row + 1
If ii = 1 Then
Cells(Row, 1) = BarStr
Cells(Row, 2) = OriNodeStr
Cells(Row, 3) = CaseStr
ElseIf ii = NumberOfPoints Then
Cells(Row, 1) = BarStr
Cells(Row, 2) = EndNodeStr
Cells(Row, 3) = CaseStr
Else
Cells(Row, 1) = BarStr
Cells(Row, 2) = Str(ii) + " /" + Str(NumberOfPoints)
Cells(Row, 3) = CaseStr

End If

Set BFD = BarForceServer.Value(BarNumber, UNC, Point)
Cells(Row, 4) = BFD.FX * 0.001
Cells(Row, 5) = BFD.FZ * 0.001
Cells(Row, 6) = BFD.MY * 0.001

Set BFD = Nothing

End If


Next j
Point = Point + Step
Next ii

Next i

End If
Cells(19, 9) = ""
Cells(20, 9) = ""

End Sub



Rafal Gaweda
0 Likes
Message 23 of 75

Anonymous
Not applicable

ok thanks, do you know how to change with API the scale of results on graphic ?

 

scale

0 Likes
Message 24 of 75

Anonymous
Not applicable

Bonjour,

 

Do you know how to export the reactions kz like :

 

Set BFD = BarForceServer.Value(BarNumber, UNC, Point)

Cells(Row, 7) = BFD.KZ * 0.001

 

réaction Kz

0 Likes
Message 25 of 75

Rafal.Gaweda
Autodesk Support
Autodesk Support

mateaus wrote:

ok thanks, do you know how to change with API the scale of results on graphic ?

 

I am afraid it is not possible to control scale by API.

 



Rafal Gaweda
0 Likes
Message 26 of 75

Rafal.Gaweda
Autodesk Support
Autodesk Support

mateaus 

 

Do you know how to export the reactions kz like :

 

Set BFD = BarForceServer.Value(BarNumber, UNC, Point)

Cells(Row, 7) = BFD.KZ * 0.001

 

This is KZ value , the one to the left from Reaction KZ checkbox shown on your screen capture

 

réaction Kz

 

Raction KZ is not available thru API. You have to calculate it by yourself \ your code.

Example below - additional code in green.

Keep in mind that results strongly depend on number of points along bar and compaxity of KZ diagram.

 

.

.

.

Step = 1# / (NumberOfPoints - 1)


Dim KZReaction() As Double
ReDim KZReaction(2)
KZReaction(1) = 0#
Dim EleLen As Double
EleLen = 0#
Dim KZAComb As Boolean
Dim KZACode As Boolean
KZACode = False
KZAComb = False
Dim CCount As Integer

If CaseCol.Get(j).Type = I_CT_CODE_COMBINATION Then
CCount = CaseCol.Get(j).Components.Count
ReDim KZReaction(CCount)

For iicomp = 1 To CCount
KZReaction(iicomp) = 0#
Next iicomp
End If

For ii = 1 To NumberOfPoints

If CaseCol.Get(j).Type = I_CT_CODE_COMBINATION Then



Dim StrCC As String
StrCC = Str(CCount)

If InStr(CaseCol.Get(j).Name, "+") <> 4 And InStr(CaseCol.Get(j).Name, "-") <> 4 And InStr(CaseCol.Get(j).Name, "+") <> 8 And InStr(CaseCol.Get(j).Name, "-") <> 8 Then


For Icomp = 1 To CCount

CompStr = "/" + Right(Str(Icomp), Len(Str(Icomp)) - 1)

Row = Row + 1

If ii = 1 Then
Cells(Row, 1) = barstr + OriNodeStr + CaseStr + CompStr
ElseIf ii = NumberOfPoints Then
Cells(Row, 1) = barstr + EndNodeStr + CaseStr + CompStr
Else
Cells(Row, 1) = barstr + Str(ii) + "/" + Right(Str(NumberOfPoints), Len(Str(NumberOfPoints)) - 1) + " / " + CaseStr + CompStr
End If

Set BFD = BarForceServer.ValueEx(BarNumber, UNC, Icomp, Point)
Cells(Row, 2) = BFD.FX
Cells(Row, 3) = BFD.FZ
Cells(Row, 4) = BFD.MY
' Cells(Row, 5) = BFD.KZ

KZACode = BFD.KZAvailable
If KZACode Then
EleLen = RBar.Length / (NumberOfPoints - 1)

If ii = 1 Or ii = NumberOfPoints Then EleLen = EleLen / 2
' Cells(Row, 6) = BFD.KZ * EleLen
KZReaction(Icomp) = KZReaction(Icomp) + BFD.KZ * EleLen
End If
Set BFD = Nothing
Next Icomp
End If
Else
Row = Row + 1
If ii = 1 Then
Cells(Row, 1) = barstr + OriNodeStr + CaseStr
ElseIf ii = NumberOfPoints Then
Cells(Row, 1) = barstr + EndNodeStr + CaseStr
Else
Cells(Row, 1) = barstr + Str(ii) + "/" + Right(Str(NumberOfPoints), Len(Str(NumberOfPoints)) - 1) + " / " + CaseStr
End If

Set BFD = BarForceServer.Value(BarNumber, UNC, Point)
Cells(Row, 2) = BFD.FX
Cells(Row, 3) = BFD.FZ
Cells(Row, 4) = BFD.MY
' Cells(Row, 5) = BFD.KZ
KZAComb = BFD.KZAvailable
If KZAComb Then
EleLen = RBar.Length / (NumberOfPoints - 1)

If ii = 1 Or ii = NumberOfPoints Then EleLen = EleLen / 2
' Cells(Row, 6) = BFD.KZ * EleLen
KZReaction(1) = KZReaction(1) + BFD.KZ * EleLen
End If
Set BFD = Nothing

End If
Point = Point + Step

Next ii
If KZAComb Then
Cells(Row, 7) = "KZ Reaction for bar " & Str(BarNumber) & " Case " & CaseStr
Cells(Row, 8) = KZReaction(1)
KZAComb = False
End If
If KZACode Then
For Icomp = 1 To CCount
Cells(Row - CCount + Icomp, 7) = "KZ Reaction for bar " & Str(BarNumber) & " Case " & CaseStr & " /" & Str(Icomp)
Cells(Row - CCount + Icomp, 8) = KZReaction(Icomp)
KZACode = False
Next Icomp
End If
Next j
Next i

End If
Cells(20, 8) = ""
Cells(20, 9) = ""
End Sub

 



Rafal Gaweda
0 Likes
Message 27 of 75

Anonymous
Not applicable

Hi,

 

I would like to export results of my plate with VBA. 

 

Now I'm doing this :

 

mode d'emploi_extraction robot cas elet finis.png

 

Can you give the macro to export it in excel automatically for simple case and moving case (only composant LM2 + LM2 _ ...) together ?

0 Likes
Message 28 of 75

Rafal.Gaweda
Autodesk Support
Autodesk Support

Take a look at attached xls



Rafal Gaweda
Message 29 of 75

Anonymous
Not applicable

Ok good but I'm looking for results by nodes.

 

Have good something for me ?

 

Thanks

0 Likes
Message 30 of 75

Rafal.Gaweda
Autodesk Support
Autodesk Support
Accepted solution

Example attached



Rafal Gaweda
Message 31 of 75

Anonymous
Not applicable

Hi,

 

is it possible to have a table of resultant loads like that :

 

descente charges.png

 

Thank you for your answer.

0 Likes
Message 32 of 75

Anonymous
Not applicable

Hi,

 

Is that possible to export results of a cut of a slab in a table :

 

coupes sur panneaux.PNG

0 Likes
Message 33 of 75

Anonymous
Not applicable

@Anonymous_Adsk wrote:

Take a look at attached xls


Hi,

 

To export results of panel, I would like to select only a list of finit elements (nodes).

 

Is that possible you modify your file ?

 

For the results I prefer to export the average in each node like this :

 

resultats elements finis.PNG

 

Thank you for you answer.

0 Likes
Message 34 of 75

Rafal.Gaweda
Autodesk Support
Autodesk Support

 

is it possible to have a table of resultant loads like that :

 

I do not knwo what is the centre de poussee and how it is calculated so you can take

 

RobApp.Project.Structure.Results.Nodes.Reactions.DDC*

or
RobApp.Project.Structure.Results.Nodes.Reactions.Sum*

 

to get Forces \ Moments Resultatntes then calculate  centre de poussee in your macro.



Rafal Gaweda
Message 35 of 75

Rafal.Gaweda
Autodesk Support
Autodesk Support

 

Is that possible to export results of a cut of a slab in a table :

 

I think:

either: generate view I_VT_DETAILED_ANALYSIS, generate panel cut and make screen capture of this view

or

get reduced results from panel

RobApp.Project.Structure.Results.FiniteElems.Reduced.*

 



Rafal Gaweda
Message 36 of 75

Rafal.Gaweda
Autodesk Support
Autodesk Support

 

For the results I prefer to export the average in each node like this :

 


File Attached.



Rafal Gaweda
Message 37 of 75

Anonymous
Not applicable

@Anonymous_Adsk wrote:

 

For the results I prefer to export the average in each node like this :

 


File Attached.


Ok for the option of results but I would like to ask for a list of nodes and not all of them.

 

I your file you have to select in the model before. I would like to ask in cases of excel file for results of a chosen list of elements (nodes of a panel) and cases.

 

Can you modify your macro for it ?

 

Thank you for you answer.

 

0 Likes
Message 38 of 75

Rafal.Gaweda
Autodesk Support
Autodesk Support
I would like to ask in cases of excel file for results of a chosen list of elements (nodes of a panel) and cases.

 for selection of fes and nodes attached

 



Rafal Gaweda
Message 39 of 75

Anonymous
Not applicable

@Anonymous_Adsk wrote:
I would like to ask in cases of excel file for results of a chosen list of elements (nodes of a panel) and cases.

 for selection of fes and nodes attached

 


Hi it doesn't work I think. Can we enter a list of nodes in a excel cell and have the results of the selection ?

0 Likes
Message 40 of 75

Rafal.Gaweda
Autodesk Support
Autodesk Support

for selection of fes and nodes attached

 


Hi it doesn't work I think. Can we enter a list of nodes in a excel cell and have the results of the selection ?


No it works on nodes selection and FEs selection made in Robot



Rafal Gaweda
0 Likes