fix usability regression of Mefisto mesher cuased by 95f20b9d
The maximum edge length for the Mefisto mesher is always set in the accept() method so that effectively user input is always ignored. There is now a button Estimate to guess a good default value. And user input is no longer ingored
This commit is contained in:
@@ -193,6 +193,34 @@ struct ShapeInfo {
|
||||
};
|
||||
}
|
||||
|
||||
void Tessellation::on_estimateMaximumEdgeLength_clicked()
|
||||
{
|
||||
std::list<ShapeInfo> shapeObjects;
|
||||
App::Document* activeDoc = App::GetApplication().getActiveDocument();
|
||||
if (!activeDoc) {
|
||||
return;
|
||||
}
|
||||
|
||||
Gui::Document* activeGui = Gui::Application::Instance->getDocument(activeDoc);
|
||||
if (!activeGui) {
|
||||
return;
|
||||
}
|
||||
|
||||
double edgeLen = 0;
|
||||
for (auto &sel : Gui::Selection().getSelection("*",0)) {
|
||||
auto shape = Part::Feature::getTopoShape(sel.pObject,sel.SubName);
|
||||
if (shape.hasSubShape(TopAbs_FACE)) {
|
||||
Base::BoundBox3d bbox = shape.getBoundBox();
|
||||
edgeLen = std::max<double>(edgeLen, bbox.LengthX());
|
||||
edgeLen = std::max<double>(edgeLen, bbox.LengthY());
|
||||
edgeLen = std::max<double>(edgeLen, bbox.LengthZ());
|
||||
shapeObjects.emplace_back(sel.pObject, sel.SubName);
|
||||
}
|
||||
}
|
||||
|
||||
ui->spinMaximumEdgeLength->setValue(edgeLen/10);
|
||||
}
|
||||
|
||||
bool Tessellation::accept()
|
||||
{
|
||||
std::list<ShapeInfo> shapeObjects;
|
||||
@@ -210,20 +238,13 @@ bool Tessellation::accept()
|
||||
|
||||
this->document = QString::fromLatin1(activeDoc->getName());
|
||||
|
||||
double edgeLen = 0;
|
||||
for (auto &sel : Gui::Selection().getSelection("*",0)) {
|
||||
auto shape = Part::Feature::getTopoShape(sel.pObject,sel.SubName);
|
||||
if (shape.hasSubShape(TopAbs_FACE)) {
|
||||
Base::BoundBox3d bbox = shape.getBoundBox();
|
||||
edgeLen = std::max<double>(edgeLen, bbox.LengthX());
|
||||
edgeLen = std::max<double>(edgeLen, bbox.LengthY());
|
||||
edgeLen = std::max<double>(edgeLen, bbox.LengthZ());
|
||||
shapeObjects.emplace_back(sel.pObject,sel.SubName);
|
||||
shapeObjects.emplace_back(sel.pObject, sel.SubName);
|
||||
}
|
||||
}
|
||||
|
||||
ui->spinMaximumEdgeLength->setValue(edgeLen/10);
|
||||
|
||||
if (shapeObjects.empty()) {
|
||||
QMessageBox::critical(this, windowTitle(),
|
||||
tr("Select a shape for meshing, first."));
|
||||
|
||||
Reference in New Issue
Block a user