@@ -26,10 +26,10 @@ using namespace std;
2626 (with invalud 'normals' value - but these are ignored anyhow in OpenSCAD */
2727void write_triangles_ascii_stl (const Face_vector& faces)
2828{
29- cout << " solid" << endl;
29+ cout << " solid" << std:: endl;
3030 for (auto &f : faces)
3131 f.write_ascii_stl (cout);
32- cout << " endsolid" << endl;
32+ cout << " endsolid" << std:: endl;
3333}
3434
3535/* Write the faces/triangles as two vectors (one "POINTS", one "FACES")
@@ -50,11 +50,11 @@ void write_triangle_scad(const Face_vector& faces)
5050 all.write_face_vector (cout);
5151
5252 // Call Polyhedron
53- cout << " module solid_object() {" << endl;
54- cout << " polyhedron (points,faces);" << endl;
55- cout << " }" << endl;
56- cout << endl;
57- cout << " solid_object();" << endl;
53+ cout << " module solid_object() {" << std:: endl;
54+ cout << " polyhedron (points,faces);" << std:: endl;
55+ cout << " }" << std:: endl;
56+ cout << std:: endl;
57+ cout << " solid_object();" << std:: endl;
5858}
5959
6060
@@ -99,32 +99,32 @@ void write_faces_scad (const Face_vector& faces)
9999 }
100100
101101 /* crazy colors version, draw each face by itself */
102- cout << " module crazy_colors() {" << endl;
102+ cout << " module crazy_colors() {" << std:: endl;
103103 for (i=1 ;i<=faces.size ();++i) {
104104 const char * color = colors[i%NUM_COLORS] ;
105- cout << " color(\" " << color << " \" )" << endl;
105+ cout << " color(\" " << color << " \" )" << std:: endl;
106106 cout << " polyhedron(face_" << i <<" _points, face_" << i << " _faces);" << endl ;
107107 }
108- cout << " }" << endl;
108+ cout << " }" << std:: endl;
109109
110- cout << " function add_offset(vec,ofs) = [for (x=vec) x + [ofs,ofs,ofs]];" << endl;
111- cout << " module solid_object() {" << endl;
112- cout << " tmp1_points = face_1_points;" << endl;
113- cout << " tmp1_faces = face_1_faces;" << endl;
114- cout << endl;
110+ cout << " function add_offset(vec,ofs) = [for (x=vec) x + [ofs,ofs,ofs]];" << std:: endl;
111+ cout << " module solid_object() {" << std:: endl;
112+ cout << " tmp1_points = face_1_points;" << std:: endl;
113+ cout << " tmp1_faces = face_1_faces;" << std:: endl;
114+ cout << std:: endl;
115115 for (i=2 ;i<=faces.size ();++i) {
116- cout << " tmp" <<i<<" _points = concat(tmp" <<(i-1 )<<" _points, face_" <<i<<" _points);" << endl;
117- cout << " tmp" <<i<<" _faces = concat(tmp" <<(i-1 )<<" _faces,add_offset(face_" <<i<<" _faces,len(tmp" <<(i-1 )<<" _points)));" << endl;
118- cout << endl;
116+ cout << " tmp" <<i<<" _points = concat(tmp" <<(i-1 )<<" _points, face_" <<i<<" _points);" << std:: endl;
117+ cout << " tmp" <<i<<" _faces = concat(tmp" <<(i-1 )<<" _faces,add_offset(face_" <<i<<" _faces,len(tmp" <<(i-1 )<<" _points)));" << std:: endl;
118+ cout << std:: endl;
119119 }
120- cout << " polyhedron (tmp" <<(faces.size ())<<" _points, tmp" <<(faces.size ())<<" _faces);" << endl;
121- cout << " }" << endl;
122- cout << endl;
123- cout << endl;
124-
125- cout << " if ($preview) {;" << endl;
126- cout << " crazy_colors();" << endl;
127- cout << " } else {" << endl;
128- cout << " solid_object();" << endl;
129- cout << " }" << endl;
120+ cout << " polyhedron (tmp" <<(faces.size ())<<" _points, tmp" <<(faces.size ())<<" _faces);" << std:: endl;
121+ cout << " }" << std:: endl;
122+ cout << std:: endl;
123+ cout << std:: endl;
124+
125+ cout << " if ($preview) {;" << std:: endl;
126+ cout << " crazy_colors();" << std:: endl;
127+ cout << " } else {" << std:: endl;
128+ cout << " solid_object();" << std:: endl;
129+ cout << " }" << std:: endl;
130130}
0 commit comments