Skip to main content

SVG2mesh

Generate finite element meshes from SVG-defined geometry.

SVG2mesh converts 2D geometries stored in SVG files into finite element meshes using Gmsh. The generated mesh can be exported to formats supported by MeshIO and used in finite element analysis and scientific computing workflows.

Features

  • Create FE meshes directly from SVG geometry
  • Mesh generation powered by Gmsh
  • Export meshes through MeshIO
  • Optional generation of periodic meshes
  • Export geometry preview as PNG

Installation

Requirements

  • Python 3.8+
  • NumPy
  • Gmsh
  • MeshIO
  • svgelements

Install from Source

git clone https://github.com/vlukes/svg2mesh.git
cd svg2mesh
pip install .

Install form PyPI

pip install svg2mesh

Usage

Basic Usage

svg2mesh geometry.svg

Specify Output File

svg2mesh geometry.svg -o mesh.vtk

Generate Unit Cell Mesh

svg2mesh geometry.svg -u

Generate Periodic Mesh

svg2mesh geometry.svg -p

Control Mesh Size

svg2mesh geometry.svg -s 0.05

Export PNG Preview

svg2mesh geometry.svg -e

Input Geometry

The input geometry must be provided as a plain SVG file.

Each physical (material) group must be defined in a separate SVG group labeled layer1, layer2, layer3, and so on. These layers are used to identify individual material regions in the generated mesh.

All SVG objects should be defined as paths.

Examples

Mesh1 -- multimaterial part

svg2mesh mesh1.svg -s 10

mesh1.png

Mesh2 -- single material part

svg2mesh mesh2.svg -s 5

mesh2.png

Mesh3 -- periodic unit cell

svg2mesh mesh3.svg -u -s "[10, 2]"

mesh3.png

License

SVG2mesh is distributed under the MIT License.

See the LICENSE file for details.

Metadata

Release files for SVG2mesh 1.2.0

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

Source distribution (sdist)

Source distribution for SVG2mesh 1.2.0
File Size Uploaded
svg2mesh-1.2.0.tar.gz 6.6 kB Details

Built distribution (wheel)

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

Total release size: 13.4 kB

Release files / svg2mesh-1.2.0.tar.gz

Download URL svg2mesh-1.2.0.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
658c161ede584ad2f4d25dfaa84ff360e82279816912b7c9047bcfa12280ab54
BLAKE2b-256 checksum
How to use checksums
304d8dd9a146b785b742ff403a6c8336cfe84b4325dc61f37b8fd55dc4cd63c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / svg2mesh-1.2.0-py3-none-any.whl

Download URL svg2mesh-1.2.0-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
26e56778cf67802d6e10e23fd4dbf173ad6e4f1cab6eab6a2b2c10bb0012426f
BLAKE2b-256 checksum
How to use checksums
34fe0187014d5ffd045f38223672a26be8c5ef990a4e78f7424123011f865f74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release history Release notifications | RSS feed

1.3.0

2 release files

This release

1.2.0 This release

2 release files

1.1.0

2 release files

1.0.0

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