Share

Repair

Methods

Name Syntax Description
closetrivialholes mesh:closetrivialholes() Close holes where exactly one triangle is missing each.
closeallholes mesh:closeallholes(timeout:number) Closes all non-trivial holes. Timeout is an optional timeout parameter (in seconds) that aborts trying to close holes if the complexity
cut Newmesh= mesh:cut(plane:number; height:number; topbottom:number) Cuts the mesh along cardinal planes. Plane 0 is the YZ plane, 1 is the XZ plane, and 2 is the XY plane. Height is the cut plane position above the respective cardinal plane. topbottom (optional) determines which section is returned: 1 returns the top half (default if unspecified), 2 returns the bottom half.
fixflippedtriangles mesh:fixflippedtriangles() Attempts to unify triangle orientation. Compares the normals of interconnected triangles, per individual shell. Flips triangles which oppose the majority of interconnected triangles as categorized by their normals.
invertnegativeshells mesh:invertnegativeshells() Inverts triangles in shells with negative volumes. This can destroy cavities.
hollow Newmesh = mesh:hollow(offset:number, resolution:number, smoothen:Boolean) Returns an inverted mesh smaller than the original mesh by the offset value. Resolution corresponds to the triangle size used to reconstruct the mesh from the offset value. Smoothing only happens at the resolution limit. Offset and rastersize should both be positive (in mm). To achieve actual hollowing, merge the result with the original.
Join mesh:join() If the mesh consists of two open shells, which contours are nearby by the mesh is connected. The feature is called "Join contours" in the mesh repair module. Please note that the selection of triangles is done automatically and may not be correct.
makeorientable mesh:makeorientable() Performs multiple operations to arrive at an orientable part even for volumetrically impossible parts like Klein bottles. This method should be used with caution as it can be highly destructive for sufficiently broken meshes.
meshnodesparsification mesh:meshnodesparsification(Epsilon:number, DegenerationUnits:number) Sparsified nodes of a mesh [Desktop Automation]
offset Newmesh = mesh:offset(offset:number, resolution:number, smoothen:Boolean; inneroffset:Boolean) Returns a non-inverted mesh smaller or larger than the original mesh by the offset value. Smoothing only happens at the resolution limit. Resolution corresponds to the triangle size used to reconstruct the mesh from the offset value. Offset and rastersize should both be positive (in mm). If inneroffset is true, the smaller mesh is generated, otherwise the larger one.
preparetopologyforexport mesh:preparetopologyforexport() Prepares topology for STL export
reducelod mesh:reducelod(target:number, deformation:number, edgelength:number) Reconstructs mesh from fewer triangles. target: Target triangle count. deformation: Maximum permitted deformation (cm³). edgelength: maximum permitted triangle edge length.
reducelodadvanced mesh:reducelodadvanced(count:number, deformation:number, edgelength:number) See reducelod. Uses a different algorithm.
removedegeneratefaces mesh:removedegeneratefaces(tolerance:number) Removes triangles with points closer than up to approx. 1.75 times the tolerance
removedoublefaces mesh:removedoublefaces() Removes duplicated triangles from the mesh
removeghostshells mesh:removeghostshells(tolerance:number) Removes shells smaller than the tolerance
removenegativeshells mesh:removenegativeshells() Remove shells with negative volume
removeproblemareas mesh:removeproblemareas() Removes tiny faces involved in several self-intersections at once
rebuildmesh mesh:rebuildmesh() Internally rebuilds the mesh. This should only ever be necessary in rare cases where errors or unexpected changes appear after working directly with individual triangles. With large meshes, this can take a while, so it is not done implicitly.
repairenhanced mesh:repairenhanced() Performs Netfabb's built-in repair script, "Default"
repairextended mesh:repairextended() Performs Netfabb's built-in repair script, "Extended"
repairsimple mesh:repairsimple() Performs Netfabb's built-in repair script, "Simple"
repairscript mesh:repairscript(scriptfile:String) Loads specified repair script file and executes it
smooth mesh:smooth(strength:number, triangleindependent:boolean, preventshrinking:boolean) Smooths the mesh
stitch mesh:stitch(tolerance:number, preserveorientation:Boolean) Stitches open triangle borders closer to each other than the tolerance. preserveorientation set to true prevents stitching triangles with opposing normals.

Back to top

Examples

Name Example Return value
removedoublefaces removed_count = mesh:removedoublefaces() integer: Returns how many triangles were removed. Two triangles are "double" if they share exactly the same corners. If they share only slightly the same corners, this function does not harm them. Stitching and removal of degenerate faces could align these cases.
closetrivialholes trivial_hole_count = mesh:closetrivialholes() integer: Returns the number of closed trivial holes. This function does not alter the mesh in any other way and is safe to call anytime.
closeallholes hole_count = mesh:closeallholes() integer: Returns the number of closed holes of the mesh, i.e. all nontrivial and non-bad holes. This function can be dangerous to call and may add unwanted walls into the mesh.
fixflippedtriangles mesh_is_orientable = mesh:fixflippedtriangles() Boolean: returns if the full mesh has been made oriented. This does not mean that the shell as a whole has a positive volume.
invertnegativeshells negative_shell_count = mesh:invertnegativeshells() integer: number of shells inverted
removedegeneratefaces mesh:removedegeneratefaces(0.02) -
stitch mesh:stitch(0.01, true) integer numbers of edges having been stitched

Back to top

Was this information helpful?