Share code for finding a body containing a feature

This commit is contained in:
Alexander Golubev
2015-07-20 11:17:15 +03:00
committed by Stefan Tröger
parent cd4dce2f1b
commit 340c52a939
6 changed files with 32 additions and 22 deletions

View File

@@ -65,7 +65,7 @@ const bool BodyBase::hasFeature(const App::DocumentObject* f) const
BodyBase* BodyBase::findBodyOf(const App::DocumentObject* f)
{
App::Document* doc = App::GetApplication().getActiveDocument();
App::Document* doc = f->getDocument();
if (doc != NULL) {
std::vector<App::DocumentObject*> bodies = doc->getObjectsOfType(BodyBase::getClassTypeId());
for (std::vector<App::DocumentObject*>::const_iterator b = bodies.begin(); b != bodies.end(); b++) {