Skip to content

Commit 7014551

Browse files
committed
Make it compatible with opencascade 1:7.7.2-5
Which is the current version available on archlinux. Also add some missing includes and std:: qualification.
1 parent 801da20 commit 7014551

File tree

6 files changed

+40
-45
lines changed

6 files changed

+40
-45
lines changed

Makefile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ LDFLAGS=-lTKSTL -lTKXDESTEP -lTKBinXCAF -lTKXmlXCAF -lTKXDEIGES -lTKXCAF \
3333
-lTKOpenGl -lTKV3d -lTKService -lTKXMesh -lTKMesh -lTKOffset \
3434
-lTKFeat -lTKFillet -lTKHLR -lTKBool -lTKBO -lTKShHealing \
3535
-lTKPrim -lTKTopAlgo -lTKGeomAlgo -lTKBRep -lTKGeomBase \
36-
-lTKG3d -lTKG2d \
37-
\
38-
/usr/lib/x86_64-linux-gnu/libTKMath.so.7.3.0 \
39-
/usr/lib/x86_64-linux-gnu/libTKernel.so.7.3.0 \
36+
-lTKG3d -lTKG2d -lTKMath -lTKernel\
4037
\
4138
-lfreetype -lpthread -lrt -lstdc++ -ldl -lm\
4239

explore-shape.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
#include <TColgp_HArray1OfPnt.hxx>
3434
#include <BRepTools_WireExplorer.hxx>
3535
#include <math.hxx>
36+
#include <GeomAbs_SurfaceType.hxx>
37+
#include <BRepAdaptor_Surface.hxx>
3638

3739

3840
/* good resources:

openscad-step-reader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ void show_help()
8282

8383
void show_version()
8484
{
85-
std::cout << 42 << endl;
85+
std::cout << 42 << std::endl;
8686
exit(0);
8787
}
8888

openscad-triangle-writer.cpp

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ using namespace std;
2626
(with invalud 'normals' value - but these are ignored anyhow in OpenSCAD */
2727
void 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
}

tessellation.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,20 +80,16 @@ Face tessellate_face(const TopoDS_Face &aFace)
8080

8181
if(!aTr.IsNull())
8282
{
83-
const TColgp_Array1OfPnt& aNodes = aTr->Nodes();
84-
const Poly_Array1OfTriangle& triangles = aTr->Triangles();
85-
const TColgp_Array1OfPnt2d & uvNodes = aTr->UVNodes();
86-
87-
TColgp_Array1OfPnt aPoints(1, aNodes.Length());
88-
for(Standard_Integer i = 1; i < aNodes.Length()+1; i++)
89-
aPoints(i) = aNodes(i).Transformed(aLocation);
83+
TColgp_Array1OfPnt aPoints(1, aTr->NbNodes());
84+
for(Standard_Integer i = 1; i < aPoints.Size()+1; i++)
85+
aPoints(i) = aTr->Node(i).Transformed(aLocation);
9086

9187
Standard_Integer nnn = aTr->NbTriangles();
9288
Standard_Integer nt,n1,n2,n3;
9389

9490
for( nt = 1 ; nt < nnn+1 ; nt++)
9591
{
96-
triangles(nt).Get(n1,n2,n3);
92+
aTr->Triangle(nt).Get(n1,n2,n3);
9793

9894
if (faceOrientation != TopAbs_Orientation::TopAbs_FORWARD)
9995
{

triangle.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Point {
3030
}
3131

3232
};
33-
static ostream & operator << (ostream &out, const Point &p)
33+
static std::ostream & operator << (std::ostream &out, const Point &p)
3434
{
3535
out << "[" << p.x() << "," << p.y() << "," << p.z() << "]";
3636
return out;
@@ -52,15 +52,15 @@ class Triangle {
5252
{
5353
ostrm << " " ;
5454
_p1.write_ascii_stl(ostrm);
55-
ostrm << endl;
55+
ostrm << std::endl;
5656

5757
ostrm << " " ;
5858
_p2.write_ascii_stl(ostrm);
59-
ostrm << endl;
59+
ostrm << std::endl;
6060

6161
ostrm << " " ;
6262
_p3.write_ascii_stl(ostrm);
63-
ostrm << endl;
63+
ostrm << std::endl;
6464
}
6565

6666
};

0 commit comments

Comments
 (0)