Skip to main content

B-spline modelling CAD and meshing tools.

Project description

B-spline GEometry Modeling package

Goal: Robust open source tool for creation of parametric geometries and computational meshes via. Python code. Primary focus are hydrogeological applications with geometries including both random fractures and deterministic natural or antropogenic features.


GMSH is a mature meshing tool recently complemented by the gmsh-sdk intreface library. However its practical usage (from Python) have several issues:

  • Geometry bolean operations (based on OCC) doesn't preserve "compatible" geometry, i.e. boundary separation two volumes exists only once. This makes major problems in meshing.
  • Lack of support to work with "groups of shapes". E.g. a group of subdomains fragmented by a fracture network results in a mess of all resulting subshapes. Note, that we must make a single fragmenting operation in order to get "compatible" geometry.
  • Compatible boundary shapes can only be retrieved from the final volume, loosing information about it's parts (e.g. boundary of internal hole vs. outer boundary).
  • The regions (physical groups in GMSH) are composed from the shapes, while the compatible geometry requests a single region per shape. So it seems logical to assigne regions to the shapes.
  • For thousands of regions, the internal GMSH/OCC algorithms are extremaly slow (probably do to quadratic complexity).
  • gmsh-sdk builds on semantics of GMSH scripting language leading to cumbersome usage from Python, namely for Fields and Options.



Longterm goal to have own CAD like library producing only compatible geometries (indepdent of OCC).

  • representation of B-spline curves and surfaces
  • approximation of point clouds by B-spline curves and surfaces
  • intersections of curves and surfaces
  • composition of compatible 3D geometries using BREP format and B-splines
  • ultimate goal: fast algorithms for B-spline logical operations
  • work in progress


Wrapping 'gmsh-sdk' meat and bones into enjoyable being.

  • documented interface to usefule GMSH options
  • documented and usable wrapper for 'Fields'
  • operations with groups of shapes
  • own association of shapes with regions, assigned just before meshing or even after meshing
  • work in progress


Decomposition of the plane into disjoint polygons by line segments.

  • keep compatibility (i.e. single segment separting two polygons)
  • support for merging close points and segments with sharp angles (enhance regularity of resulting mesh)
  • support for assignment of regions (or other data) to the shapes (points, segments, polygons)
  • support for undo/redo of the operations


Installation from PYPI

System-wide installation of a last version from PYPI. Need root/admin access (or sudo).

pip install bgem

Installation from PYPI into the user's directory, no admin access necessary. E.g. on a cluster. However prefered is usage of a virtual environment.

pip install --user bgem

Instalation from sources

Installation from sources located in DIR (copy of sources is performed).

pip install DIR

Installation from sources located in DIR. It uses links to the editable sources (usefull for debugging).

pip install -e DIR


Jan Březina, Jiří Kopal, Radek Srb, Jana Ehlerová, Jiří Hnídek


Theory references


Similar libraries (for B-splines]

  • NURBS++ - unmantained, last updates from 2002, seems there is no support for intersections
  • libnurbs - effort to add intersections and other features to the openNURBBS library provided by Rhino
  • SINTEF SISL - mature, mantained, features, C lib:
    • approximation for curves
    • intersection of curves
    • closest point problems for curves
    • evaluation and manipulation of curves
    • approximation of surfaces
    • intersection of surfaces: topology and inspection of the intersection curve
    • evaluation and manipulation of surfaces
  • Ayam - under development, 3d modeling tool .

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for bgem, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size bgem-0.2.0-py3-none-any.whl (127.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size bgem-0.2.0.tar.gz (107.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page