Toponaming: bring in missing code fragments in PartDesign
This commit is contained in:
@@ -32,7 +32,8 @@
|
||||
# include <TopoDS.hxx>
|
||||
#endif
|
||||
|
||||
#include "App/DocumentObject.h"
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObject.h>
|
||||
#include <App/FeaturePythonPyImp.h>
|
||||
#include <App/ElementNamingUtils.h>
|
||||
#include "App/OriginFeature.h"
|
||||
@@ -115,6 +116,28 @@ TopoShape Feature::getSolid(const TopoShape& shape)
|
||||
return shape;
|
||||
}
|
||||
|
||||
void Feature::onChanged(const App::Property *prop)
|
||||
{
|
||||
if (!this->isRestoring()
|
||||
&& this->getDocument()
|
||||
&& !this->getDocument()->isPerformingTransaction()) {
|
||||
if (prop == &Visibility || prop == &BaseFeature) {
|
||||
auto body = Body::findBodyOf(this);
|
||||
if (body) {
|
||||
if (prop == &BaseFeature && BaseFeature.getValue()) {
|
||||
int idx = -1;
|
||||
body->Group.find(this->getNameInDocument(), &idx);
|
||||
int baseidx = -1;
|
||||
body->Group.find(BaseFeature.getValue()->getNameInDocument(), &idx);
|
||||
if (idx >= 0 && baseidx >= 0 && baseidx+1 != idx)
|
||||
body->insertObject(BaseFeature.getValue(), this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Part::Feature::onChanged(prop);
|
||||
}
|
||||
|
||||
int Feature::countSolids(const TopoDS_Shape& shape, TopAbs_ShapeEnum type)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
@@ -84,6 +84,7 @@ public:
|
||||
return "PartDesignGui::ViewProvider";
|
||||
}
|
||||
|
||||
void onChanged(const App::Property* prop) override;
|
||||
|
||||
App::DocumentObject *getSubObject(const char *subname,
|
||||
PyObject **pyObj, Base::Matrix4D *pmat, bool transform, int depth) const override;
|
||||
|
||||
@@ -101,7 +101,11 @@ void ProfileBased::positionByPrevious()
|
||||
else {
|
||||
//no base. Use either Sketch support's placement, or sketch's placement itself.
|
||||
Part::Part2DObject* sketch = getVerifiedSketch();
|
||||
#ifdef FC_USE_TNP_FIX
|
||||
App::DocumentObject* support = sketch->Support.getValue();
|
||||
#else
|
||||
App::DocumentObject* support = sketch->AttachmentSupport.getValue();
|
||||
#endif
|
||||
if (support && support->isDerivedFrom(App::GeoFeature::getClassTypeId())) {
|
||||
this->Placement.setValue(static_cast<App::GeoFeature*>(support)->Placement.getValue());
|
||||
}
|
||||
@@ -575,8 +579,13 @@ TopoShape ProfileBased::getTopoShapeSupportFace() const
|
||||
shape = getTopoShapeVerifiedFace();
|
||||
}
|
||||
else if (sketch->MapMode.getValue() == Attacher::mmFlatFace
|
||||
#ifdef FC_USE_TNP_FIX
|
||||
&& sketch->Support.getValue()) {
|
||||
const auto& Support = sketch->Support;
|
||||
#else
|
||||
&& sketch->AttachmentSupport.getValue()) {
|
||||
const auto& Support = sketch->AttachmentSupport;
|
||||
#endif
|
||||
App::DocumentObject* ref = Support.getValue();
|
||||
shape = Part::Feature::getTopoShape(
|
||||
ref,
|
||||
@@ -631,8 +640,11 @@ Part::Feature* ProfileBased::getBaseObject(bool silent) const
|
||||
//due to former test we know we have a 2d object
|
||||
Part::Part2DObject* sketch = getVerifiedSketch(silent);
|
||||
const char* err = nullptr;
|
||||
|
||||
#ifdef FC_USE_TNP_FIX
|
||||
App::DocumentObject* spt = sketch->Support.getValue();
|
||||
#else
|
||||
App::DocumentObject* spt = sketch->AttachmentSupport.getValue();
|
||||
#endif
|
||||
if (spt) {
|
||||
if (spt->isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
rv = static_cast<Part::Feature*>(spt);
|
||||
|
||||
Reference in New Issue
Block a user