Installing 3DFrame-py

Updated 1st Feb 2025.

As mentioned in the previous post, the installation process for the 3DFrame-py spreadsheet has changed with the new version. Also there have been some significant changes to the code to fix installation problems. Updated files are at:

3DFrame-py.zip

The frame analysis uses the Scipy linear algebra functions called from pyLinalgfuncs3, other Scipy functions called from pyScipy3, and a beam analysis function called from BeamAct_2, which must all be available on the Python path. BeamAct_2 is included in the download file. The other two are included in:

pySciPyzip

The Scipy functions include very recent updates, so download the latest version even if you already have it installed.

The 3DFrame-py download file includes:

  • 3DFrame-py-comb.xlsb: Spreadsheet with added provision for factored load combinations and saving multiple load cases and results.
  • 3DFrame-py.xlsb: The basic spreadsheet, including data for a small example frame
  • 3DFrame-py Strand7 check.xlsb: Results for the small frame compared with Strand7 results.
  • 3DFrame-py-vvbig.xlsb: Spreadsheet with input and results for a much larger frame
  • 3DFrame-py-Mastan.xlsb, 3DFrame-py-Mastan steel1.xlsb, 3DFrame-py-Strand7 Steel1.xlsb: Results compared with the Mastan frame analysis package, and Strand7 using steel sections.
  • Load3DFrame.py: Python code to load the 3DFrame-py code at startup of the associated spreadsheet
  • py_3DFrame1_2.py: The 3DFrame-py code, using the Numba just-in-time compiler.
  • py_3DFrame1_2-nojit.py: The same code but without any calls to Numba jit compilation.
  • BeamAct_2py: Beam analysis functions

In addition to the download files, the following modules are used:
Required:

  • pyxll
  • Numpy and Scipy
  • ctypes

Optional:

The spreadsheet has VBA code to automatically load the Python frame analysis code when the file is opened:

Public Sub Workbook_Open()
Dim iErr As Long

Application.EnableEvents = True
iErr = Run("Load3DFrame")
End Sub

The Load3DFrame module should either be added to the list of files opened at startup, in the pyxll.cfg file, or the code below should be added to an existing startup file:

import pyxll
from pyxll import xl_menu, xl_macro, xl_app, xlcAlert
import importlib as imp

@xl_macro
@xl_menu("Frame Analysis", menu="Load")
def Load3DFrame():
    xl = xl_app()
    usejit = xl.Range("Usejit").Value
    try:
        usejit = xl.Range("Usejit").Value
    except:
        usejit = 0
    try:
        if usejit == 0:
            imp.import_module('py_3DFrame1_2-nojit')
        else:
            imp.import_module('py_3DFrame1_2')

        pyxll.rebind()
        xlcAlert('Frame Analysis module import completed')
    except ImportError as e:
        xlcAlert(f'Module not imported: {e}')
    except Exception as e:
        xlcAlert(f'Error: {e}')
    return 0

Note that:

  • The Load3DFrame function has added error handling to return a message if any modules fail to load. If the Frame Analysis module is imported successfully, but the analysis does not work, have a look at the pyxll log file, which should indicate the source of the problem.
  • This is still a work in progress, and all results must be carefully checked.
Posted in Arrays, Beam Bending, Excel, Finite Element Analysis, Frame Analysis, Link to Python, Newton, NumPy and SciPy, PyXLL, Strand7, UDFs | Tagged , , , , , , , , , , , , | 4 Comments

3DFrame-py; with non-linear analysis

Exactly a year since the previous update I have revised the 3DFrame-py spreadsheet with the addition of non-linear analysis options.

The new files can be downloaded from:

3DFrame-py.zip

Details of file installation, and required software are at:

3DFrame-py

Minor revisions to the installation files will be covered in the next post.

The new code allows for non-linear analysis for geometric effects and/or using moment-curvature tables for non-linear flexural effects.

