PD Extrude up to multiple faces or shape
This commit is contained in:
committed by
Chris Hennes
parent
526cc024ad
commit
7ffddb6f7d
@@ -75,6 +75,7 @@ ProfileBased::ProfileBased()
|
||||
ADD_PROPERTY_TYPE(Midplane, (0), "SketchBased", App::Prop_None, "Extrude symmetric to sketch face");
|
||||
ADD_PROPERTY_TYPE(Reversed, (0), "SketchBased", App::Prop_None, "Reverse extrusion direction");
|
||||
ADD_PROPERTY_TYPE(UpToFace, (nullptr), "SketchBased", (App::PropertyType)(App::Prop_None), "Face where feature will end");
|
||||
ADD_PROPERTY_TYPE(UpToShape, (nullptr), "SketchBased", (App::PropertyType)(App::Prop_None), "Shape where feature will end");
|
||||
ADD_PROPERTY_TYPE(AllowMultiFace, (false), "SketchBased", App::Prop_None, "Allow multiple faces in profile");
|
||||
}
|
||||
|
||||
@@ -682,6 +683,58 @@ void ProfileBased::getUpToFaceFromLinkSub(TopoShape& upToFace, const App::Proper
|
||||
}
|
||||
}
|
||||
|
||||
int ProfileBased::getUpToShapeFromLinkSubList(TopoShape& upToShape, const App::PropertyLinkSubList& refShape)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
auto subSets = refShape.getSubListValues();
|
||||
|
||||
std::vector<TopoShape> faceList;
|
||||
for (auto &subSet : subSets){
|
||||
auto ref = subSet.first;
|
||||
if (ref->isDerivedFrom<App::Plane>()) {
|
||||
faceList.push_back(makeTopoShapeFromPlane(ref));
|
||||
ret ++;
|
||||
} else {
|
||||
if (!ref->isDerivedFrom<Part::Feature>())
|
||||
throw Base::TypeError("SketchBased: Must be face of a feature");
|
||||
|
||||
auto subStrings = subSet.second;
|
||||
if (subStrings.empty() || subStrings[0].empty()) {
|
||||
TopoShape baseShape = Part::Feature::getTopoShape(ref, nullptr, true);
|
||||
for (auto face : baseShape.getSubTopoShapes(TopAbs_FACE)){
|
||||
faceList.push_back(face);
|
||||
ret ++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (auto &subString : subStrings){
|
||||
auto shape = Part::Feature::getTopoShape(ref, subString.c_str(), true);
|
||||
TopoShape face = shape;
|
||||
face = face.makeElementFace();
|
||||
if (face.isNull()) {
|
||||
throw Base::ValueError("SketchBased: Failed to extract face");
|
||||
}
|
||||
faceList.push_back(face);
|
||||
ret ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ret == 0){
|
||||
throw Base::ValueError("SketchBased: No face selected");
|
||||
}
|
||||
|
||||
upToShape = faceList[0];
|
||||
|
||||
if (ret == 1){
|
||||
return 1;
|
||||
}
|
||||
|
||||
// create a unique shell with all selected faces
|
||||
upToShape = upToShape.makeElementCompound(faceList);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ProfileBased::getFaceFromLinkSub(TopoDS_Face& upToFace, const App::PropertyLinkSub& refFace)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user