refuse to create partdesign objects if no active body in document
This commit is contained in:
parent
e62d883f54
commit
9f0db2d900
|
@ -870,6 +870,14 @@ CmdPartDesignPad::CmdPartDesignPad()
|
||||||
|
|
||||||
void CmdPartDesignPad::activated(int iMsg)
|
void CmdPartDesignPad::activated(int iMsg)
|
||||||
{
|
{
|
||||||
|
App::Document *doc = getDocument();
|
||||||
|
PartDesign::Body *pcActiveBody = PartDesignGui::getBody(
|
||||||
|
/*messageIfNot = */ PartDesignGui::assureModernWorkflow(doc));
|
||||||
|
|
||||||
|
// No PartDesign feature without Body past FreeCAD 0.16
|
||||||
|
if (!pcActiveBody && PartDesignGui::isModernWorkflow(doc))
|
||||||
|
return;
|
||||||
|
|
||||||
Gui::Command* cmd = this;
|
Gui::Command* cmd = this;
|
||||||
auto worker = [cmd](Part::Feature* profile, std::string FeatName) {
|
auto worker = [cmd](Part::Feature* profile, std::string FeatName) {
|
||||||
|
|
||||||
|
@ -919,6 +927,14 @@ CmdPartDesignPocket::CmdPartDesignPocket()
|
||||||
|
|
||||||
void CmdPartDesignPocket::activated(int iMsg)
|
void CmdPartDesignPocket::activated(int iMsg)
|
||||||
{
|
{
|
||||||
|
App::Document *doc = getDocument();
|
||||||
|
PartDesign::Body *pcActiveBody = PartDesignGui::getBody(
|
||||||
|
/*messageIfNot = */ PartDesignGui::assureModernWorkflow(doc));
|
||||||
|
|
||||||
|
// No PartDesign feature without Body past FreeCAD 0.16
|
||||||
|
if (!pcActiveBody && PartDesignGui::isModernWorkflow(doc))
|
||||||
|
return;
|
||||||
|
|
||||||
Gui::Command* cmd = this;
|
Gui::Command* cmd = this;
|
||||||
auto worker = [cmd](Part::Feature* sketch, std::string FeatName) {
|
auto worker = [cmd](Part::Feature* sketch, std::string FeatName) {
|
||||||
|
|
||||||
|
@ -956,6 +972,14 @@ CmdPartDesignRevolution::CmdPartDesignRevolution()
|
||||||
|
|
||||||
void CmdPartDesignRevolution::activated(int iMsg)
|
void CmdPartDesignRevolution::activated(int iMsg)
|
||||||
{
|
{
|
||||||
|
App::Document *doc = getDocument();
|
||||||
|
PartDesign::Body *pcActiveBody = PartDesignGui::getBody(
|
||||||
|
/*messageIfNot = */ PartDesignGui::assureModernWorkflow(doc));
|
||||||
|
|
||||||
|
// No PartDesign feature without Body past FreeCAD 0.16
|
||||||
|
if (!pcActiveBody && PartDesignGui::isModernWorkflow(doc))
|
||||||
|
return;
|
||||||
|
|
||||||
Gui::Command* cmd = this;
|
Gui::Command* cmd = this;
|
||||||
auto worker = [cmd](Part::Feature* sketch, std::string FeatName) {
|
auto worker = [cmd](Part::Feature* sketch, std::string FeatName) {
|
||||||
|
|
||||||
|
@ -999,6 +1023,13 @@ CmdPartDesignGroove::CmdPartDesignGroove()
|
||||||
|
|
||||||
void CmdPartDesignGroove::activated(int iMsg)
|
void CmdPartDesignGroove::activated(int iMsg)
|
||||||
{
|
{
|
||||||
|
App::Document *doc = getDocument();
|
||||||
|
PartDesign::Body *pcActiveBody = PartDesignGui::getBody(
|
||||||
|
/*messageIfNot = */ PartDesignGui::assureModernWorkflow(doc));
|
||||||
|
|
||||||
|
if (!pcActiveBody && PartDesignGui::isModernWorkflow(doc))
|
||||||
|
return;
|
||||||
|
|
||||||
Gui::Command* cmd = this;
|
Gui::Command* cmd = this;
|
||||||
auto worker = [cmd](Part::Feature* sketch, std::string FeatName) {
|
auto worker = [cmd](Part::Feature* sketch, std::string FeatName) {
|
||||||
|
|
||||||
|
@ -1042,6 +1073,12 @@ CmdPartDesignAdditivePipe::CmdPartDesignAdditivePipe()
|
||||||
|
|
||||||
void CmdPartDesignAdditivePipe::activated(int iMsg)
|
void CmdPartDesignAdditivePipe::activated(int iMsg)
|
||||||
{
|
{
|
||||||
|
PartDesign::Body *pcActiveBody = PartDesignGui::getBody(/*messageIfNot = */ true);
|
||||||
|
|
||||||
|
// No PartDesign feature without Body past FreeCAD 0.13
|
||||||
|
if (!pcActiveBody)
|
||||||
|
return;
|
||||||
|
|
||||||
Gui::Command* cmd = this;
|
Gui::Command* cmd = this;
|
||||||
auto worker = [cmd](Part::Feature* sketch, std::string FeatName) {
|
auto worker = [cmd](Part::Feature* sketch, std::string FeatName) {
|
||||||
|
|
||||||
|
@ -1082,6 +1119,12 @@ CmdPartDesignSubtractivePipe::CmdPartDesignSubtractivePipe()
|
||||||
|
|
||||||
void CmdPartDesignSubtractivePipe::activated(int iMsg)
|
void CmdPartDesignSubtractivePipe::activated(int iMsg)
|
||||||
{
|
{
|
||||||
|
PartDesign::Body *pcActiveBody = PartDesignGui::getBody(/*messageIfNot = */ true);
|
||||||
|
|
||||||
|
// No PartDesign feature without Body past FreeCAD 0.13
|
||||||
|
if (!pcActiveBody)
|
||||||
|
return;
|
||||||
|
|
||||||
Gui::Command* cmd = this;
|
Gui::Command* cmd = this;
|
||||||
auto worker = [cmd](Part::Feature* sketch, std::string FeatName) {
|
auto worker = [cmd](Part::Feature* sketch, std::string FeatName) {
|
||||||
|
|
||||||
|
@ -1122,6 +1165,12 @@ CmdPartDesignAdditiveLoft::CmdPartDesignAdditiveLoft()
|
||||||
|
|
||||||
void CmdPartDesignAdditiveLoft::activated(int iMsg)
|
void CmdPartDesignAdditiveLoft::activated(int iMsg)
|
||||||
{
|
{
|
||||||
|
PartDesign::Body *pcActiveBody = PartDesignGui::getBody(/*messageIfNot = */ true);
|
||||||
|
|
||||||
|
// No PartDesign feature without Body past FreeCAD 0.13
|
||||||
|
if (!pcActiveBody)
|
||||||
|
return;
|
||||||
|
|
||||||
Gui::Command* cmd = this;
|
Gui::Command* cmd = this;
|
||||||
auto worker = [cmd](Part::Feature* sketch, std::string FeatName) {
|
auto worker = [cmd](Part::Feature* sketch, std::string FeatName) {
|
||||||
|
|
||||||
|
@ -1162,6 +1211,12 @@ CmdPartDesignSubtractiveLoft::CmdPartDesignSubtractiveLoft()
|
||||||
|
|
||||||
void CmdPartDesignSubtractiveLoft::activated(int iMsg)
|
void CmdPartDesignSubtractiveLoft::activated(int iMsg)
|
||||||
{
|
{
|
||||||
|
PartDesign::Body *pcActiveBody = PartDesignGui::getBody(/*messageIfNot = */ true);
|
||||||
|
|
||||||
|
// No PartDesign feature without Body past FreeCAD 0.13
|
||||||
|
if (!pcActiveBody)
|
||||||
|
return;
|
||||||
|
|
||||||
Gui::Command* cmd = this;
|
Gui::Command* cmd = this;
|
||||||
auto worker = [cmd](Part::Feature* sketch, std::string FeatName) {
|
auto worker = [cmd](Part::Feature* sketch, std::string FeatName) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user