https://github.com/admesh/radmesh
Ruby bindings for ADMesh
https://github.com/admesh/radmesh
Last synced: 10 months ago
JSON representation
Ruby bindings for ADMesh
- Host: GitHub
- URL: https://github.com/admesh/radmesh
- Owner: admesh
- License: gpl-2.0
- Created: 2016-01-21T16:02:58.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-04-26T20:24:41.000Z (about 10 years ago)
- Last Synced: 2025-09-16T03:59:22.895Z (10 months ago)
- Language: Ruby
- Size: 47.9 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this 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](https://github.com/admesh/admesh/releases)
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](http://yardoc.org/)
or see it online on [RubyDoc.info](http://www.rubydoc.info/gems/radmesh/RADMesh/STL).