Project

admesh

0.0
No commit activity in last 3 years
No release in over 3 years
The ruby-admesh gem wraps the Admesh STL mesh manipulation tool CLI in a Ruby gem. It has the Admesh software packaged, so installation of Admesh it not necessary.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

ruby-admesh ruby-admesh

The admesh gem wraps the Admesh STL mesh manipulation tool CLI in a Ruby gem.

Installation

The gem has the Admesh software packaged, so installation of Admesh it not necessary.

Add to Gemfile:

gem "admesh"

Run bundle install and require the gem:

require "admesh"

Perform file operations

Perform file operations by running Admesh.perform(file, options = {}). It uses the same options as the admesh executable, but remember to underscore all options names (eg. z_rotate instead of z-rotate). The options are not manipulated or validated, they will be sent to Admesh as-is.

When the command was successful, the output is returned as a string. When the command fails, the output is returned contained in a RuntimeError.

ADMesh supports the following options, grouped by type.

Mesh Transformation and Manipulation Options

   x_rotate: angle          # Rotate CCW about x-axis by angle degrees
   y_rotate: angle          # Rotate CCW about y-axis by angle degrees
   z_rotate: angle          # Rotate CCW about z-axis by angle degrees
   xy-mirror: true          # Mirror about the xy plane
   yz-mirror: true          # Mirror about the yz plane
   xz_mirror: true          # Mirror about the xz plane
   scale: factor            # Scale the file by factor (multiply by factor)
   translate: x,y,z         # Translate the file to x, y, and z
   merge: name              # Merge file called name with input file

Mesh Checking and Repairing Options

   exact: true              # Only check for perfectly matched edges
   nearby: true             # Find and connect nearby facets. Correct bad facets
   tolerance: tol           # Initial tolerance to use for nearby check = tol
   iterations: i            # Number of iterations for nearby check = i
   increment: inc           # Amount to increment tolerance after iteration=inc
   remove_unconnected: true # Remove facets that have 0 neighbors
   fill_holes: true         # Add facets to fill holes
   normal_directions: true  # Check and fix direction of normals (ie. CW, CCW)
   reverse_all: true        # Reverse the directions of all facets and normals
   normal_values: true      # Check and fix normal values
   no_check: true           # Don't do any check on input file

File Output Options

   write_binary_stl: name   # Output a binary STL file called name
   write_ascii_stl: name    # Output an ASCII STL file called name
   write_off: name          # Output a Geomview OFF format file called name
   write_dxf: name          # Output a DXF format file called name
   write_vrml: name         # Output a VRML format file called name

For more information about running admesh, please refer to the official documentation

Print help information

Admesh.help                 # Prints the same info as "admesh --help"