Heeks / heekscad

Computer-Aided Design application based on OCE
https://sites.google.com/site/heekscad/
Other
193 stars 48 forks source link

OCE is discontinued, can this be made to work with OpenCascade? #438

Open frankspace opened 2 years ago

frankspace commented 2 years ago

According to this comment, OCE is EOL. I cannot get this to compile on Artix with OpenCASCADE, primarily running into repeated fatal error: Handle_Geom_TrimmedCurve.hxx: No such file or directory errors. There is a "/usr/include/opencascade/Geom_TrimmedCurve.hxx" on my box from OpenCASCADE, and during compilation CMake says, among other things, "Found OCC include dir: /usr/include/opencascade". It does complain about not finding OCE. I simply don't know enough programming to know whether this does work with OpenCASCADE and I'm just doing something wrong, or if something needs to be done under the hood for compatibility. Nonetheless, I don't seem to be able to get this to compile against OpenCASCADE, and it seems that with OCE being discontinued, perhaps there ought to be a way to do that?

lpgasparotto commented 1 year ago

Hi, it seems OpenCascade uses different names for certain files. In this specific case /usr/include/opencascade/Handle_Geom_TrimmedCurve.hxx Seems to be replaced by: /usr/include/opencascade/Geom_TrimmedCurve.hxx A workaround is to create a symbolic link with the old name pointing to the current file, something like: ln -s /usr/include/opencascade/Geom_TrimmedCurve.hxx Handle_Geom_TrimmedCurve.hxx And to repeat this for every missing file. I can't guarantee it will solve all the compilation issues but at least it will hwlp to find the missing files.

bullestock commented 1 year ago

I have created a fork which compiles with the latest OpenCascade (7.6.0). See https://github.com/bullestock/heekscad/

hadess commented 1 year ago

I have created a fork which compiles with the latest OpenCascade (7.6.0). See https://github.com/bullestock/heekscad/

