Skip to main content

Constructive Solid helper for Gmsh

This project is an opinionated helper tool that aims to provide a high level Python API for 2D/3D Constructive Solid Geometry modelling, which is a very convenient way of defining geometries using boolean operations. A typical script looks like this:

from csgmsh import mesh, shape, field

rect = shape.Rectangle()
circ = shape.Circle(center=[1,1], radius=.5)

mesh.write(
    output_path = "demo.msh",
    physical_groups = {
        "domain": rect - circ,
        "top-right": rect.top | circ.boundary | rect.right,
        "bottom-left": rect.left | rect.bottom,
    },
    mesh_size = field.Threshold(
        d=field.Distance(rect.bottom),
        dmin=0, vmin=.01,
        dmax=.5, vmax=.1),
)

Context: gmsh supports GSG modelling via its OpenCASCADE kernel. Unfortunately it is set up in a way that makes it difficult to keep track of boundary segments, which is crucial for computational applications. Csgmsh fixes this by assuming that the (undocumented) order in which boundary entities are provided is stable, and keeps track of how these boundaries are subdivided via the BooleanFragments operation.

This project is very much a work in progress and the API may change extensively pre-1.0, so be sure to pin it to a version if you find a use for it.

Release files for csgmsh 0.3.1

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

Source distribution (sdist)

Source distribution for csgmsh 0.3.1
File Size Uploaded
csgmsh-0.3.1.tar.gz 12.3 kB Details

Built distribution (wheel)

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

Total release size: 28.3 kB

Release files / csgmsh-0.3.1.tar.gz

Download URL csgmsh-0.3.1.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f5160e3543e56ed03462ccfab17e722dd7a0cc42acc982d58d62f5f8bf954100
BLAKE2b-256 checksum
How to use checksums
f8cb8a2577ea1b09343ec440d34cc3339d5bf8cd2112a7be80f436a0c127929e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.20

Release files / csgmsh-0.3.1-py3-none-any.whl

Download URL csgmsh-0.3.1-py3-none-any.whl
Size 15.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98be770277ec893ae39c963dedeb60b0208bda3755189c733dc492d87ebd89f0
BLAKE2b-256 checksum
How to use checksums
6d302c3e8f3dc0c6cb4926b270dc0acb4af45727f4bbb8f052e0997fac1bc165
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.20

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1

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