Skip to content

dylanjude/surfconv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SurfConv

Surface mesh converter supporting UGRID, VTK, STL, Pointwise FACET, and Tecplot formats.

Supported Formats

Format Extension Read Write Notes
UGRID .ugrid Yes Yes Triangles and quads
VTK Legacy .vtk Yes Yes ASCII unstructured grid
VTK XML .vtu Yes Yes XML unstructured grid
STL ASCII .stl Yes Yes Triangles only (default)
STL Binary .stl Yes Yes Triangles only (--format stl-binary)
FACET .facet Yes Yes Pointwise format
Tecplot .dat Yes Yes ASCII finite element

Requirements

  • Python 3.6+
  • NumPy

Usage

Unified Converter

Convert between any supported formats:

# Format auto-detected from extensions
python surfconv.py input.ugrid output.vtu
python surfconv.py mesh.stl mesh.facet
python surfconv.py model.vtu model.ugrid

# Specify output format (generates filename automatically)
python surfconv.py mesh.ugrid --format stl      # Creates mesh.stl
python surfconv.py mesh.ugrid --format stl-binary

# Override format detection
python surfconv.py input.dat output.dat --input-format ugrid --output-format vtk

Python API

from surfconv import read_mesh, write_mesh, convert, SurfaceMesh

# Simple conversion
convert('input.ugrid', 'output.vtu')

# Read and manipulate mesh
mesh = read_mesh('input.ugrid')
print(f"Vertices: {len(mesh.vertices)}")
print(f"Triangles: {len(mesh.triangles)}")
print(f"Quads: {len(mesh.quads)}")

# Write to different format
write_mesh(mesh, 'output.stl')

# Get all faces as triangles (quads split)
all_tris = mesh.all_triangles()

Notes

  • Quad elements are preserved when converting between formats that support them (UGRID, VTK, FACET, Tecplot)
  • STL only supports triangles; quads are automatically split into two triangles
  • Index conversion between 0-based and 1-based formats is handled automatically

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages