Part: Allow to disable progress bar in brep string reader
This commit is contained in:
@@ -597,18 +597,21 @@ void TopoShape::importBrep(const char *FileName)
|
||||
}
|
||||
}
|
||||
|
||||
void TopoShape::importBrep(std::istream& str)
|
||||
void TopoShape::importBrep(std::istream& str, int indicator)
|
||||
{
|
||||
try {
|
||||
// read brep-file
|
||||
BRep_Builder aBuilder;
|
||||
TopoDS_Shape aShape;
|
||||
#if OCC_VERSION_HEX >= 0x060300
|
||||
Handle(Message_ProgressIndicator) pi = new ProgressIndicator(100);
|
||||
pi->NewScope(100, "Reading BREP file...");
|
||||
pi->Show();
|
||||
BRepTools::Read(aShape,str,aBuilder,pi);
|
||||
pi->EndScope();
|
||||
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
|
||||
BRepTools::Read(aShape,str,aBuilder);
|
||||
#endif
|
||||
|
||||
@@ -136,7 +136,7 @@ public:
|
||||
void importIges(const char *FileName);
|
||||
void importStep(const char *FileName);
|
||||
void importBrep(const char *FileName);
|
||||
void importBrep(std::istream&);
|
||||
void importBrep(std::istream&, int indicator=1);
|
||||
void importBinary(std::istream&);
|
||||
void exportIges(const char *FileName) const;
|
||||
void exportStep(const char *FileName) const;
|
||||
|
||||
@@ -85,7 +85,9 @@ Sub-elements such as vertices, edges or faces are accessible as:
|
||||
</Methode>
|
||||
<Methode Name="importBrepFromString">
|
||||
<Documentation>
|
||||
<UserDocu>Load the shape from a string that keeps the content in BREP format.</UserDocu>
|
||||
<UserDocu>Load the shape from a string that keeps the content in BREP format.
|
||||
importBrepFromString(str,False) to not display a progress bar.
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="extrude" Const="true">
|
||||
|
||||
@@ -513,13 +513,14 @@ PyObject* TopoShapePy::importBinary(PyObject *args)
|
||||
PyObject* TopoShapePy::importBrepFromString(PyObject *args)
|
||||
{
|
||||
char* input;
|
||||
if (!PyArg_ParseTuple(args, "s", &input))
|
||||
int indicator=1;
|
||||
if (!PyArg_ParseTuple(args, "s|i", &input, &indicator))
|
||||
return NULL;
|
||||
|
||||
try {
|
||||
// read brep
|
||||
std::stringstream str(input);
|
||||
getTopoShapePtr()->importBrep(str);
|
||||
getTopoShapePtr()->importBrep(str,indicator);
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
PyErr_SetString(PartExceptionOCCError,e.what());
|
||||
|
||||
Reference in New Issue
Block a user