Skip to main content

PyMeshIt

Python 3.8+ License: GPL v3 Code style: black

PyMeshIt is a complete Python package for mesh generation and manipulation with a full-featured Qt-based GUI. It provides a comprehensive workflow to process point clouds and polylines into conforming surface meshes and tetrahedral meshes.

Note: This version runs entirely in Python without C++ dependencies, making it easier to install and deploy.

Highlights (GUI-driven workflow)

The included GUI (main.py) implements a full MeshIt workflow with the following main tabs:

    1. Load Data — load points, wells (polylines) or VTU/Poly formats; manage multiple datasets and colors.
    1. Convex Hull — compute dataset boundaries (convex or rim for/quasi-planar sheets) with corner detection.
    1. Segmentation — refine hulls by target feature size and per-surface length tables (RefineByLength).
    1. Triangulation — generate surface triangulations with gradient, min-angle, interpolation and uniform options.
    1. Intersections — compute & visualize global surface–surface and polyline–surface intersections; triple point detection.
    1. Refine & Mesh — refine intersection/hull lines, generate conforming surface meshes, constraint selection UI, per-surface mesh density table.
    1. Pre‑Tetramesh — select conforming surfaces, validate for TetGen, manage selection tree for tetrahedralization.
    1. Tetra Mesh — generate and visualize tetrahedral meshes, assign materials, export results.

Installation

PyMeshIt provides standalone executables for Windows 10/11 and Ubuntu (22.04+). These do not require Python to be installed.

  1. Go to the Releases page.
  2. Download the appropriate file for your OS:
    • Windows: PyMeshit-vX.X.X-win64.zip
    • Ubuntu: PyMeshit-vX.X.X-linux.zip
    • MacOS: PyMeshit-vX.X.X-macos.zip
  3. Extract the archive.
  4. On Linux, you may need to make the file executable:
    chmod +x PyMeshIt
    
  5. Run the executable (./PyMeshIt on Linux, double-click PyMeshIt.exe on Windows).

Note: macOS support is planned for future releases.

From PyPI (Cross-Platform)

If you prefer to run from source or use the Python API, you can install via pip:

pip install triangle
pip install pymeshit

From Source

If you want to install from source:

git clone https://github.com/waqashussain117/PyMeshit
cd PyMeshit
pip install -e .

Requirements

The package will automatically install all required dependencies:

  • numpy
  • scipy
  • matplotlib
  • PySide6
  • pyvista
  • tetgen
  • triangle (optional)

Linux Users: You may need to install system libraries for Qt. On Ubuntu:

sudo apt-get install libxcb-cursor0 libxkbcommon-x11-0 libegl1 libopengl0 libgl1

Quick start (GUI)

For installation either install the Requirements and then open through Python. After installation, run the GUI:

meshit-gui

Or from Python:

import Pymeshit
Pymeshit.main_wrapper()

Typical workflow:

  1. Load one or more point or VTU files (File → Load).
  2. Compute hulls (Convex Hull tab).
  3. Compute segmentation (Segmentation tab) — set "Target Feature Size" or per-surface values.
  4. Run triangulation (Triangulation tab), choose interpolation and quality settings.
  5. Compute intersections (Intersections tab) to extract shared constraints and triple points.
  6. Refine intersection lines and generate conforming meshes (Refine & Mesh tab).
  7. Select conforming surfaces and validate for TetGen (Pre‑Tetramesh tab).
  8. Generate and visualize tetrahedral mesh (Tetra Mesh tab) and export.

Programmatic Usage

PyMeshIt also exposes an experimental headless API for simple batch workflows. This is intended for scripted geometry variations where the GUI constraint tree would normally be set to "select intersections".

A full notebook-style walkthrough is available in examples/headless_batch_workflow.ipynb. It includes file upload/path setup, surface role assignment, material seed setup, workflow execution, mesh export, and a batch-loop template.

from Pymeshit import MeshCase, MeshOptions, SurfaceSpec, MaterialSpec, run_mesh_case

case = MeshCase(
    surfaces=[
        SurfaceSpec("bottom", bottom_points, role="border", target_size=50.0),
        SurfaceSpec("top", top_points, role="border", target_size=50.0),
        SurfaceSpec("fault", fault_points, role="fault", target_size=25.0),
    ],
    materials=[
        MaterialSpec("lower", [0.0, 0.0, -500.0], attribute=1),
        MaterialSpec("upper", [0.0, 0.0, 500.0], attribute=2),
    ],
    options=MeshOptions(
        constraint_mode="intersections",
        preserve_boundary_hulls=True,
        include_hull_fallback_faults_in_volume=False,
        target_size=50.0,
        tetgen_switches="pq1.414aAY",
    ),
)

result = run_mesh_case(case, output_path="case_001.vtu")

For parameter studies, build one MeshCase per geometry configuration and call run_mesh_case() in a loop. constraint_mode="intersections" selects only intersection constraints for conforming surface meshing, while preserve_boundary_hulls=True keeps each surface hull as the outer PLC boundary. This matches the GUI "select intersections" workflow used by the benchmark cases. If a non-benchmark case still cannot be triangulated from hull plus intersections, PyMeshIt keeps a hull-fallback fault surface for inspection but leaves it out of TetGen volume constraints by default.

Troubleshooting

Linux / Virtual Machine Issues

If you encounter an error like X Error of failed request: BadWindow or the application crashes on startup, it is likely due to graphics driver compatibility, especially in Virtual Machines (VirtualBox, VMware).

Try running the application with software rendering forced:

export LIBGL_ALWAYS_SOFTWARE=1
./PyMeshIt

Or force the Qt platform to X11:

export QT_QPA_PLATFORM=xcb
./PyMeshIt

Contributing

Contributions are welcome. Please open an issue for discussion and submit PRs for fixes and features. Keep GUI behavior consistent with the tab-based workflow.

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Metadata

Release files for Pymeshit 0.8.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Pymeshit 0.8.5
File Size Uploaded
pymeshit-0.8.5.tar.gz 3.8 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for Pymeshit 0.8.5
File Interpreter ABI Platform
pymeshit-0.8.5-py3-none-any.whl Python 3 none any Details

Total release size: 4.1 MB

Release files / pymeshit-0.8.5.tar.gz

Download URL pymeshit-0.8.5.tar.gz
Size 3.8 MB
Tags Source
SHA-256 checksum
How to use checksums
014ba5594e7188a306a1cb34e440884a01571d30b9b20ef2a1efc2835232c416
BLAKE2b-256 checksum
How to use checksums
86c2581c472b6942b4e15dee8bcde5ad8573526ef5ebe8b6cdd56135d747fdce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / pymeshit-0.8.5-py3-none-any.whl

Download URL pymeshit-0.8.5-py3-none-any.whl
Size 336.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8b40ef5dc4d8fa2a2fe54aa3350572e85609bb69a6bbe7f7b4e96b672361964a
BLAKE2b-256 checksum
How to use checksums
7698d840d1f030d8cf90c9d864aa68d062b0b2712d919553af7cf205de1134f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

0.9.2

2 release files

0.9.0

2 release files

0.8.8

2 release files

0.8.6

2 release files

This release

0.8.5 This release

2 release files

0.8.4

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.8

2 release files

0.7.7

2 release files

0.7.6

2 release files

0.7.5

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.9

2 release files

0.6.8

2 release files

0.6.6

2 release files

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.8

2 release files

0.5.7

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.9

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.0

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page