This repository contains a collection of utility python scripts for BioMesh library.
Theese scripts are mainly needed to create artificial muscle geometries - for testing purposes or if imaging data is missing.
Generating seed points
-
seed_pattern.py — Generates layered circular seed patterns and exports to JSON.
-
fermat_seed_pattern.py — Produces evenly distributed seed points using a Fermat spiral and writes them to JSON. The parameter
biascan be used to cluster the points at the center.Run:
python3 fermat_seed_pattern.py #id #seed_points R z
Generating a vector field
-
vfield_ellipsoid.py — Builds a tangential vector field inside an ellipsoid (parameters a,b), zeros out outside points, and saves a structured VTK (outputs like vfield{id}.vtk).
-
vfield_mutator.py — Utilities to post-process or mutate existing vector fields (filters/transforms for vfield files).
-
tube_vfield.py — Creates a tube-aligned tangent vector field using a radius profile R(z) and derivative dRdz.
Run:
python3 tube_vfield.py #id L Rmax Rmin
Other
-
fem_mesh_generator.py — Generates structured hexahedral tube meshes and maps a unit cube to a circular tube. This script is NOT needed for BioMesh, but it is used to generate a matching mechanics mesh to the fibers mesh given by a vector field created by tube_vfield.py.
Run:
python3 fem_mesh_generator.py #id L Rmax Rmin nx ny nz. -
json_to_vtp.py — Loads a JSON of seed points and writes a VTK .vtp polydata file. Useful for visualization of the seed points in ParaView.
Run:
python3 json_to_vtp.py input.json