Moved some methods from PartDesign::Body to Part::BodyBase so the SketchObjects will be removed cleanly from the Body when deleted
This commit is contained in:
committed by
Stefan Tröger
parent
857ede8847
commit
5ac8aeaf2c
@@ -165,12 +165,6 @@ App::DocumentObject* Body::getNextSolidFeature(App::DocumentObject *start, const
|
||||
return *it;
|
||||
}
|
||||
|
||||
const bool Body::hasFeature(const App::DocumentObject* f) const
|
||||
{
|
||||
const std::vector<App::DocumentObject*> features = Model.getValues();
|
||||
return std::find(features.begin(), features.end(), f) != features.end();
|
||||
}
|
||||
|
||||
const bool Body::isAfterTip(const App::DocumentObject *f) {
|
||||
std::vector<App::DocumentObject*> features = Model.getValues();
|
||||
std::vector<App::DocumentObject*>::const_iterator it = std::find(features.begin(), features.end(), f);
|
||||
@@ -196,21 +190,6 @@ const bool Body::isAllowed(const App::DocumentObject* f)
|
||||
f->getTypeId().isDerivedFrom(Part::Part2DObject::getClassTypeId()));
|
||||
}
|
||||
|
||||
Body* Body::findBodyOf(const App::DocumentObject* f)
|
||||
{
|
||||
App::Document* doc = App::GetApplication().getActiveDocument();
|
||||
if (doc != NULL) {
|
||||
std::vector<App::DocumentObject*> bodies = doc->getObjectsOfType(PartDesign::Body::getClassTypeId());
|
||||
for (std::vector<App::DocumentObject*>::const_iterator b = bodies.begin(); b != bodies.end(); b++) {
|
||||
PartDesign::Body* body = static_cast<PartDesign::Body*>(*b);
|
||||
if (body->hasFeature(f))
|
||||
return body;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void Body::addFeature(App::DocumentObject *feature)
|
||||
{
|
||||
// Set the BaseFeature property
|
||||
|
||||
@@ -75,9 +75,6 @@ public:
|
||||
// Return the shape of the feature preceding this feature
|
||||
//const Part::TopoShape getPreviousSolid(const PartDesign::Feature* f);
|
||||
|
||||
/// Return true if the feature belongs to this body
|
||||
const bool hasFeature(const App::DocumentObject *f) const;
|
||||
|
||||
/// Return true if the feature is located after the current Tip feature
|
||||
const bool isAfterTip(const App::DocumentObject *f);
|
||||
|
||||
@@ -87,7 +84,6 @@ public:
|
||||
/// Remove the feature from the body
|
||||
void removeFeature(App::DocumentObject* feature);
|
||||
|
||||
|
||||
/**
|
||||
* Return true if the given feature is a solid feature allowed in a Body. Currently this is only valid
|
||||
* for features derived from PartDesign::Feature
|
||||
@@ -99,10 +95,7 @@ public:
|
||||
* Return true if the given feature is allowed in a Body. Currently allowed are
|
||||
* all features derived from PartDesign::Feature and Part::Datum and sketches
|
||||
*/
|
||||
static const bool isAllowed(const App::DocumentObject* f);
|
||||
|
||||
/// Return the body which this feature belongs too, or NULL
|
||||
static Body* findBodyOf(const App::DocumentObject* f);
|
||||
static const bool isAllowed(const App::DocumentObject* f);
|
||||
|
||||
PyObject *getPyObject(void);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user