---
name: "meshfix"
section: "7"
platform: "linux"
package: "iso2mesh-tools"
version: "1.9.8+ds-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/meshfix"
---

# meshfix(7)

a surface mesh cleaning and repairing utility

## NAME

meshfix - a surface mesh cleaning and repairing utility

## SYNOPSIS

meshfix \<file1\> \[\<file2\>\] \[OPTIONS\]

## DESCRIPTION

Meshfix is a surface mesh repairing and cleaning tool. It was written by Marco Attene, Mirko Windhoff, Axel Thielscher. The details regarding this tool can be found in the below paper

M. Attene - A lightweight approach to repairing digitized polygon meshes. The Visual Computer, 2010. (c) Springer.

Meshfix processes file1 and saves the result to \<file1\>\_fixed.off. An optionally passed file2 is merged with the first one.

Accepted input formats are OFF, PLY and STL.

## OPTIONS

This program accepts the following input parameters:

- **-a \<epsilon\_angle\>**

  **Allowed range: 0 \< epsilon\_angle \< 2, default: 0 (degrees)**

- **-j**

  **Join 2 biggest components if they overlap, remove the rest.**

- **-jc**

  **Join the closest pair of components.**

- **-h**\|(--help)

  Print this help and exit.

- **--shells \<n\>**

  **Only the n biggest shells are kept.**

- **-o \<output\>**

  **Set the output filename (without extension).**

- **-q**

  **Quiet mode, don't write much to stdout.**

- **-u \<steps\>**

  **Uniform remeshing of the whole mesh, steps \> 0**

- **--vertices \<n\>**

  **Constrain number of vertices to n (only with -u)**

- **--no-clean**

  **Don't clean.**

- **--smooth \<n\>**

  **Apply n laplacian smoothing steps.**

- **-s**\|(--stl)

  Result is saved in STL     format instead of OFF.

- **-w**\|(--wrl)

  Result is saved in VRML1.0 format instead of OFF.

- **--fsmesh \<n\>**

  **Result is saved in FreeSurfer format instead of OFF.**

- **--xshift \<d\>**

  **Shift x-coordinates of vertices by d when saving output.** **Only works with --fsmesh; used to deal with small FreeSurfer glitch**

- **--msh**

  **Result is saved in gmsh format for debugging (including vertex and triangle masks)**

- **--cut-outer \<d\>**

  **Remove triangles of 1st that are outside of the 2nd shell.**

- **--cut-inner \<d\>**

  **Remove triangles of 1st that are inside  of the 2nd shell.** **Dilate 2nd by d; Fill holes and keep only 1st afterwards.**

- **--decouple-inin \<d\>**

  **Treat 1st file as inner, 2nd file as outer component.** **Resolve overlaps by moving inners triangles inwards.**

- **--decouple-outin \<d\>**

  **Treat 1st file as outer, 2nd file as inner component.** **Resolve overlaps by moving outers triangles inwards.**

- **--decouple-outout \<d\>**

  **Treat 1st file as outer, 2nd file as inner component.** **Resolve overlaps by moving outers triangles outwards.** **Constrain the min distance between the components \> d.**

- **--fineTuneIn \<d\> \<n\>**

  **Used to fine-tune the minimal distance between surfaces**  **A minimal distance d is ensured, and reached in n substeps**  **When using the surfaces for subsequent volume meshing by gmsh** **this step prevent too flat tetrahedra**

- **--fineTuneOut \<d\> \<n\>**

  **Similar to --fineTuneIn, but ensures minimal distance in the other direction** **--dilate \<d\>** **Dilate the surface by d. d \< 0 means shrinking.** **--intersect** **If the mesh contains intersections, return value = 1.** **--intersect -o fname.msh** **If the mesh contains intersections, return value = 1.** **In addtion, save mesh with highlighted intersections in Gmsh format**

## SEE ALSO

**[cgalmesh(7)](/cgalmesh/7.md), [cgalsurf(7)](/cgalsurf/7.md), [cgalsimp2(7)](/cgalsimp2/7.md), [cgalpoly(7)](/cgalpoly/7.md), cork(7), [jmeshlib(7)](/jmeshlib/7.md)**

## AUTHOR

**Marco Attene (attene@ge.imati.cnr.it), Mirko Windhoff, Axel Thielscher and Qianqian Fang (fangqq@gmail.com)**
