Measure: Allow any surface type for MeasureArea
This commit is contained in:
@@ -53,6 +53,15 @@ MeasureArea::MeasureArea()
|
||||
|
||||
MeasureArea::~MeasureArea() = default;
|
||||
|
||||
bool MeasureArea::isSupported(App::MeasureElementType type)
|
||||
{
|
||||
// clang-format off
|
||||
return (type == App::MeasureElementType::PLANE) ||
|
||||
(type == App::MeasureElementType::CYLINDER) ||
|
||||
(type == App::MeasureElementType::SURFACE) ||
|
||||
(type == App::MeasureElementType::VOLUME);
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
bool MeasureArea::isValidSelection(const App::MeasureSelection& selection)
|
||||
{
|
||||
@@ -68,8 +77,7 @@ bool MeasureArea::isValidSelection(const App::MeasureSelection& selection)
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((type != App::MeasureElementType::PLANE && type != App::MeasureElementType::CYLINDER
|
||||
&& type != App::MeasureElementType::SURFACE)) {
|
||||
if (!isSupported(type)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,6 +79,7 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
static bool isSupported(App::MeasureElementType type);
|
||||
void onChanged(const App::Property* prop) override;
|
||||
};
|
||||
|
||||
|
||||
@@ -189,6 +189,9 @@ App::MeasureElementType PartMeasureTypeCb(App::DocumentObject* ob, const char* s
|
||||
return App::MeasureElementType::SURFACE; }
|
||||
}
|
||||
}
|
||||
case TopAbs_SHELL: {
|
||||
return App::MeasureElementType::SURFACE;
|
||||
}
|
||||
case TopAbs_SOLID: {
|
||||
return App::MeasureElementType::VOLUME;
|
||||
}
|
||||
@@ -341,7 +344,7 @@ MeasureAreaInfoPtr MeasureAreaHandler(const App::SubObjectT& subject)
|
||||
}
|
||||
TopAbs_ShapeEnum sType = shape.ShapeType();
|
||||
|
||||
if (sType != TopAbs_FACE) {
|
||||
if (sType != TopAbs_FACE && sType != TopAbs_SHELL && sType != TopAbs_SOLID) {
|
||||
return std::make_shared<MeasureAreaInfo>(false, 0.0, Base::Matrix4D());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user