Highly efficient and portable finite element visualization framework
veux
is a finite element rendering library that leverages modern
web technologies to produce sharable, efficient, and detailed renderings.
veux
is a finite element rendering library that leverages modern
web technologies to produce sharable, efficient, and detailed renderings.
Unlike most tools that only provide temporary visualization, veux
generates
persistent 3D models that can be stored in files, shared with colleagues, and
viewed with any standard 3D model viewer. This means anyone can interact with
the renderings without needing to install specialized software or even Python.
Simply open the 3D object with your computer’s 3D viewer (e.g., 3D Viewer on
Windows) or load it into a free online viewer in like gltf-viewer.
Documentation is currently under development.
- Detailed Render frames with extruded cross sections
- Persistence: Save your finite element visualizations as persistent 3D models that can be revisited and analyzed at any time.
- Portability: Share your models effortlessly with colleagues, enabling seamless collaboration and review.
- Accessibility: View and interact with the models using any standard 3D model viewer, eliminating the need for specialized software or Python installation.
- Versatility: A wide selection of rendering backends and output file types, including
optimized 3D web formats like
.glb
. Generated 3D models can be loaded directly into programs like PowerPoint and animated. - Correctly render models that treat both
y
orz
as the vertical coordinate.
To install veux
run:
pip install veux
To render a model directly from Python, use the veux.render
function:
artist = veux.render(model, canvas=canvas)
- model: the
model
parameter can be of several types - canvas: The
canvas
parameter is a string which indicates which "backend" technology to use. The options are:"gltf"
is the default canvas and produces the highest quality renderings. You can save renderings drawn by this backend to either.html
or.glb
files..glb
files are preferred as they are a natural format for 3D objects and can be viewed by standard 3D viewing applications."plotly"
is best for model debugging as it is able to embed model details like node/element numbers and properties with hover annotations. However, the renderings produced by this backend dont look quite as good as withgltf
."matplotlib"
: can be used to programatically create.png
files.
Once the artist
is created, the rendering can either be displayed or saved to a file. Each canvas
supports slightly different options:
-
viewing To view a rendering that is generated either with
canvas="gltf"
orcanvas="plotly"
, use theveux.serve()
function:veux.serve(artist)
After running you will see a message like the following printed to your terminal:
Bottle v0.13.1 server starting up (using WSGIRefServer())... Listening on http://localhost:8081/ Hit Ctrl-C to quit.
Paste the URL from this message (eg, http://localhost:8081) into the address bar of a browser and an interactive rendering will appear.
-
saving Use the
artist
'ssave()
method to write the rendering to a file. The file type depends on the canvas:- with
canvas="gltf"
, files are saved in the glTF format with extension.glb
:... artist.save("model.glb")
- with
canvas="plotly"
, files are saved in to HTML:... artist.save("model.html")
- with
canvas="matplotlib"
, files are saved in as PNGs:Note, however, that renderings produced by the... artist.save("model.png")
"matplotlib"
canvas are generally very poor quality. For high quality images, use the"gltf"
canvas and take screen captures.
- with
To create a rendering, execute the following command from the anaconda prompt (after activating the appropriate environment):
python -m veux model.json -o model.html
where model.json
is a JSON file generated from executing the following OpenSees command:
print -JSON model.json
If you omit the -o <file.html>
portion, it will plot immediately in a new
window. You can also use a .png
extension to save a static image file, as
opposed to the interactive html.
Note Printing depends on the JSON output of a model. Several materials and elements in the OpenSeesPy and upstream OpenSees implementations do not correctly print to JSON. For the most reliable results, use the
opensees
package.
By default, the rendering treats the --vert 3
to render model --vert 2
to render model
If the opensees
package is installed,
you can directly render a Tcl script without first printing to JSON,
by just passing a Tcl script instead of the JSON file:
python -m veux model.tcl -o model.html
To plot an elevation (elev
) plan (plan
) or section (sect
) view, run:
python -m veux model.json --view elev
and add -o <file.extension>
as appropriate.
To see the help page run
python -m veux --help
See also
The veux
packages was used to generate figures for the following publications:
- On nonlinear geometric transformations of finite elements doi: 10.1002/nme.7506