PartDesign: Add new need active body dialog with option to choose body (#4949)
* [PD] Add new need active body dialog Intended for use wherever an active body is needed but none exists. The dialog contains a list with the bodies present in the document, with an extra option to make a new body. Custom text can be provided if needed. This commit also replaces the warnings used by "new sketch" and "primitive" command with this new dialog. Addresses issue #4288.
This commit is contained in:
@@ -70,6 +70,7 @@
|
||||
#include "WorkflowManager.h"
|
||||
#include "ViewProvider.h"
|
||||
#include "ViewProviderBody.h"
|
||||
#include "DlgActiveBody.h"
|
||||
|
||||
// TODO Remove this header after fixing code so it won;t be needed here (2015-10-20, Fat-Zer)
|
||||
#include "ui_DlgReference.h"
|
||||
@@ -505,12 +506,15 @@ void CmdPartDesignNewSketch::activated(int iMsg)
|
||||
// objects (in which case, just make one) to make a new sketch.
|
||||
|
||||
pcActiveBody = PartDesignGui::getBody( /* messageIfNot = */ false );
|
||||
if (pcActiveBody == nullptr) {
|
||||
if ( doc->getObjectsOfType(PartDesign::Body::getClassTypeId()).empty() ) {
|
||||
if (!pcActiveBody) {
|
||||
if ( doc->countObjectsOfType(PartDesign::Body::getClassTypeId()) == 0 ) {
|
||||
shouldMakeBody = true;
|
||||
} else {
|
||||
PartDesignGui::needActiveBodyError();
|
||||
return;
|
||||
PartDesignGui::DlgActiveBody dia(Gui::getMainWindow(), doc);
|
||||
if (dia.exec() == QDialog::DialogCode::Accepted)
|
||||
pcActiveBody = dia.getActiveBody();
|
||||
if (!pcActiveBody)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user