Heeks / heekscad-old

/!\ Obsolete repository of HeeksCAD
http://heeks.net
Other
111 stars 47 forks source link

HeeksCAD fails to build against OCE 6.8.0 #32

Open danieloneill opened 9 years ago

danieloneill commented 9 years ago

Trying to build against OCE found in Github, though I'm not sure how legitimate it is. It appears fairly well maintained.

Regardless, it fails to compile here:

/home/doneill/cnc/heekscad/src/ConversionTools.cpp: In function ‘bool ConvertEdgeToSketch2(const TopoDS_Edge&, HeeksObj*, double, bool)’:
/home/doneill/cnc/heekscad/src/ConversionTools.cpp:634:4: error: ‘Mesh’ is not a member of ‘BRepMesh’
    BRepMesh::Mesh(edge, deviation);

According to the OpenCascade documentation as of at least 6.8.1 the method has been missing.

maleadt commented 9 years ago

As per this thread, replacing BRepMesh::Mesh with BRepMesh_IncrementalMesh fixes this.

These are all the changes I had to make to HeeksCAD in order to get it compiled:

Index: interface/Geom.cpp
===================================================================
--- interface/Geom.cpp  (revision 1711)
+++ interface/Geom.cpp  (working copy)
@@ -1165,7 +1165,7 @@
    gp_Trsf tr;
    try
 {
-   tr.SetValues(m[0], m[1], m[2], m[3], m[4], m[5], m[6], m[7], m[8], m[9], m[10], m[11], 0.0001, 0.00000001);
+   tr.SetValues(m[0], m[1], m[2], m[3], m[4], m[5], m[6], m[7], m[8], m[9], m[10], m[11]);
 }
    catch(...)
 {
Index: src/ConversionTools.cpp
===================================================================
--- src/ConversionTools.cpp (revision 1711)
+++ src/ConversionTools.cpp (working copy)
@@ -637,7 +637,7 @@
        {
            // make lots of small lines
            BRepTools::Clean(edge);
-           BRepMesh::Mesh(edge, deviation);
+           BRepMesh_IncrementalMesh(edge, deviation);

            TopLoc_Location L;
            Handle(Poly_Polygon3D) Polyg = BRep_Tool::Polygon3D(edge, L);
Index: src/Edge.cpp
===================================================================
--- src/Edge.cpp    (revision 1711)
+++ src/Edge.cpp    (working copy)
@@ -79,7 +79,7 @@
        {
            BRepTools::Clean(m_topods_edge);
            double pixels_per_mm = wxGetApp().GetPixelScale();
-           BRepMesh::Mesh(m_topods_edge, 1/pixels_per_mm);
+           BRepMesh_IncrementalMesh(m_topods_edge, 1/pixels_per_mm);
            if(marked){
                glGetFloatv(GL_DEPTH_RANGE, save_depth_range);
                glDepthRange(0, 0);
Index: src/Face.cpp
===================================================================
--- src/Face.cpp    (revision 1711)
+++ src/Face.cpp    (working copy)
@@ -36,7 +36,7 @@
 void CFace::glCommands(bool select, bool marked, bool no_color){
    bool owned_by_solid = false;
    if(GetParentBody()) {
-       // using existing BRepMesh::Mesh
+       // using existing BRepMesh_IncrementalMesh
        // use solid's colour
        owned_by_solid = true;

@@ -109,7 +109,7 @@

 void CFace::GetTriangles(void(*callbackfunc)(const double* x, const double* n), double cusp, bool just_one_average_normal){
    if(GetParentBody()) {
-       // using existing BRepMesh::Mesh
+       // using existing BRepMesh_IncrementalMesh
    }
    else {
        MeshFace(m_topods_face,1/cusp);
Index: src/FaceTools.cpp
===================================================================
--- src/FaceTools.cpp   (revision 1711)
+++ src/FaceTools.cpp   (working copy)
@@ -28,7 +28,7 @@
 void MeshFace(TopoDS_Face face, double pixels_per_mm)
 {
    BRepTools::Clean(face);
-   BRepMesh::Mesh(face, 1/pixels_per_mm);
+   BRepMesh_IncrementalMesh(face, 1/pixels_per_mm);
 }

 void command_callback(const double* x, const double* n)
@@ -175,7 +175,7 @@
        // ni  : sommet i du triangle courant
        for (nt = 1; nt <= nnn; nt++)                   
        {
-           if (SST.Orientation(face) == TopAbs_REVERSED)           // si la face est "reversed"
+           if (face.Orientation() == TopAbs_REVERSED)          // si la face est "reversed"
                triangles(nt).Get(n1,n3,n2);                        // le triangle est n1,n3,n2
            else 
                triangles(nt).Get(n1,n2,n3);                        // le triangle est n1,n2,n3
Index: src/Ruler.cpp
===================================================================
--- src/Ruler.cpp   (revision 1711)
+++ src/Ruler.cpp   (working copy)
@@ -383,7 +383,7 @@
    config.Read(_T("RulerTrsf32"), &m32, 0.0);
    config.Read(_T("RulerTrsf33"), &m33, 1.0);
    config.Read(_T("RulerTrsf34"), &m34, 0.0);
-   m_trsf.SetValues(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, 0.0001, 0.00000001);
+   m_trsf.SetValues(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34);

    config.Read(_T("RulerUseViewUnits"), &m_use_view_units);
    config.Read(_T("RulerUnits"), &m_units);
Index: src/Shape.cpp
===================================================================
--- src/Shape.cpp   (revision 1711)
+++ src/Shape.cpp   (working copy)
@@ -167,7 +167,7 @@
 {
    double pixels_per_mm = wxGetApp().GetPixelScale();
    BRepTools::Clean(m_shape);
-   BRepMesh::Mesh(m_shape, 1/pixels_per_mm);
+   BRepMesh_IncrementalMesh(m_shape, 1/pixels_per_mm);
 }

 void CShape::glCommands(bool select, bool marked, bool no_color)
@@ -264,7 +264,7 @@
    {
        if(m_faces == NULL)create_faces_and_edges();
        BRepTools::Clean(m_shape);
-       BRepMesh::Mesh(m_shape, 1.0);
+       BRepMesh_IncrementalMesh(m_shape, 1.0);
        if(m_faces)m_faces->GetBox(m_box);
    }

@@ -289,7 +289,7 @@
 #ifdef TESTNEWSHAPE
                //This will end up throwing 90% of the exceptions caused by a bad offset
                BRepTools::Clean(new_shape);
-               BRepMesh::Mesh(new_shape, 1.0);
+               BRepMesh_IncrementalMesh(new_shape, 1.0);
 #endif

                HeeksObj* new_object = CShape::MakeObject(new_shape, shape_for_tools->m_title_made_from_id ? wxString(_("Result of 'Offset Shape'")).c_str() : shape_for_tools->m_title.c_str(), SOLID_TYPE_UNKNOWN, shape_for_tools->m_color, shape_for_tools->GetOpacity());
@@ -1026,7 +1026,7 @@

 void CShape::GetTriangles(void(*callbackfunc)(const double* x, const double* n), double cusp, bool just_one_average_normal){
    BRepTools::Clean(m_shape);
-   BRepMesh::Mesh(m_shape, cusp);
+   BRepMesh_IncrementalMesh(m_shape, cusp);

    return IdNamedObjList::GetTriangles(callbackfunc, cusp, just_one_average_normal);
 }
Index: src/stdafx.h
===================================================================
--- src/stdafx.h    (revision 1711)
+++ src/stdafx.h    (working copy)
@@ -94,6 +94,7 @@
 #include <BRepFilletAPI_MakeFillet2d.hxx>
 #include <BRepGProp.hxx>
 #include <BRepMesh.hxx>
+#include <BRepMesh_IncrementalMesh.hxx>
 #include <BRepOffsetAPI_DraftAngle.hxx>
 #include <BRepOffsetAPI_MakeEvolved.hxx>
 #include <BRepOffsetAPI_MakeOffset.hxx>