diff options
author | Marius Kintel <marius@kintel.net> | 2012-02-03 22:06:16 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2012-02-03 22:06:16 (GMT) |
commit | c2c67f2eacd74b560c5c5a428e8a0a7bae4fd55a (patch) | |
tree | e37581784d32d5daa1592715ec311988fe6fadd9 | |
parent | cb363df358a70a1f366085773d13a3875a1ceda5 (diff) |
Added debug function for exporting a PolySet to STL
-rw-r--r-- | src/export.cc | 18 | ||||
-rw-r--r-- | src/export.h | 9 |
2 files changed, 24 insertions, 3 deletions
diff --git a/src/export.cc b/src/export.cc index 6dce699..40ce6cb 100644 --- a/src/export.cc +++ b/src/export.cc @@ -53,7 +53,6 @@ void export_stl(CGAL_Nef_polyhedron *root_N, std::ostream &output) output << "solid OpenSCAD_Model\n"; - int facet_count = 0; for (FCI fi = P.facets_begin(); fi != P.facets_end(); ++fi) { HFCC hc = fi->facet_begin(); HFCC hc_end = hc; @@ -198,3 +197,20 @@ void export_dxf(CGAL_Nef_polyhedron *root_N, std::ostream &output) #endif +#ifdef DEBUG +#include <boost/foreach.hpp> +void export_stl(const PolySet &ps, std::ostream &output) +{ + output << "solid OpenSCAD_PolySet\n"; + BOOST_FOREACH(const PolySet::Polygon &p, ps.polygons) { + output << "facet\n"; + output << "outer loop\n"; + BOOST_FOREACH(const Vector3d &v, p) { + output << "vertex " << v[0] << " " << v[1] << " " << v[2] << "\n"; + } + output << "endloop\n"; + output << "endfacet\n"; + } + output << "endsolid OpenSCAD_PolySet\n"; +} +#endif diff --git a/src/export.h b/src/export.h index 9750c30..3897be0 100644 --- a/src/export.h +++ b/src/export.h @@ -1,13 +1,18 @@ #ifndef EXPORT_H_ #define EXPORT_H_ -#ifdef ENABLE_CGAL - #include <iostream> +#ifdef ENABLE_CGAL + void export_stl(class CGAL_Nef_polyhedron *root_N, std::ostream &output); void export_off(CGAL_Nef_polyhedron *root_N, std::ostream &output); void export_dxf(CGAL_Nef_polyhedron *root_N, std::ostream &output); + +#endif + +#ifdef DEBUG +void export_stl(const class PolySet &ps, std::ostream &output); #endif #endif |