0% found this document useful (0 votes)
2 views1 page

GRASP Python (11)

The document outlines a VBA script that processes structural analysis results, populating a worksheet with node reactions and element forces. It formats the results into tables and includes a summary of the analysis, detailing the counts of nodes, elements, supports, and loads. The script utilizes error handling to manage potential issues during execution.

Uploaded by

Le Fondateur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

GRASP Python (11)

The document outlines a VBA script that processes structural analysis results, populating a worksheet with node reactions and element forces. It formats the results into tables and includes a summary of the analysis, detailing the counts of nodes, elements, supports, and loads. The script utilizes error handling to manage potential issues during execution.

Uploaded by

Le Fondateur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

row = row + 1

For nodeId = 1 To nodes.Count


On Error Resume Next
Dim s As Support
Set s = supports("S" & nodeId)
If Not s Is Nothing Then
wsResults.Cells(row, 1).Value = "N" & nodeId
wsResults.Cells(row, 2).Value = reactions(3 * (nodeId - 1) + 1)
wsResults.Cells(row, 3).Value = reactions(3 * (nodeId - 1) + 2)
wsResults.Cells(row, 4).Value = reactions(3 * (nodeId - 1) + 3)
row = row + 1
End If
On Error GoTo 0
Next nodeId

' Format as table


wsResults.ListObjects.Add(xlSrcRange, wsResults.Range("A" & row -
nodes.Count & ":D" & row - 1), , xlYes).Name = "Reactions"

' Write element forces


row = row + 2
wsResults.Cells(row, 1).Value = "Element Forces"
row = row + 1
wsResults.Cells(row, 1).Value = "Element"
wsResults.Cells(row, 2).Value = "Node"
wsResults.Cells(row, 3).Value = "Axial (N)"
wsResults.Cells(row, 4).Value = "Shear (N)"
wsResults.Cells(row, 5).Value = "Moment (Nm)"

row = row + 1
Dim elemId As Integer
For elemId = 1 To elements.Count
wsResults.Cells(row, 1).Value = "E" & elemId
wsResults.Cells(row, 2).Value = "N" & elements("E" & elemId).node1
wsResults.Cells(row, 3).Value = elementForces(elemId, 1) ' Axial
wsResults.Cells(row, 4).Value = elementForces(elemId, 2) ' Shear
wsResults.Cells(row, 5).Value = elementForces(elemId, 3) ' Moment
row = row + 1

wsResults.Cells(row, 2).Value = "N" & elements("E" & elemId).node2


wsResults.Cells(row, 3).Value = elementForces(elemId, 4)
wsResults.Cells(row, 4).Value = elementForces(elemId, 5)
wsResults.Cells(row, 5).Value = elementForces(elemId, 6)
row = row + 1
Next elemId

' Format as table


wsResults.ListObjects.Add(xlSrcRange, wsResults.Range("A" & row - 2 *
elements.Count & ":E" & row - 1), , xlYes).Name = "ElementForces"

' Add summary and formatting


wsResults.Cells(1, 6).Value = "Analysis Summary"
wsResults.Cells(2, 6).Value = "Nodes: " & nodes.Count
wsResults.Cells(3, 6).Value = "Elements: " & elements.Count
wsResults.Cells(4, 6).Value = "Supports: " & supports.Count
wsResults.Cells(5, 6).Value = "Loads: " & loads.Count
wsResults.Cells(6, 6).Value = "Analysis Type: " & analysisType

P a g e 59 | 62

You might also like