Skip to content

Commit

Permalink
PartDesign: fix DressUp SupportTransform
Browse files Browse the repository at this point in the history
Skip multiple consequtive DressUp features when SupportTransform is
enabled.
  • Loading branch information
realthunder authored and wwmayer committed Jul 11, 2020
1 parent 7fadfd0 commit 896e774
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/Mod/PartDesign/App/FeatureDressUp.cpp
Expand Up @@ -203,13 +203,25 @@ void DressUp::getAddSubShape(Part::TopoShape &addShape, Part::TopoShape &subShap
shape.setPlacement(Base::Placement());

FeatureAddSub *base = nullptr;
if(SupportTransform.getValue())
base = Base::freecad_dynamic_cast<FeatureAddSub>(getBaseObject(true));
if(SupportTransform.getValue()) {
// SupportTransform means transform the support together with
// the dressing. So we need to find the previous support
// feature (which must be of type FeatureAddSub), and skipping
// any consequtive DressUp in-between.
for(Feature *current=this; ;current=static_cast<DressUp*>(base)) {
base = Base::freecad_dynamic_cast<FeatureAddSub>(current->getBaseObject(true));
if(!base)
FC_THROWM(Base::CADKernelError,
"Cannot find additive or subtractive support for " << getFullName());
if(!base->isDerivedFrom(DressUp::getClassTypeId()))
break;
}
}

Part::TopoShape baseShape;
if(base) {
baseShape = base->getBaseTopoShape(true);
baseShape.setPlacement(Base::Placement());
baseShape.move(base->getLocation().Inverted());
if (base->getAddSubType() == Additive) {
if(!baseShape.isNull() && baseShape.hasSubShape(TopAbs_SOLID))
shapes.push_back(shape.cut(baseShape.getShape()));
Expand All @@ -228,7 +240,7 @@ void DressUp::getAddSubShape(Part::TopoShape &addShape, Part::TopoShape &subShap
}
} else {
baseShape = getBaseTopoShape();
baseShape.setPlacement(Base::Placement());
baseShape.move(getLocation().Inverted());
shapes.push_back(shape.cut(baseShape.getShape()));
shapes.push_back(baseShape.cut(shape.getShape()));
}
Expand Down

0 comments on commit 896e774

Please sign in to comment.