Date: Sat, 14 Nov 2020 21:07:08 +0000 (UTC) From: Christoph Moench-Tegeder <cmt@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r555147 - head/cad/freecad/files Message-ID: <202011142107.0AEL78aY019676@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: cmt Date: Sat Nov 14 21:07:08 2020 New Revision: 555147 URL: https://svnweb.freebsd.org/changeset/ports/555147 Log: freecad: fix build with opencascade 7.5.0 after r555127 OpenCascade APIs changed significantly in some areas - FreeCAD is affected on progress bars and some message output. While messages are easily fixed, the affected progress bars have to be enabled for now. Patches adapted (some manual fuzzing required) from upstream https://github.com/FreeCAD/FreeCAD/commit/2cb9b147f13419f019f9808ace21d3d2ceae99c5 https://github.com/FreeCAD/FreeCAD/commit/fd9cdb9de9d06ebd8dc1ce26c99e4e4eb005ca43 Added: head/cad/freecad/files/patch-src_Mod_Import_App_AppImportPy.cpp (contents, props changed) head/cad/freecad/files/patch-src_Mod_Import_App_StepShape.cpp (contents, props changed) head/cad/freecad/files/patch-src_Mod_Import_Gui_AppImportGuiPy.cpp (contents, props changed) head/cad/freecad/files/patch-src_Mod_Part_App_ImportIges.cpp (contents, props changed) head/cad/freecad/files/patch-src_Mod_Part_App_ImportStep.cpp (contents, props changed) head/cad/freecad/files/patch-src_Mod_Part_App_ProgressIndicator.cpp (contents, props changed) head/cad/freecad/files/patch-src_Mod_Part_App_ProgressIndicator.h (contents, props changed) head/cad/freecad/files/patch-src_Mod_Part_App_TopoShape.cpp (contents, props changed) head/cad/freecad/files/patch-src_Mod_Part_Gui_TaskCheckGeometry.cpp (contents, props changed) head/cad/freecad/files/patch-src_Mod_Part_Gui_TaskCheckGeometry.h (contents, props changed) Added: head/cad/freecad/files/patch-src_Mod_Import_App_AppImportPy.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cad/freecad/files/patch-src_Mod_Import_App_AppImportPy.cpp Sat Nov 14 21:07:08 2020 (r555147) @@ -0,0 +1,36 @@ +--- src/Mod/Import/App/AppImportPy.cpp.orig 2020-11-14 19:46:48 UTC ++++ src/Mod/Import/App/AppImportPy.cpp +@@ -146,12 +146,16 @@ class Module : public Py::ExtensionModule<Module> (pri + throw Py::Exception(PyExc_IOError, "cannot read STEP file"); + } + ++#if OCC_VERSION_HEX < 0x070500 + Handle(Message_ProgressIndicator) pi = new Part::ProgressIndicator(100); + aReader.Reader().WS()->MapReader()->SetProgress(pi); + pi->NewScope(100, "Reading STEP file..."); + pi->Show(); ++#endif + aReader.Transfer(hDoc); ++#if OCC_VERSION_HEX < 0x070500 + pi->EndScope(); ++#endif + } + catch (OSD_Exception& e) { + Base::Console().Error("%s\n", e.GetMessageString()); +@@ -178,12 +182,16 @@ class Module : public Py::ExtensionModule<Module> (pri + throw Py::Exception(PyExc_IOError, "cannot read IGES file"); + } + ++#if OCC_VERSION_HEX < 0x070500 + Handle(Message_ProgressIndicator) pi = new Part::ProgressIndicator(100); + aReader.WS()->MapReader()->SetProgress(pi); + pi->NewScope(100, "Reading IGES file..."); + pi->Show(); ++#endif + aReader.Transfer(hDoc); ++#if OCC_VERSION_HEX < 0x070500 + pi->EndScope(); ++#endif + // http://opencascade.blogspot.de/2009/03/unnoticeable-memory-leaks-part-2.html + Handle(IGESToBRep_Actor)::DownCast(aReader.WS()->TransferReader()->Actor()) + ->SetModel(new IGESData_IGESModel); Added: head/cad/freecad/files/patch-src_Mod_Import_App_StepShape.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cad/freecad/files/patch-src_Mod_Import_App_StepShape.cpp Sat Nov 14 21:07:08 2020 (r555147) @@ -0,0 +1,37 @@ +--- src/Mod/Import/App/StepShape.cpp.orig 2020-11-14 20:26:44 UTC ++++ src/Mod/Import/App/StepShape.cpp +@@ -34,6 +34,7 @@ + # include <Interface_Static.hxx> + # include <Message_Messenger.hxx> + # include <Message_PrinterOStream.hxx> ++# include <Standard_Version.hxx> + + # include <Base/FileInfo.h> + # include <Base/Exception.h> +@@ -85,18 +86,26 @@ int StepShape::read(const char* fileName) + Handle(StepData_StepModel) model = aReader.StepModel(); + //rank = model->NextNumberForLabe(label, 0, Standard_False); + ++#if OCC_VERSION_HEX < 0x070401 + Handle(Message_PrinterOStream) mstr = new Message_PrinterOStream(); + Handle(Message_Messenger) msg = new Message_Messenger(mstr); + + std::cout << "dump of step header:" << std::endl; + + model->DumpHeader(msg); ++#else ++ model->DumpHeader(std::cout); ++#endif + + for(int nent=1;nent<=model->NbEntities();nent++) { + Handle(Standard_Transient) entity=model->Entity(nent); + + std::cout << "label entity " << nent << ":" ; ++#if OCC_VERSION_HEX < 0x070401 + model->PrintLabel(entity,msg); ++#else ++ model->PrintLabel(entity,std::cout); ++#endif + std::cout << ";"<< entity->DynamicType()->Name() << std::endl; + } + Added: head/cad/freecad/files/patch-src_Mod_Import_Gui_AppImportGuiPy.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cad/freecad/files/patch-src_Mod_Import_Gui_AppImportGuiPy.cpp Sat Nov 14 21:07:08 2020 (r555147) @@ -0,0 +1,70 @@ +--- src/Mod/Import/Gui/AppImportGuiPy.cpp.orig 2020-11-14 19:49:55 UTC ++++ src/Mod/Import/Gui/AppImportGuiPy.cpp +@@ -391,12 +391,16 @@ class Module : public Py::ExtensionModule<Module> (pri + throw Py::Exception(PyExc_IOError, "cannot read STEP file"); + } + ++#if OCC_VERSION_HEX < 0x070500 + Handle(Message_ProgressIndicator) pi = new Part::ProgressIndicator(100); + aReader.Reader().WS()->MapReader()->SetProgress(pi); + pi->NewScope(100, "Reading STEP file..."); + pi->Show(); ++#endif + aReader.Transfer(hDoc); ++#if OCC_VERSION_HEX < 0x070500 + pi->EndScope(); ++#endif + } + catch (OSD_Exception& e) { + Base::Console().Error("%s\n", e.GetMessageString()); +@@ -423,12 +427,16 @@ class Module : public Py::ExtensionModule<Module> (pri + throw Py::Exception(Base::BaseExceptionFreeCADError, "cannot read IGES file"); + } + ++#if OCC_VERSION_HEX < 0x070500 + Handle(Message_ProgressIndicator) pi = new Part::ProgressIndicator(100); + aReader.WS()->MapReader()->SetProgress(pi); + pi->NewScope(100, "Reading IGES file..."); + pi->Show(); ++#endif + aReader.Transfer(hDoc); ++#if OCC_VERSION_HEX < 0x070500 + pi->EndScope(); ++#endif + // http://opencascade.blogspot.de/2009/03/unnoticeable-memory-leaks-part-2.html + Handle(IGESToBRep_Actor)::DownCast(aReader.WS()->TransferReader()->Actor()) + ->SetModel(new IGESData_IGESModel); +@@ -601,12 +609,16 @@ class Module : public Py::ExtensionModule<Module> (pri + throw Py::Exception(PyExc_IOError, "cannot read STEP file"); + } + ++#if OCC_VERSION_HEX < 0x070500 + Handle(Message_ProgressIndicator) pi = new Part::ProgressIndicator(100); + aReader.Reader().WS()->MapReader()->SetProgress(pi); + pi->NewScope(100, "Reading STEP file..."); + pi->Show(); ++#endif + aReader.Transfer(hDoc); ++#if OCC_VERSION_HEX < 0x070500 + pi->EndScope(); ++#endif + } + else if (file.hasExtension("igs") || file.hasExtension("iges")) { + Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter() +@@ -623,12 +635,16 @@ class Module : public Py::ExtensionModule<Module> (pri + throw Py::Exception(PyExc_IOError, "cannot read IGES file"); + } + ++#if OCC_VERSION_HEX < 0x070500 + Handle(Message_ProgressIndicator) pi = new Part::ProgressIndicator(100); + aReader.WS()->MapReader()->SetProgress(pi); + pi->NewScope(100, "Reading IGES file..."); + pi->Show(); ++#endif + aReader.Transfer(hDoc); ++#if OCC_VERSION_HEX < 0x070500 + pi->EndScope(); ++#endif + // http://opencascade.blogspot.de/2009/03/unnoticeable-memory-leaks-part-2.html + Handle(IGESToBRep_Actor)::DownCast(aReader.WS()->TransferReader()->Actor()) + ->SetModel(new IGESData_IGESModel); Added: head/cad/freecad/files/patch-src_Mod_Part_App_ImportIges.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cad/freecad/files/patch-src_Mod_Part_App_ImportIges.cpp Sat Nov 14 21:07:08 2020 (r555147) @@ -0,0 +1,23 @@ +--- src/Mod/Part/App/ImportIges.cpp.orig 2020-11-14 19:52:35 UTC ++++ src/Mod/Part/App/ImportIges.cpp +@@ -90,16 +90,20 @@ int Part::ImportIgesParts(App::Document *pcDoc, const + + #if 1 + std::string aName = fi.fileNamePure(); ++#if OCC_VERSION_HEX < 0x070500 + Handle(Message_ProgressIndicator) pi = new ProgressIndicator(100); + pi->NewScope(100, "Reading IGES file..."); + pi->Show(); + aReader.WS()->MapReader()->SetProgress(pi); ++#endif + + // make model + aReader.ClearShapes(); + //Standard_Integer nbRootsForTransfer = aReader.NbRootsForTransfer(); + aReader.TransferRoots(); ++#if OCC_VERSION_HEX < 0x070500 + pi->EndScope(); ++#endif + + // put all other free-flying shapes into a single compound + Standard_Boolean emptyComp = Standard_True; Added: head/cad/freecad/files/patch-src_Mod_Part_App_ImportStep.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cad/freecad/files/patch-src_Mod_Part_App_ImportStep.cpp Sat Nov 14 21:07:08 2020 (r555147) @@ -0,0 +1,25 @@ +--- src/Mod/Part/App/ImportStep.cpp.orig 2020-11-14 19:53:50 UTC ++++ src/Mod/Part/App/ImportStep.cpp +@@ -105,10 +105,12 @@ int Part::ImportStepParts(App::Document *pcDoc, const + throw Base::FileException("Cannot open STEP file"); + } + ++#if OCC_VERSION_HEX < 0x070500 + Handle(Message_ProgressIndicator) pi = new ProgressIndicator(100); + aReader.WS()->MapReader()->SetProgress(pi); + pi->NewScope(100, "Reading STEP file..."); + pi->Show(); ++#endif + + // Root transfers + Standard_Integer nbr = aReader.NbRootsForTransfer(); +@@ -117,7 +119,9 @@ int Part::ImportStepParts(App::Document *pcDoc, const + Base::Console().Log("STEP: Transferring Root %d\n",n); + aReader.TransferRoot(n); + } ++#if OCC_VERSION_HEX < 0x070500 + pi->EndScope(); ++#endif + + // Collecting resulting entities + Standard_Integer nbs = aReader.NbShapes(); Added: head/cad/freecad/files/patch-src_Mod_Part_App_ProgressIndicator.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cad/freecad/files/patch-src_Mod_Part_App_ProgressIndicator.cpp Sat Nov 14 21:07:08 2020 (r555147) @@ -0,0 +1,15 @@ +--- src/Mod/Part/App/ProgressIndicator.cpp.orig 2020-11-14 19:54:58 UTC ++++ src/Mod/Part/App/ProgressIndicator.cpp +@@ -54,6 +54,7 @@ using namespace Part; + \endcode + */ + ++#if OCC_VERSION_HEX < 0x070500 + ProgressIndicator::ProgressIndicator (int theMaxVal) + : myProgress(new Base::SequencerLauncher("", theMaxVal)) + { +@@ -83,3 +84,4 @@ Standard_Boolean ProgressIndicator::UserBreak() + { + return myProgress->wasCanceled(); + } ++#endif Added: head/cad/freecad/files/patch-src_Mod_Part_App_ProgressIndicator.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cad/freecad/files/patch-src_Mod_Part_App_ProgressIndicator.h Sat Nov 14 21:07:08 2020 (r555147) @@ -0,0 +1,24 @@ +--- src/Mod/Part/App/ProgressIndicator.h.orig 2020-11-14 19:56:01 UTC ++++ src/Mod/Part/App/ProgressIndicator.h +@@ -25,11 +25,13 @@ + #define PART_PROGRESSINDICATOR_H + + #include <Message_ProgressIndicator.hxx> ++#include <Standard_Version.hxx> + #include <Base/Sequencer.h> + #include <memory> + + namespace Part { + ++#if OCC_VERSION_HEX < 0x070500 + class PartExport ProgressIndicator : public Message_ProgressIndicator + { + public: +@@ -42,6 +44,7 @@ class PartExport ProgressIndicator : public Message_Pr + private: + std::unique_ptr<Base::SequencerLauncher> myProgress; + }; ++#endif + + } + Added: head/cad/freecad/files/patch-src_Mod_Part_App_TopoShape.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cad/freecad/files/patch-src_Mod_Part_App_TopoShape.cpp Sat Nov 14 21:07:08 2020 (r555147) @@ -0,0 +1,86 @@ +--- src/Mod/Part/App/TopoShape.cpp.orig 2020-11-14 19:57:17 UTC ++++ src/Mod/Part/App/TopoShape.cpp +@@ -584,17 +584,21 @@ void TopoShape::importIges(const char *FileName) + if (aReader.ReadFile(encodeFilename(FileName).c_str()) != IFSelect_RetDone) + throw Base::FileException("Error in reading IGES"); + ++#if OCC_VERSION_HEX < 0x070500 + Handle(Message_ProgressIndicator) pi = new ProgressIndicator(100); + pi->NewScope(100, "Reading IGES file..."); + pi->Show(); + aReader.WS()->MapReader()->SetProgress(pi); ++#endif + + // make brep + aReader.ClearShapes(); + aReader.TransferRoots(); + // one shape that contains all subshapes + this->_Shape = aReader.OneShape(); ++#if OCC_VERSION_HEX < 0x070500 + pi->EndScope(); ++#endif + } + catch (Standard_Failure& e) { + throw Base::CADKernelError(e.GetMessageString()); +@@ -608,16 +612,20 @@ void TopoShape::importStep(const char *FileName) + if (aReader.ReadFile(encodeFilename(FileName).c_str()) != IFSelect_RetDone) + throw Base::FileException("Error in reading STEP"); + ++#if OCC_VERSION_HEX < 0x070500 + Handle(Message_ProgressIndicator) pi = new ProgressIndicator(100); + aReader.WS()->MapReader()->SetProgress(pi); + pi->NewScope(100, "Reading STEP file..."); + pi->Show(); ++#endif + + // Root transfers + aReader.TransferRoots(); + // one shape that contains all subshapes + this->_Shape = aReader.OneShape(); ++#if OCC_VERSION_HEX < 0x070500 + pi->EndScope(); ++#endif + } + catch (Standard_Failure& e) { + throw Base::CADKernelError(e.GetMessageString()); +@@ -630,7 +638,7 @@ void TopoShape::importBrep(const char *FileName) + // read brep-file + BRep_Builder aBuilder; + TopoDS_Shape aShape; +-#if OCC_VERSION_HEX >= 0x060300 ++#if OCC_VERSION_HEX >= 0x060300 && OCC_VERSION_HEX < 0x070500 + Handle(Message_ProgressIndicator) pi = new ProgressIndicator(100); + pi->NewScope(100, "Reading BREP file..."); + pi->Show(); +@@ -652,7 +660,7 @@ void TopoShape::importBrep(std::istream& str, int indi + // read brep-file + BRep_Builder aBuilder; + TopoDS_Shape aShape; +-#if OCC_VERSION_HEX >= 0x060300 ++#if OCC_VERSION_HEX >= 0x060300 && OCC_VERSION_HEX < 0x070500 + if (indicator) { + Handle(Message_ProgressIndicator) pi = new ProgressIndicator(100); + pi->NewScope(100, "Reading BREP file..."); +@@ -750,10 +758,12 @@ void TopoShape::exportStep(const char *filename) const + + const Handle(XSControl_TransferWriter)& hTransferWriter = aWriter.WS()->TransferWriter(); + Handle(Transfer_FinderProcess) hFinder = hTransferWriter->FinderProcess(); ++#if OCC_VERSION_HEX < 0x070500 + Handle(Message_ProgressIndicator) pi = new ProgressIndicator(100); + hFinder->SetProgress(pi); + pi->NewScope(100, "Writing STEP file..."); + pi->Show(); ++#endif + + if (aWriter.Transfer(this->_Shape, STEPControl_AsIs) != IFSelect_RetDone) + throw Base::FileException("Error in transferring STEP"); +@@ -767,7 +777,9 @@ void TopoShape::exportStep(const char *filename) const + + if (aWriter.Write(encodeFilename(filename).c_str()) != IFSelect_RetDone) + throw Base::FileException("Writing of STEP failed"); ++#if OCC_VERSION_HEX < 0x070500 + pi->EndScope(); ++#endif + } + catch (Standard_Failure& e) { + throw Base::CADKernelError(e.GetMessageString()); Added: head/cad/freecad/files/patch-src_Mod_Part_Gui_TaskCheckGeometry.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cad/freecad/files/patch-src_Mod_Part_Gui_TaskCheckGeometry.cpp Sat Nov 14 21:07:08 2020 (r555147) @@ -0,0 +1,58 @@ +--- src/Mod/Part/Gui/TaskCheckGeometry.cpp.orig 2020-11-14 20:05:24 UTC ++++ src/Mod/Part/Gui/TaskCheckGeometry.cpp +@@ -418,11 +418,13 @@ void TaskCheckGeometryResults::goCheck() + std::vector<Gui::SelectionSingleton::SelObj>::iterator it; + ResultEntry *theRoot = new ResultEntry(); + ++#if OCC_VERSION_HEX < 0x070500 + Handle(Message_ProgressIndicator) theProgress = new BOPProgressIndicator(tr("Check geometry"), Gui::getMainWindow()); + theProgress->NewScope("BOP check..."); + #if OCC_VERSION_HEX >= 0x060900 + theProgress->Show(); + #endif ++#endif + + selectedCount = static_cast<int>(selection.size()); + for (it = selection.begin(); it != selection.end(); ++it) +@@ -484,11 +486,17 @@ void TaskCheckGeometryResults::goCheck() + std::string label = "Checking "; + label += feature->Label.getStrValue(); + label += "..."; ++#if OCC_VERSION_HEX < 0x070500 + theProgress->NewScope(label.c_str()); + invalidShapes += goBOPSingleCheck(shape, theRoot, baseName, theProgress); ++#else ++ invalidShapes += goBOPSingleCheck(shape, theRoot, baseName, nullptr); ++#endif ++#if OCC_VERSION_HEX < 0x070500 + theProgress->EndScope(); + if (theProgress->UserBreak()) + break; ++#endif + } + } + } +@@ -613,7 +621,7 @@ int TaskCheckGeometryResults::goBOPSingleCheck(const T + //this is left for another time. + TopoDS_Shape BOPCopy = BRepBuilderAPI_Copy(shapeIn).Shape(); + BOPAlgo_ArgumentAnalyzer BOPCheck; +-#if OCC_VERSION_HEX >= 0x060900 ++#if OCC_VERSION_HEX >= 0x060900 && OCC_VERSION_HEX < 0x070500 + BOPCheck.SetProgressIndicator(theProgress); + #else + Q_UNUSED(theProgress); +@@ -961,6 +969,7 @@ TaskCheckGeometryDialog::~TaskCheckGeometryDialog() + + //////////////////////////////////////////////////////////////////////////////////////////////// + ++#if OCC_VERSION_HEX < 0x070500 + BOPProgressIndicator::BOPProgressIndicator (const QString& title, QWidget* parent) + { + steps = 0; +@@ -1023,5 +1032,6 @@ Standard_Boolean BOPProgressIndicator::UserBreak() + + return Standard_False; + } ++#endif + + #include "moc_TaskCheckGeometry.cpp" Added: head/cad/freecad/files/patch-src_Mod_Part_Gui_TaskCheckGeometry.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cad/freecad/files/patch-src_Mod_Part_Gui_TaskCheckGeometry.h Sat Nov 14 21:07:08 2020 (r555147) @@ -0,0 +1,26 @@ +--- src/Mod/Part/Gui/TaskCheckGeometry.h.orig 2020-11-14 20:12:50 UTC ++++ src/Mod/Part/Gui/TaskCheckGeometry.h +@@ -27,6 +27,7 @@ + #include <BRepCheck_Analyzer.hxx> + #include <BRepCheck_Status.hxx> + #include <Message_ProgressIndicator.hxx> ++#include <Standard_Version.hxx> + #include <TopTools_MapOfShape.hxx> + #include <Gui/TaskView/TaskDialog.h> + #include <Gui/TaskView/TaskView.h> +@@ -147,6 +148,7 @@ class TaskCheckGeometryDialog : public Gui::TaskView:: + QTextEdit *contentLabel; + }; + ++#if OCC_VERSION_HEX < 0x070500 + class BOPProgressIndicator : public Message_ProgressIndicator + { + public: +@@ -162,6 +164,7 @@ class BOPProgressIndicator : public Message_ProgressIn + QTime time; + QProgressDialog* myProgress; + }; ++#endif + + } +
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202011142107.0AEL78aY019676>