wxTruss Documentation

A desktop GUI application for structural 2D Truss analysis via the Finite Element Method (FEM)

1. Introduction

wxTruss is an interactive, lightweight desktop application designed for modeling, analyzing, and visualizing 2D structures under axial loads (trusses). Built on top of wxPython for the user interface, Matplotlib for graphical rendering, and powered by the NuSA (Numerical Structural Analysis) finite element library, it bridges the gap between complex engineering software and simple educational tools.

Whether you are an engineering student learning structural analysis or a professional performing quick design validations, wxTruss provides an immediate visual response to structural loads, reactions, deformations, and internal member stresses.

2. End-User Manual

This section guides end-users step-by-step through setting up, analyzing, and inspecting a 2D truss model.

Step-by-Step Modeling Guide

Step 1: Set Up the Geometry (Nodes)

Click on the Nodes icon in the left vertical toolbar. A table will pop up. Enter the X and Y coordinates (e.g., in meters) for every joint in your structure. Once finished, click OK.

Step 2: Create Struts & Ties (Elements)

Click on the Elements icon in the toolbar. Under Ni (Initial Node) and Nj (Final Node), enter the integer labels of the nodes you want to connect. Specify the material properties: E (Young's Modulus, e.g., 200e9 for steel in Pascals) and A (Cross-sectional Area in square meters).

Step 3: Define Supports (Constraints)

Click on the Constraints icon. Select the node you wish to anchor. To prevent movement in X, enter 0 under UX. To prevent movement in Y, enter 0 under UY. Leaving a cell blank or entering a non-numeric value leaves that direction free.

Step 4: Apply Structural Loads (Forces)

Click on the Forces icon. Assign forces (in Newtons or corresponding units) to specific nodes by writing down the node index and specifying FX (horizontal force) or FY (vertical force). Negative values represent downward or leftward directions.

Step 5: Visualize the Model & Solve

Click the Plot Model icon to see your nodes, elements, loads (indicated as red arrows), and supports (triangles and rollers) updated in the window. Once verified, click the Solve button. A full, interactive HTML report will immediately load in the right-hand panel of the window.

Step 6: View the Deformed Shape

After solving, click on the Deformed Shape icon. The program will overlay a red dashed line over your original blue structure, visually magnifying the displacement of the nodes under the given loads.

Understanding Graphical Symbols

  • Green Triangle with hatched ground: A fully fixed support (pinned support restricting both X and Y movement).
  • Green Triangle with two wheels underneath: A roller support restricting vertical movement (UY) while allowing horizontal drift.
  • Orange Triangle with wheels on the side: A roller support restricting horizontal movement (UX) while allowing vertical drift.
  • Red Arrows: Active concentrated loads. The size of the arrow self-adjusts based on the global dimensions of your layout.

3. Interactive Grid Features

The dialog grids in wxTruss act similarly to standard spreadsheet software and include several hidden features to speed up your modeling:

Pro-Tip: Spreadsheet Formulas
You can input mathematical expressions directly into any cell. Simply start your cell entry with an equals sign (=). For instance, typing =200*10**9 and pressing Enter will automatically compute and write 200000000000.0.

Right-Click Context Menu

Right-clicking anywhere inside the grids opens an options menu:

  • Add rows...: Appends a new blank row to the bottom of the active sheet.
  • Delete rows: Deletes the currently selected row(s).
  • Fill columns randomly: Fills selected coordinates or properties with arbitrary values (useful for quick structural testing and noise generation).

4. Developer Reference

For developers wanting to modify, extend, or understand the codebase, here is the architecture of the primary modules.

Core UI Frame: wxTruss

This is the main container of the application. It inherits from wx.Frame. It handles events from the menu bar, coordinates the Matplotlib figure canvas, and passes numerical data to the NuSA FEA library.

Key GUI Subclasses

Class Name Inherits From Responsibility
DataGrid wx.grid.Grid Handles raw cell input, selection blocks, and context menus. Implements custom expression parsing via OnCellEdit().
HTMLWindow wx.html.HtmlWindow Displays the rendered HTML output from Pandas. Uses Python's native webbrowser to redirect hyperlink clicks to the OS default browser.
AboutDialog wx.Frame A modal pop-up displaying credits, license info, and repository links formatted via HTML.

Computational Pipeline

When you click Solve, the application runs solve_model(), executing the following pipeline:

  1. build_model() parses rows from self.nodes and self.elements.
  2. An instance of TrussModel (from nusa) is initialized.
  3. Nodal coordinate variables, structural element profiles, forces, and constraints are registered.
  4. self.model.solve() is executed, solving the system stiffness matrix equations: [K]{U} = {F}.
  5. Results are gathered into pandas.DataFrame tables and formatted using .to_html().
  6. The finalized text is loaded into self.txtout (HTML Panel).

5. File Format (.truss / .json)

You can load files inside the File menu. Internally, wxTruss uses human-readable JSON formats. Files can end in .json or .truss.

{
  "nodes": [
    {"x": 0.0, "y": 0.0},
    {"x": 2.0, "y": 0.0},
    {"x": 1.0, "y": 1.5}
  ],
  "elements": [
    {"ni": 1, "nj": 2, "E": 200e9, "A": 0.01},
    {"ni": 2, "nj": 3, "E": 200e9, "A": 0.01},
    {"ni": 3, "nj": 1, "E": 200e9, "A": 0.01}
  ],
  "constraints": [
    {"node": 1, "ux": 0.0, "uy": 0.0},
    {"node": 2, "ux": "free", "uy": 0.0}
  ],
  "forces": [
    {"node": 3, "fx": 10000.0, "fy": -5000.0}
  ]
}

6. Author & License

wxTruss is distributed as an open-source tool under the permissive MIT License, giving developers and engineers absolute freedom to repurpose, deploy, and adjust the source code.

Developer: Pedro Jorge De Los Santos
E-mail: delossantosmfq@gmail.com
Open Source Code: wxtruss GitHub Repository