Remove support to oldest occ <7.5 (#20084)
* remove support to oldest occ <7.5 The os ubuntu 22.04 not supported use occ 7.5.1. There is a lot of code implemented to support even older versions. The patch removes support for versions lower than occ 7.5.0 * . * move include library #pieterhijma change request : * removed deprecated functions get/setAngle functions has been removed with OCC 7.5
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
|
||||
# we first try to find opencascade directly:
|
||||
if (NOT OCCT_CMAKE_FALLBACK)
|
||||
find_package(OpenCASCADE CONFIG QUIET)
|
||||
find_package(OpenCASCADE "7.5.1" CONFIG QUIET)
|
||||
get_property(flags DIRECTORY PROPERTY COMPILE_DEFINITIONS)
|
||||
# OCCT 7.5 adds this define that causes hundreds of compiler warnings with Qt5.x, so remove it again
|
||||
list(FILTER flags EXCLUDE REGEX [[GL_GLEXT_LEGACY]])
|
||||
@@ -121,11 +121,9 @@ if (OCC_FOUND)
|
||||
TKMeshVS
|
||||
TKService
|
||||
TKV3d
|
||||
TKRWMesh
|
||||
)
|
||||
|
||||
if (NOT OCC_VERSION_STRING VERSION_LESS 7.5.0)
|
||||
list(APPEND OCC_OCAF_LIBRARIES TKRWMesh)
|
||||
endif ()
|
||||
if (OCC_VERSION_STRING VERSION_LESS 7.8.0)
|
||||
list(APPEND OCC_LIBRARIES TKIGES TKSTL TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP)
|
||||
list(APPEND OCC_OCAF_LIBRARIES TKXDESTEP TKXDEIGES)
|
||||
|
||||
@@ -42,9 +42,8 @@
|
||||
#include <XCAFDoc_DocumentTool.hxx>
|
||||
#include <XSControl_TransferReader.hxx>
|
||||
#include <XSControl_WorkSession.hxx>
|
||||
#if OCC_VERSION_HEX >= 0x070500
|
||||
#include <Message_ProgressRange.hxx>
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
@@ -62,7 +61,6 @@
|
||||
#include <Mod/Part/App/Interface.h>
|
||||
#include <Mod/Part/App/OCAF/ImportExportSettings.h>
|
||||
#include <Mod/Part/App/PartFeaturePy.h>
|
||||
#include <Mod/Part/App/ProgressIndicator.h>
|
||||
#include <Mod/Part/App/TopoShapePy.h>
|
||||
#include <Mod/Part/App/encodeFilename.h>
|
||||
|
||||
|
||||
@@ -57,13 +57,9 @@
|
||||
|
||||
#include "ImportOCAF2.h"
|
||||
|
||||
|
||||
#if OCC_VERSION_HEX >= 0x070500
|
||||
// See https://dev.opencascade.org/content/occt-3d-viewer-becomes-srgb-aware
|
||||
#define OCC_COLOR_SPACE Quantity_TOC_sRGB
|
||||
#else
|
||||
#define OCC_COLOR_SPACE Quantity_TOC_RGB
|
||||
#endif
|
||||
|
||||
|
||||
FC_LOG_LEVEL_INIT("Import", true, true)
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#ifndef _PreComp_
|
||||
#include <boost/core/ignore_unused.hpp>
|
||||
#include <Standard_Version.hxx>
|
||||
#if OCC_VERSION_HEX >= 0x070500
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
#include <Quantity_ColorRGBA.hxx>
|
||||
@@ -39,7 +38,6 @@
|
||||
#include <XCAFDoc_VisMaterial.hxx>
|
||||
#include <XCAFDoc_VisMaterialTool.hxx>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "ReaderGltf.h"
|
||||
#include "Tools.h"
|
||||
@@ -57,7 +55,6 @@ ReaderGltf::ReaderGltf(const Base::FileInfo& file)
|
||||
// NOLINTNEXTLINE
|
||||
void ReaderGltf::read(Handle(TDocStd_Document) hDoc)
|
||||
{
|
||||
#if OCC_VERSION_HEX >= 0x070500
|
||||
const double unit = 0.001; // mm
|
||||
RWGltf_CafReader aReader;
|
||||
aReader.SetSystemLengthUnit(unit);
|
||||
@@ -72,17 +69,11 @@ void ReaderGltf::read(Handle(TDocStd_Document) hDoc)
|
||||
}
|
||||
|
||||
processDocument(hDoc);
|
||||
|
||||
#else
|
||||
boost::ignore_unused(hDoc);
|
||||
throw Base::RuntimeError("gITF support requires OCCT 7.5.0 or later");
|
||||
#endif
|
||||
}
|
||||
|
||||
// NOLINTNEXTLINE
|
||||
void ReaderGltf::processDocument(Handle(TDocStd_Document) hDoc)
|
||||
{
|
||||
#if OCC_VERSION_HEX >= 0x070500
|
||||
Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool(hDoc->Main());
|
||||
|
||||
TDF_LabelSequence shapeLabels;
|
||||
@@ -101,9 +92,6 @@ void ReaderGltf::processDocument(Handle(TDocStd_Document) hDoc)
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
boost::ignore_unused(hDoc);
|
||||
#endif
|
||||
}
|
||||
|
||||
// NOLINTNEXTLINE
|
||||
@@ -111,7 +99,6 @@ TopoDS_Shape ReaderGltf::processSubShapes(Handle(TDocStd_Document) hDoc,
|
||||
const TDF_LabelSequence& subShapeLabels)
|
||||
{
|
||||
TopoDS_Compound compound;
|
||||
#if OCC_VERSION_HEX >= 0x070500
|
||||
Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool(hDoc->Main());
|
||||
Handle(XCAFDoc_ColorTool) aColorTool = XCAFDoc_DocumentTool::ColorTool(hDoc->Main());
|
||||
Handle(XCAFDoc_VisMaterialTool) aVisTool = XCAFDoc_DocumentTool::VisMaterialTool(hDoc->Main());
|
||||
@@ -141,10 +128,6 @@ TopoDS_Shape ReaderGltf::processSubShapes(Handle(TDocStd_Document) hDoc,
|
||||
aColorTool->SetColor(faceLabel, rgba, XCAFDoc_ColorSurf);
|
||||
}
|
||||
}
|
||||
#else
|
||||
boost::ignore_unused(hDoc);
|
||||
boost::ignore_unused(subShapeLabels);
|
||||
#endif
|
||||
|
||||
return {std::move(compound)};
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
#include <Base/Exception.h>
|
||||
#include <App/Application.h>
|
||||
#include <Mod/Part/App/encodeFilename.h>
|
||||
#include <Mod/Part/App/ProgressIndicator.h>
|
||||
|
||||
using namespace Import;
|
||||
|
||||
@@ -69,16 +68,8 @@ void ReaderIges::read(Handle(TDocStd_Document) hDoc) // NOLINT
|
||||
throw Base::FileException("Cannot read IGES file", 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);
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "ReaderStep.h"
|
||||
#include <Base/Exception.h>
|
||||
#include <Mod/Part/App/encodeFilename.h>
|
||||
#include <Mod/Part/App/ProgressIndicator.h>
|
||||
|
||||
using namespace Import;
|
||||
|
||||
@@ -66,14 +65,5 @@ void ReaderStep::read(Handle(TDocStd_Document) hDoc) // NOLINT
|
||||
throw Base::FileException("Cannot read STEP file", 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
|
||||
}
|
||||
|
||||
@@ -69,22 +69,12 @@ int StepShape::read(const char* fileName)
|
||||
|
||||
|
||||
std::cout << "dump of step header:" << std::endl;
|
||||
#if OCC_VERSION_HEX < 0x070401
|
||||
Handle(Message_PrinterOStream) mstr = new Message_PrinterOStream();
|
||||
Handle(Message_Messenger) msg = new Message_Messenger(mstr);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,12 +35,8 @@
|
||||
#include <Base/Console.h>
|
||||
#include <Mod/Part/App/TopoShape.h>
|
||||
|
||||
#if OCC_VERSION_HEX >= 0x070500
|
||||
// See https://dev.opencascade.org/content/occt-3d-viewer-becomes-srgb-aware
|
||||
#define OCC_COLOR_SPACE Quantity_TOC_sRGB
|
||||
#else
|
||||
#define OCC_COLOR_SPACE Quantity_TOC_RGB
|
||||
#endif
|
||||
|
||||
FC_LOG_LEVEL_INIT("Import", true, true)
|
||||
|
||||
|
||||
@@ -27,11 +27,9 @@
|
||||
#include <boost/core/ignore_unused.hpp>
|
||||
#include <Standard_Version.hxx>
|
||||
#include <TColStd_IndexedDataMapOfStringString.hxx>
|
||||
#if OCC_VERSION_HEX >= 0x070500
|
||||
#include <Message_ProgressRange.hxx>
|
||||
#include <RWGltf_CafWriter.hxx>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "WriterGltf.h"
|
||||
#include <Base/Exception.h>
|
||||
@@ -48,7 +46,6 @@ void WriterGltf::write(Handle(TDocStd_Document) hDoc) const // NOLINT
|
||||
std::string utf8Name = file.filePath();
|
||||
std::string name8bit = Part::encodeFilename(utf8Name);
|
||||
|
||||
#if OCC_VERSION_HEX >= 0x070500
|
||||
TColStd_IndexedDataMapOfStringString aMetadata;
|
||||
RWGltf_CafWriter aWriter(name8bit.c_str(), file.hasExtension("glb"));
|
||||
aWriter.SetTransformationFormat(RWGltf_WriterTrsfFormat_Compact);
|
||||
@@ -62,8 +59,4 @@ void WriterGltf::write(Handle(TDocStd_Document) hDoc) const // NOLINT
|
||||
if (!ret) {
|
||||
throw Base::FileException("Cannot save to file: ", file);
|
||||
}
|
||||
#else
|
||||
boost::ignore_unused(hDoc);
|
||||
throw Base::RuntimeError("gITF support requires OCCT 7.5.0 or later");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -71,7 +71,6 @@
|
||||
#include <Mod/Part/App/ImportStep.h>
|
||||
#include <Mod/Part/App/Interface.h>
|
||||
#include <Mod/Part/App/OCAF/ImportExportSettings.h>
|
||||
#include <Mod/Part/App/ProgressIndicator.h>
|
||||
#include <Mod/Part/App/encodeFilename.h>
|
||||
#include <Mod/Part/Gui/DlgExportStep.h>
|
||||
#include <Mod/Part/Gui/DlgImportStep.h>
|
||||
|
||||
@@ -556,8 +556,6 @@ SET(Part_SRCS
|
||||
Interface.h
|
||||
PreCompiled.cpp
|
||||
PreCompiled.h
|
||||
ProgressIndicator.cpp
|
||||
ProgressIndicator.h
|
||||
Services.cpp
|
||||
Services.h
|
||||
TopoShape.cpp
|
||||
|
||||
@@ -158,12 +158,6 @@ Make a shape with the internal outlines in each face of shape S.
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Attribute Name="Angle">
|
||||
<Documentation><!-- OCCT has no further documentation -->
|
||||
<UserDocu></UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Angle" Type="Float"/>
|
||||
</Attribute>
|
||||
<Attribute Name="TolAngular">
|
||||
<Documentation><!-- OCCT has no further documentation -->
|
||||
<UserDocu></UserDocu>
|
||||
|
||||
@@ -243,23 +243,6 @@ PyObject* HLRBRep_PolyAlgoPy::outLinedShape(PyObject *args)
|
||||
return new TopoShapePy(new TopoShape(result));
|
||||
}
|
||||
|
||||
Py::Float HLRBRep_PolyAlgoPy::getAngle() const
|
||||
{
|
||||
#if OCC_VERSION_HEX <= 0x070400
|
||||
return Py::Float(getHLRBRep_PolyAlgoPtr()->Angle());
|
||||
#else
|
||||
throw Py::RuntimeError("Function has been removed with OCC 7.5");
|
||||
#endif
|
||||
}
|
||||
|
||||
void HLRBRep_PolyAlgoPy::setAngle(Py::Float arg)
|
||||
{
|
||||
#if OCC_VERSION_HEX <= 0x070400
|
||||
getHLRBRep_PolyAlgoPtr()->Angle(static_cast<double>(arg));
|
||||
#else
|
||||
(void)arg;
|
||||
#endif
|
||||
}
|
||||
|
||||
Py::Float HLRBRep_PolyAlgoPy::getTolAngular() const
|
||||
{
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
|
||||
#include "ImportIges.h"
|
||||
#include "PartFeature.h"
|
||||
#include "ProgressIndicator.h"
|
||||
|
||||
|
||||
using namespace Part;
|
||||
@@ -75,20 +74,11 @@ int Part::ImportIgesParts(App::Document *pcDoc, const char* FileName)
|
||||
aReader.PrintCheckLoad(Standard_True,IFSelect_GeneralInfo);
|
||||
|
||||
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;
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
#include "encodeFilename.h"
|
||||
#include "ShapeMapHasher.h"
|
||||
#include "PartFeature.h"
|
||||
#include "ProgressIndicator.h"
|
||||
|
||||
|
||||
namespace Part {
|
||||
@@ -82,23 +81,12 @@ int Part::ImportStepParts(App::Document *pcDoc, const char* Name)
|
||||
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();
|
||||
//aReader.PrintCheckTransfer (failsonly, IFSelect_ItemsByEntity);
|
||||
for (Standard_Integer n = 1; n<= nbr; n++) {
|
||||
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();
|
||||
@@ -106,13 +94,8 @@ int Part::ImportStepParts(App::Document *pcDoc, const char* Name)
|
||||
throw Base::FileException("No shapes found in file ");
|
||||
}
|
||||
else {
|
||||
//Handle(StepData_StepModel) Model = aReader.StepModel();
|
||||
//Handle(XSControl_WorkSession) ws = aReader.WS();
|
||||
//Handle(XSControl_TransferReader) tr = ws->TransferReader();
|
||||
|
||||
std::map<int, Quantity_Color> hash_col;
|
||||
//ReadColors(aReader.WS(), hash_col);
|
||||
//ReadNames(aReader.WS());
|
||||
|
||||
for (Standard_Integer i=1; i<=nbs; i++) {
|
||||
Base::Console().Log("STEP: Transferring Shape %d\n",i);
|
||||
@@ -148,7 +131,6 @@ int Part::ImportStepParts(App::Document *pcDoc, const char* Name)
|
||||
col.setItem(1, Py::Float(it->second.Green()));
|
||||
col.setItem(2, Py::Float(it->second.Blue()));
|
||||
vp.setAttr("ShapeAppearance", col);
|
||||
//Base::Console().Message("Set color to shape\n");
|
||||
}
|
||||
catch (Py::Exception& e) {
|
||||
e.clear();
|
||||
@@ -162,10 +144,6 @@ int Part::ImportStepParts(App::Document *pcDoc, const char* Name)
|
||||
const TopoDS_Shell& aShell = TopoDS::Shell(ex.Current());
|
||||
|
||||
std::string name = fi.fileNamePure();
|
||||
//Handle(Standard_Transient) ent = tr->EntityFromShapeResult(aShell, 3);
|
||||
//if (!ent.IsNull()) {
|
||||
// name += ws->Model()->StringLabel(ent)->ToCString();
|
||||
//}
|
||||
|
||||
Part::Feature *pcFeature = pcDoc->addObject<Part::Feature>(name.c_str());
|
||||
pcFeature->Shape.setValue(aShell);
|
||||
|
||||
@@ -174,9 +174,6 @@
|
||||
#include <BRepLib_MakeWire.hxx>
|
||||
#include <BRepLProp_SurfaceTool.hxx>
|
||||
|
||||
#if OCC_VERSION_HEX < 0x070400
|
||||
# include <BRepMesh.hxx>
|
||||
#endif
|
||||
#include <BRepMesh_Edge.hxx>
|
||||
#include <BRepMesh_IncrementalMesh.hxx>
|
||||
#include <BRepMesh_Triangle.hxx>
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2009 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#include "ProgressIndicator.h"
|
||||
|
||||
|
||||
using namespace Part;
|
||||
/*!
|
||||
\code
|
||||
#include <XSControl_WorkSession.hxx>
|
||||
#include <Transfer_TransientProcess.hxx>
|
||||
|
||||
STEPControl_Reader aReader;
|
||||
Handle(Message_ProgressIndicator) pi = new ProgressIndicator(100);
|
||||
|
||||
pi->NewScope(20, "Loading STEP file...");
|
||||
pi->Show();
|
||||
aReader.ReadFile("myfile.stp");
|
||||
pi->EndScope();
|
||||
|
||||
Handle(StepData_StepModel) Model = aReader.StepModel();
|
||||
pi->NewScope(80, "Translating...");
|
||||
pi->Show();
|
||||
aReader.WS()->MapReader()->SetProgress(pi);
|
||||
Standard_Integer nbr = aReader.NbRootsForTransfer();
|
||||
for ( Standard_Integer n = 1; n<= nbr; n++) {
|
||||
...
|
||||
}
|
||||
|
||||
pi->EndScope();
|
||||
\endcode
|
||||
*/
|
||||
|
||||
#if OCC_VERSION_HEX < 0x070500
|
||||
ProgressIndicator::ProgressIndicator (int theMaxVal)
|
||||
: myProgress(new Base::SequencerLauncher("", theMaxVal))
|
||||
{
|
||||
SetScale (0, theMaxVal, 1);
|
||||
}
|
||||
|
||||
ProgressIndicator::~ProgressIndicator ()
|
||||
{
|
||||
}
|
||||
|
||||
Standard_Boolean ProgressIndicator::Show (const Standard_Boolean theForce)
|
||||
{
|
||||
if (theForce) {
|
||||
Handle(TCollection_HAsciiString) aName = GetScope(1).GetName(); //current step
|
||||
if (!aName.IsNull())
|
||||
myProgress->setText (aName->ToCString());
|
||||
}
|
||||
|
||||
Standard_Real aPc = GetPosition(); //always within [0,1]
|
||||
int aVal = (int)(aPc * myProgress->numberOfSteps());
|
||||
myProgress->setProgress (aVal);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean ProgressIndicator::UserBreak()
|
||||
{
|
||||
return myProgress->wasCanceled();
|
||||
}
|
||||
#endif
|
||||
@@ -1,54 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2009 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef PART_PROGRESSINDICATOR_H
|
||||
#define PART_PROGRESSINDICATOR_H
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <Message_ProgressIndicator.hxx>
|
||||
#include <Standard_Version.hxx>
|
||||
|
||||
#include <Base/Sequencer.h>
|
||||
#include <Mod/Part/PartGlobal.h>
|
||||
|
||||
|
||||
namespace Part {
|
||||
|
||||
#if OCC_VERSION_HEX < 0x070500
|
||||
class PartExport ProgressIndicator : public Message_ProgressIndicator
|
||||
{
|
||||
public:
|
||||
ProgressIndicator (int theMaxVal = 100);
|
||||
virtual ~ProgressIndicator ();
|
||||
|
||||
virtual Standard_Boolean Show (const Standard_Boolean theForce = Standard_True);
|
||||
virtual Standard_Boolean UserBreak();
|
||||
|
||||
private:
|
||||
std::unique_ptr<Base::SequencerLauncher> myProgress;
|
||||
};
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif // PART_PROGRESSINDICATOR_H
|
||||
@@ -25,10 +25,7 @@
|
||||
# include <Standard_Version.hxx>
|
||||
# include <TopoDS.hxx>
|
||||
# include <TopoDS_Solid.hxx>
|
||||
|
||||
# if OCC_VERSION_HEX >= 0x070500
|
||||
# include <Message_ProgressRange.hxx>
|
||||
# endif
|
||||
# include <Message_ProgressRange.hxx>
|
||||
#endif
|
||||
|
||||
#include "ShapeFix/ShapeFix_SolidPy.h"
|
||||
|
||||
@@ -180,7 +180,6 @@
|
||||
#include "Interface.h"
|
||||
#include "modelRefine.h"
|
||||
#include "PartPyCXX.h"
|
||||
#include "ProgressIndicator.h"
|
||||
#include "Tools.h"
|
||||
#include "TopoShapeCompoundPy.h"
|
||||
#include "TopoShapeCompSolidPy.h"
|
||||
@@ -721,21 +720,11 @@ 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());
|
||||
@@ -749,20 +738,10 @@ 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());
|
||||
@@ -775,15 +754,7 @@ void TopoShape::importBrep(const char *FileName)
|
||||
// read brep-file
|
||||
BRep_Builder aBuilder;
|
||||
TopoDS_Shape aShape;
|
||||
#if OCC_VERSION_HEX < 0x070500
|
||||
Handle(Message_ProgressIndicator) pi = new ProgressIndicator(100);
|
||||
pi->NewScope(100, "Reading BREP file...");
|
||||
pi->Show();
|
||||
BRepTools::Read(aShape,encodeFilename(FileName).c_str(),aBuilder,pi);
|
||||
pi->EndScope();
|
||||
#else
|
||||
BRepTools::Read(aShape,static_cast<Standard_CString>(FileName),aBuilder);
|
||||
#endif
|
||||
this->_Shape = aShape;
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
@@ -797,21 +768,8 @@ void TopoShape::importBrep(std::istream& str, int indicator)
|
||||
// read brep-file
|
||||
BRep_Builder aBuilder;
|
||||
TopoDS_Shape aShape;
|
||||
#if OCC_VERSION_HEX < 0x070500
|
||||
if (indicator) {
|
||||
Handle(Message_ProgressIndicator) pi = new ProgressIndicator(100);
|
||||
pi->NewScope(100, "Reading BREP file...");
|
||||
pi->Show();
|
||||
BRepTools::Read(aShape,str,aBuilder,pi);
|
||||
pi->EndScope();
|
||||
}
|
||||
else {
|
||||
BRepTools::Read(aShape,str,aBuilder);
|
||||
}
|
||||
#else
|
||||
(void)indicator;
|
||||
BRepTools::Read(aShape,str,aBuilder);
|
||||
#endif
|
||||
this->_Shape = aShape;
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
@@ -903,13 +861,6 @@ 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");
|
||||
|
||||
@@ -923,9 +874,6 @@ 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());
|
||||
@@ -3472,20 +3420,10 @@ void TopoShape::setFaces(const std::vector<Base::Vector3d> &Points,
|
||||
aSewingTool.Init(tolerance, performSewing);
|
||||
aSewingTool.Load(aComp);
|
||||
|
||||
#if OCC_VERSION_HEX < 0x070500
|
||||
Handle(Message_ProgressIndicator) pi = new ProgressIndicator(100);
|
||||
pi->NewScope(100, "Create shape from mesh...");
|
||||
pi->Show();
|
||||
|
||||
aSewingTool.Perform(pi);
|
||||
#else
|
||||
aSewingTool.Perform();
|
||||
#endif
|
||||
|
||||
_Shape = aSewingTool.SewedShape();
|
||||
#if OCC_VERSION_HEX < 0x070500
|
||||
pi->EndScope();
|
||||
#endif
|
||||
|
||||
if (_Shape.IsNull())
|
||||
_Shape = aComp;
|
||||
}
|
||||
|
||||
@@ -83,9 +83,7 @@
|
||||
|
||||
#endif
|
||||
|
||||
#if OCC_VERSION_HEX >= 0x070500
|
||||
#include <OSD_Parallel.hxx>
|
||||
#endif
|
||||
|
||||
#include "modelRefine.h"
|
||||
#include "CrossSection.h"
|
||||
@@ -2661,9 +2659,7 @@ TopoShape& TopoShape::makeElementOffset2D(const TopoShape& shape,
|
||||
if (shape.isNull()) {
|
||||
FC_THROWM(Base::ValueError, "makeOffset2D: input shape is null!");
|
||||
}
|
||||
if (allowOpenResult == OpenResult::allowOpenResult && OCC_VERSION_HEX < 0x060900) {
|
||||
FC_THROWM(Base::AttributeError, "openResult argument is not supported on OCC < 6.9.0.");
|
||||
}
|
||||
|
||||
|
||||
// OUTLINE OF MAKEOFFSET2D
|
||||
// * Prepare shapes to process
|
||||
@@ -5742,17 +5738,8 @@ TopoShape& TopoShape::makeElementBoolean(const char* maker,
|
||||
}
|
||||
}
|
||||
|
||||
#if OCC_VERSION_HEX >= 0x070500
|
||||
// -1/22/2024 Removing the parameter.
|
||||
// if (PartParams::getParallelRunThreshold() > 0) {
|
||||
mk->SetRunParallel(Standard_True);
|
||||
OSD_Parallel::SetUseOcctThreads(Standard_True);
|
||||
// }
|
||||
#else
|
||||
// 01/22/2024 This will be an extremely rare case, since we don't
|
||||
// build against OCCT versions this old. Removing the parameter.
|
||||
mk->SetRunParallel(true);
|
||||
#endif
|
||||
|
||||
mk->SetArguments(shapeArguments);
|
||||
mk->SetTools(shapeTools);
|
||||
|
||||
@@ -422,12 +422,7 @@ void TaskCheckGeometryResults::goCheck()
|
||||
reportViewStrings << QLatin1String("\n");
|
||||
|
||||
std::string scopeName {tr("Boolean operation check...").toStdString()};
|
||||
#if OCC_VERSION_HEX < 0x070500
|
||||
Handle(Message_ProgressIndicator) theProgress = new BOPProgressIndicator(tr("Check geometry"),
|
||||
Gui::getMainWindow());
|
||||
theProgress->NewScope(scopeName.c_str());
|
||||
theProgress->Show();
|
||||
#else
|
||||
|
||||
Handle(Message_ProgressIndicator) theProgress = new BOPProgressIndicator(tr("Check geometry"),
|
||||
Gui::getMainWindow());
|
||||
Message_ProgressRange theRange(theProgress->Start());
|
||||
@@ -435,7 +430,6 @@ void TaskCheckGeometryResults::goCheck()
|
||||
TCollection_AsciiString(scopeName.c_str()),
|
||||
selection.size());
|
||||
theScope.Show();
|
||||
#endif // 0x070500
|
||||
|
||||
for(const auto &sel : selection) {
|
||||
selectedCount++;
|
||||
@@ -516,14 +510,7 @@ void TaskCheckGeometryResults::goCheck()
|
||||
std::string label = tr("Checking").toStdString() + " ";
|
||||
label += sel.pObject->Label.getStrValue();
|
||||
label += "...";
|
||||
#if OCC_VERSION_HEX < 0x070500
|
||||
theProgress->NewScope(label.c_str());
|
||||
localInvalidShapeCount += goBOPSingleCheck(shape, theRoot, baseName, theProgress);
|
||||
invalidShapes += localInvalidShapeCount;
|
||||
theProgress->EndScope();
|
||||
if (theProgress->UserBreak())
|
||||
break;
|
||||
#else
|
||||
|
||||
Message_ProgressScope theInnerScope(theScope.Next(), TCollection_AsciiString(label.c_str()), 1);
|
||||
theInnerScope.Show();
|
||||
localInvalidShapeCount += goBOPSingleCheck(shape, theRoot, baseName, theInnerScope);
|
||||
@@ -531,7 +518,6 @@ void TaskCheckGeometryResults::goCheck()
|
||||
theInnerScope.Close();
|
||||
if (theScope.UserBreak())
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
// create an entry for shapes without errors
|
||||
@@ -705,13 +691,8 @@ QString TaskCheckGeometryResults::getShapeContentString()
|
||||
return QString::fromStdString(shapeContentString);
|
||||
}
|
||||
|
||||
#if OCC_VERSION_HEX < 0x070500
|
||||
int TaskCheckGeometryResults::goBOPSingleCheck(const TopoDS_Shape& shapeIn, ResultEntry *theRoot, const QString &baseName,
|
||||
const Handle(Message_ProgressIndicator)& theProgress)
|
||||
#else
|
||||
int TaskCheckGeometryResults::goBOPSingleCheck(const TopoDS_Shape& shapeIn, ResultEntry *theRoot, const QString &baseName,
|
||||
const Message_ProgressScope& theScope)
|
||||
#endif
|
||||
{
|
||||
ParameterGrp::handle group = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod")->GetGroup("Part")->GetGroup("CheckGeometry");
|
||||
@@ -740,13 +721,11 @@ int TaskCheckGeometryResults::goBOPSingleCheck(const TopoDS_Shape& shapeIn, Resu
|
||||
TopoDS_Shape BOPCopy = BRepBuilderAPI_Copy(shapeIn).Shape();
|
||||
BOPAlgo_ArgumentAnalyzer BOPCheck;
|
||||
|
||||
#if OCC_VERSION_HEX < 0x070500
|
||||
BOPCheck.SetProgressIndicator(theProgress);
|
||||
#elif OCC_VERSION_HEX < 0x070600
|
||||
#if OCC_VERSION_HEX < 0x070600
|
||||
BOPCheck.SetProgressIndicator(theScope);
|
||||
#else
|
||||
Q_UNUSED(theScope)
|
||||
#endif // 0x070500
|
||||
#endif // 0x070600
|
||||
|
||||
|
||||
BOPCheck.SetShape1(BOPCopy);
|
||||
@@ -1441,28 +1420,6 @@ BOPProgressIndicator::~BOPProgressIndicator ()
|
||||
myProgress->close();
|
||||
}
|
||||
|
||||
#if OCC_VERSION_HEX < 0x070500
|
||||
Standard_Boolean BOPProgressIndicator::Show (const Standard_Boolean theForce)
|
||||
{
|
||||
if (theForce) {
|
||||
steps = 0;
|
||||
canceled = false;
|
||||
|
||||
time.start();
|
||||
myProgress->show();
|
||||
|
||||
myProgress->setRange(0, 0);
|
||||
myProgress->setValue(0);
|
||||
}
|
||||
else {
|
||||
Handle(TCollection_HAsciiString) aName = GetScope(1).GetName(); //current step
|
||||
if (!aName.IsNull())
|
||||
myProgress->setLabelText (QString::fromUtf8(aName->ToCString()));
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
#else
|
||||
void BOPProgressIndicator::Show (const Message_ProgressScope& theScope,
|
||||
const Standard_Boolean isForce)
|
||||
{
|
||||
@@ -1486,7 +1443,6 @@ void BOPProgressIndicator::Reset()
|
||||
myProgress->setRange(0, 0);
|
||||
myProgress->setValue(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
Standard_Boolean BOPProgressIndicator::UserBreak()
|
||||
{
|
||||
|
||||
@@ -123,13 +123,10 @@ private:
|
||||
void dispatchError(ResultEntry *entry, const BRepCheck_Status &stat);
|
||||
bool split(QString &input, QString &doc, QString &object, QString &sub);
|
||||
void setupFunctionMap();
|
||||
#if OCC_VERSION_HEX < 0x070500
|
||||
int goBOPSingleCheck(const TopoDS_Shape &shapeIn, ResultEntry *theRoot, const QString &baseName,
|
||||
const Handle(Message_ProgressIndicator)& theProgress);
|
||||
#else
|
||||
|
||||
int goBOPSingleCheck(const TopoDS_Shape &shapeIn, ResultEntry *theRoot, const QString &baseName,
|
||||
const Message_ProgressScope& theScope);
|
||||
#endif
|
||||
|
||||
void buildShapeContent(App::DocumentObject *pObject, const QString &baseName, const TopoDS_Shape &shape);
|
||||
ResultModel *model;
|
||||
QTreeView *treeView;
|
||||
@@ -207,13 +204,10 @@ public:
|
||||
BOPProgressIndicator (const QString &title, QWidget* parent);
|
||||
~BOPProgressIndicator () override;
|
||||
|
||||
#if OCC_VERSION_HEX < 0x070500
|
||||
Standard_Boolean Show (const Standard_Boolean theForce = Standard_True) override;
|
||||
#else
|
||||
void Show (const Message_ProgressScope& theScope,
|
||||
const Standard_Boolean isForce) override;
|
||||
void Reset() override;
|
||||
#endif
|
||||
|
||||
Standard_Boolean UserBreak() override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -978,7 +978,6 @@ void ViewProviderPartExt::updateVisual()
|
||||
// create or use the mesh on the data structure
|
||||
Standard_Real AngDeflectionRads = AngularDeflection.getValue() / 180.0 * M_PI;
|
||||
|
||||
#if OCC_VERSION_HEX >= 0x070500
|
||||
IMeshTools_Parameters meshParams;
|
||||
meshParams.Deflection = deflection;
|
||||
meshParams.Relative = Standard_False;
|
||||
@@ -987,9 +986,6 @@ void ViewProviderPartExt::updateVisual()
|
||||
meshParams.AllowQualityDecrease = Standard_True;
|
||||
|
||||
BRepMesh_IncrementalMesh(cShape, meshParams);
|
||||
#else
|
||||
BRepMesh_IncrementalMesh(cShape, deflection, Standard_False, AngDeflectionRads, Standard_True);
|
||||
#endif
|
||||
|
||||
// We must reset the location here because the transformation data
|
||||
// are set in the placement property
|
||||
|
||||
@@ -124,9 +124,7 @@ TEST_F(TopoShapeExpansionTest, makeElementCompoundEmptyShapesReturnsEmptyCompoun
|
||||
// Assert
|
||||
EXPECT_EQ(TopAbs_ShapeEnum::TopAbs_COMPOUND, topoShape.getShape().ShapeType());
|
||||
EXPECT_TRUE(topoShape.getMappedChildElements().empty());
|
||||
#if OCC_VERSION_HEX >= 0x070400
|
||||
EXPECT_EQ(0, topoShape.getShape().TShape()->NbChildren());
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST_F(TopoShapeExpansionTest, makeElementCompoundTwoShapesGeneratesMap)
|
||||
@@ -1272,9 +1270,7 @@ TEST_F(TopoShapeExpansionTest, makeElementShellSingle)
|
||||
// Act
|
||||
TopoShape result = topoShape.makeElementShell(false, nullptr);
|
||||
// Assert
|
||||
#if OCC_VERSION_HEX >= 0x070400
|
||||
EXPECT_EQ(result.getShape().NbChildren(), 1);
|
||||
#endif
|
||||
EXPECT_EQ(result.countSubElements("Vertex"), 4);
|
||||
EXPECT_EQ(result.countSubElements("Edge"), 4);
|
||||
EXPECT_EQ(result.countSubElements("Face"), 1);
|
||||
@@ -1300,9 +1296,7 @@ TEST_F(TopoShapeExpansionTest, makeElementShellOpen)
|
||||
// Act
|
||||
TopoShape result = topoShape.makeElementShell(true, nullptr);
|
||||
// Assert
|
||||
#if OCC_VERSION_HEX >= 0x070400
|
||||
EXPECT_EQ(result.getShape().NbChildren(), 2);
|
||||
#endif
|
||||
EXPECT_EQ(result.countSubElements("Vertex"), 6);
|
||||
EXPECT_EQ(result.countSubElements("Edge"), 7);
|
||||
EXPECT_EQ(result.countSubElements("Face"), 2);
|
||||
@@ -1323,9 +1317,7 @@ TEST_F(TopoShapeExpansionTest, makeElementShellClosed)
|
||||
topoShape1.makeElementCompound(shapes, "D");
|
||||
// Assert
|
||||
TopoShape result = topoShape1.makeElementShell(false, "SH1");
|
||||
#if OCC_VERSION_HEX >= 0x070400
|
||||
EXPECT_EQ(result.getShape().NbChildren(), 6);
|
||||
#endif
|
||||
EXPECT_EQ(result.countSubElements("Vertex"), 8);
|
||||
EXPECT_EQ(result.countSubElements("Edge"), 12);
|
||||
EXPECT_EQ(result.countSubElements("Face"), 6);
|
||||
@@ -1369,9 +1361,7 @@ TEST_F(TopoShapeExpansionTest, makeElementShellFromWires)
|
||||
topoShape1.makeElementCompound(shapes, "D");
|
||||
// Assert
|
||||
TopoShape result = topoShape1.makeElementShellFromWires(shapes);
|
||||
#if OCC_VERSION_HEX >= 0x070400
|
||||
EXPECT_EQ(result.getShape().NbChildren(), 20); // Have a NbChildren method?
|
||||
#endif
|
||||
EXPECT_EQ(result.countSubElements("Vertex"), 8);
|
||||
EXPECT_EQ(result.countSubElements("Edge"), 32);
|
||||
EXPECT_EQ(result.countSubElements("Face"), 20);
|
||||
|
||||
Reference in New Issue
Block a user