Part Design: adding const char PDBODYKEY and using. No functional change.
This commit is contained in:
parent
56af3ca44d
commit
10a7f15c37
|
@ -66,4 +66,6 @@ namespace Gui
|
|||
|
||||
} //namespace Gui
|
||||
|
||||
#endif
|
||||
static const char PDBODYKEY[] = "pdbody";
|
||||
|
||||
#endif
|
||||
|
|
|
@ -123,7 +123,7 @@ void CmdPartDesignBody::activated(int iMsg)
|
|||
//doCommand(Doc,"App.activeDocument().%s.Model = []",FeatName.c_str());
|
||||
//doCommand(Doc,"App.activeDocument().%s.Tip = None",FeatName.c_str());
|
||||
addModule(Gui,"PartDesignGui"); // import the Gui module only once a session
|
||||
doCommand(Gui::Command::Gui, "Gui.activeView().setActiveObject('Body',App.activeDocument().%s)", FeatName.c_str());
|
||||
doCommand(Gui::Command::Gui, "Gui.activeView().setActiveObject('%s', App.activeDocument().%s)", PDBODYKEY, FeatName.c_str());
|
||||
// Make the "Create sketch" prompt appear in the task panel
|
||||
doCommand(Gui,"Gui.Selection.clearSelection()");
|
||||
doCommand(Gui,"Gui.Selection.addSelection(App.ActiveDocument.%s)", FeatName.c_str());
|
||||
|
@ -174,8 +174,8 @@ void CmdPartDesignMoveTip::activated(int iMsg)
|
|||
// Switch to other body
|
||||
pcActiveBody = static_cast<PartDesign::Body*>(Part::BodyBase::findBodyOf(selFeature));
|
||||
if (pcActiveBody != NULL)
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeView().setActiveObject('Body',App.activeDocument().%s)",
|
||||
pcActiveBody->getNameInDocument());
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeView().setActiveObject('%s',App.activeDocument().%s)",
|
||||
PDBODYKEY, pcActiveBody->getNameInDocument());
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
@ -244,8 +244,8 @@ void CmdPartDesignDuplicateSelection::activated(int iMsg)
|
|||
// Switch to other body
|
||||
pcActiveBody = static_cast<PartDesign::Body*>(Part::BodyBase::findBodyOf(selFeature));
|
||||
if (pcActiveBody != NULL)
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeView().setActiveObject('Body',App.activeDocument().%s)",
|
||||
pcActiveBody->getNameInDocument());
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeView().setActiveObject('%s', App.activeDocument().%s)",
|
||||
PDBODYKEY, pcActiveBody->getNameInDocument());
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
@ -1868,7 +1868,7 @@ void CmdPartDesignBoolean::activated(int iMsg)
|
|||
|
||||
openCommand("Create Boolean");
|
||||
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>("Body");
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
|
||||
// Make sure we are working on the selected body
|
||||
if (body != activeBody) {
|
||||
Gui::Selection().clearSelection();
|
||||
|
|
|
@ -51,7 +51,7 @@ using namespace Gui;
|
|||
|
||||
bool ReferenceSelection::allow(App::Document* pDoc, App::DocumentObject* pObj, const char* sSubName)
|
||||
{
|
||||
PartDesign::Body* ActivePartObject = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>("Body");
|
||||
PartDesign::Body* ActivePartObject = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
|
||||
App::Part* activePart = Gui::Application::Instance->activeView()->getActiveObject<App::Part*>("Part");
|
||||
|
||||
// Don't allow selection in other document
|
||||
|
|
|
@ -435,7 +435,7 @@ void TaskDatumParameters::onCheckFlip(bool on)
|
|||
void TaskDatumParameters::onButtonRef(const bool pressed, const int idx)
|
||||
{
|
||||
// Note: Even if there is no solid, App::Plane and Part::Datum can still be selected
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>("Body");
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
|
||||
App::DocumentObject* solid = activeBody->getPrevSolidFeature();
|
||||
|
||||
if (pressed) {
|
||||
|
@ -507,7 +507,7 @@ void TaskDatumParameters::onRefName(const QString& text, const int idx)
|
|||
if (obj == NULL) return;
|
||||
|
||||
std::string subElement;
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>("Body");
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
|
||||
|
||||
if (obj->getTypeId().isDerivedFrom(App::Plane::getClassTypeId())) {
|
||||
// everything is OK (we assume a Part can only have exactly 3 App::Plane objects located at the base of the feature tree)
|
||||
|
@ -715,7 +715,7 @@ bool TaskDlgDatumParameters::accept()
|
|||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Angle = %f",name.c_str(),parameter->getAngle());
|
||||
//Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Checked = %i",name.c_str(),parameter->getCheckBox1()?1:0);
|
||||
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>("Body");
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
|
||||
App::DocumentObject* solid = activeBody->getPrevSolidFeature();
|
||||
if (solid != NULL) {
|
||||
QString buf = QString::fromAscii("[");
|
||||
|
@ -749,7 +749,7 @@ bool TaskDlgDatumParameters::reject()
|
|||
Gui::Command::abortCommand();
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()");
|
||||
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>("Body");
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
|
||||
// Body housekeeping
|
||||
if (activeBody != NULL) {
|
||||
// Make the new Tip and the previous solid feature visible again
|
||||
|
|
|
@ -240,7 +240,7 @@ bool TaskDlgDressUpParameters::reject()
|
|||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()");
|
||||
|
||||
// Body housekeeping
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>("Body");
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
|
||||
if (activeBody != NULL) {
|
||||
// Make the new Tip and the previous solid feature visible again
|
||||
App::DocumentObject* tip = activeBody->Tip.getValue();
|
||||
|
|
|
@ -91,7 +91,7 @@ const QString TaskSketchBasedParameters::onAddSelection(const Gui::SelectionChan
|
|||
|
||||
void TaskSketchBasedParameters::onSelectReference(const bool pressed, const bool edge, const bool face, const bool planar) {
|
||||
// Note: Even if there is no solid, App::Plane and Part::Datum can still be selected
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>("Body");
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
|
||||
App::DocumentObject* prevSolid = activeBody->getPrevSolidFeature(vp->getObject(), false);
|
||||
App::DocumentObject* curSolid = activeBody->getPrevSolidFeature();
|
||||
|
||||
|
@ -136,7 +136,7 @@ const QByteArray TaskSketchBasedParameters::onFaceName(const QString& text)
|
|||
if (obj == NULL)
|
||||
return QByteArray();
|
||||
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>("Body");
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
|
||||
if (obj->getTypeId().isDerivedFrom(App::Plane::getClassTypeId())) {
|
||||
// everything is OK (we assume a Part can only have exactly 3 App::Plane objects located at the base of the feature tree)
|
||||
return QByteArray();
|
||||
|
@ -245,7 +245,7 @@ bool TaskDlgSketchBasedParameters::reject()
|
|||
}
|
||||
|
||||
// Body housekeeping
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>("Body");
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
|
||||
if (activeBody != NULL) {
|
||||
// Make the new Tip and the previous solid feature visible again
|
||||
App::DocumentObject* tip = activeBody->Tip.getValue();
|
||||
|
|
|
@ -340,7 +340,7 @@ bool TaskDlgTransformedParameters::reject()
|
|||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()");
|
||||
|
||||
// Body housekeeping
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>("Body");
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
|
||||
if (activeBody != NULL) {
|
||||
// Make the new Tip and the previous solid feature visible again
|
||||
App::DocumentObject* tip = activeBody->Tip.getValue();
|
||||
|
|
|
@ -52,7 +52,7 @@ ViewProvider::~ViewProvider()
|
|||
|
||||
bool ViewProvider::doubleClicked(void)
|
||||
{
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>("Body");
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
|
||||
if (activeBody != NULL) {
|
||||
// Drop into insert mode so that the user doesn't see all the geometry that comes later in the tree
|
||||
// Also, this way the user won't be tempted to use future geometry as external references for the sketch
|
||||
|
@ -85,7 +85,7 @@ void ViewProvider::unsetEdit(int ModNum)
|
|||
|
||||
if (ModNum == ViewProvider::Default) {
|
||||
// when pressing ESC make sure to close the dialog
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>("Body");
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
|
||||
Gui::Control().closeDialog();
|
||||
if ((activeBody != NULL) && (oldTip != NULL)) {
|
||||
Gui::Selection().clearSelection();
|
||||
|
|
|
@ -105,7 +105,7 @@ bool ViewProviderBody::doubleClicked(void)
|
|||
// assure the PartDesign workbench
|
||||
Gui::Command::assureWorkbench("PartDesignWorkbench");
|
||||
//Gui::Command::doCommand(Gui::Command::Gui,"PartDesignGui.setActiveBody(App.activeDocument().%s)",this->getObject()->getNameInDocument());
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeView().setActiveObject('Body',App.activeDocument().%s)",this->getObject()->getNameInDocument());
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeView().setActiveObject('%s', App.activeDocument().%s)", PDBODYKEY, this->getObject()->getNameInDocument());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -276,7 +276,7 @@ bool ViewProviderDatum::doubleClicked(void)
|
|||
std::string Msg("Edit ");
|
||||
Msg += this->pcObject->Label.getValue();
|
||||
Gui::Command::openCommand(Msg.c_str());
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>("Body");
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
|
||||
if (activeBody != NULL) {
|
||||
// Drop into insert mode so that the user doesn't see all the geometry that comes later in the tree
|
||||
// Also, this way the user won't be tempted to use future geometry as external references for the sketch
|
||||
|
@ -301,7 +301,7 @@ void ViewProviderDatum::unsetEdit(int ModNum)
|
|||
if (ModNum == ViewProvider::Default) {
|
||||
// when pressing ESC make sure to close the dialog
|
||||
Gui::Control().closeDialog();
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>("Body");
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
|
||||
|
||||
if ((activeBody != NULL) && (oldTip != NULL)) {
|
||||
Gui::Selection().clearSelection();
|
||||
|
|
|
@ -75,7 +75,7 @@ namespace PartDesignGui {
|
|||
|
||||
PartDesign::Body *getBody(void)
|
||||
{
|
||||
PartDesign::Body * activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>("Body");
|
||||
PartDesign::Body * activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
|
||||
|
||||
if (!activeBody){
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("No active Body"),
|
||||
|
@ -118,7 +118,7 @@ PartDesign::Body *Workbench::setUpPart(const App::Part *part)
|
|||
Gui::Command::addModule(Gui::Command::Doc, "PartDesign");
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.activeDocument().addObject('PartDesign::Body','%s')", BodyName.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.activeDocument().%s.addObject(App.activeDocument().ActiveObject)", part->getNameInDocument());
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeView().setActiveObject('Body',App.activeDocument().%s)", BodyName.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeView().setActiveObject('%s', App.activeDocument().%s)", PDBODYKEY, BodyName.c_str());
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ void Workbench::_doMigration(const App::Document* doc)
|
|||
// Always create at least the first body, even if the document is empty
|
||||
// This adds both the base planes and the body
|
||||
Gui::Command::runCommand(Gui::Command::Doc, "FreeCADGui.runCommand('PartDesign_Body')");
|
||||
PartDesign::Body *activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>("Body");
|
||||
PartDesign::Body *activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
|
||||
assert(activeBody);
|
||||
|
||||
|
||||
|
@ -192,7 +192,7 @@ void Workbench::_doMigration(const App::Document* doc)
|
|||
for (std::vector<App::DocumentObject*>::iterator r = roots.begin(); r != roots.end(); r++) {
|
||||
if (r != roots.begin()) {
|
||||
Gui::Command::runCommand(Gui::Command::Doc, "FreeCADGui.runCommand('PartDesign_Body')");
|
||||
activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>("Body");
|
||||
activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
|
||||
}
|
||||
|
||||
std::set<App::DocumentObject*> inList;
|
||||
|
@ -355,7 +355,7 @@ void Workbench::_switchToDocument(const App::Document* doc)
|
|||
Gui::Command::doCommand(Gui::Command::Doc, "PartDesignGui.setUpPart(App.activeDocument().%s)", PartName.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeView().setActiveObject('Part',App.activeDocument().%s)", PartName.c_str());
|
||||
|
||||
activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>("Body");
|
||||
activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
|
||||
|
||||
// body have to be created
|
||||
assert(activeBody);
|
||||
|
@ -363,13 +363,13 @@ void Workbench::_switchToDocument(const App::Document* doc)
|
|||
} else {
|
||||
// empty document with no tip, so do migration
|
||||
_doMigration(doc);
|
||||
activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>("Body");
|
||||
activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
|
||||
assert(activeBody);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>("Body");
|
||||
activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
|
||||
assert(activeBody);
|
||||
activePart = Gui::Application::Instance->activeView()->getActiveObject<App::Part*>("Part");
|
||||
assert(activePart);
|
||||
|
|
Loading…
Reference in New Issue
Block a user