Sketcher: Extension of Copy/Array functionality to clone
============================================================= This commit allows the user to select in advance whether he wants a simple copy or a clone. This involves substitution of dimensional constraints in the copies by equality and parallel constraints. Terminology change for Arrays, now it is Rectangular array
This commit is contained in:
parent
6ea93a4a04
commit
97d551b551
|
@ -2011,7 +2011,7 @@ int SketchObject::addSymmetric(const std::vector<int> &geoIdList, int refGeoId,
|
|||
return Geometry.getSize()-1;
|
||||
}
|
||||
|
||||
int SketchObject::addCopy(const std::vector<int> &geoIdList, const Base::Vector3d& displacement, int csize/*=2*/, int rsize/*=1*/,
|
||||
int SketchObject::addCopy(const std::vector<int> &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<int> &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<int> &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<int>::const_iterator tit=std::find(geoIdList.begin(), geoIdList.end(), (*it)->Third);
|
||||
|
@ -2188,7 +2220,6 @@ int SketchObject::addCopy(const std::vector<int> &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
|
||||
|
|
|
@ -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<int> &geoIdList, const Base::Vector3d& displacement, int csize=2, int rsize=1, bool constraindisplacement = false, double perpscale = 1.0);
|
||||
int addCopy(const std::vector<int> &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
|
||||
|
|
|
@ -142,7 +142,7 @@
|
|||
<UserDocu>add a copy of geometric objects to the sketch displaced by a vector3d</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="addArray">
|
||||
<Methode Name="addRectangularArray">
|
||||
<Documentation>
|
||||
<UserDocu>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</UserDocu>
|
||||
</Documentation>
|
||||
|
|
|
@ -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<Base::VectorPy*>(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<Base::VectorPy*>(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!");
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
# include <Precision.hxx>
|
||||
#endif
|
||||
|
||||
# include <QMessageBox>
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <App/Application.h>
|
||||
#include <Gui/Application.h>
|
||||
|
@ -47,7 +49,7 @@
|
|||
#include <Mod/Sketcher/App/SketchObject.h>
|
||||
|
||||
#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<Base::Vector2D> EditCurve;
|
||||
std::vector<AutoConstraint> 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<Sketcher::SketchObject *>(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<Gui::SelectionObject> 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());
|
||||
}
|
||||
|
|
|
@ -118,11 +118,11 @@
|
|||
<file>icons/Sketcher_Elliptical_Arc_Constr.svg</file>
|
||||
<file>icons/Sketcher_External.svg</file>
|
||||
<file>icons/Sketcher_LeaveSketch.svg</file>
|
||||
<file>icons/Sketcher_LinearArray.svg</file>
|
||||
<file>icons/Sketcher_MapSketch.svg</file>
|
||||
<file>icons/Sketcher_MergeSketch.svg</file>
|
||||
<file>icons/Sketcher_NewSketch.svg</file>
|
||||
<file>icons/Sketcher_ProfilesHexagon1.svg</file>
|
||||
<file>icons/Sketcher_RectangularArray.svg</file>
|
||||
<file>icons/Sketcher_SelectConflictingConstraints.svg</file>
|
||||
<file>icons/Sketcher_SelectConstraints.svg</file>
|
||||
<file>icons/Sketcher_SelectElementsAssociatedWithConstraints.svg</file>
|
||||
|
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
@ -32,13 +32,13 @@
|
|||
#include <Base/Tools.h>
|
||||
#include <Base/UnitsApi.h>
|
||||
|
||||
#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"
|
|
@ -20,36 +20,37 @@
|
|||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef SKETCHERGUI_SketchLinearArrayDialog_H
|
||||
#define SKETCHERGUI_SketchLinearArrayDialog_H
|
||||
#ifndef SKETCHERGUI_SketchRectangularArrayDialog_H
|
||||
#define SKETCHERGUI_SketchRectangularArrayDialog_H
|
||||
|
||||
#include <Base/Placement.h>
|
||||
#include <QDialog>
|
||||
|
||||
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
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SketcherGui::SketchLinearArrayDialog</class>
|
||||
<widget class="QDialog" name="SketcherGui::SketchLinearArrayDialog">
|
||||
<class>SketcherGui::SketchRectangularArrayDialog</class>
|
||||
<widget class="QDialog" name="SketcherGui::SketchRectangularArrayDialog">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::ApplicationModal</enum>
|
||||
</property>
|
||||
|
@ -10,7 +10,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>287</width>
|
||||
<height>177</height>
|
||||
<height>205</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -109,6 +109,22 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="CloneCheckBox">
|
||||
<property name="toolTip">
|
||||
<string>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</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clone</string>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>CloneOnCopy</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Sketcher</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
|
@ -154,7 +170,7 @@
|
|||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>SketcherGui::SketchLinearArrayDialog</receiver>
|
||||
<receiver>SketcherGui::SketchRectangularArrayDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
|
@ -170,7 +186,7 @@
|
|||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>SketcherGui::SketchLinearArrayDialog</receiver>
|
||||
<receiver>SketcherGui::SketchRectangularArrayDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
|
@ -248,7 +248,7 @@ inline void SketcherAddWorkbenchTools<Gui::MenuItem>(Gui::MenuItem& consaccel){
|
|||
<< "Sketcher_RestoreInternalAlignmentGeometry"
|
||||
<< "Sketcher_Symmetry"
|
||||
<< "Sketcher_Copy"
|
||||
<< "Sketcher_LinearArray";
|
||||
<< "Sketcher_RectangularArray";
|
||||
|
||||
}
|
||||
template <>
|
||||
|
@ -259,7 +259,7 @@ inline void SketcherAddWorkbenchTools<Gui::ToolBarItem>(Gui::ToolBarItem& consac
|
|||
<< "Sketcher_RestoreInternalAlignmentGeometry"
|
||||
<< "Sketcher_Symmetry"
|
||||
<< "Sketcher_Copy"
|
||||
<< "Sketcher_LinearArray";
|
||||
<< "Sketcher_RectangularArray";
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
|
Loading…
Reference in New Issue
Block a user