Create standard XY, XZ, YZ planes when running the PartDesign_Body command if they don't exist yet
This commit is contained in:
committed by
Stefan Tröger
parent
13f3ff24c3
commit
dde81fe8f5
@@ -153,17 +153,22 @@ void Workbench::activated()
|
||||
|
||||
// make the previously used active Body active again
|
||||
PartDesign::Body* activeBody = NULL;
|
||||
std::vector<App::DocumentObject*> bodies = App::GetApplication().getActiveDocument()->getObjectsOfType(PartDesign::Body::getClassTypeId());
|
||||
for (std::vector<App::DocumentObject*>::const_iterator b = bodies.begin(); b != bodies.end(); b++) {
|
||||
PartDesign::Body* body = static_cast<PartDesign::Body*>(*b);
|
||||
if (body->IsActive.getValue()) {
|
||||
activeBody = body;
|
||||
break;
|
||||
App::Document* activeDocument = App::GetApplication().getActiveDocument();
|
||||
if (activeDocument != NULL) {
|
||||
std::vector<App::DocumentObject*> bodies = activeDocument->getObjectsOfType(PartDesign::Body::getClassTypeId());
|
||||
for (std::vector<App::DocumentObject*>::const_iterator b = bodies.begin(); b != bodies.end(); b++) {
|
||||
PartDesign::Body* body = static_cast<PartDesign::Body*>(*b);
|
||||
if (body->IsActive.getValue()) {
|
||||
activeBody = body;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If there is only one body, make it active
|
||||
if ((activeBody == NULL) && (bodies.size() == 1))
|
||||
activeBody = static_cast<PartDesign::Body*>(bodies.front());
|
||||
}
|
||||
// If there is only one body, make it active
|
||||
if ((activeBody == NULL) && (bodies.size() == 1))
|
||||
activeBody = static_cast<PartDesign::Body*>(bodies.front());
|
||||
|
||||
|
||||
if (activeBody != NULL) {
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"import PartDesignGui");
|
||||
|
||||
Reference in New Issue
Block a user