PD Extrude up to multiple faces or shape
This commit is contained in:
committed by
Chris Hennes
parent
526cc024ad
commit
7ffddb6f7d
@@ -375,6 +375,7 @@ void FeatureExtrude::updateProperties(const std::string &method)
|
||||
bool isMidplaneEnabled = false;
|
||||
bool isReversedEnabled = false;
|
||||
bool isUpToFaceEnabled = false;
|
||||
bool isUpToShapeEnabled = false;
|
||||
bool isTaperVisible = false;
|
||||
bool isTaper2Visible = false;
|
||||
if (method == "Length") {
|
||||
@@ -409,6 +410,7 @@ void FeatureExtrude::updateProperties(const std::string &method)
|
||||
}
|
||||
else if (method == "UpToShape") {
|
||||
isReversedEnabled = true;
|
||||
isUpToShapeEnabled = true;
|
||||
}
|
||||
|
||||
Length.setReadOnly(!isLengthEnabled);
|
||||
@@ -420,6 +422,7 @@ void FeatureExtrude::updateProperties(const std::string &method)
|
||||
Midplane.setReadOnly(!isMidplaneEnabled);
|
||||
Reversed.setReadOnly(!isReversedEnabled);
|
||||
UpToFace.setReadOnly(!isUpToFaceEnabled);
|
||||
UpToShape.setReadOnly(!isUpToShapeEnabled);
|
||||
}
|
||||
|
||||
void FeatureExtrude::setupObject()
|
||||
@@ -558,7 +561,7 @@ App::DocumentObjectExecReturn* FeatureExtrude::buildExtrusion(ExtrudeOptions opt
|
||||
|
||||
TopoShape prism(0, getDocument()->getStringHasher());
|
||||
|
||||
if (method == "UpToFirst" || method == "UpToLast" || method == "UpToFace") {
|
||||
if (method == "UpToFirst" || method == "UpToLast" || method == "UpToFace" || method == "UpToShape") {
|
||||
// Note: This will return an unlimited planar face if support is a datum plane
|
||||
TopoShape supportface = getTopoShapeSupportFace();
|
||||
supportface.move(invObjLoc);
|
||||
@@ -567,18 +570,33 @@ App::DocumentObjectExecReturn* FeatureExtrude::buildExtrusion(ExtrudeOptions opt
|
||||
dir.Reverse();
|
||||
}
|
||||
|
||||
// Find a valid face or datum plane to extrude up to
|
||||
TopoShape upToFace;
|
||||
|
||||
if (method != "UpToShape") {
|
||||
if (method == "UpToFace") {
|
||||
getUpToFaceFromLinkSub(upToFace, UpToFace);
|
||||
upToFace.move(invObjLoc);
|
||||
TopoShape upToShape;
|
||||
int faceCount = 1;
|
||||
// Find a valid shape, face or datum plane to extrude up to
|
||||
if (method == "UpToFace") {
|
||||
getUpToFaceFromLinkSub(upToShape, UpToFace);
|
||||
upToShape.move(invObjLoc);
|
||||
faceCount = 1;
|
||||
}
|
||||
else if (method == "UpToShape") {
|
||||
try {
|
||||
faceCount = getUpToShapeFromLinkSubList(upToShape, UpToShape);
|
||||
upToShape.move(invObjLoc);
|
||||
}
|
||||
catch (Base::ValueError&){
|
||||
//no shape selected use the base
|
||||
upToShape = base;
|
||||
faceCount = 0;
|
||||
}
|
||||
getUpToFace(upToFace, base, supportface, sketchshape, method, dir);
|
||||
addOffsetToFace(upToFace, dir, Offset.getValue());
|
||||
}
|
||||
|
||||
if (faceCount == 1) {
|
||||
getUpToFace(upToShape, base, supportface, sketchshape, method, dir);
|
||||
addOffsetToFace(upToShape, dir, Offset.getValue());
|
||||
}
|
||||
else if (fabs(Offset.getValue()) > Precision::Confusion()){
|
||||
return new App::DocumentObjectExecReturn(QT_TRANSLATE_NOOP("Exception", "Extrude: Can only offset one face"));
|
||||
}
|
||||
|
||||
if (!supportface.hasSubShape(TopAbs_WIRE)) {
|
||||
supportface = TopoShape();
|
||||
@@ -588,7 +606,7 @@ App::DocumentObjectExecReturn* FeatureExtrude::buildExtrusion(ExtrudeOptions opt
|
||||
base.isNull() ? TopoShape::PrismMode::None : TopoShape::PrismMode::CutFromBase;
|
||||
prism = base.makeElementPrismUntil(sketchshape,
|
||||
supportface,
|
||||
upToFace,
|
||||
upToShape,
|
||||
dir,
|
||||
mode,
|
||||
false /*CheckUpToFaceLimits.getValue()*/);
|
||||
@@ -630,7 +648,7 @@ App::DocumentObjectExecReturn* FeatureExtrude::buildExtrusion(ExtrudeOptions opt
|
||||
prism.makeElementPrismUntil(base,
|
||||
sketchshape,
|
||||
supportface,
|
||||
upToFace,
|
||||
upToShape,
|
||||
dir,
|
||||
TopoShape::PrismMode::None,
|
||||
true /*CheckUpToFaceLimits.getValue()*/);
|
||||
|
||||
Reference in New Issue
Block a user