Remove BasePlanes from part design
This commit is contained in:
parent
eb226967f3
commit
f873fb80e9
|
@ -41,13 +41,6 @@
|
|||
#include "Workbench.h"
|
||||
|
||||
|
||||
namespace PartDesignGui {
|
||||
|
||||
// The names of the base planes. Note: The user-visible label is different from this
|
||||
const char* BaseplaneNames[3] = {"BaseplaneXY", "BaseplaneXZ", "BaseplaneYZ"};
|
||||
|
||||
}
|
||||
|
||||
//static PyObject * setActiveBody(PyObject *self, PyObject *args)
|
||||
//{
|
||||
// PyObject *object=0;
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <Base/UnitsApi.h>
|
||||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/Part.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
|
@ -182,11 +183,11 @@ void TaskLinearPatternParameters::updateUI()
|
|||
ui->comboDirection->setCurrentIndex(0);
|
||||
else if (directions.front() == "V_Axis")
|
||||
ui->comboDirection->setCurrentIndex(1);
|
||||
else if (strcmp(directionFeature->getNameInDocument(), PartDesignGui::BaseplaneNames[0]) == 0)
|
||||
else if (strcmp(directionFeature->getNameInDocument(), App::Part::BaseplaneTypes[0]) == 0)
|
||||
ui->comboDirection->setCurrentIndex(2);
|
||||
else if (strcmp(directionFeature->getNameInDocument(), PartDesignGui::BaseplaneNames[1]) == 0)
|
||||
else if (strcmp(directionFeature->getNameInDocument(), App::Part::BaseplaneTypes[1]) == 0)
|
||||
ui->comboDirection->setCurrentIndex(3);
|
||||
else if (strcmp(directionFeature->getNameInDocument(), PartDesignGui::BaseplaneNames[2]) == 0)
|
||||
else if (strcmp(directionFeature->getNameInDocument(), App::Part::BaseplaneTypes[2]) == 0)
|
||||
ui->comboDirection->setCurrentIndex(4);
|
||||
else if (directions.front().size() > 4 && directions.front().substr(0,4) == "Axis") {
|
||||
int pos = 5 + std::atoi(directions.front().substr(4,4000).c_str());
|
||||
|
@ -328,17 +329,17 @@ void TaskLinearPatternParameters::onDirectionChanged(int num) {
|
|||
exitSelectionMode();
|
||||
}
|
||||
else if (num == 2) {
|
||||
pcLinearPattern->Direction.setValue(getObject()->getDocument()->getObject(PartDesignGui::BaseplaneNames[0]),
|
||||
pcLinearPattern->Direction.setValue(getObject()->getDocument()->getObject(App::Part::BaseplaneTypes[0]),
|
||||
std::vector<std::string>(1,""));
|
||||
exitSelectionMode();
|
||||
}
|
||||
else if (num == 3) {
|
||||
pcLinearPattern->Direction.setValue(getObject()->getDocument()->getObject(PartDesignGui::BaseplaneNames[1]),
|
||||
pcLinearPattern->Direction.setValue(getObject()->getDocument()->getObject(App::Part::BaseplaneTypes[1]),
|
||||
std::vector<std::string>(1,""));
|
||||
exitSelectionMode();
|
||||
}
|
||||
else if (num == 4) {
|
||||
pcLinearPattern->Direction.setValue(getObject()->getDocument()->getObject(PartDesignGui::BaseplaneNames[2]),
|
||||
pcLinearPattern->Direction.setValue(getObject()->getDocument()->getObject(App::Part::BaseplaneTypes[2]),
|
||||
std::vector<std::string>(1,""));
|
||||
exitSelectionMode();
|
||||
}
|
||||
|
@ -405,11 +406,11 @@ void TaskLinearPatternParameters::getDirection(App::DocumentObject*& obj, std::v
|
|||
else if (num == 1)
|
||||
sub[0] = "V_Axis";
|
||||
else if (num == 2)
|
||||
obj = getObject()->getDocument()->getObject(PartDesignGui::BaseplaneNames[0]);
|
||||
obj = getObject()->getDocument()->getObject(App::Part::BaseplaneTypes[0]);
|
||||
else if (num == 3)
|
||||
obj = getObject()->getDocument()->getObject(PartDesignGui::BaseplaneNames[1]);
|
||||
obj = getObject()->getDocument()->getObject(App::Part::BaseplaneTypes[1]);
|
||||
else if (num == 4)
|
||||
obj = getObject()->getDocument()->getObject(PartDesignGui::BaseplaneNames[2]);
|
||||
obj = getObject()->getDocument()->getObject(App::Part::BaseplaneTypes[2]);
|
||||
else if (num >= 5 && num < maxcount) {
|
||||
QString buf = QString::fromUtf8("Axis%1").arg(num-5);
|
||||
sub[0] = buf.toStdString();
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "ReferenceSelection.h"
|
||||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/Part.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
|
@ -154,11 +155,11 @@ void TaskMirroredParameters::updateUI()
|
|||
ui->comboPlane->setCurrentIndex(0);
|
||||
else if (mirrorPlanes.front() == "V_Axis")
|
||||
ui->comboPlane->setCurrentIndex(1);
|
||||
else if (strcmp(mirrorPlaneFeature->getNameInDocument(), PartDesignGui::BaseplaneNames[0]) == 0)
|
||||
else if (strcmp(mirrorPlaneFeature->getNameInDocument(), App::Part::BaseplaneTypes[0]) == 0)
|
||||
ui->comboPlane->setCurrentIndex(2);
|
||||
else if (strcmp(mirrorPlaneFeature->getNameInDocument(), PartDesignGui::BaseplaneNames[1]) == 0)
|
||||
else if (strcmp(mirrorPlaneFeature->getNameInDocument(), App::Part::BaseplaneTypes[1]) == 0)
|
||||
ui->comboPlane->setCurrentIndex(3);
|
||||
else if (strcmp(mirrorPlaneFeature->getNameInDocument(), PartDesignGui::BaseplaneNames[2]) == 0)
|
||||
else if (strcmp(mirrorPlaneFeature->getNameInDocument(), App::Part::BaseplaneTypes[2]) == 0)
|
||||
ui->comboPlane->setCurrentIndex(4);
|
||||
else if (mirrorPlanes.front().size() > 4 && mirrorPlanes.front().substr(0,4) == "Axis") {
|
||||
int pos = 5 + std::atoi(mirrorPlanes.front().substr(4,4000).c_str());
|
||||
|
@ -254,17 +255,17 @@ void TaskMirroredParameters::onPlaneChanged(int num) {
|
|||
exitSelectionMode();
|
||||
}
|
||||
else if (num == 2) {
|
||||
pcMirrored->MirrorPlane.setValue(getObject()->getDocument()->getObject(PartDesignGui::BaseplaneNames[0]),
|
||||
pcMirrored->MirrorPlane.setValue(getObject()->getDocument()->getObject(App::Part::BaseplaneTypes[0]),
|
||||
std::vector<std::string>(1,""));
|
||||
exitSelectionMode();
|
||||
}
|
||||
else if (num == 3) {
|
||||
pcMirrored->MirrorPlane.setValue(getObject()->getDocument()->getObject(PartDesignGui::BaseplaneNames[1]),
|
||||
pcMirrored->MirrorPlane.setValue(getObject()->getDocument()->getObject(App::Part::BaseplaneTypes[1]),
|
||||
std::vector<std::string>(1,""));
|
||||
exitSelectionMode();
|
||||
}
|
||||
else if (num == 4) {
|
||||
pcMirrored->MirrorPlane.setValue(getObject()->getDocument()->getObject(PartDesignGui::BaseplaneNames[2]),
|
||||
pcMirrored->MirrorPlane.setValue(getObject()->getDocument()->getObject(App::Part::BaseplaneTypes[2]),
|
||||
std::vector<std::string>(1,""));
|
||||
exitSelectionMode();
|
||||
}
|
||||
|
@ -328,11 +329,11 @@ void TaskMirroredParameters::getMirrorPlane(App::DocumentObject*& obj, std::vect
|
|||
else if (num == 1)
|
||||
sub[0] = "V_Axis";
|
||||
else if (num == 2)
|
||||
obj = getObject()->getDocument()->getObject(PartDesignGui::BaseplaneNames[0]);
|
||||
obj = getObject()->getDocument()->getObject(App::Part::BaseplaneTypes[0]);
|
||||
else if (num == 3)
|
||||
obj = getObject()->getDocument()->getObject(PartDesignGui::BaseplaneNames[1]);
|
||||
obj = getObject()->getDocument()->getObject(App::Part::BaseplaneTypes[1]);
|
||||
else if (num == 4)
|
||||
obj = getObject()->getDocument()->getObject(PartDesignGui::BaseplaneNames[2]);
|
||||
obj = getObject()->getDocument()->getObject(App::Part::BaseplaneTypes[2]);
|
||||
else if (num >= 5 && num < maxcount) {
|
||||
QString buf = QString::fromUtf8("Axis%1").arg(num-5);
|
||||
sub[0] = buf.toStdString();
|
||||
|
|
|
@ -290,7 +290,7 @@ void Workbench::_doMigration(const App::Document* doc)
|
|||
if (fabs(offset) < Precision::Confusion()) {
|
||||
// One of the base planes
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Support = (App.activeDocument().%s,['%s'])",
|
||||
sketch->getNameInDocument(), BaseplaneNames[index], side.c_str());
|
||||
sketch->getNameInDocument(), App::Part::BaseplaneTypes[index], side.c_str());
|
||||
} else {
|
||||
// Offset to base plane
|
||||
// Find out which direction we need to offset
|
||||
|
@ -307,7 +307,7 @@ void Workbench::_doMigration(const App::Document* doc)
|
|||
|
||||
std::string Datum = doc->getUniqueObjectName("DatumPlane");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().addObject('PartDesign::Plane','%s')",Datum.c_str());
|
||||
QString refStr = QString::fromAscii("[(App.activeDocument().") + QString::fromAscii(BaseplaneNames[index]) +
|
||||
QString refStr = QString::fromAscii("[(App.activeDocument().") + QString::fromAscii(App::Part::BaseplaneTypes[index]) +
|
||||
QString::fromAscii(",'')]");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.References = %s",Datum.c_str(), refStr.toStdString().c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Offset = %f",Datum.c_str(), offset);
|
||||
|
|
|
@ -49,8 +49,6 @@ namespace PartDesignGui {
|
|||
//extern Gui::Document *ActiveGuiDoc;
|
||||
//extern App::Document *ActiveAppDoc;
|
||||
//extern Gui::ViewProviderDocumentObject *ActiveVp;
|
||||
// The names of the base planes
|
||||
extern const char* BaseplaneNames[3];
|
||||
|
||||
/// Return active body or show a warning message
|
||||
PartDesign::Body *getBody(void);
|
||||
|
|
Loading…
Reference in New Issue
Block a user