From c2c67f2eacd74b560c5c5a428e8a0a7bae4fd55a Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Fri, 3 Feb 2012 23:06:16 +0100 Subject: Added debug function for exporting a PolySet to STL 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 +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 +#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 -- cgit v0.10.1