Sketcher: UI Copy Support & 2D Array python command rework

==========================================================

- Support for copying geometric elements in the sketcher with Ctrl+C (or using the still missing icon). It will show you the vector of displacement from the
"reference point". The reference point can be chosen by the user (although it is not necessary to do it so) by making the point the user wish to be the reference point
the last selected element. It conveniently incorporates "autoconstraints", so that you can make this point (the one of the copy) directly coincident with any other point in the sketch.

- Python 2D array command modified to lock elements position using construction lines and constraints.
- Support for different spacing between u and v directions (the direction of the cols and the direction of the rows).

- Support to avoid copying DistanceX and DistanceY constraints when used for locking a point. This means that if the geometry that you copy(array) is
fully constraint, the resulting 2D array is also fully constraint.

- UI support for creating 2D linear arrays in the sketcher.
- Bug fix in python addArray, wrong line copy startingpoint calculation fixed.

How to create a 2D array in the sketcher:
1. Select your geometric elements.
2. Click the button
3. Fill in the rows/cols and preferences on spacing and constraining each element of the array
4. Click Ok
5. Define the direction of the cols of the array and click
This commit is contained in:
Abdullah Tahiri
2015-08-05 14:45:27 +02:00
committed by wmayer
parent ee43612125
commit 6a16910ba5
9 changed files with 1178 additions and 40 deletions

View File

@@ -834,8 +834,10 @@ PyObject* SketchObjectPy::addArray(PyObject *args)
{
PyObject *pcObj, *pcVect;
int rows,cols;
if (!PyArg_ParseTuple(args, "OO!ii", &pcObj, &(Base::VectorPy::Type), &pcVect,&rows,&cols))
double perpscale=1.0;
PyObject* constraindisplacement= Py_False;
if (!PyArg_ParseTuple(args, "OO!ii|O!d", &pcObj, &(Base::VectorPy::Type), &pcVect,&rows,&cols, &PyBool_Type, &constraindisplacement,&perpscale))
return 0;
Base::Vector3d vect = static_cast<Base::VectorPy*>(pcVect)->value();
@@ -849,7 +851,7 @@ PyObject* SketchObjectPy::addArray(PyObject *args)
geoIdList.push_back(PyInt_AsLong((*it).ptr()));
}
int ret = this->getSketchObjectPtr()->addCopy(geoIdList,vect,rows,cols) + 1;
int ret = this->getSketchObjectPtr()->addCopy(geoIdList,vect,rows,cols, PyObject_IsTrue(constraindisplacement) ? true : false, perpscale) + 1;
if(ret == -1)
throw Py::TypeError("Copy operation unsuccessful!");