Project

radmesh

0.0
No commit activity in last 3 years
No release in over 3 years
ADMesh is a library for processing triangulated solid meshes. Currently, ADMesh only reads the STL file format that is used for rapid prototyping applications, although it can write STL, VRML, OFF, and DXF files. Those are bindings for Ruby. You'll need the ADMesh C library in version 0.98.x.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

~> 1.9
 Project Readme

radmesh

ADMesh is a library for processing triangulated solid meshes. Currently, ADMesh only reads the STL file format that is used for rapid prototyping applications, although it can write STL, VRML, OFF, and DXF files. Those are bindings for Ruby.

You'll need the ADMesh C library in version 0.98.x.

Usage

require 'radmesh'

# load an STL file
stl = RADMesh::STL.new 'file.stl'

# observe the available methods
p stl.methods

# read the stats
p stl.stats

# see how many facets are there
p stl.size

# walk the facets
stl.each_facet do |facet|
  # get the normal
  p facet[:normal]
  # walk the vertices
  facet[:vertex].each do |vertex|
    # read the coordinates
    p vertex[:x]
    p vertex[:y]
    p vertex[:z]
  end
end

# manipulate the mesh
stl.rotate! :x, 90
stl.scale! 0.5

# repair the mesh
stl.repair!

# and save it
stl.write_binary 'block2.stl'

You can generate the full documentation with yard or see it online on RubyDoc.info.