I recently discovered robbie van leeuwen’s structural engineering blog, which has an open-source set of Python routines for calculation of section properties, including torsion and warping constants. The program uses the MeshPY Library for generating the finite element meshes required for the torsion and warping calculations. The Python code for generation of the input to MeshPY, and for carrying out the finite element analyses, is all by Robbie van Leeuwen.

I have written an Excel front-end for these routines, allowing most of the functionality to be accessed quickly and easily, with no programming required. The spreadsheet, including full open source code, can be downloaded from:

## xlwSectProp.zip

The spreadsheet requires the following software to be installed:

- Windows version of Excel
- Python version 2.7 or later (not checked with version 3)
- xlwings version 0.11.4 or later
- Matplotlib, Numpy and Scipy
- The required MeshPY and other Python files are included with the download

The spreadsheet includes two calculation sheets:

- Twelve defined shapes
- Any shape defined by a series of coordinates

The screenshots below show the list of defined shapes and input and output for a rectangular hollow section:

Input cells are shaded blue. Select a section type by number (1-12) and the required dimensions will update. The optional input, Nu (Poisson’s Ratio) and mesh size (maximum area of each generated mesh element), is only required for the warping results. The applied actions are only required for display of stress results.

The section properties output is shown in the two screen-shots below. More detailed descriptions can be found at the on-line documentation.

For graphic display of the generated cross-section, element meshes, and stress plots under the input actions, click the “Display Stress Results” button:

17 images are shown in sequence in an external window. Close each image to move on to the next. There is currently no way to automatically save the images to the spreadsheet, but any image may be manually saved to disk as a png file. At present each image must be viewed in sequence before control is returned to the spreadsheet.

The image window may be dragged to any required size (or made full-screen):

Stress distributions are generated for each of applied actions, and combined stresses:

The image window has tools to zoom and pan, and edit output format:

Sections defined by co-ordinates may be analysed on the second sheet. The Python code has provision for analysis of sections with holes, but this is not yet implemented in the spreadsheet version:

The numerical results are as for the defined shapes:

The download file contains output for an asymmetrical I section, compared with the same section analysed in Strand7. The geometric results are in exact agreement, to machine accuracy, except for the plastic modulus results, which have larger, but still very small differences. The shear area, and torsion and warping constants have larger differences, due to different implementations of the finite element analysis, but are generally within 1%.

The output torsion and shear stress results from the spreadsheet are compared below with the equivalent results from Strand7:

Looks amazing. Could be great if somedays there will possibility to use generated results (pictures) directly in Excel

LikeLiked by 1 person

Feel free to play with the python code to write the results to Excel 🙂

See:

https://newtonexcelbach.com/2017/05/07/using-matplotlib-from-excel-with-xlwings-update/

LikeLike

I was talking about getting native pictures with mesh and isolines of stresses in section from Python 🙂 Is it possible at least theoretically?

LikeLike

Yes, it should be possible. Ill have a look when I have time, but not right now.

LikeLike

Is it possible to use this with sections with different materials? Like composite or rc sections?

LikeLike

I think the answer is that it is possible, but it would need a fair bit of work. I suggest asking at Robbie van Leeuwen’s site, as he is the author of the original code:

https://robbievanleeuwen.github.io/

LikeLike

Thanks for the quick reply and great works in your blog.

LikeLike

Pingback: SectionProperties update | Newton Excel Bach, not (just) an Excel Blog