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

Python Results Display Automation

The document outlines a VBA function and subroutine for displaying results in an Excel worksheet. It creates a 'Results' worksheet, populates it with nodal displacements and support reactions, and formats the data as tables. The code includes error handling for existing worksheets and organizes the output for clarity.

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)
5 views1 page

Python Results Display Automation

The document outlines a VBA function and subroutine for displaying results in an Excel worksheet. It creates a 'Results' worksheet, populates it with nodal displacements and support reactions, and formats the data as tables. The code includes error handling for existing worksheets and organizes the output for clarity.

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

End If

' Return empty array to indicate failure


ReDim result(0)
SolveDirect = result
End Function

Sub DisplayResults(displacements() As Double, reactions() As Double,


elementForces() As Variant)
' Enhanced results display with multiple worksheets

' Create results worksheet


Dim wsResults As Worksheet
On Error Resume Next
Set wsResults = [Link]("Results")
If Not wsResults Is Nothing Then
[Link] = False
[Link]
[Link] = True
End If
On Error GoTo 0

Set wsResults =
[Link](After:=[Link]([Link]
[Link]))
[Link] = "Results"

' Write nodal displacements


[Link](1, 1).Value = "Node Displacements"
[Link](2, 1).Value = "Node"
[Link](2, 2).Value = "UX (m)"
[Link](2, 3).Value = "UY (m)"
[Link](2, 4).Value = "RZ (rad)"

Dim nodeId As Integer, row As Integer


row = 3
For nodeId = 1 To [Link]
[Link](row, 1).Value = "N" & nodeId
[Link](row, 2).Value = displacements(3 * (nodeId - 1) + 1)
[Link](row, 3).Value = displacements(3 * (nodeId - 1) + 2)
[Link](row, 4).Value = displacements(3 * (nodeId - 1) + 3)
row = row + 1
Next nodeId

' Format as table


[Link](xlSrcRange, [Link]("A1:D" & row - 1),
, xlYes).Name = "Displacements"

' Write reactions


row = row + 2
[Link](row, 1).Value = "Support Reactions"
row = row + 1
[Link](row, 1).Value = "Node"
[Link](row, 2).Value = "RX (N)"
[Link](row, 3).Value = "RY (N)"
[Link](row, 4).Value = "MZ (Nm)"

P a g e 58 | 62

You might also like