Merge remote-tracking branch 'svn/trunk'
This commit is contained in:
@@ -49,6 +49,7 @@ short Revolution::mustExecute() const
|
||||
{
|
||||
if (Base.isTouched() ||
|
||||
Axis.isTouched() ||
|
||||
Angle.isTouched() ||
|
||||
Source.isTouched())
|
||||
return 1;
|
||||
return 0;
|
||||
|
||||
@@ -609,6 +609,32 @@ void TopoShape::importBrep(const char *FileName)
|
||||
}
|
||||
}
|
||||
|
||||
void TopoShape::importBrep(std::istream& str)
|
||||
{
|
||||
try {
|
||||
// read brep-file
|
||||
BRep_Builder aBuilder;
|
||||
TopoDS_Shape aShape;
|
||||
#if OCC_HEX_VERSION >= 0x060300
|
||||
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);
|
||||
#endif
|
||||
this->_Shape = aShape;
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||
throw Base::Exception(aFail->GetMessageString());
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
throw Base::Exception(e.what());
|
||||
}
|
||||
}
|
||||
|
||||
void TopoShape::write(const char *FileName) const
|
||||
{
|
||||
Base::FileInfo File(FileName);
|
||||
|
||||
@@ -120,6 +120,7 @@ public:
|
||||
void importIges(const char *FileName);
|
||||
void importStep(const char *FileName);
|
||||
void importBrep(const char *FileName);
|
||||
void importBrep(std::istream&);
|
||||
void exportIges(const char *FileName) const;
|
||||
void exportStep(const char *FileName) const;
|
||||
void exportBrep(const char *FileName) const;
|
||||
|
||||
@@ -48,6 +48,11 @@ Sub-elements such as vertices, edges or faces are accessible as:
|
||||
<UserDocu>Export the content of this shape to an STL mesh file.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="importBrep">
|
||||
<Documentation>
|
||||
<UserDocu>Import the content to this shape of a string in BREP format.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="extrude">
|
||||
<Documentation>
|
||||
<UserDocu>Extrude the shape along a direction.</UserDocu>
|
||||
|
||||
@@ -311,6 +311,30 @@ PyObject* TopoShapePy::exportBrep(PyObject *args)
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* TopoShapePy::importBrep(PyObject *args)
|
||||
{
|
||||
PyObject* input;
|
||||
if (!PyArg_ParseTuple(args, "O", &input))
|
||||
//char* input;
|
||||
//if (!PyArg_ParseTuple(args, "s", &input))
|
||||
return NULL;
|
||||
|
||||
try {
|
||||
// read brep
|
||||
Base::PyStreambuf buf(input);
|
||||
std::istream str(0);
|
||||
str.rdbuf(&buf);
|
||||
//std::stringstream str(input);
|
||||
getTopoShapePtr()->importBrep(str);
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
PyErr_SetString(PyExc_Exception,e.what());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* TopoShapePy::exportStl(PyObject *args)
|
||||
{
|
||||
char* filename;
|
||||
|
||||
@@ -215,6 +215,15 @@ void CmdSketcherMapSketch::activated(int iMsg)
|
||||
qApp->translate(className(),"You have to select a single face as support for a sketch!"));
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<App::DocumentObject*> input = part->getOutList();
|
||||
if (std::find(input.begin(), input.end(), sel[index]) != input.end()) {
|
||||
QMessageBox::warning(Gui::getMainWindow(),
|
||||
qApp->translate(className(),"Cyclic dependency"),
|
||||
qApp->translate(className(),"You cannot choose a support object depending on the selected sketch!"));
|
||||
return;
|
||||
}
|
||||
|
||||
// get the selected sub shape (a Face)
|
||||
const Part::TopoShape &shape = part->Shape.getValue();
|
||||
TopoDS_Shape sh = shape.getSubShape(sub[0].c_str());
|
||||
|
||||
Reference in New Issue
Block a user