Part/Import: [skip ci] disable use of Message_ProgressIndicator for OCC >= 7.5 due to major API changes
This commit is contained in:
@@ -47,6 +47,7 @@
|
||||
# include <Interface_EntityIterator.hxx>
|
||||
# include <Quantity_Color.hxx>
|
||||
# include <TCollection_ExtendedString.hxx>
|
||||
# include <Standard_Version.hxx>
|
||||
#endif
|
||||
|
||||
#include <Base/Console.h>
|
||||
@@ -86,16 +87,20 @@ int Part::ImportIgesParts(App::Document *pcDoc, const char* FileName)
|
||||
|
||||
#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;
|
||||
|
||||
@@ -103,10 +103,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();
|
||||
@@ -115,7 +117,9 @@ int Part::ImportStepParts(App::Document *pcDoc, const char* Name)
|
||||
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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 @@ public:
|
||||
private:
|
||||
std::unique_ptr<Base::SequencerLauncher> myProgress;
|
||||
};
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -739,17 +739,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());
|
||||
@@ -763,16 +767,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());
|
||||
@@ -785,7 +793,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();
|
||||
@@ -807,16 +815,19 @@ void TopoShape::importBrep(std::istream& str, int indicator)
|
||||
// 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...");
|
||||
pi->Show();
|
||||
BRepTools::Read(aShape,str,aBuilder,pi);
|
||||
pi->EndScope();
|
||||
} else
|
||||
}
|
||||
else {
|
||||
BRepTools::Read(aShape,str,aBuilder);
|
||||
}
|
||||
#else
|
||||
(void)indicator;
|
||||
BRepTools::Read(aShape,str,aBuilder);
|
||||
#endif
|
||||
this->_Shape = aShape;
|
||||
@@ -905,10 +916,13 @@ 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");
|
||||
@@ -922,7 +936,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());
|
||||
@@ -3455,13 +3471,20 @@ void TopoShape::setFaces(const std::vector<Base::Vector3d> &Points,
|
||||
|
||||
aSewingTool.Load(aComp);
|
||||
|
||||
#if OCC_VERSION_HEX < 0x070500
|
||||
Handle(Message_ProgressIndicator) pi = new ProgressIndicator(100);
|
||||
pi->NewScope(100, "Sewing Faces...");
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user