+ fixes #0001266: Part Common fails with two surface objects
This commit is contained in:
parent
795bd01f31
commit
08698154c8
|
@ -274,14 +274,18 @@ void CmdPartCut::activated(int iMsg)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool askUser = false;
|
||||||
for (std::vector<Gui::SelectionObject>::iterator it = Sel.begin(); it != Sel.end(); ++it) {
|
for (std::vector<Gui::SelectionObject>::iterator it = Sel.begin(); it != Sel.end(); ++it) {
|
||||||
App::DocumentObject* obj = it->getObject();
|
App::DocumentObject* obj = it->getObject();
|
||||||
if (obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
if (obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||||
const TopoDS_Shape& shape = static_cast<Part::Feature*>(obj)->Shape.getValue();
|
const TopoDS_Shape& shape = static_cast<Part::Feature*>(obj)->Shape.getValue();
|
||||||
if (!PartGui::checkForSolids(shape)) {
|
if (!PartGui::checkForSolids(shape) && !askUser) {
|
||||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
|
int ret = QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Non-solids selected"),
|
||||||
QObject::tr("Non-solids cannot be used for boolean operations."));
|
QObject::tr("The use of non-solids for boolean operations may lead to unexpected results.\n"
|
||||||
return;
|
"Do you want to continue?"), QMessageBox::Yes, QMessageBox::No);
|
||||||
|
if (ret == QMessageBox::No)
|
||||||
|
return;
|
||||||
|
askUser = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -333,6 +337,7 @@ void CmdPartCommon::activated(int iMsg)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool askUser = false;
|
||||||
std::string FeatName = getUniqueObjectName("Common");
|
std::string FeatName = getUniqueObjectName("Common");
|
||||||
std::stringstream str;
|
std::stringstream str;
|
||||||
std::vector<std::string> tempSelNames;
|
std::vector<std::string> tempSelNames;
|
||||||
|
@ -341,10 +346,13 @@ void CmdPartCommon::activated(int iMsg)
|
||||||
App::DocumentObject* obj = it->getObject();
|
App::DocumentObject* obj = it->getObject();
|
||||||
if (obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
if (obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||||
const TopoDS_Shape& shape = static_cast<Part::Feature*>(obj)->Shape.getValue();
|
const TopoDS_Shape& shape = static_cast<Part::Feature*>(obj)->Shape.getValue();
|
||||||
if (!PartGui::checkForSolids(shape)) {
|
if (!PartGui::checkForSolids(shape) && !askUser) {
|
||||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
|
int ret = QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Non-solids selected"),
|
||||||
QObject::tr("Non-solids cannot be used for boolean operations."));
|
QObject::tr("The use of non-solids for boolean operations may lead to unexpected results.\n"
|
||||||
return;
|
"Do you want to continue?"), QMessageBox::Yes, QMessageBox::No);
|
||||||
|
if (ret == QMessageBox::No)
|
||||||
|
return;
|
||||||
|
askUser = true;
|
||||||
}
|
}
|
||||||
str << "App.activeDocument()." << it->getFeatName() << ",";
|
str << "App.activeDocument()." << it->getFeatName() << ",";
|
||||||
tempSelNames.push_back(it->getFeatName());
|
tempSelNames.push_back(it->getFeatName());
|
||||||
|
@ -394,6 +402,7 @@ void CmdPartFuse::activated(int iMsg)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool askUser = false;
|
||||||
std::string FeatName = getUniqueObjectName("Fusion");
|
std::string FeatName = getUniqueObjectName("Fusion");
|
||||||
std::stringstream str;
|
std::stringstream str;
|
||||||
std::vector<std::string> tempSelNames;
|
std::vector<std::string> tempSelNames;
|
||||||
|
@ -402,10 +411,13 @@ void CmdPartFuse::activated(int iMsg)
|
||||||
App::DocumentObject* obj = it->getObject();
|
App::DocumentObject* obj = it->getObject();
|
||||||
if (obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
if (obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||||
const TopoDS_Shape& shape = static_cast<Part::Feature*>(obj)->Shape.getValue();
|
const TopoDS_Shape& shape = static_cast<Part::Feature*>(obj)->Shape.getValue();
|
||||||
if (!PartGui::checkForSolids(shape)) {
|
if (!PartGui::checkForSolids(shape) && !askUser) {
|
||||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
|
int ret = QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Non-solids selected"),
|
||||||
QObject::tr("Non-solids cannot be used for boolean operations."));
|
QObject::tr("The use of non-solids for boolean operations may lead to unexpected results.\n"
|
||||||
return;
|
"Do you want to continue?"), QMessageBox::Yes, QMessageBox::No);
|
||||||
|
if (ret == QMessageBox::No)
|
||||||
|
return;
|
||||||
|
askUser = true;
|
||||||
}
|
}
|
||||||
str << "App.activeDocument()." << it->getFeatName() << ",";
|
str << "App.activeDocument()." << it->getFeatName() << ",";
|
||||||
tempSelNames.push_back(it->getFeatName());
|
tempSelNames.push_back(it->getFeatName());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user