change inheritance of Item (again)

This commit is contained in:
jriegel
2012-05-17 17:20:44 +02:00
committed by Stefan Tröger
parent 5f8ebafd7d
commit 0f6f91caec
8 changed files with 36 additions and 18 deletions

View File

@@ -53,6 +53,12 @@ short ItemAssembly::mustExecute() const
}
App::DocumentObjectExecReturn *ItemAssembly::execute(void)
{
return App::DocumentObject::StdReturn;
}
TopoDS_Shape ItemAssembly::getShape(void) const
{
std::vector<TopoDS_Shape> s;
std::vector<App::DocumentObject*> obj = Items.getValues();
@@ -60,7 +66,7 @@ App::DocumentObjectExecReturn *ItemAssembly::execute(void)
std::vector<App::DocumentObject*>::iterator it;
for (it = obj.begin(); it != obj.end(); ++it) {
if ((*it)->getTypeId().isDerivedFrom(Assembly::Item::getClassTypeId())) {
TopoDS_Shape aShape = static_cast<Assembly::Item*>(*it)->Shape.getValue();
TopoDS_Shape aShape = static_cast<Assembly::Item*>(*it)->getShape();
if (!aShape.IsNull())
s.push_back(aShape);
}
@@ -75,15 +81,13 @@ App::DocumentObjectExecReturn *ItemAssembly::execute(void)
aBuilder.Add(aRes, *it);
}
if (aRes.IsNull())
throw Base::Exception("Resulting shape is invalid");
this->Shape.setValue(aRes);
//if (aRes.IsNull())
// throw Base::Exception("Resulting shape is invalid");
return aRes;
}
else {
// set empty shape
this->Shape.setValue(TopoDS_Shape());
}
return App::DocumentObject::StdReturn;
// set empty shape
return TopoDS_Compound();
}
}
}