Enter 0 or 1 in the appropriate column to exclude or include the non-linear analysis.

For moment-curvature non-linearity to be included, moment curvature tables must be added to the new Input3 sheet, and the table allocated to each property type added in the new “MomCurve Table” column on the right.

Note that:

  • The non-linear analysis does not currently work with warping effects included. The warping code still works with the linear analysis option set.
  • Code linking to the Numba just-in-time compiler needs more work. At present it works, but gives no performance improvement.

The non-linear code has been checked against Strand7 analyses for the frame below, with high axial loads applied to the horizontal members.

Vertical deflection results are shown below for the linear, non-linear geometry, and non-linear geometry and material effects. It can be seen there is a large increase in deflections due to non-linear effects, with good agreement between the Strand7 and 3DFrame results.

There was also a large increase in bending moments in the geometric non-linear analysis, with a small additional increase from moment-curvature effects. There was again close agreement between the Strand7 and 3DFrame results.

Posted in Beam Bending, Excel, Finite Element Analysis, Frame Analysis, Link to Python, Newton, PyXLL, Strand7, UDFs | Tagged , , , , , , , , , , , | Leave a comment

Scipy Linalg functions stopped working

I recently noticed that the iterative linear algebra solvers in my pyLinAlgfuncs3.xlsb spreadsheet had stopped working. It turned out that the optional tolerance argument had been renamed ‘rtol’. Changing all the occurrences of the name in the Python code fixed the problem. The revised code and updated spreadsheet can be downloaded from:

py_SciPy.zip

For more details of the included functions, and links to related topics see: Scipy Functions with Excel and pyxll 7 – Linear Algebra.

Posted in Excel, Finite Element Analysis, Frame Analysis, Link to Python, Maths, Newton, NumPy and SciPy, PyXLL, UDFs | Tagged , , , , , , , , , , , | Leave a comment

Beam geometric non-linear effects – end loads

Following the previous post, I found some errors in the Python code:

  • Point loads applied at the left hand end generated incorrect results.
  • The effect of beam deflections on shear forces was not included.

These problems have now been fixed, and updated code and a revised spreadsheet have been added to the download file at:

py_GeomK.zip

The screenshots below show results with end point loads, compared with results from Strand7 and the 3DFrame spreadsheet:

Posted in Beam Bending, Excel, Finite Element Analysis, Frame Analysis, Link to Python, Newton, PyXLL, UDFs | Tagged , , , , , , | Leave a comment

Beam geometric non-linear effects – Python version

In 2018 I posted Beam geometric non-linear effects with a VBA based spreadsheet to calculate beam actions and deflections under combined transverse and axial load, allowing for geometric non-linear effects. I have now converted the code to Python, linking to Excel with pyxll, with several added features:

  • The beam flexural stiffness may be specified with moment-curvature tables, allowing material non-linear effects to be included.
  • The deflection output now includes the section curvature, as well as transverse deflection and slope.
  • Where moment-curvature tables are specified the flexural stiffness of each beam segment may based on either the average moment along the segment (default), or the maximum absolute moment.

Typical input and results are shown in the screenshots below. See the previous post for background on the analysis method used. The spreadsheet and required Python code can be downloaded from:

py_GeomK.zip

The first examples are based on a beam with two different cross sections, fixed for rotation and transverse deflection at both ends, and with an axial load close to the buckling load. The spreadsheet results are compared with results from Strand7 and from my 3DFrame spreadsheet.

Specifying moment-curvature tables, and an increased number of iterations significantly increases the deflections:

Doubling the number of beam segments improves the match between the alternative softwares used:

The results below are for a 20 m long beam with different end conditions:

Moment and transverse deflection fixed at both ends.

Transverse deflection restraint removed at the right hand end.

Moment restraint removed at both ends

Posted in Beam Bending, Excel, Finite Element Analysis, Frame Analysis, Link to Python, Newton, PyXLL, UDFs | Tagged , , , , , , | 1 Comment