Mesh Viewer is a simple STL/OBJ CAD geometry and surface mesh viewer prototype with a Model View Controller (MVC) type design. Three different visualization backends are compared and embedded within the same Python/tkinter GUI framework.
- matplotlib
- plotly (WebGL with embedded webview)
- vispy (OpenGL)
The vispy/opengl backend seems to be the best choice overall with respect to performance and packaged size (~35 MB), while plotly (subjectively) looks the best but leads to large binaries due to embedding the Chromium framework (~70-90 MB), matplotlib is the simplest backend but suffers from slow performance for larger visualizations.
Simply downloading and running the corresponding Python scripts should start both the GUI and mesh viewer application. The examples below show how to set up a new conda Python environment with the required dependencies.
conda create -n mpl python=3.7 conda activate mpl conda install conda-forge::blas=*=openblas numpy pip install matplotlib==3.2.2 python meshviewer_mpl_tk.py conda create -n plotly python=3.7 conda activate plotly conda install conda-forge::blas=*=openblas numpy pip install cefpython3 python meshviewer_plotly_cef_tk.py conda create -n vispy python=3.7 conda activate vispy conda install conda-forge::blas=*=openblas numpy pip install cython pip install pyopengltk git clone --recurse-submodules https://github.com/Wosser1sProductions/vispy.git cd vispy git submodule update --init --recursive pip install . --no-use-pep517 cd .. python meshviewer_vispy_tk.py The releases include stand-alone and pre-compiled executable one-click binaries (exe) for Windows systems (note that it may take several seconds to load/start due to extracting all resources, and that the plotly backed required an internet connection and accepting a Microsoft/Windows certificate to download the plotly javascript library). Building stand-alone executables can be done with pyinstaller as described below.
conda create -n mpl python=3.7 conda activate mpl conda install conda-forge::blas=*=openblas numpy pip install matplotlib==3.2.2 pip install pyinstaller pyinstaller --onefile --windowed --noupx meshviewer_mpl_tk.py conda env remove -n mpl conda create -n plotly python=3.7 conda activate plotly conda install conda-forge::blas=*=openblas numpy pip install cefpython3 pip install pyinstaller==3.6 cd build python build.py --onefile conda env remove -n plotly conda create -n vispy python=3.7 conda activate vispy conda install conda-forge::blas=*=openblas numpy pip install cython pip install pyopengltk git clone --recurse-submodules https://github.com/Wosser1sProductions/vispy.git cd vispy git submodule update --init --recursive pip install . --no-use-pep517 pip install pyinstaller cd ../build pyinstaller --onefile meshviewer_vispy_tk.spec conda env remove -n vispy This is just a simple prototype/proof-of-concept and not intended to be a full fledged application. If you are interested in custom CAE and simulation tools such as this app and FEATool Multiphysics please feel free to get in touch with Precise Simulation.
AGPL v3, see LICENSE for more details.
Copyright (C) 2020 Precise Simulation Ltd.
