diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 429b0df82..88b06a441 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -2011,7 +2011,7 @@ int SketchObject::addSymmetric(const std::vector &geoIdList, int refGeoId, return Geometry.getSize()-1; } -int SketchObject::addCopy(const std::vector &geoIdList, const Base::Vector3d& displacement, int csize/*=2*/, int rsize/*=1*/, +int SketchObject::addCopy(const std::vector &geoIdList, const Base::Vector3d& displacement, bool clone /*=false*/, int csize/*=2*/, int rsize/*=1*/, bool constraindisplacement /*= false*/, double perpscale /*= 1.0*/) { const std::vector< Part::Geometry * > &geovals = getInternalGeometry(); @@ -2153,10 +2153,29 @@ int SketchObject::addCopy(const std::vector &geoIdList, const Base::Vector3 if( (*it)->Second == Constraint::GeoUndef /*&& (*it)->Third == Constraint::GeoUndef*/) { if( ((*it)->Type != Sketcher::DistanceX && (*it)->Type != Sketcher::DistanceY ) || - (*it)->FirstPos == Sketcher::none ) { // if it is not a point locking DistanceX/Y - Constraint *constNew = (*it)->clone(); - constNew->First = geoIdMap[(*it)->First]; - newconstrVals.push_back(constNew); + (*it)->FirstPos == Sketcher::none ) { // if it is not a point locking DistanceX/Y + if (((*it)->Type == Sketcher::DistanceX || + (*it)->Type == Sketcher::DistanceY || + (*it)->Type == Sketcher::Distance || + (*it)->Type == Sketcher::Radius ) && clone ) { + // Distances on a single Element are mapped to equality constraints in clone mode + Constraint *constNew = (*it)->clone(); + constNew->Type = Sketcher::Equal; + constNew->Second = geoIdMap[(*it)->First]; // first is already (*it->First) + newconstrVals.push_back(constNew); + } + else if ((*it)->Type == Sketcher::Angle && clone){ + // Angles on a single Element are mapped to parallel constraints in clone mode + Constraint *constNew = (*it)->clone(); + constNew->Type = Sketcher::Parallel; + constNew->Second = geoIdMap[(*it)->First]; // first is already (*it->First) + newconstrVals.push_back(constNew); + } + else { + Constraint *constNew = (*it)->clone(); + constNew->First = geoIdMap[(*it)->First]; + newconstrVals.push_back(constNew); + } } } else { // other geoids intervene in this constraint @@ -2165,10 +2184,23 @@ int SketchObject::addCopy(const std::vector &geoIdList, const Base::Vector3 if(sit != geoIdList.end()) { // Second is also in the list if( (*it)->Third == Constraint::GeoUndef ) { - Constraint *constNew = (*it)->clone(); - constNew->First = geoIdMap[(*it)->First]; - constNew->Second = geoIdMap[(*it)->Second]; - newconstrVals.push_back(constNew); + if (((*it)->Type == Sketcher::DistanceX || + (*it)->Type == Sketcher::DistanceY || + (*it)->Type == Sketcher::Distance) && ((*it)->First == (*it)->Second) && clone ) { + // Distances on a two Elements, which must be points of the same line are mapped to equality constraints in clone mode + Constraint *constNew = (*it)->clone(); + constNew->Type = Sketcher::Equal; + constNew->FirstPos = Sketcher::none; + constNew->Second = geoIdMap[(*it)->First]; // first is already (*it->First) + constNew->SecondPos = Sketcher::none; + newconstrVals.push_back(constNew); + } + else { + Constraint *constNew = (*it)->clone(); + constNew->First = geoIdMap[(*it)->First]; + constNew->Second = geoIdMap[(*it)->Second]; + newconstrVals.push_back(constNew); + } } else { std::vector::const_iterator tit=std::find(geoIdList.begin(), geoIdList.end(), (*it)->Third); @@ -2188,7 +2220,6 @@ int SketchObject::addCopy(const std::vector &geoIdList, const Base::Vector3 } // handle inter-geometry constraints - // example: App.ActiveDocument.Sketch.addArray([0,1], App.Vector(150,150,0),3,4,True) if(constraindisplacement){ // add a construction line diff --git a/src/Mod/Sketcher/App/SketchObject.h b/src/Mod/Sketcher/App/SketchObject.h index 2faf9b594..5d58fb46a 100644 --- a/src/Mod/Sketcher/App/SketchObject.h +++ b/src/Mod/Sketcher/App/SketchObject.h @@ -155,7 +155,7 @@ public: /// with default parameters adds a copy of the geometric elements displaced by the displacement vector. /// It creates an array of csize elements in the direction of the displacement vector by rsize elements in the /// direction perpendicular to the displacement vector, wherein the modulus of this perpendicular vector is scaled by perpscale. - int addCopy(const std::vector &geoIdList, const Base::Vector3d& displacement, int csize=2, int rsize=1, bool constraindisplacement = false, double perpscale = 1.0); + int addCopy(const std::vector &geoIdList, const Base::Vector3d& displacement, bool clone=false, int csize=2, int rsize=1, bool constraindisplacement = false, double perpscale = 1.0); /// Exposes all internal geometry of an object supporting internal geometry /*! * \return -1 on error diff --git a/src/Mod/Sketcher/App/SketchObjectPy.xml b/src/Mod/Sketcher/App/SketchObjectPy.xml index 52e966f31..ac5939936 100644 --- a/src/Mod/Sketcher/App/SketchObjectPy.xml +++ b/src/Mod/Sketcher/App/SketchObjectPy.xml @@ -142,7 +142,7 @@ add a copy of geometric objects to the sketch displaced by a vector3d - + add an array of size cols by rows where each element is a copy of the selected geometric objects displaced by a vector3d in the cols direction and by a vector perpendicular to it in the rows direction diff --git a/src/Mod/Sketcher/App/SketchObjectPyImp.cpp b/src/Mod/Sketcher/App/SketchObjectPyImp.cpp index 376b72391..b84145f3b 100644 --- a/src/Mod/Sketcher/App/SketchObjectPyImp.cpp +++ b/src/Mod/Sketcher/App/SketchObjectPyImp.cpp @@ -759,6 +759,7 @@ PyObject* SketchObjectPy::addSymmetric(PyObject *args) PyObject *pcObj; int refGeoId; int refPosId = Sketcher::none; + if (!PyArg_ParseTuple(args, "Oi|i", &pcObj, &refGeoId, &refPosId)) return 0; @@ -795,8 +796,9 @@ PyObject* SketchObjectPy::addSymmetric(PyObject *args) PyObject* SketchObjectPy::addCopy(PyObject *args) { PyObject *pcObj, *pcVect; + PyObject* clone= Py_False; - if (!PyArg_ParseTuple(args, "OO!", &pcObj, &(Base::VectorPy::Type), &pcVect)) + if (!PyArg_ParseTuple(args, "OO!|O!", &pcObj, &(Base::VectorPy::Type), &pcVect, &PyBool_Type, &clone)) return 0; Base::Vector3d vect = static_cast(pcVect)->value(); @@ -810,7 +812,7 @@ PyObject* SketchObjectPy::addCopy(PyObject *args) geoIdList.push_back(PyInt_AsLong((*it).ptr())); } - int ret = this->getSketchObjectPtr()->addCopy(geoIdList,vect) + 1; + int ret = this->getSketchObjectPtr()->addCopy(geoIdList, vect, PyObject_IsTrue(clone) ? true : false) + 1; if(ret == -1) throw Py::TypeError("Copy operation unsuccessful!"); @@ -830,14 +832,16 @@ PyObject* SketchObjectPy::addCopy(PyObject *args) throw Py::TypeError(error); } -PyObject* SketchObjectPy::addArray(PyObject *args) +PyObject* SketchObjectPy::addRectangularArray(PyObject *args) { PyObject *pcObj, *pcVect; int rows,cols; double perpscale=1.0; PyObject* constraindisplacement= Py_False; + PyObject* clone= Py_False; - if (!PyArg_ParseTuple(args, "OO!ii|O!d", &pcObj, &(Base::VectorPy::Type), &pcVect,&rows,&cols, &PyBool_Type, &constraindisplacement,&perpscale)) + if (!PyArg_ParseTuple(args, "OO!O!ii|O!d", &pcObj, &(Base::VectorPy::Type), &pcVect, + &PyBool_Type, &clone, &rows, &cols, &PyBool_Type, &constraindisplacement,&perpscale)) return 0; Base::Vector3d vect = static_cast(pcVect)->value(); @@ -851,7 +855,8 @@ PyObject* SketchObjectPy::addArray(PyObject *args) geoIdList.push_back(PyInt_AsLong((*it).ptr())); } - int ret = this->getSketchObjectPtr()->addCopy(geoIdList,vect,rows,cols, PyObject_IsTrue(constraindisplacement) ? true : false, perpscale) + 1; + int ret = this->getSketchObjectPtr()->addCopy(geoIdList,vect, PyObject_IsTrue(clone) ? true : false, + rows, cols, PyObject_IsTrue(constraindisplacement) ? true : false, perpscale) + 1; if(ret == -1) throw Py::TypeError("Copy operation unsuccessful!"); diff --git a/src/Mod/Sketcher/Gui/CMakeLists.txt b/src/Mod/Sketcher/Gui/CMakeLists.txt index 7c8910a52..8e2149596 100644 --- a/src/Mod/Sketcher/Gui/CMakeLists.txt +++ b/src/Mod/Sketcher/Gui/CMakeLists.txt @@ -37,7 +37,7 @@ set(SketcherGui_MOC_HDRS TaskDlgEditSketch.h SketchOrientationDialog.h SketcherSettings.h - SketchLinearArrayDialog.h + SketchRectangularArrayDialog.h PropertyConstraintListItem.h ) fc_wrap_cpp(SketcherGui_MOC_SRCS ${SketcherGui_MOC_HDRS}) @@ -55,7 +55,7 @@ set(SketcherGui_UIC_SRCS InsertDatum.ui SketchOrientationDialog.ui SketcherSettings.ui - SketchLinearArrayDialog.ui + SketchRectangularArrayDialog.ui ) qt4_wrap_ui(SketcherGui_UIC_HDRS ${SketcherGui_UIC_SRCS}) @@ -112,8 +112,8 @@ SET(SketcherGui_SRCS SketchOrientationDialog.h SketcherSettings.cpp SketcherSettings.h - SketchLinearArrayDialog.h - SketchLinearArrayDialog.cpp + SketchRectangularArrayDialog.h + SketchRectangularArrayDialog.cpp TaskDlgEditSketch.cpp TaskDlgEditSketch.h ViewProviderPython.cpp diff --git a/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp b/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp index 34258467c..5cad0e89a 100644 --- a/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp +++ b/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp @@ -28,6 +28,8 @@ # include #endif +# include + #include #include #include @@ -47,7 +49,7 @@ #include #include "ViewProviderSketch.h" -#include "SketchLinearArrayDialog.h" +#include "SketchRectangularArrayDialog.h" using namespace std; using namespace SketcherGui; @@ -1232,8 +1234,8 @@ static const char *cursor_createcopy[]={ class DrawSketchHandlerCopy: public DrawSketchHandler { public: - DrawSketchHandlerCopy(string geoidlist, int origingeoid, Sketcher::PointPos originpos, int nelements): geoIdList(geoidlist), OriginGeoId (origingeoid), - OriginPos(originpos), nElements(nelements), Mode(STATUS_SEEK_First), EditCurve(2){} + DrawSketchHandlerCopy(string geoidlist, int origingeoid, Sketcher::PointPos originpos, int nelements, bool clone): geoIdList(geoidlist), OriginGeoId (origingeoid), + OriginPos(originpos), nElements(nelements), Clone(clone), Mode(STATUS_SEEK_First), EditCurve(2){} virtual ~DrawSketchHandlerCopy(){} /// mode table enum SelectMode { @@ -1295,10 +1297,10 @@ static const char *cursor_createcopy[]={ try{ Gui::Command::doCommand( - Gui::Command::Doc, "App.ActiveDocument.%s.addCopy(%s,App.Vector(%f,%f,0))", + Gui::Command::Doc, "App.ActiveDocument.%s.addCopy(%s,App.Vector(%f,%f,0),%s)", sketchgui->getObject()->getNameInDocument(), - geoIdList.c_str(), vector.fX, vector.fY - ); + geoIdList.c_str(), vector.fX, vector.fY, + (Clone?"True":"False")); Gui::Command::commitCommand(); } @@ -1332,6 +1334,7 @@ static const char *cursor_createcopy[]={ int OriginGeoId; Sketcher::PointPos OriginPos; int nElements; + bool Clone; std::vector EditCurve; std::vector sugConstr1; }; @@ -1455,7 +1458,22 @@ void CmdSketcherCopy::activated(int iMsg) } } - ActivateAcceleratorHandler(getActiveGuiDocument(),new DrawSketchHandlerCopy(geoIdList, LastGeoId, LastPointPos, geoids)); + bool clone=false; + + // Ask the user if he wants to clone or to simple copy + int ret = QMessageBox::question(Gui::getMainWindow(), QObject::tr("Dimensional/Geometric constraints"), + QObject::tr("Do you want to clone the object, i.e. substitute dimensional constraints by geometric constraints?"), + QMessageBox::Yes, QMessageBox::No, QMessageBox::Cancel); + // use an equality constraint + if (ret == QMessageBox::Yes) { + clone = true; + } + else if (ret == QMessageBox::Cancel) { + // do nothing + return; + } + + ActivateAcceleratorHandler(getActiveGuiDocument(),new DrawSketchHandlerCopy(geoIdList, LastGeoId, LastPointPos, geoids, clone)); } @@ -1466,7 +1484,7 @@ bool CmdSketcherCopy::isActive(void) } /* XPM */ -static const char *cursor_createlineararray[]={ +static const char *cursor_createrectangulararray[]={ "32 32 3 1", "+ c white", "# c red", @@ -1504,15 +1522,15 @@ static const char *cursor_createlineararray[]={ "................................", "................................"}; - class DrawSketchHandlerLinearArray: public DrawSketchHandler + class DrawSketchHandlerRectangularArray: public DrawSketchHandler { public: - DrawSketchHandlerLinearArray(string geoidlist, int origingeoid, Sketcher::PointPos originpos, int nelements, - int rows,int cols,bool constraintSeparation, - bool equalVerticalHorizontalSpacing ): geoIdList(geoidlist), OriginGeoId (origingeoid), + DrawSketchHandlerRectangularArray(string geoidlist, int origingeoid, Sketcher::PointPos originpos, int nelements, bool clone, + int rows, int cols, bool constraintSeparation, + bool equalVerticalHorizontalSpacing ): geoIdList(geoidlist), OriginGeoId (origingeoid), Clone(clone), Rows(rows), Cols(cols), ConstraintSeparation(constraintSeparation), EqualVerticalHorizontalSpacing(equalVerticalHorizontalSpacing), OriginPos(originpos), nElements(nelements), Mode(STATUS_SEEK_First), EditCurve(2){} - virtual ~DrawSketchHandlerLinearArray(){} + virtual ~DrawSketchHandlerRectangularArray(){} /// mode table enum SelectMode { STATUS_SEEK_First, /**< enum value ----. */ @@ -1521,7 +1539,7 @@ static const char *cursor_createlineararray[]={ virtual void activated(ViewProviderSketch *sketchgui) { - setCursor(QPixmap(cursor_createlineararray),7,7); + setCursor(QPixmap(cursor_createrectangulararray),7,7); Origin = static_cast(sketchgui->getObject())->getPoint(OriginGeoId, OriginPos); EditCurve[0] = Base::Vector2D(Origin.x,Origin.y); } @@ -1573,9 +1591,10 @@ static const char *cursor_createlineararray[]={ try{ Gui::Command::doCommand( - Gui::Command::Doc, "App.ActiveDocument.%s.addArray(%s, App.Vector(%f,%f,0),%d,%d,%s,%f)", + Gui::Command::Doc, "App.ActiveDocument.%s.addRectangularArray(%s, App.Vector(%f,%f,0),%s,%d,%d,%s,%f)", sketchgui->getObject()->getNameInDocument(), geoIdList.c_str(), vector.fX, vector.fY, + (Clone?"True":"False"), Cols, Rows, (ConstraintSeparation?"True":"False"), (EqualVerticalHorizontalSpacing?1.0:0.5)); @@ -1612,6 +1631,7 @@ static const char *cursor_createlineararray[]={ int OriginGeoId; Sketcher::PointPos OriginPos; int nElements; + bool Clone; int Rows; int Cols; bool ConstraintSeparation; @@ -1621,23 +1641,23 @@ static const char *cursor_createlineararray[]={ }; -DEF_STD_CMD_A(CmdSketcherLinearArray); +DEF_STD_CMD_A(CmdSketcherRectangularArray); -CmdSketcherLinearArray::CmdSketcherLinearArray() -:Command("Sketcher_LinearArray") +CmdSketcherRectangularArray::CmdSketcherRectangularArray() +:Command("Sketcher_RectangularArray") { sAppModule = "Sketcher"; sGroup = QT_TR_NOOP("Sketcher"); - sMenuText = QT_TR_NOOP("LinearArray"); - sToolTipText = QT_TR_NOOP("Creates a lineararray of the geometry taking as reference the last selected point"); + sMenuText = QT_TR_NOOP("Rectangular Array"); + sToolTipText = QT_TR_NOOP("Creates an rectangular array pattern of the geometry taking as reference the last selected point"); sWhatsThis = sToolTipText; sStatusTip = sToolTipText; - sPixmap = "Sketcher_LinearArray"; + sPixmap = "Sketcher_RectangularArray"; sAccel = ""; eType = ForEdit; } -void CmdSketcherLinearArray::activated(int iMsg) +void CmdSketcherRectangularArray::activated(int iMsg) { // get the selection std::vector selection = getSelection().getSelectionEx(); @@ -1741,11 +1761,11 @@ void CmdSketcherLinearArray::activated(int iMsg) } // Pop-up asking for values - SketchLinearArrayDialog * slad = new SketchLinearArrayDialog(); - + SketchRectangularArrayDialog * slad = new SketchRectangularArrayDialog(); + if( slad->exec() == QDialog::Accepted ) ActivateAcceleratorHandler(getActiveGuiDocument(), - new DrawSketchHandlerLinearArray(geoIdList, LastGeoId, LastPointPos, geoids, + new DrawSketchHandlerRectangularArray(geoIdList, LastGeoId, LastPointPos, geoids, slad->Clone, slad->Rows, slad->Cols, slad->ConstraintSeparation, slad->EqualVerticalHorizontalSpacing)); @@ -1755,7 +1775,7 @@ void CmdSketcherLinearArray::activated(int iMsg) -bool CmdSketcherLinearArray::isActive(void) +bool CmdSketcherRectangularArray::isActive(void) { return isSketcherAcceleratorActive( getActiveGuiDocument(), true ); } @@ -1776,5 +1796,5 @@ void CreateSketcherCommandsConstraintAccel(void) rcCmdMgr.addCommand(new CmdSketcherRestoreInternalAlignmentGeometry()); rcCmdMgr.addCommand(new CmdSketcherSymmetry()); rcCmdMgr.addCommand(new CmdSketcherCopy()); - rcCmdMgr.addCommand(new CmdSketcherLinearArray()); + rcCmdMgr.addCommand(new CmdSketcherRectangularArray()); } diff --git a/src/Mod/Sketcher/Gui/Resources/Sketcher.qrc b/src/Mod/Sketcher/Gui/Resources/Sketcher.qrc index 901502d5b..3cf54e523 100644 --- a/src/Mod/Sketcher/Gui/Resources/Sketcher.qrc +++ b/src/Mod/Sketcher/Gui/Resources/Sketcher.qrc @@ -118,11 +118,11 @@ icons/Sketcher_Elliptical_Arc_Constr.svg icons/Sketcher_External.svg icons/Sketcher_LeaveSketch.svg - icons/Sketcher_LinearArray.svg icons/Sketcher_MapSketch.svg icons/Sketcher_MergeSketch.svg icons/Sketcher_NewSketch.svg icons/Sketcher_ProfilesHexagon1.svg + icons/Sketcher_RectangularArray.svg icons/Sketcher_SelectConflictingConstraints.svg icons/Sketcher_SelectConstraints.svg icons/Sketcher_SelectElementsAssociatedWithConstraints.svg diff --git a/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_LinearArray.svg b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_RectangularArray.svg similarity index 100% rename from src/Mod/Sketcher/Gui/Resources/icons/Sketcher_LinearArray.svg rename to src/Mod/Sketcher/Gui/Resources/icons/Sketcher_RectangularArray.svg diff --git a/src/Mod/Sketcher/Gui/SketchLinearArrayDialog.cpp b/src/Mod/Sketcher/Gui/SketchRectangularArrayDialog.cpp similarity index 79% rename from src/Mod/Sketcher/Gui/SketchLinearArrayDialog.cpp rename to src/Mod/Sketcher/Gui/SketchRectangularArrayDialog.cpp index 3524573b4..d00cfa902 100644 --- a/src/Mod/Sketcher/Gui/SketchLinearArrayDialog.cpp +++ b/src/Mod/Sketcher/Gui/SketchRectangularArrayDialog.cpp @@ -32,13 +32,13 @@ #include #include -#include "ui_SketchLinearArrayDialog.h" -#include "SketchLinearArrayDialog.h" +#include "ui_SketchRectangularArrayDialog.h" +#include "SketchRectangularArrayDialog.h" using namespace SketcherGui; -SketchLinearArrayDialog::SketchLinearArrayDialog(void) - : QDialog(Gui::getMainWindow()), ui(new Ui_SketchLinearArrayDialog) +SketchRectangularArrayDialog::SketchRectangularArrayDialog(void) + : QDialog(Gui::getMainWindow()), ui(new Ui_SketchRectangularArrayDialog) { ui->setupUi(this); @@ -46,33 +46,36 @@ SketchLinearArrayDialog::SketchLinearArrayDialog(void) ui->ColsQuantitySpinBox->onRestore(); ui->ConstraintSeparationCheckBox->onRestore(); ui->EqualVerticalHorizontalSpacingCheckBox->onRestore(); + ui->CloneCheckBox->onRestore(); updateValues(); } -SketchLinearArrayDialog::~SketchLinearArrayDialog() +SketchRectangularArrayDialog::~SketchRectangularArrayDialog() { } -void SketchLinearArrayDialog::accept() +void SketchRectangularArrayDialog::accept() { ui->RowsQuantitySpinBox->onSave(); ui->ColsQuantitySpinBox->onSave(); ui->ConstraintSeparationCheckBox->onSave(); ui->EqualVerticalHorizontalSpacingCheckBox->onSave(); + ui->CloneCheckBox->onSave(); updateValues(); QDialog::accept(); } -void SketchLinearArrayDialog::updateValues(void) +void SketchRectangularArrayDialog::updateValues(void) { Rows = ui->RowsQuantitySpinBox->value(); Cols = ui->ColsQuantitySpinBox->value(); ConstraintSeparation = ui->ConstraintSeparationCheckBox->isChecked(); - EqualVerticalHorizontalSpacing = ui->EqualVerticalHorizontalSpacingCheckBox->isChecked(); + EqualVerticalHorizontalSpacing = ui->EqualVerticalHorizontalSpacingCheckBox->isChecked(); + Clone = ui->CloneCheckBox->isChecked(); } -#include "moc_SketchLinearArrayDialog.cpp" +#include "moc_SketchRectangularArrayDialog.cpp" diff --git a/src/Mod/Sketcher/Gui/SketchLinearArrayDialog.h b/src/Mod/Sketcher/Gui/SketchRectangularArrayDialog.h similarity index 79% rename from src/Mod/Sketcher/Gui/SketchLinearArrayDialog.h rename to src/Mod/Sketcher/Gui/SketchRectangularArrayDialog.h index ca7642cea..620c7e779 100644 --- a/src/Mod/Sketcher/Gui/SketchLinearArrayDialog.h +++ b/src/Mod/Sketcher/Gui/SketchRectangularArrayDialog.h @@ -20,36 +20,37 @@ * * ***************************************************************************/ -#ifndef SKETCHERGUI_SketchLinearArrayDialog_H -#define SKETCHERGUI_SketchLinearArrayDialog_H +#ifndef SKETCHERGUI_SketchRectangularArrayDialog_H +#define SKETCHERGUI_SketchRectangularArrayDialog_H #include #include namespace SketcherGui { -class Ui_SketchLinearArrayDialog; -class SketchLinearArrayDialog : public QDialog +class Ui_SketchRectangularArrayDialog; +class SketchRectangularArrayDialog : public QDialog { Q_OBJECT public: - SketchLinearArrayDialog(void); - ~SketchLinearArrayDialog(); + SketchRectangularArrayDialog(void); + ~SketchRectangularArrayDialog(); void accept(); int Rows; int Cols; bool ConstraintSeparation; - bool EqualVerticalHorizontalSpacing; + bool EqualVerticalHorizontalSpacing; + bool Clone; protected: void updateValues(void); private: - Ui_SketchLinearArrayDialog* ui; + Ui_SketchRectangularArrayDialog* ui; }; } -#endif // SKETCHERGUI_SketchLinearArrayDialog_H +#endif // SKETCHERGUI_SketchRectangularArrayDialog_H diff --git a/src/Mod/Sketcher/Gui/SketchLinearArrayDialog.ui b/src/Mod/Sketcher/Gui/SketchRectangularArrayDialog.ui similarity index 81% rename from src/Mod/Sketcher/Gui/SketchLinearArrayDialog.ui rename to src/Mod/Sketcher/Gui/SketchRectangularArrayDialog.ui index 68e58213f..2f2b98631 100644 --- a/src/Mod/Sketcher/Gui/SketchLinearArrayDialog.ui +++ b/src/Mod/Sketcher/Gui/SketchRectangularArrayDialog.ui @@ -1,7 +1,7 @@ - SketcherGui::SketchLinearArrayDialog - + SketcherGui::SketchRectangularArrayDialog + Qt::ApplicationModal @@ -10,7 +10,7 @@ 0 0 287 - 177 + 205 @@ -109,6 +109,22 @@ + + + + If checked it substitutes dimensional constraints by geometric constraints in the copies, so that a change in the original element is directly reflected on copies + + + Clone + + + CloneOnCopy + + + Mod/Sketcher + + + @@ -154,7 +170,7 @@ buttonBox accepted() - SketcherGui::SketchLinearArrayDialog + SketcherGui::SketchRectangularArrayDialog accept() @@ -170,7 +186,7 @@ buttonBox rejected() - SketcherGui::SketchLinearArrayDialog + SketcherGui::SketchRectangularArrayDialog reject() diff --git a/src/Mod/Sketcher/Gui/Workbench.cpp b/src/Mod/Sketcher/Gui/Workbench.cpp index 9074dbfd8..e1e968b82 100644 --- a/src/Mod/Sketcher/Gui/Workbench.cpp +++ b/src/Mod/Sketcher/Gui/Workbench.cpp @@ -248,7 +248,7 @@ inline void SketcherAddWorkbenchTools(Gui::MenuItem& consaccel){ << "Sketcher_RestoreInternalAlignmentGeometry" << "Sketcher_Symmetry" << "Sketcher_Copy" - << "Sketcher_LinearArray"; + << "Sketcher_RectangularArray"; } template <> @@ -259,7 +259,7 @@ inline void SketcherAddWorkbenchTools(Gui::ToolBarItem& consac << "Sketcher_RestoreInternalAlignmentGeometry" << "Sketcher_Symmetry" << "Sketcher_Copy" - << "Sketcher_LinearArray"; + << "Sketcher_RectangularArray"; } template