Function CreatePicture(Width As Long, Height As Long) As StdPicture
' Creates a blank picture of specified size
' ... [implementation]
End Function
Sub LogError(errNum As Long, errDesc As String, procName As String)
' Log errors to a dedicated worksheet
On Error Resume Next ' Prevent infinite loop if error occurs here
Dim wsLog As Worksheet
Set wsLog = ThisWorkbook.Worksheets("ErrorLog")
If wsLog Is Nothing Then
Set wsLog =
ThisWorkbook.Worksheets.Add(After:=ThisWorkbook.Worksheets(ThisWorkbook.Works
heets.Count))
wsLog.Name = "ErrorLog"
wsLog.Cells(1, 1).Value = "Timestamp"
wsLog.Cells(1, 2).Value = "Error Number"
wsLog.Cells(1, 3).Value = "Error Description"
wsLog.Cells(1, 4).Value = "Procedure"
End If
Dim nextRow As Long
nextRow = wsLog.Cells(wsLog.Rows.Count, 1).End(xlUp).Row + 1
wsLog.Cells(nextRow, 1).Value = Now
wsLog.Cells(nextRow, 2).Value = errNum
wsLog.Cells(nextRow, 3).Value = errDesc
wsLog.Cells(nextRow, 4).Value = procName
wsLog.Columns("A:D").AutoFit
End Sub
Key Enhancements in This Version:
1. Improved Visualization:
o Uses Windows API calls for proper drawing (lines, circles, etc.)
o Shows both original and deformed shapes (with adjustable scale)
o Better coordinate system handling and scaling
2. Robust Analysis Engine:
o Supports both direct and iterative solvers
o Comprehensive error handling for singular matrices
o Detailed error logging to worksheet
3. Enhanced Results Reporting:
o Creates formatted worksheets with results tables
o Includes nodal displacements, reactions, and element forces
o Automatic formatting as Excel tables
4. Extended Analysis Capabilities:
o Support for both 2D and 3D analysis (switchable via UI)
o Handles both frame and truss elements
o Configurable solver options
5. Better User Interface:
P a g e 61 | 62