3D structural FEM engine with a compiled Rust core
This repository holds two things, under two licences.
The calculation engine — the source in this tree, xdfem3d, is a Python library with a compiled core (Rust) for three-dimensional finite element analysis of building frames, shells, slabs, walls and solids: linear and nonlinear, modal and time-history. It is under the GNU Lesser General Public License v3 (LGPLv3). It has no interface and no dependency on one: it builds a model, solves it, and gives back numbers.
The desktop application — a graphical interface built on that engine. It is free to use, distributed as a compiled application under its own terms, and its source is not published. It is the way most people will meet the engine: you draw and load a model in a window, run it, and look at the results. Download it from Releases.
AI in the engine and in the application — optional, and off until you use it. The engine includes an MCP server (python -m xdfem3d.mcp) through which an agent you already use (Claude Code, OpenCode, Codex, Visual Studio Code, Claude Desktop) builds, checks and analyses a model. The application adds an Agent panel in which an agent works on the model you have open, while you watch it change, with a model of your choice (a local one through Ollama, or a remote one with your own account). Remote models receive what the agent reads of your model.
The documentation is at pcachim.github.io/xdfem3d. It is the manual of the application, and it also describes the engine: the Scripting section is the guide to the Python API, with a reference for every method, and the Command Language lists the commands.
They are two programs with one boundary, and the boundary is kept on purpose:
What you would use the engine alone for: scripts that build or change many models, parametric studies and optimisation, analysis in a service or a pipeline, a post-processor, a front end of your own, or an AI agent working on a model with no window at all.
Python 3.12 or later. The compiled core is written in Rust and built with maturin, so building from source needs a Rust toolchain and uv.
git clone https://github.com/pcachim/xdfem3d.git cd xdfem3d uv sync uv run maturin develop # builds the core and installs the package in the environment uv run pytest # the tests, and the validation cases The core install is NumPy, SciPy and eurocodepy (the Eurocode actions and combinations, and the catalogues of materials and profiles). The formats that need a library of their own are extras, so that a solver in a script or a service does not have to install them:
pip install "xdfem3d[mcp]" # the MCP server: the mcp package pip install "xdfem3d[ifc]" # ifcopenshell — IFC (openBIM) import and export pip install "xdfem3d[dxf]" # ezdxf — DXF import and export Everything they cover is reached when it is used, so the engine imports, assembles and solves without them.
Units are metres, kN and kPa (kN/m²), tonne for mass, degrees for angles. A model is built from the materials and the sections up to the elements and the loads, and an analysis case says what to solve.
from xdfem3d import Model3D m = Model3D("beam") m.add_material("C30", E=3.3e7, nu=0.2, unit_weight=25.0, type="concrete") m.add_section_shape("S", "C30", "rectangular", b=0.3, h=0.5) m.add_node("A", 0, 0, 0) m.add_node("B", 6, 0, 0) m.add_bar("b", "A", "B", "S") m.support("A", "ux", "uy", "uz", "rx") # a pin that also holds the twist m.support("B", "uy", "uz") # a roller along x m.add_load_case("Q", action_type="Q") m.add_uniform_load("Q", "b", (0, 0, -10)) # 10 kN/m downwards, in global axes m.add_analysis_case("ULS", "linear", coefficients={"Q": 1.0}) assert m.check() == [] # what would stop the analysis; empty when nothing does results = m.solve_pending() # the analysis cases that have no current results r = results["ULS"] print(r.reaction("ULS", "A")) # fx, fy, fz, mx, my, mz — here fz = qL/2 = 30 kN print(r.displacement("ULS", "B")) Every id is a name you choose. A command that gets something that does not exist or does not fit raises ModelError, says what is wrong, and leaves the model as it was. A model with results can be locked, so that its input cannot change under them.
A model is saved with xdfem3d.save(m, "beam.xdfem3d") and read with xdfem3d.load(...); export_script(m) writes the model as a Python script that rebuilds it. The Scripting section goes on from here: combinations, results, files, and recipes that are run by the tests of the documentation.
Inside, the element kernels (bars, corotational bars, fibres, shells, solids, springs and the materials) are written in Rust; assembly and solving use SciPy's sparse solvers and ARPACK for the eigenproblems.
The engine is compared with what is independent of it, and the cases run with uv run pytest (the validation cases are in validation/, next to the unit tests in tests/):
What that does and does not establish, so the result is not taken for more:
xdfem3d computes analysis results. It does not verify them, and producing a number is not the same as the number being right for your problem. It is an aid to calculation, not a substitute for engineering judgement: anyone using its output in the design or construction of a real structure is responsible for verifying it independently and remains the engineer of record. The same holds for anything that an AI agent does with the model or says about it.
If xdfem3d contributes to published work, please cite it:
Cachim, P. (2026). pcachim/xdfem3d [Computer software]. https://github.com/pcachim/xdfem3d
Say the version of the engine you used (xdfem3d.__version__, and the application's Help ▸ About if you used it).
Bugs and questions, for the library or the application, go to Issues. A report with a model that reproduces the problem (the .xdfem3d file, or a script) is the most useful thing you can send. For anything else, write to eurocodepy@gmail.com.
Development happens in a private repository, and what is published here is that work: open an issue before you spend time on a pull request, because a change may not be able to land as it is.
The engine — everything in this tree — is under the LGPLv3; see LICENSE.md. It depends on eurocodepy, also LGPLv3, for the Eurocode actions and combinations and the catalogues of materials and profiles.
The desktop application is a separate work, distributed as freeware in compiled form under its own terms (see the Licenses page, and LICENSE.md shipped with the application). Nothing in those terms restricts your rights to the engine: you may use, modify and redistribute it under the LGPLv3, from here.
All 6 files in this release have provenance metadata.
GNU Lesser General Public License v3 or later (LGPLv3+) (LGPL-3.0-or-later)
finite element structural analysis structural engineering FEM Eurocode building frames shells solids
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Enable javascript to be able to filter the list of wheel files.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.
All 6 files in this release have been uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.