I tried to build it against OpenCascade 7.6.2 (or rather https://gitlab.com/blobfish/occt.git/ commit f3f00c9e9487713be0c64f36c53590cc0f30e5a6), and ran into errors as well:

build log ``` [16/135] Building CXX object interface/CMakeFiles/heeksintf.dir/Geom.cpp.o /run/build/heekscad/interface/Geom.cpp: In function ‘bool intersect(const gp_Pln&, const gp_Pln&, gp_Lin&)’: /run/build/heekscad/interface/Geom.cpp:80:81: warning: ‘static opencascade::handle opencascade::handle::DownCast(const opencascade::handle&, typename std::enable_if<(! opencascade::is_base_but_not_same::value), void*>::type) [with T2 = Geom_Plane; T = Geom_Plane; typename std::enable_if<(! opencascade::is_base_but_not_same::value), void*>::type = void*]’ is deprecated: down-casting from object of the same or unrelated type is meaningless [-Wdeprecated-declarations] 80 | Handle (Geom_Surface) hs = Handle (Geom_Plane)::DownCast(g_p); | ^ In file included from /app/include/opencascade/Bnd_Box.hxx:22, from /run/build/heekscad/src/stdafx.h:75, from /run/build/heekscad/interface/Geom.cpp:5: /app/include/opencascade/Standard_Handle.hxx:203:19: note: declared here 203 | static handle DownCast (const handle& theObject, typename opencascade::std::enable_if::value, void*>::type = 0) | ^~~~~~~~ /run/build/heekscad/interface/Geom.cpp:81:82: warning: ‘static opencascade::handle opencascade::handle::DownCast(const opencascade::handle&, typename std::enable_if<(! opencascade::is_base_but_not_same::value), void*>::type) [with T2 = Geom_Plane; T = Geom_Plane; typename std::enable_if<(! opencascade::is_base_but_not_same::value), void*>::type = void*]’ is deprecated: down-casting from object of the same or unrelated type is meaningless [-Wdeprecated-declarations] 81 | Handle (Geom_Surface) hs2 = Handle (Geom_Plane)::DownCast(g_p2); | ^ /app/include/opencascade/Standard_Handle.hxx:203:19: note: declared here 203 | static handle DownCast (const handle& theObject, typename opencascade::std::enable_if::value, void*>::type = 0) | ^~~~~~~~ [18/135] Running utility command for translations /run/build/heekscad/translations/de/HeeksCAD.po:9: warning: header field 'Language' missing in header /run/build/heekscad/translations/es/HeeksCAD.po:9: warning: header field 'Project-Id-Version' still has the initial default value /run/build/heekscad/translations/es/HeeksCAD.po:9: warning: header field 'PO-Revision-Date' still has the initial default value /run/build/heekscad/translations/es/HeeksCAD.po:9: warning: header field 'Last-Translator' still has the initial default value /run/build/heekscad/translations/es/HeeksCAD.po:9: warning: header field 'Language-Team' still has the initial default value /run/build/heekscad/translations/es/HeeksCAD.po:9: warning: header field 'Language' missing in header /run/build/heekscad/translations/ko/HeeksCAD.po:2: warning: header field 'Language' missing in header /run/build/heekscad/translations/ru/HeeksCAD.po:2: warning: header field 'Language' missing in header /run/build/heekscad/translations/sk/HeeksCAD.po:10: warning: header field 'Language' still has the initial default value /run/build/heekscad/translations/zh/HeeksCAD.po:7: warning: header field 'Language' missing in header [41/135] Building CXX object src/CMakeFiles/heekscad.dir/ConversionTools.cpp.o FAILED: src/CMakeFiles/heekscad.dir/ConversionTools.cpp.o /run/ccache/bin/c++ -DHAVE_CONFIG_H -DHAVE_FSTREAM -DHAVE_IOMANIP -DHAVE_IOSTREAM -DHAVE_LIMITS_H -DHEEKSCAD -DLIN -DLININTEL -DTIXML_USE_STL -DUNICODE -DUSE_GENERIC_TREECTRL -DWXUSINGDLL -D_OCC64 -D__WXGTK3__ -D__WXGTK__ -I/run/build/heekscad -I/run/build/heekscad/src -I/usr/include/python3.10 -I/app/include/area -isystem /app/lib/wx/include/gtk3-unicode-3.2 -isystem /app/include/wx-3.2 -isystem /app/include/opencascade -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -pthread -pthread -Wall -m64 -Wall -m64 -MD -MT src/CMakeFiles/heekscad.dir/ConversionTools.cpp.o -MF src/CMakeFiles/heekscad.dir/ConversionTools.cpp.o.d -o src/CMakeFiles/heekscad.dir/ConversionTools.cpp.o -c /run/build/heekscad/src/ConversionTools.cpp /run/build/heekscad/src/ConversionTools.cpp: In function ‘bool ConvertSketchToEdges(HeeksObj*, std::__cxx11::list >&)’: /run/build/heekscad/src/ConversionTools.cpp:407:64: error: ‘Caught’ is not a member of ‘Standard_Failure’ 407 | Handle(Standard_Failure) e = Standard_Failure::Caught(); | ^~~~~~ /run/build/heekscad/src/ConversionTools.cpp: In function ‘bool ConvertEdgesToFaceOrWire(const std::vector&, std::__cxx11::list&, bool)’: /run/build/heekscad/src/ConversionTools.cpp:468:64: error: ‘Caught’ is not a member of ‘Standard_Failure’ 468 | Handle(Standard_Failure) e = Standard_Failure::Caught(); | ^~~~~~ [43/135] Building CXX object src/CMakeFiles/heekscad.dir/Edge.cpp.o FAILED: src/CMakeFiles/heekscad.dir/Edge.cpp.o /run/ccache/bin/c++ -DHAVE_CONFIG_H -DHAVE_FSTREAM -DHAVE_IOMANIP -DHAVE_IOSTREAM -DHAVE_LIMITS_H -DHEEKSCAD -DLIN -DLININTEL -DTIXML_USE_STL -DUNICODE -DUSE_GENERIC_TREECTRL -DWXUSINGDLL -D_OCC64 -D__WXGTK3__ -D__WXGTK__ -I/run/build/heekscad -I/run/build/heekscad/src -I/usr/include/python3.10 -I/app/include/area -isystem /app/lib/wx/include/gtk3-unicode-3.2 -isystem /app/include/wx-3.2 -isystem /app/include/opencascade -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -pthread -pthread -Wall -m64 -Wall -m64 -MD -MT src/CMakeFiles/heekscad.dir/Edge.cpp.o -MF src/CMakeFiles/heekscad.dir/Edge.cpp.o.d -o src/CMakeFiles/heekscad.dir/Edge.cpp.o -c /run/build/heekscad/src/Edge.cpp /run/build/heekscad/src/Edge.cpp: In member function ‘virtual void CEdge::glCommands(bool, bool, bool)’: /run/build/heekscad/src/Edge.cpp:60:84: error: ‘class Poly_Triangulation’ has no member named ‘Nodes’; did you mean ‘Node’? 60 | const TColgp_Array1OfPnt& FNodes = facing->Nodes(); | ^~~~~ | Node /run/build/heekscad/src/Edge.cpp: In member function ‘void CEdge::Blend(double, bool)’: /run/build/heekscad/src/Edge.cpp:279:16: warning: catching polymorphic type ‘class Standard_Failure’ by value [-Wcatch-value=] 279 | catch (Standard_Failure) { | ^~~~~~~~~~~~~~~~ /run/build/heekscad/src/Edge.cpp:280:63: error: ‘Caught’ is not a member of ‘Standard_Failure’ 280 | Handle_Standard_Failure e = Standard_Failure::Caught(); | ^~~~~~ [48/135] Building CXX object src/CMakeFiles/heekscad.dir/FaceTools.cpp.o FAILED: src/CMakeFiles/heekscad.dir/FaceTools.cpp.o /run/ccache/bin/c++ -DHAVE_CONFIG_H -DHAVE_FSTREAM -DHAVE_IOMANIP -DHAVE_IOSTREAM -DHAVE_LIMITS_H -DHEEKSCAD -DLIN -DLININTEL -DTIXML_USE_STL -DUNICODE -DUSE_GENERIC_TREECTRL -DWXUSINGDLL -D_OCC64 -D__WXGTK3__ -D__WXGTK__ -I/run/build/heekscad -I/run/build/heekscad/src -I/usr/include/python3.10 -I/app/include/area -isystem /app/lib/wx/include/gtk3-unicode-3.2 -isystem /app/include/wx-3.2 -isystem /app/include/opencascade -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -pthread -pthread -Wall -m64 -Wall -m64 -MD -MT src/CMakeFiles/heekscad.dir/FaceTools.cpp.o -MF src/CMakeFiles/heekscad.dir/FaceTools.cpp.o.d -o src/CMakeFiles/heekscad.dir/FaceTools.cpp.o -c /run/build/heekscad/src/FaceTools.cpp /run/build/heekscad/src/FaceTools.cpp: In function ‘void DrawFace(TopoDS_Face, void (*)(const double*, const double*), bool)’: /run/build/heekscad/src/FaceTools.cpp:167:59: error: ‘class Poly_Triangulation’ has no member named ‘Nodes’; did you mean ‘Node’? 167 | const TColgp_Array1OfPnt& Nodes = facing->Nodes(); | ^~~~~ | Node /run/build/heekscad/src/FaceTools.cpp:168:75: warning: ‘const Poly_Array1OfTriangle& Poly_Triangulation::Triangles() const’ is deprecated: Deprecated method, Triangle() should be used instead [-Wdeprecated-declarations] 168 | const Poly_Array1OfTriangle& triangles = facing->Triangles(); | ~~~~~~~~~~~~~~~~~^~ In file included from /app/include/opencascade/Poly_ListOfTriangulation.hxx:20, from /app/include/opencascade/BRep_Builder.hxx:31, from /app/include/opencascade/BRepPrim_Builder.hxx:24, from /app/include/opencascade/BRepPrim_GWedge.hxx:24, from /app/include/opencascade/BRepPrim_Wedge.hxx:24, from /app/include/opencascade/BRepPrimAPI_MakeBox.hxx:24, from /run/build/heekscad/src/stdafx.h:103, from /run/build/heekscad/src/FaceTools.cpp:5: /app/include/opencascade/Poly_Triangulation.hxx:318:32: note: declared here 318 | const Poly_Array1OfTriangle& Triangles() const { return myTriangles; } | ^~~~~~~~~ [49/135] Building CXX object src/CMakeFiles/heekscad.dir/DigitizedPoint.cpp.o /run/build/heekscad/src/DigitizedPoint.cpp: In static member function ‘static bool DigitizedPoint::GetEllipse(const DigitizedPoint&, const DigitizedPoint&, const DigitizedPoint&, gp_Elips&)’: /run/build/heekscad/src/DigitizedPoint.cpp:288:16: warning: variable ‘x_axis’ set but not used [-Wunused-but-set-variable] 288 | gp_Dir x_axis = e.XAxis().Direction(); | ^~~~~~ /run/build/heekscad/src/DigitizedPoint.cpp:289:16: warning: variable ‘y_axis’ set but not used [-Wunused-but-set-variable] 289 | gp_Dir y_axis = e.YAxis().Direction(); | ^~~~~~ [52/135] Building CXX object src/CMakeFiles/heekscad.dir/Face.cpp.o FAILED: src/CMakeFiles/heekscad.dir/Face.cpp.o /run/ccache/bin/c++ -DHAVE_CONFIG_H -DHAVE_FSTREAM -DHAVE_IOMANIP -DHAVE_IOSTREAM -DHAVE_LIMITS_H -DHEEKSCAD -DLIN -DLININTEL -DTIXML_USE_STL -DUNICODE -DUSE_GENERIC_TREECTRL -DWXUSINGDLL -D_OCC64 -D__WXGTK3__ -D__WXGTK__ -I/run/build/heekscad -I/run/build/heekscad/src -I/usr/include/python3.10 -I/app/include/area -isystem /app/lib/wx/include/gtk3-unicode-3.2 -isystem /app/include/wx-3.2 -isystem /app/include/opencascade -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -pthread -pthread -Wall -m64 -Wall -m64 -MD -MT src/CMakeFiles/heekscad.dir/Face.cpp.o -MF src/CMakeFiles/heekscad.dir/Face.cpp.o.d -o src/CMakeFiles/heekscad.dir/Face.cpp.o -c /run/build/heekscad/src/Face.cpp /run/build/heekscad/src/Face.cpp: In member function ‘virtual void RotateToFace::Run()’: /run/build/heekscad/src/Face.cpp:275:25: warning: variable ‘inv_matrix’ set but not used [-Wunused-but-set-variable] 275 | gp_Trsf inv_matrix = face_matrix.Inverted(); | ^~~~~~~~~~ /run/build/heekscad/src/Face.cpp: In member function ‘bool CFace::IsAPlane(gp_Pln*)’: /run/build/heekscad/src/Face.cpp:388:40: warning: variable ‘n00’ set but not used [-Wunused-but-set-variable] 388 | gp_Dir n00 = GetNormalAtUV(uv_box[0] + U * 0.1, uv_box[2] + V * 0.1, &p00); | ^~~ /run/build/heekscad/src/Face.cpp:389:40: warning: variable ‘nN0’ set but not used [-Wunused-but-set-variable] 389 | gp_Dir nN0 = GetNormalAtUV(uv_box[0] + U * 0.9, uv_box[2] + V * 0.1, &pN0); | ^~~ /run/build/heekscad/src/Face.cpp:390:40: warning: variable ‘nNN’ set but not used [-Wunused-but-set-variable] 390 | gp_Dir nNN = GetNormalAtUV(uv_box[0] + U * 0.9, uv_box[2] + V * 0.9, &pNN); | ^~~ /run/build/heekscad/src/Face.cpp:402:48: warning: variable ‘n’ set but not used [-Wunused-but-set-variable] 402 | gp_Dir n = GetNormalAtUV(u[i], v[j], &p); | ^ /run/build/heekscad/src/Face.cpp:376:32: warning: variable ‘n00’ set but not used [-Wunused-but-set-variable] 376 | gp_Dir n00 = GetNormalAtUV(u[0], v[0], &p00); | ^~~ /run/build/heekscad/src/Face.cpp:377:32: warning: variable ‘nN0’ set but not used [-Wunused-but-set-variable] 377 | gp_Dir nN0 = GetNormalAtUV(u[GRID], v[0], &pN0); | ^~~ /run/build/heekscad/src/Face.cpp:378:32: warning: variable ‘nNN’ set but not used [-Wunused-but-set-variable] 378 | gp_Dir nNN = GetNormalAtUV(u[GRID], v[GRID], &pNN); | ^~~ /run/build/heekscad/src/Face.cpp: In member function ‘bool CFace::GetNurbSurfaceParams(CNurbSurfaceParams*)’: /run/build/heekscad/src/Face.cpp:650:15: warning: catching polymorphic type ‘class Standard_Failure’ by value [-Wcatch-value=] 650 | catch(Standard_Failure) { | ^~~~~~~~~~~~~~~~ /run/build/heekscad/src/Face.cpp:651:64: error: ‘Caught’ is not a member of ‘Standard_Failure’ 651 | Handle(Standard_Failure) e = Standard_Failure::Caught(); | ^~~~~~ [54/135] Building CXX object src/CMakeFiles/heekscad.dir/DigitizeMode.cpp.o /run/build/heekscad/src/DigitizeMode.cpp: In member function ‘virtual const wxChar* DigitizeMode::GetTitle()’: /run/build/heekscad/src/DigitizeMode.cpp:51:23: warning: enumeration value ‘DigitizeNoItemType’ not handled in switch [-Wswitch] 51 | switch(digitized_point.m_type) | ^ /run/build/heekscad/src/DigitizeMode.cpp:51:23: warning: enumeration value ‘DigitizeCoordsType’ not handled in switch [-Wswitch] /run/build/heekscad/src/DigitizeMode.cpp:51:23: warning: enumeration value ‘DigitizeInputType’ not handled in switch [-Wswitch] /run/build/heekscad/src/DigitizeMode.cpp: In member function ‘DigitizedPoint DigitizeMode::digitize1(const wxPoint&)’: /run/build/heekscad/src/DigitizeMode.cpp:281:16: warning: variable ‘best_dp’ set but not used [-Wunused-but-set-variable] 281 | double best_dp = 0; | ^~~~~~~ [56/135] Building CXX object src/CMakeFiles/heekscad.dir/CxfFont.cpp.o ```

That was after I modified heekscad to use BRepAlgoAPI_Fuse instead of BRepAlgo_Fuse which got removed from the 7.6.0 API.