@@ -88,11 +88,11 @@ PyMOD_INIT_FUNC(_PartDesign)
|
||||
PartDesign::Feature ::init();
|
||||
PartDesign::FeaturePython ::init();
|
||||
PartDesign::Solid ::init();
|
||||
PartDesign::DressUp ::init();
|
||||
PartDesign::FeatureAddSub ::init();
|
||||
PartDesign::FeatureAddSubPython ::init();
|
||||
PartDesign::FeatureAdditivePython ::init();
|
||||
PartDesign::FeatureSubtractivePython ::init();
|
||||
PartDesign::DressUp ::init();
|
||||
PartDesign::ProfileBased ::init();
|
||||
PartDesign::Transformed ::init();
|
||||
PartDesign::Mirrored ::init();
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
|
||||
#include "FeatureDressUp.h"
|
||||
#include <App/Document.h>
|
||||
#include <Base/Exception.h>
|
||||
|
||||
|
||||
@@ -42,12 +43,22 @@ using namespace PartDesign;
|
||||
namespace PartDesign {
|
||||
|
||||
|
||||
PROPERTY_SOURCE(PartDesign::DressUp, PartDesign::Feature)
|
||||
PROPERTY_SOURCE(PartDesign::DressUp, PartDesign::FeatureAddSub)
|
||||
|
||||
DressUp::DressUp()
|
||||
{
|
||||
ADD_PROPERTY(Base,(0));
|
||||
Placement.setStatus(App::Property::ReadOnly, true);
|
||||
|
||||
ADD_PROPERTY_TYPE(SupportTransform,(false),"Base", App::Prop_None,
|
||||
"Enable support for transform patterns");
|
||||
|
||||
addSubType = Additive;
|
||||
}
|
||||
|
||||
void DressUp::setupObject() {
|
||||
SupportTransform.setValue(true);
|
||||
FeatureAddSub::setupObject();
|
||||
}
|
||||
|
||||
short DressUp::mustExecute() const
|
||||
@@ -170,6 +181,27 @@ void DressUp::onChanged(const App::Property* prop)
|
||||
if (BaseFeature.getValue() && Base.getValue() != BaseFeature.getValue()) {
|
||||
BaseFeature.setValue (Base.getValue());
|
||||
}
|
||||
} else if (prop == &Shape || prop == &SupportTransform) {
|
||||
if (!isRestoring() && !getDocument()->isPerformingTransaction()) {
|
||||
Part::TopoShape s;
|
||||
auto base = Base::freecad_dynamic_cast<FeatureAddSub>(getBaseObject(true));
|
||||
if(!base) {
|
||||
addSubType = Additive;
|
||||
if(!SupportTransform.getValue())
|
||||
s = getBaseShape();
|
||||
else
|
||||
s = Shape.getShape();
|
||||
} else {
|
||||
addSubType = base->getAddSubType();
|
||||
if(!SupportTransform.getValue())
|
||||
s = base->AddSubShape.getShape();
|
||||
else if(addSubType == Additive)
|
||||
s = Shape.getShape().cut(base->getBaseShape());
|
||||
else
|
||||
s = TopoShape(base->getBaseShape()).cut(Shape.getValue());
|
||||
}
|
||||
AddSubShape.setValue(s);
|
||||
}
|
||||
}
|
||||
|
||||
Feature::onChanged(prop);
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
#define PARTDESIGN_DressUp_H
|
||||
|
||||
#include <App/PropertyStandard.h>
|
||||
#include "Feature.h"
|
||||
#include "FeatureAddSub.h"
|
||||
|
||||
namespace PartDesign
|
||||
{
|
||||
|
||||
class PartDesignExport DressUp : public PartDesign::Feature
|
||||
class PartDesignExport DressUp : public PartDesign::FeatureAddSub
|
||||
{
|
||||
PROPERTY_HEADER(PartDesign::DressUp);
|
||||
|
||||
@@ -43,6 +43,9 @@ public:
|
||||
* But for consistency if BaseFeature is nonzero this links to the same body as it.
|
||||
*/
|
||||
App::PropertyLinkSub Base;
|
||||
App::PropertyBool SupportTransform;
|
||||
|
||||
virtual void setupObject();
|
||||
|
||||
short mustExecute() const;
|
||||
/// updates the Placement property from the Placement of the BaseFeature
|
||||
|
||||
Reference in New Issue
Block a user