fixes #0003159: ShapeBinder is part of solid

This commit is contained in:
wmayer
2017-11-09 23:21:06 +01:00
parent d9187fa444
commit b01c503c2c

View File

@@ -39,6 +39,7 @@
#include <App/FeaturePythonPyImp.h>
#include "App/OriginFeature.h"
#include "Body.h"
#include "ShapeBinder.h"
#include "Feature.h"
#include "FeaturePy.h"
#include "Mod/Part/App/DatumFeature.h"
@@ -120,6 +121,10 @@ Part::Feature* Feature::getBaseObject(bool silent) const {
const TopoDS_Shape& Feature::getBaseShape() const {
const Part::Feature* BaseObject = getBaseObject();
if (BaseObject->isDerivedFrom(PartDesign::ShapeBinder::getClassTypeId())) {
throw Base::ValueError("Base shape of shape binder cannot be used");
}
const TopoDS_Shape& result = BaseObject->Shape.getValue();
if (result.IsNull())
throw Base::Exception("Base feature's shape is invalid");
@@ -133,6 +138,10 @@ const TopoDS_Shape& Feature::getBaseShape() const {
const Part::TopoShape Feature::getBaseTopoShape() const {
const Part::Feature* BaseObject = getBaseObject();
if (BaseObject->isDerivedFrom(PartDesign::ShapeBinder::getClassTypeId())) {
throw Base::ValueError("Base shape of shape binder cannot be used");
}
const Part::TopoShape& result = BaseObject->Shape.getShape();
if (result.getShape().IsNull())
throw Base::Exception("Base feature's TopoShape is invalid");