diff --git a/src/Mod/Path/PathScripts/PathSurface.py b/src/Mod/Path/PathScripts/PathSurface.py index a7839ffb0b..d722226cda 100644 --- a/src/Mod/Path/PathScripts/PathSurface.py +++ b/src/Mod/Path/PathScripts/PathSurface.py @@ -76,7 +76,7 @@ class ObjectSurface(PathOp.ObjectOp): obj.addProperty("App::PropertyPercent", "StepOver", "Surface", QtCore.QT_TRANSLATE_NOOP("App::Property", "Step over percentage of the drop cutter path")) obj.addProperty("App::PropertyDistance", "DepthOffset", "Surface", QtCore.QT_TRANSLATE_NOOP("App::Property", "Z-axis offset from the surface of the object")) obj.addProperty("App::PropertyFloatConstraint", "SampleInterval", "Surface", QtCore.QT_TRANSLATE_NOOP("App::Property", "The Sample Interval. Small values cause long wait times")) - obj.addProperty("App::PropertyBool", "Optimize", "Surface", QtCore.QT_TRANSLATE_NOOP("App::Property", "Enable optimization which removes unecessary points from G-Code output")) + obj.addProperty("App::PropertyBool", "Optimize", "Surface", QtCore.QT_TRANSLATE_NOOP("App::Property", "Enable optimization which removes unnecessary points from G-Code output")) obj.BoundBox = ['Stock', 'BaseBoundBox'] obj.DropCutterDir = ['X', 'Y'] obj.Algorithm = ['OCL Dropcutter', 'OCL Waterline'] diff --git a/src/Mod/Sketcher/App/SketchObjectPyImp.cpp b/src/Mod/Sketcher/App/SketchObjectPyImp.cpp index 71a055c03c..bdeedd3692 100644 --- a/src/Mod/Sketcher/App/SketchObjectPyImp.cpp +++ b/src/Mod/Sketcher/App/SketchObjectPyImp.cpp @@ -51,7 +51,7 @@ using namespace Sketcher; // returns a string which represents the object e.g. when printed in python std::string SketchObjectPy::representation(void) const -{ +{ return ""; } @@ -66,7 +66,7 @@ PyObject* SketchObjectPy::solve(PyObject *args) PyObject* SketchObjectPy::addGeometry(PyObject *args) { - PyObject *pcObj; + PyObject *pcObj; PyObject* construction; // this is an optional argument default false bool isConstruction; if (!PyArg_ParseTuple(args, "OO!", &pcObj, &PyBool_Type, &construction)) { @@ -99,7 +99,7 @@ PyObject* SketchObjectPy::addGeometry(PyObject *args) Part::GeomArcOfEllipse aoe; aoe.setHandle(trim); ret = this->getSketchObjectPtr()->addGeometry(&aoe,isConstruction); - } + } else { std::stringstream str; str << "Unsupported geometry type: " << geo->getTypeId().getName(); @@ -232,7 +232,7 @@ PyObject* SketchObjectPy::deleteAllConstraints(PyObject *args) { if (!PyArg_ParseTuple(args, "")) return 0; - + if (this->getSketchObjectPtr()->deleteAllConstraints()) { std::stringstream str; str << "Unable to delete Constraints"; @@ -416,7 +416,7 @@ PyObject* SketchObjectPy::carbonCopy(PyObject *args) Sketcher::SketchObject* skObj = this->getSketchObjectPtr(); App::DocumentObject * Obj = skObj->getDocument()->getObject(ObjectName); - + if (!Obj) { std::stringstream str; str << ObjectName << " does not exist in the document"; @@ -430,7 +430,7 @@ PyObject* SketchObjectPy::carbonCopy(PyObject *args) PyErr_SetString(PyExc_ValueError, str.str().c_str()); return 0; } - + // add the external if (skObj->carbonCopy(Obj, PyObject_IsTrue(construction) ? true : false) < 0) { std::stringstream str; @@ -438,7 +438,7 @@ PyObject* SketchObjectPy::carbonCopy(PyObject *args) PyErr_SetString(PyExc_ValueError, str.str().c_str()); return 0; } - + Py_Return; } @@ -713,7 +713,7 @@ PyObject* SketchObjectPy::setDriving(PyObject *args) { PyObject* driving; int constrid; - + if (!PyArg_ParseTuple(args, "iO!", &constrid, &PyBool_Type, &driving)) return 0; @@ -736,7 +736,7 @@ PyObject* SketchObjectPy::setDatumsDriving(PyObject *args) if (this->getSketchObjectPtr()->setDatumsDriving(PyObject_IsTrue(driving) ? true : false)) { std::stringstream str; - str << "Not able set all dimensionals driving/refernce"; + str << "Not able set all dimensionals driving/reference"; PyErr_SetString(PyExc_ValueError, str.str().c_str()); return 0; } @@ -764,7 +764,7 @@ PyObject* SketchObjectPy::getDriving(PyObject *args) { int constrid; bool driving; - + if (!PyArg_ParseTuple(args, "i", &constrid)) return 0; @@ -779,7 +779,7 @@ PyObject* SketchObjectPy::getDriving(PyObject *args) PyObject* SketchObjectPy::toggleDriving(PyObject *args) { int constrid; - + if (!PyArg_ParseTuple(args, "i", &constrid)) return 0; @@ -1002,7 +1002,7 @@ PyObject* SketchObjectPy::addSymmetric(PyObject *args) int ret = this->getSketchObjectPtr()->addSymmetric(geoIdList,refGeoId,(Sketcher::PointPos) refPosId) + 1; if(ret == -1) - throw Py::TypeError("Symmetric operation unsuccessful!"); + throw Py::TypeError("Symmetric operation unsuccessful!"); std::size_t numGeo = geoIdList.size(); Py::Tuple tuple(numGeo); @@ -1044,7 +1044,7 @@ PyObject* SketchObjectPy::addCopy(PyObject *args) } int ret = this->getSketchObjectPtr()->addCopy(geoIdList, vect, false, PyObject_IsTrue(clone) ? true : false) + 1; - + if(ret == -1) throw Py::TypeError("Copy operation unsuccessful!"); @@ -1060,7 +1060,7 @@ PyObject* SketchObjectPy::addCopy(PyObject *args) std::string error = std::string("type must be list of GeoIds, not "); error += pcObj->ob_type->tp_name; - throw Py::TypeError(error); + throw Py::TypeError(error); } PyObject* SketchObjectPy::addMove(PyObject *args) @@ -1087,10 +1087,10 @@ PyObject* SketchObjectPy::addMove(PyObject *args) } this->getSketchObjectPtr()->addCopy(geoIdList, vect, true); - + Py_Return; } - + std::string error = std::string("type must be list of GeoIds, not "); error += pcObj->ob_type->tp_name; throw Py::TypeError(error); @@ -1103,8 +1103,8 @@ PyObject* SketchObjectPy::addRectangularArray(PyObject *args) double perpscale=1.0; PyObject* constraindisplacement= Py_False; PyObject* clone= Py_False; - - if (!PyArg_ParseTuple(args, "OO!O!ii|O!d", &pcObj, &(Base::VectorPy::Type), &pcVect, + + 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; @@ -1124,9 +1124,9 @@ PyObject* SketchObjectPy::addRectangularArray(PyObject *args) #endif } - int ret = this->getSketchObjectPtr()->addCopy(geoIdList,vect, false, PyObject_IsTrue(clone) ? true : false, + int ret = this->getSketchObjectPtr()->addCopy(geoIdList,vect, false, PyObject_IsTrue(clone) ? true : false, rows, cols, PyObject_IsTrue(constraindisplacement) ? true : false, perpscale) + 1; - + if(ret == -1) throw Py::TypeError("Copy operation unsuccessful!"); Py_Return; @@ -1134,7 +1134,7 @@ PyObject* SketchObjectPy::addRectangularArray(PyObject *args) std::string error = std::string("type must be list of GeoIds, not "); error += pcObj->ob_type->tp_name; - throw Py::TypeError(error); + throw Py::TypeError(error); } PyObject* SketchObjectPy::calculateAngleViaPoint(PyObject *args) @@ -1214,7 +1214,7 @@ PyObject* SketchObjectPy::ExposeInternalGeometry(PyObject *args) PyErr_SetString(PyExc_ValueError, str.str().c_str()); return 0; } - + Py_Return; } @@ -1232,7 +1232,7 @@ PyObject* SketchObjectPy::DeleteUnusedInternalGeometry(PyObject *args) PyErr_SetString(PyExc_ValueError, str.str().c_str()); return 0; } - + Py_Return; } @@ -1291,17 +1291,17 @@ PyObject* SketchObjectPy::increaseBSplineDegree(PyObject *args) { int GeoId; int incr = 1; - + if (!PyArg_ParseTuple(args, "i|i", &GeoId, &incr)) return 0; - + if (this->getSketchObjectPtr()->increaseBSplineDegree(GeoId, incr)==false) { std::stringstream str; str << "Degree increase failed for: " << GeoId; PyErr_SetString(PyExc_ValueError, str.str().c_str()); return 0; } - + Py_Return; } @@ -1320,14 +1320,14 @@ PyObject* SketchObjectPy::modifyBSplineKnotMultiplicity(PyObject *args) PyErr_SetString(PyExc_ValueError, str.str().c_str()); return 0; } - + Py_Return; } PyObject* SketchObjectPy::autoconstraint(PyObject *args) { double precision = Precision::Confusion() * 1000; - double angleprecision = M_PI/8; + double angleprecision = M_PI/8; PyObject* includeconstruction = Py_True; @@ -1346,7 +1346,7 @@ PyObject* SketchObjectPy::autoconstraint(PyObject *args) PyObject* SketchObjectPy::detectMissingPointOnPointConstraints(PyObject *args) { - double precision = Precision::Confusion() * 1000; + double precision = Precision::Confusion() * 1000; PyObject* includeconstruction = Py_True; if (!PyArg_ParseTuple(args, "|dO!", &precision, &PyBool_Type, &includeconstruction)) @@ -1357,7 +1357,7 @@ PyObject* SketchObjectPy::detectMissingPointOnPointConstraints(PyObject *args) PyObject* SketchObjectPy::detectMissingVerticalHorizontalConstraints(PyObject *args) { - double angleprecision = M_PI/8; + double angleprecision = M_PI/8; if (!PyArg_ParseTuple(args, "|d", &angleprecision)) return 0; @@ -1367,7 +1367,7 @@ PyObject* SketchObjectPy::detectMissingVerticalHorizontalConstraints(PyObject *a PyObject* SketchObjectPy::detectMissingEqualityConstraints(PyObject *args) { - double precision = Precision::Confusion() * 1000; + double precision = Precision::Confusion() * 1000; if (!PyArg_ParseTuple(args, "|d", &precision)) return 0; @@ -1377,7 +1377,7 @@ PyObject* SketchObjectPy::detectMissingEqualityConstraints(PyObject *args) PyObject* SketchObjectPy::analyseMissingPointOnPointCoincident(PyObject *args) { - double angleprecision = M_PI/8; + double angleprecision = M_PI/8; if (!PyArg_ParseTuple(args, "|d", &angleprecision)) return 0; @@ -1427,12 +1427,12 @@ PyObject* SketchObjectPy::makeMissingEquality(PyObject *args) PyObject* SketchObjectPy::autoRemoveRedundants(PyObject *args) { PyObject* updategeo = Py_True; - + if (!PyArg_ParseTuple(args, "|O!", &PyBool_Type, &updategeo)) return 0; - + this->getSketchObjectPtr()->autoRemoveRedundants(PyObject_IsTrue(updategeo) ? true : false); - + Py_Return; } @@ -1480,7 +1480,7 @@ void SketchObjectPy::setMissingPointOnPointConstraints(Py::List arg) Py::List SketchObjectPy::getMissingVerticalHorizontalConstraints(void) const { std::vector constraints = this->getSketchObjectPtr()->getMissingVerticalHorizontalConstraints(); - + Py::List list; for (auto c : constraints) { Py::Tuple t(5); @@ -1497,12 +1497,12 @@ Py::List SketchObjectPy::getMissingVerticalHorizontalConstraints(void) const void SketchObjectPy::setMissingVerticalHorizontalConstraints(Py::List arg) { std::vector constraints; - + auto checkpos = [](Py::Tuple &t,int i) { auto checkitem = [](Py::Tuple &t,int i, int val) {return long(Py::Long(t.getItem(i)))==val;}; return (checkitem(t,i,0)?Sketcher::none:(checkitem(t,i,1)?Sketcher::start:(checkitem(t,i,2)?Sketcher::end:Sketcher::mid))); }; - + for (auto ti : arg) { Py::Tuple t(ti); ConstraintIds c; @@ -1561,7 +1561,7 @@ void SketchObjectPy::setMissingLineEqualityConstraints(Py::List arg) Py::List SketchObjectPy::getMissingRadiusConstraints(void) const { std::vector constraints = this->getSketchObjectPtr()->getMissingRadiusConstraints(); - + Py::List list; for (auto c : constraints) { Py::Tuple t(4); diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index 669b63d060..0080398f20 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -245,7 +245,7 @@ struct EditData { SoCoordinate3 *CurvesCoordinate; SoCoordinate3 *RootCrossCoordinate; SoCoordinate3 *EditCurvesCoordinate; - SoLineSet *CurveSet; + SoLineSet *CurveSet; SoLineSet *RootCrossSet; SoLineSet *EditCurveSet; SoMarkerSet *PointSet; @@ -317,7 +317,7 @@ ViewProviderSketch::ViewProviderSketch() zHighPoints = 0.011f; zHighlight=0.012f; zText=0.012f; - + xInit=0; yInit=0; @@ -339,7 +339,7 @@ ViewProviderSketch::ViewProviderSketch() color = hGrp->GetUnsigned("SketchVertexColor", color); vertexColor.setPackedValue((uint32_t)color); PointColor.setValue(vertexColor); - + //rubberband selection rubberband = new Gui::Rubberband(); } @@ -348,18 +348,18 @@ ViewProviderSketch::~ViewProviderSketch() { delete rubberband; } - + void ViewProviderSketch::slotUndoDocument(const Gui::Document& /*doc*/) { - if(getSketchObject()->noRecomputes) + if(getSketchObject()->noRecomputes) getSketchObject()->solve(); // the sketch must be solved to update the DoF of the solver else getSketchObject()->getDocument()->recompute(); // or fully recomputed if applicable } -void ViewProviderSketch::slotRedoDocument(const Gui::Document& /*doc*/) +void ViewProviderSketch::slotRedoDocument(const Gui::Document& /*doc*/) { - if(getSketchObject()->noRecomputes) + if(getSketchObject()->noRecomputes) getSketchObject()->solve(); // the sketch must be solved to update the DoF of the solver else getSketchObject()->getDocument()->recompute(); // or fully recomputed if applicable @@ -851,10 +851,10 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe case STATUS_SKETCH_UseRubberBand: doBoxSelection(prvCursorPos, cursorPos, viewer); rubberband->setWorking(false); - + //disable framebuffer drawing in viewer const_cast(viewer)->setRenderType(Gui::View3DInventorViewer::Native); - + // a redraw is required in order to clear the rubberband draw(true,false); Mode = STATUS_NONE; @@ -1068,7 +1068,7 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor boost::scoped_ptr pp(this->getPointOnRay(cursorPos, viewer)); preselectChanged = detectPreselection(pp.get(), viewer, cursorPos); } - + switch (Mode) { case STATUS_NONE: if (preselectChanged) { @@ -1277,7 +1277,7 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2d &toPo p2 = center + radius * Base::Vector3d(cos(angle),sin(angle),0.); } - else if (geo->getTypeId() == Part::GeomCircle::getClassTypeId()) { + else if (geo->getTypeId() == Part::GeomCircle::getClassTypeId()) { const Part::GeomCircle *circle = static_cast(geo); double radius = circle->getRadius(); Base::Vector3d center = circle->getCenter(); @@ -1291,7 +1291,7 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2d &toPo p2 = center + radius * Base::Vector3d(cos(angle),sin(angle),0.); } - else + else return; } else return; @@ -1662,7 +1662,7 @@ std::set ViewProviderSketch::detectPreselectionConstr(const SoPickedPoint * // Screen dimensions of the icon SbVec3s iconSize = getDisplayedSize(static_cast(tail)); // Center of the icon - //SbVec2f iconCoords = viewer->screenCoordsOfPath(path); + //SbVec2f iconCoords = viewer->screenCoordsOfPath(path); // The use of the Path to get the screen coordinates to get the icon center coordinates // does not work. @@ -1675,7 +1675,7 @@ std::set ViewProviderSketch::detectPreselectionConstr(const SoPickedPoint * // the first. // // Coordinates are projected on the sketch plane and then to the screen in the interval [0 1] - // Then this result is coverted to pixels using the scale factor. + // Then this result is converted to pixels using the scale factor. SbVec3f absPos; SbVec3f trans; @@ -1705,7 +1705,7 @@ std::set ViewProviderSketch::detectPreselectionConstr(const SoPickedPoint * Gui::ViewVolumeProjection proj(viewer->getSoRenderManager()->getCamera()->getViewVolume()); // dimensionless [0 1] (or 1.5 see View3DInventorViewer.cpp ) - Base::Vector3d screencoords = proj(Base::Vector3d(x,y,0)); + Base::Vector3d screencoords = proj(Base::Vector3d(x,y,0)); int width = viewer->getGLWidget()->width(), height = viewer->getGLWidget()->height(); @@ -1726,7 +1726,7 @@ std::set ViewProviderSketch::detectPreselectionConstr(const SoPickedPoint * SbVec2f iconCoords(screencoords.x,screencoords.y); // cursorPos is SbVec2s in screen coordinates coming from SoEvent in mousemove - // + // // Coordinates of the mouse cursor on the icon, origin at top-left for Qt // but bottom-left for OIV. // The coordinates are needed in Qt format, i.e. from top to bottom. @@ -2096,7 +2096,7 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s & } } - } else if ((*it)->getTypeId() == Part::GeomCircle::getClassTypeId()) { + } else if ((*it)->getTypeId() == Part::GeomCircle::getClassTypeId()) { // ----- Check if circle lies inside box selection -----/ ///TODO: Make it impossible to miss the circle if it's big and the selection pretty thin. const Part::GeomCircle *circle = static_cast(*it); @@ -2147,7 +2147,7 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s & Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(),ss.str().c_str()); } } - } else if ((*it)->getTypeId() == Part::GeomEllipse::getClassTypeId()) { + } else if ((*it)->getTypeId() == Part::GeomEllipse::getClassTypeId()) { // ----- Check if ellipse lies inside box selection -----/ const Part::GeomEllipse *ellipse = static_cast(*it); pnt0 = ellipse->getCenter(); @@ -2399,7 +2399,7 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s & float a = float(aoh->getMajorRadius()) / cos(segment/2); float b = float(aoh->getMinorRadius()) / cos(segment/2); float phi = float(aoh->getAngleXU()); - + pnt0 = aoh->getCenter(); float angle = float(startangle) + segment/2; for (int i = 0; i < countSegments; ++i, angle += segment) { @@ -2485,7 +2485,7 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s & // circumscribed polygon radius float focal = float(aop->getFocal()) / cos(segment/2); float phi = float(aop->getAngleXU()); - + pnt0 = aop->getCenter(); float angle = float(startangle) + segment/2; for (int i = 0; i < countSegments; ++i, angle += segment) { @@ -2534,7 +2534,7 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s & const Part::GeomBSplineCurve *spline = static_cast(*it); //std::vector poles = spline->getPoles(); VertexId += 2; - + Plm.multVec(spline->getStartPoint(), pnt1); Plm.multVec(spline->getEndPoint(), pnt2); pnt1 = proj(pnt1); @@ -2547,13 +2547,13 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s & ss << "Vertex" << VertexId; Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), ss.str().c_str()); } - + if (pnt2Inside || (touchMode && pnt1Inside)) { std::stringstream ss; ss << "Vertex" << VertexId + 1; Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), ss.str().c_str()); } - + // This is a rather approximated approach. No it does not guarantee that the whole curve is boxed, specially // for periodic curves, but it works reasonably well. Including all poles, which could be done, generally // forces the user to select much more than the curve (all the poles) and it would not select the curve in cases @@ -2582,22 +2582,22 @@ void ViewProviderSketch::updateColor(void) int CurvNum = edit->CurvesMaterials->diffuseColor.getNum(); SbColor *color = edit->CurvesMaterials->diffuseColor.startEditing(); SbColor *crosscolor = edit->RootCrossMaterials->diffuseColor.startEditing(); - + SbVec3f *verts = edit->CurvesCoordinate->point.startEditing(); //int32_t *index = edit->CurveSet->numVertices.startEditing(); SbVec3f *pverts = edit->PointsCoordinate->point.startEditing(); - + ParameterGrp::handle hGrpp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher"); - + // 1->Normal Geometry, 2->Construction, 3->External int topid = hGrpp->GetInt("TopRenderGeometryId",1); int midid = hGrpp->GetInt("MidRenderGeometryId",2); - + float zNormPoint = (topid==1?zHighPoints:(midid==1 && topid!=2)?zHighPoints:zLowPoints); float zConstrPoint = (topid==2?zHighPoints:(midid==2 && topid!=1)?zHighPoints:zLowPoints); float x,y,z; - + // colors of the point set if (edit->FullyConstrained) { for (int i=0; i < PtNum; i++) @@ -2607,7 +2607,7 @@ void ViewProviderSketch::updateColor(void) for (int i=0; i < PtNum; i++) pcolor[i] = VertexColor; } - + for (int i=0; i < PtNum; i++) { // 0 is the origin pverts[i].getValue(x,y,z); const Part::Geometry * tmp = getSketchObject()->getGeometry(edit->PointIdToGeoId[i]); @@ -2618,7 +2618,7 @@ void ViewProviderSketch::updateColor(void) pverts[i].setValue(x,y,zNormPoint); } } - + if (edit->PreselectCross == 0) { pcolor[0] = PreselectColor; @@ -2638,17 +2638,17 @@ void ViewProviderSketch::updateColor(void) // colors of the curves //int intGeoCount = getSketchObject()->getHighestCurveIndex() + 1; //int extGeoCount = getSketchObject()->getExternalGeometryCount(); - - + + float zNormLine = (topid==1?zHighLines:midid==1?zMidLines:zLowLines); float zConstrLine = (topid==2?zHighLines:midid==2?zMidLines:zLowLines); float zExtLine = (topid==3?zHighLines:midid==3?zMidLines:zLowLines); - - - + + + int j=0; // vertexindex - + for (int i=0; i < CurvNum; i++) { int GeoId = edit->CurvIdToGeoId[i]; // CurvId has several vertices associated to 1 material @@ -2747,7 +2747,7 @@ void ViewProviderSketch::updateColor(void) hasMaterial = true; m = static_cast(s->getChild(CONSTRAINT_SEPARATOR_INDEX_MATERIAL_OR_DATUMLABEL)); } - + if (edit->SelConstraintSet.find(i) != edit->SelConstraintSet.end()) { if (hasDatumLabel) { SoDatumLabel *l = static_cast(s->getChild(CONSTRAINT_SEPARATOR_INDEX_MATERIAL_OR_DATUMLABEL)); @@ -2769,7 +2769,7 @@ void ViewProviderSketch::updateColor(void) int CurvNum = edit->CurvesMaterials->diffuseColor.getNum(); for (int i=0; i < CurvNum; i++) { int cGeoId = edit->CurvIdToGeoId[i]; - + if(cGeoId == constraint->First) { color[i] = SelectColor; break; @@ -2800,7 +2800,7 @@ void ViewProviderSketch::updateColor(void) if (hasDatumLabel) { SoDatumLabel *l = static_cast(s->getChild(CONSTRAINT_SEPARATOR_INDEX_MATERIAL_OR_DATUMLABEL)); - l->textColor = (getSketchObject()->constraintHasExpression(i) ? ExprBasedConstrDimColor: + l->textColor = (getSketchObject()->constraintHasExpression(i) ? ExprBasedConstrDimColor: (constraint->isDriving ? ConstrDimColor : NonDrivingConstrDimColor)); } else if (hasMaterial) { @@ -2839,7 +2839,7 @@ QString ViewProviderSketch::getPresentationString(const Constraint *constraint) QString baseUnitStr; // the expected base unit string double factor; // unit scaling factor, currently not used Base::UnitSystem unitSys; // current unit system - + // Get value of HideUnits option. Default is false. hGrpSketcher = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Sketcher"); iHideUnits = hGrpSketcher->GetBool("HideUnits", 0); @@ -2859,7 +2859,7 @@ QString ViewProviderSketch::getPresentationString(const Constraint *constraint) unitSys = Base::UnitsApi::getSchema(); // If this is a supported unit system then define what the base unit is. - switch (unitSys) + switch (unitSys) { case Base::SI1: case Base::MmMin: @@ -2883,7 +2883,7 @@ QString ViewProviderSketch::getPresentationString(const Constraint *constraint) break; } - if( !baseUnitStr.isEmpty() ) + if( !baseUnitStr.isEmpty() ) { // expected unit string matches actual unit string. remove. if( QString::compare(baseUnitStr, unitStr)==0 ) @@ -2964,7 +2964,7 @@ QColor ViewProviderSketch::constrColor(int constraintId) (int)(PreselectColor[2] * 255.0f)); const std::vector &constraints = getSketchObject()->Constraints.getValues(); - + if (edit->PreselectConstraintSet.count(constraintId)) return constrIconPreselColor; else if (edit->SelConstraintSet.find(constraintId) != edit->SelConstraintSet.end()) @@ -2973,7 +2973,7 @@ QColor ViewProviderSketch::constrColor(int constraintId) return nonDrivingConstrIcoColor; else return constrIcoColor; - + } int ViewProviderSketch::constrColorPriority(int constraintId) @@ -3149,14 +3149,14 @@ void ViewProviderSketch::combineConstraintIcons(IconQueue iconQueue) thisGroup.push_back(iconQueue.back()); ViewProviderSketch::constrIconQueueItem init = iconQueue.back(); iconQueue.pop_back(); - + // we group only icons not being Symmetry icons, because we want those on the line if(init.type != QString::fromLatin1("small/Constraint_Symmetric_sm")){ - + IconQueue::iterator i = iconQueue.begin(); while(i != iconQueue.end()) { bool addedToGroup = false; - + for(IconQueue::iterator j = thisGroup.begin(); j != thisGroup.end(); ++j) if(i->position.equals(j->position, maxDistSquared) && (*i).type != QString::fromLatin1("small/Constraint_Symmetric_sm")) { @@ -3308,7 +3308,7 @@ void ViewProviderSketch::drawMergedConstraintIcons(IconQueue iconQueue) compositeIcon = compositeIcon.copy(0, 0, std::max(partialIcon.width(), compositeIcon.width()), - partialIcon.height() + + partialIcon.height() + compositeIcon.height()); QPainter qp(&compositeIcon); @@ -3376,7 +3376,7 @@ QImage ViewProviderSketch::renderConstrIcon(const QString &type, QTransform rotation; rotation.rotate(iconRotation); - + QImage roticon = icon.transformed(rotation); QImage image = roticon.copy(0, 0, roticon.width() + labelWidth, roticon.height() + pxBelowBase); @@ -3488,24 +3488,24 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer edit->CurvIdToGeoId.clear(); edit->PointIdToGeoId.clear(); - + edit->PointIdToGeoId.push_back(-1); // root point - + // information layer if(rebuildinformationlayer) { // every time we start with empty information layer edit->infoGroup->removeAllChildren(); } - + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View"); int fontSize = hGrp->GetInt("EditSketcherFontSize", 17); - + int currentInfoNode = 0; - + ParameterGrp::handle hGrpsk = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher/General"); - + std::vector bsplineGeoIds; - + double combrepscale = 0; // the repscale that would correspond to this comb based only on this calculation. // end information layer @@ -3649,7 +3649,7 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer edit->PointIdToGeoId.push_back(GeoId); edit->PointIdToGeoId.push_back(GeoId); } - else if ((*it)->getTypeId() == Part::GeomArcOfHyperbola::getClassTypeId()) { + else if ((*it)->getTypeId() == Part::GeomArcOfHyperbola::getClassTypeId()) { const Part::GeomArcOfHyperbola *aoh = static_cast(*it); Handle(Geom_TrimmedCurve) curve = Handle(Geom_TrimmedCurve)::DownCast(aoh->handle()); @@ -3684,8 +3684,8 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer edit->PointIdToGeoId.push_back(GeoId); edit->PointIdToGeoId.push_back(GeoId); edit->PointIdToGeoId.push_back(GeoId); - } - else if ((*it)->getTypeId() == Part::GeomArcOfParabola::getClassTypeId()) { + } + else if ((*it)->getTypeId() == Part::GeomArcOfParabola::getClassTypeId()) { const Part::GeomArcOfParabola *aop = static_cast(*it); Handle(Geom_TrimmedCurve) curve = Handle(Geom_TrimmedCurve)::DownCast(aop->handle()); @@ -3754,23 +3754,23 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer Points.push_back(endp); edit->PointIdToGeoId.push_back(GeoId); edit->PointIdToGeoId.push_back(GeoId); - + //*************************************************************************************************************** // global information gathering for geometry information layer - + std::vector poles = spline->getPoles(); - + Base::Vector3d midp = Base::Vector3d(0,0,0); - + for (std::vector::iterator it = poles.begin(); it != poles.end(); ++it) { midp += (*it); } - + midp /= poles.size(); - + double firstparam = spline->getFirstParameter(); double lastparam = spline->getLastParameter(); - + const int ndiv = poles.size()>4?poles.size()*16:64; double step = (lastparam - firstparam ) / (ndiv -1); @@ -3805,179 +3805,179 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer combrepscale = temprepscale; } } - + if ( (combrepscale > (2 * combrepscalehyst)) || (combrepscale < (combrepscalehyst/2))) combrepscalehyst = combrepscale ; - - + + // geometry information layer for bsplines, as they need a second round now that max curvature is known for (std::vector::const_iterator it = bsplineGeoIds.begin(); it != bsplineGeoIds.end(); ++it) { const Part::Geometry *geo = GeoById(*geomlist, *it); const Part::GeomBSplineCurve *spline = static_cast(geo); - + //---------------------------------------------------------- // geometry information layer - + // polynom degree -------------------------------------------------------- std::vector poles = spline->getPoles(); - + Base::Vector3d midp = Base::Vector3d(0,0,0); - + for (std::vector::iterator it = poles.begin(); it != poles.end(); ++it) { midp += (*it); } - + midp /= poles.size(); - + if(rebuildinformationlayer) { SoSwitch *sw = new SoSwitch(); - + sw->whichChild = hGrpsk->GetBool("BSplineDegreeVisible", true)?SO_SWITCH_ALL:SO_SWITCH_NONE; - + SoSeparator *sep = new SoSeparator(); sep->ref(); // no caching for fluctuand data structures sep->renderCaching = SoSeparator::OFF; - + // every information visual node gets its own material for to-be-implemented preselection and selection SoMaterial *mat = new SoMaterial; mat->ref(); mat->diffuseColor = InformationColor; - + SoTranslation *translate = new SoTranslation; - + translate->translation.setValue(midp.x,midp.y,zInfo); - + SoFont *font = new SoFont; font->name.setValue("Helvetica"); font->size.setValue(fontSize); - + SoText2 *degreetext = new SoText2; degreetext->string = SbString(spline->getDegree()); - + sep->addChild(translate); sep->addChild(mat); sep->addChild(font); sep->addChild(degreetext); - + sw->addChild(sep); - + edit->infoGroup->addChild(sw); sep->unref(); mat->unref(); } else { SoSwitch *sw = static_cast(edit->infoGroup->getChild(currentInfoNode)); - + if(visibleInformationChanged) sw->whichChild = hGrpsk->GetBool("BSplineDegreeVisible", true)?SO_SWITCH_ALL:SO_SWITCH_NONE; - + SoSeparator *sep = static_cast(sw->getChild(0)); - + static_cast(sep->getChild(GEOINFO_BSPLINE_DEGREE_POS))->translation.setValue(midp.x,midp.y,zInfo); - + static_cast(sep->getChild(GEOINFO_BSPLINE_DEGREE_TEXT))->string = SbString(spline->getDegree()); } - + currentInfoNode++; // switch to next node - + // control polygon -------------------------------------------------------- if(rebuildinformationlayer) { SoSwitch *sw = new SoSwitch(); - + sw->whichChild = hGrpsk->GetBool("BSplineControlPolygonVisible", true)?SO_SWITCH_ALL:SO_SWITCH_NONE; - + SoSeparator *sep = new SoSeparator(); sep->ref(); // no caching for fluctuand data structures sep->renderCaching = SoSeparator::OFF; - + // every information visual node gets its own material for to-be-implemented preselection and selection SoMaterial *mat = new SoMaterial; mat->ref(); mat->diffuseColor = InformationColor; - + SoLineSet *lineset = new SoLineSet; - + SoCoordinate3 *coords = new SoCoordinate3; - + if(spline->isPeriodic()) { coords->point.setNum(poles.size()+1); } else { coords->point.setNum(poles.size()); } - + SbVec3f *vts = coords->point.startEditing(); - + int i=0; for (std::vector::iterator it = poles.begin(); it != poles.end(); ++it, i++) { vts[i].setValue((*it).x,(*it).y,zInfo); } - + if(spline->isPeriodic()) { vts[poles.size()].setValue(poles[0].x,poles[0].y,zInfo); } - + coords->point.finishEditing(); - + sep->addChild(mat); sep->addChild(coords); sep->addChild(lineset); - + sw->addChild(sep); - + edit->infoGroup->addChild(sw); sep->unref(); mat->unref(); } else { SoSwitch *sw = static_cast(edit->infoGroup->getChild(currentInfoNode)); - + if(visibleInformationChanged) sw->whichChild = hGrpsk->GetBool("BSplineControlPolygonVisible", true)?SO_SWITCH_ALL:SO_SWITCH_NONE; - + SoSeparator *sep = static_cast(sw->getChild(0)); - + SoCoordinate3 *coords = static_cast(sep->getChild(GEOINFO_BSPLINE_POLYGON)); - + if(spline->isPeriodic()) { coords->point.setNum(poles.size()+1); } else { coords->point.setNum(poles.size()); } - + SbVec3f *vts = coords->point.startEditing(); - + int i=0; for (std::vector::iterator it = poles.begin(); it != poles.end(); ++it, i++) { vts[i].setValue((*it).x,(*it).y,zInfo); } - + if(spline->isPeriodic()) { vts[poles.size()].setValue(poles[0].x,poles[0].y,zInfo); } - + coords->point.finishEditing(); - + } currentInfoNode++; // switch to next node - + // curvature graph -------------------------------------------------------- - + // reimplementation of python source: // https://github.com/tomate44/CurvesWB/blob/master/ParametricComb.py // by FreeCAD user Chris_G - + double firstparam = spline->getFirstParameter(); double lastparam = spline->getLastParameter(); - + const int ndiv = poles.size()>4?poles.size()*16:64; double step = (lastparam - firstparam ) / (ndiv -1); - + std::vector paramlist(ndiv); std::vector pointatcurvelist(ndiv); std::vector curvaturelist(ndiv); @@ -4002,167 +4002,167 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer for(int i = 0; i < ndiv; i++) { pointatcomblist[i] = pointatcurvelist[i] - combrepscalehyst * curvaturelist[i] * normallist[i]; } - + if(rebuildinformationlayer) { SoSwitch *sw = new SoSwitch(); - + sw->whichChild = hGrpsk->GetBool("BSplineCombVisible", true)?SO_SWITCH_ALL:SO_SWITCH_NONE; - + SoSeparator *sep = new SoSeparator(); sep->ref(); // no caching for fluctuand data structures sep->renderCaching = SoSeparator::OFF; - + // every information visual node gets its own material for to-be-implemented preselection and selection SoMaterial *mat = new SoMaterial; mat->ref(); mat->diffuseColor = InformationColor; - + SoLineSet *lineset = new SoLineSet; - + SoCoordinate3 *coords = new SoCoordinate3; - + coords->point.setNum(3*ndiv); // 2*ndiv +1 points of ndiv separate segments + ndiv points for last segment lineset->numVertices.setNum(ndiv+1); // ndiv separate segments of radials + 1 segment connecting at comb end - + int32_t *index = lineset->numVertices.startEditing(); SbVec3f *vts = coords->point.startEditing(); - + for(int i = 0; i < ndiv; i++) { vts[2*i].setValue(pointatcurvelist[i].x, pointatcurvelist[i].y, zInfo); // radials vts[2*i+1].setValue(pointatcomblist[i].x, pointatcomblist[i].y, zInfo); index[i] = 2; - + vts[2*ndiv+i].setValue(pointatcomblist[i].x, pointatcomblist[i].y, zInfo); // comb endpoint closing segment } - + index[ndiv] = ndiv; // comb endpoint closing segment - + coords->point.finishEditing(); lineset->numVertices.finishEditing(); - + sep->addChild(mat); sep->addChild(coords); sep->addChild(lineset); - + sw->addChild(sep); - + edit->infoGroup->addChild(sw); sep->unref(); mat->unref(); } else { SoSwitch *sw = static_cast(edit->infoGroup->getChild(currentInfoNode)); - + if(visibleInformationChanged) sw->whichChild = hGrpsk->GetBool("BSplineCombVisible", true)?SO_SWITCH_ALL:SO_SWITCH_NONE; - + SoSeparator *sep = static_cast(sw->getChild(0)); - + SoCoordinate3 *coords = static_cast(sep->getChild(GEOINFO_BSPLINE_POLYGON)); - + SoLineSet *lineset = static_cast(sep->getChild(GEOINFO_BSPLINE_POLYGON+1)); - + coords->point.setNum(3*ndiv); // 2*ndiv +1 points of ndiv separate segments + ndiv points for last segment lineset->numVertices.setNum(ndiv+1); // ndiv separate segments of radials + 1 segment connecting at comb end - + int32_t *index = lineset->numVertices.startEditing(); SbVec3f *vts = coords->point.startEditing(); - + for(int i = 0; i < ndiv; i++) { vts[2*i].setValue(pointatcurvelist[i].x, pointatcurvelist[i].y, zInfo); // radials vts[2*i+1].setValue(pointatcomblist[i].x, pointatcomblist[i].y, zInfo); index[i] = 2; - + vts[2*ndiv+i].setValue(pointatcomblist[i].x, pointatcomblist[i].y, zInfo); // comb endpoint closing segment } - + index[ndiv] = ndiv; // comb endpoint closing segment - + coords->point.finishEditing(); lineset->numVertices.finishEditing(); - + } - + currentInfoNode++; // switch to next node - + // knot multiplicity -------------------------------------------------------- std::vector knots = spline->getKnots(); std::vector mult = spline->getMultiplicities(); - + std::vector::const_iterator itk; std::vector::const_iterator itm; - - + + if(rebuildinformationlayer) { - + for( itk = knots.begin(), itm = mult.begin(); itk != knots.end() && itm != mult.end(); ++itk, ++itm) { - + SoSwitch *sw = new SoSwitch(); - + sw->whichChild = hGrpsk->GetBool("BSplineKnotMultiplicityVisible", true)?SO_SWITCH_ALL:SO_SWITCH_NONE; - + SoSeparator *sep = new SoSeparator(); sep->ref(); // no caching for fluctuand data structures sep->renderCaching = SoSeparator::OFF; - + // every information visual node gets its own material for to-be-implemented preselection and selection SoMaterial *mat = new SoMaterial; mat->ref(); mat->diffuseColor = InformationColor; - + SoTranslation *translate = new SoTranslation; - + Base::Vector3d knotposition = spline->pointAtParameter(*itk); - + translate->translation.setValue(knotposition.x,knotposition.y,zInfo); - + SoFont *font = new SoFont; font->name.setValue("Helvetica"); font->size.setValue(fontSize); - + SoText2 *degreetext = new SoText2; degreetext->string = SbString("(")+SbString(*itm)+SbString(")"); - + sep->addChild(translate); sep->addChild(mat); sep->addChild(font); sep->addChild(degreetext); - + sw->addChild(sep); - + edit->infoGroup->addChild(sw); sep->unref(); mat->unref(); - + currentInfoNode++; // switch to next node } } else { - for( itk = knots.begin(), itm = mult.begin(); itk != knots.end() && itm != mult.end(); ++itk, ++itm) { + for( itk = knots.begin(), itm = mult.begin(); itk != knots.end() && itm != mult.end(); ++itk, ++itm) { SoSwitch *sw = static_cast(edit->infoGroup->getChild(currentInfoNode)); - + if(visibleInformationChanged) sw->whichChild = hGrpsk->GetBool("BSplineKnotMultiplicityVisible", true)?SO_SWITCH_ALL:SO_SWITCH_NONE; - + SoSeparator *sep = static_cast(sw->getChild(0)); - + Base::Vector3d knotposition = spline->pointAtParameter(*itk); - + static_cast(sep->getChild(GEOINFO_BSPLINE_DEGREE_POS))->translation.setValue(knotposition.x,knotposition.y,zInfo); - + static_cast(sep->getChild(GEOINFO_BSPLINE_DEGREE_TEXT))->string = SbString("(")+SbString(*itm)+SbString(")"); - + currentInfoNode++; // switch to next node } } - - // End of knot multiplicity + + // End of knot multiplicity } - - - + + + visibleInformationChanged=false; // whatever that changed in Information layer is already updated edit->CurvesCoordinate->point.setNum(Coords.size()); @@ -4170,11 +4170,11 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer edit->CurvesMaterials->diffuseColor.setNum(Index.size()); edit->PointsCoordinate->point.setNum(Points.size()); edit->PointsMaterials->diffuseColor.setNum(Points.size()); - + SbVec3f *verts = edit->CurvesCoordinate->point.startEditing(); int32_t *index = edit->CurveSet->numVertices.startEditing(); SbVec3f *pverts = edit->PointsCoordinate->point.startEditing(); - + float dMg = 100; int i=0; // setting up the line set @@ -4183,7 +4183,7 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer dMg = dMg>std::abs(it->y)?dMg:std::abs(it->y); verts[i].setValue(it->x,it->y,zLowLines); } - + i=0; // setting up the indexes of the line set for (std::vector::const_iterator it = Index.begin(); it != Index.end(); ++it,i++) index[i] = *it; @@ -4366,7 +4366,7 @@ Restart: Base::Vector3d majdir = - aop->getXAxisDir(); angle = atan2(majdir.y, majdir.x); angleplus = (startangle + endangle)/2; - midpos = aop->getFocus(); + midpos = aop->getFocus(); } else break; @@ -5132,7 +5132,7 @@ Restart: SbVec3f p2(pnt2.x,pnt2.y,zConstr); SoDatumLabel *asciiText = static_cast(sep->getChild(CONSTRAINT_SEPARATOR_INDEX_MATERIAL_OR_DATUMLABEL)); - + // Get display string with units hidden if so requested asciiText->string = SbString( getPresentationString(Constr).toUtf8().constData() ); @@ -5152,11 +5152,11 @@ Restart: case Radius: { assert(Constr->First >= -extGeoCount && Constr->First < intGeoCount); - + Base::Vector3d pnt1(0.,0.,0.), pnt2(0.,0.,0.); if (Constr->First != Constraint::GeoUndef) { const Part::Geometry *geo = GeoById(*geomlist, Constr->First); - + if (geo->getTypeId() == Part::GeomArcOfCircle::getClassTypeId()) { const Part::GeomArcOfCircle *arc = static_cast(geo); double radius = arc->getRadius(); @@ -5183,26 +5183,26 @@ Restart: break; } else break; - + SbVec3f p1(pnt1.x,pnt1.y,zConstr); SbVec3f p2(pnt2.x,pnt2.y,zConstr); - + SoDatumLabel *asciiText = static_cast(sep->getChild(CONSTRAINT_SEPARATOR_INDEX_MATERIAL_OR_DATUMLABEL)); asciiText->string = SbString(Constr->getPresentationValue().getUserString().toUtf8().constData()); - + asciiText->datumtype = SoDatumLabel::RADIUS; asciiText->param1 = Constr->LabelDistance; asciiText->param2 = Constr->LabelPosition; - + asciiText->pnts.setNum(2); SbVec3f *verts = asciiText->pnts.startEditing(); - + verts[0] = p1; verts[1] = p2; - + asciiText->pnts.finishEditing(); } - break; + break; case Coincident: // nothing to do for coincident case None: case InternalAlignment: @@ -5230,7 +5230,7 @@ Restart: } Gui::MDIView *mdi = this->getActiveView(); - if (mdi && mdi->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (mdi && mdi->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { static_cast(mdi)->getViewer()->redraw(); } } @@ -5432,7 +5432,7 @@ void ViewProviderSketch::setIsShownVirtualSpace(bool isshownvirtualspace) this->isShownVirtualSpace = isshownvirtualspace; updateVirtualSpace(); - + signalConstraintsChanged(); } @@ -5471,8 +5471,8 @@ void ViewProviderSketch::updateData(const App::Property *prop) if (edit && (prop == &(getSketchObject()->Geometry) || prop == &(getSketchObject()->Constraints))) { edit->FullyConstrained = false; - // At this point, we do not need to solve the Sketch - // If we are adding geometry an update can be triggered before the sketch is actually solved. + // At this point, we do not need to solve the Sketch + // If we are adding geometry an update can be triggered before the sketch is actually solved. // Because a solve is mandatory to any addition (at least to update the DoF of the solver), // only when the solver geometry is the same in number than the sketch geometry an update // should trigger a redraw. This reduces even more the number of redraws per insertion of geometry @@ -5481,12 +5481,12 @@ void ViewProviderSketch::updateData(const App::Property *prop) // this failed solving info is presented to the user UpdateSolverInformation(); // just update the solver window with the last SketchObject solving information - if(getSketchObject()->getExternalGeometryCount()+getSketchObject()->getHighestCurveIndex() + 1 == + if(getSketchObject()->getExternalGeometryCount()+getSketchObject()->getHighestCurveIndex() + 1 == getSketchObject()->getSolvedSketch().getGeometrySize()) { Gui::MDIView *mdi = Gui::Application::Instance->activeDocument()->getActiveView(); if (mdi->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) draw(false,true); - + signalConstraintsChanged(); signalElementsChanged(); } @@ -5500,7 +5500,7 @@ void ViewProviderSketch::onChanged(const App::Property *prop) } void ViewProviderSketch::attach(App::DocumentObject *pcFeat) -{ +{ ViewProviderPart::attach(pcFeat); } @@ -5512,8 +5512,8 @@ void ViewProviderSketch::setupContextMenu(QMenu *menu, QObject *receiver, const bool ViewProviderSketch::setEdit(int ModNum) { Q_UNUSED(ModNum); - - // always change to sketcher WB, remember where we come from + + // always change to sketcher WB, remember where we come from oldWb = Gui::Command::assureWorkbench("SketcherWorkbench"); // When double-clicking on the item for this sketch the @@ -5699,8 +5699,8 @@ QString ViewProviderSketch::appendConflictMsg(const std::vector &conflictin if (conflicting.size() > 0) { if (conflicting.size() == 1) ss << tr("Please remove the following constraint:"); - else - ss << tr("Please remove at least one of the following constraints:"); + else + ss << tr("Please remove at least one of the following constraints:"); ss << "\n"; ss << conflicting[0]; for (unsigned int i=1; i < conflicting.size(); i++) @@ -5723,7 +5723,7 @@ QString ViewProviderSketch::appendRedundantMsg(const std::vector &redundant ss << redundant[0]; for (unsigned int i=1; i < redundant.size(); i++) ss << ", " << redundant[i]; - + ss << "\n"; } return msg; @@ -5735,7 +5735,7 @@ void ViewProviderSketch::UpdateSolverInformation() int dofs = getSketchObject()->getLastDoF(); bool hasConflicts = getSketchObject()->getLastHasConflicts(); bool hasRedundancies = getSketchObject()->getLastHasRedundancies(); - + if (getSketchObject()->Geometry.getSize() == 0) { signalSetUp(tr("Empty sketch")); signalSolved(QString()); @@ -5746,7 +5746,7 @@ void ViewProviderSketch::UpdateSolverInformation() signalSetUp(QString::fromLatin1("%1%2
%3

") .arg(tr("Over-constrained sketch ")) .arg(tr("(click to select)")) - .arg(QString::fromStdString(msg))); + .arg(QString::fromStdString(msg))); signalSolved(QString()); } else if (hasConflicts) { // conflicting constraints @@ -5768,7 +5768,7 @@ void ViewProviderSketch::UpdateSolverInformation() // color the sketch as fully constrained if it has geometry (other than the axes) if(getSketchObject()->getSolvedSketch().getGeometrySize()>2) edit->FullyConstrained = true; - + if (!hasRedundancies) { signalSetUp(QString::fromLatin1("%1").arg(tr("Fully constrained sketch"))); } @@ -5779,7 +5779,7 @@ void ViewProviderSketch::UpdateSolverInformation() else signalSetUp(tr("Under-constrained sketch with %1 degrees of freedom").arg(dofs)); } - + signalSolved(QString::fromLatin1("%1").arg(tr("Solved in %1 sec").arg(getSketchObject()->getLastSolveTime()))); } else { @@ -5848,7 +5848,7 @@ void ViewProviderSketch::createEditInventorNodes(void) edit->CurveSet = new SoLineSet; edit->CurveSet->setName("CurvesLineSet"); curvesRoot->addChild(edit->CurveSet); - + // stuff for the RootCross lines +++++++++++++++++++++++++++++++++++++++ SoGroup* crossRoot = new Gui::SoSkipBoundingGroup; edit->pickStyleAxes = new SoPickStyle(); @@ -5946,24 +5946,24 @@ void ViewProviderSketch::createEditInventorNodes(void) edit->constrGroup = new SmSwitchboard(); edit->constrGroup->setName("ConstraintGroup"); edit->EditRoot->addChild(edit->constrGroup); - + // group node for the Geometry information visual +++++++++++++++++++++++++++++++++++ MtlBind = new SoMaterialBinding; MtlBind->setName("InformationMaterialBinding"); MtlBind->value = SoMaterialBinding::OVERALL ; edit->EditRoot->addChild(MtlBind); - + // use small line width for the information visual DrawStyle = new SoDrawStyle; DrawStyle->setName("InformationDrawStyle"); DrawStyle->lineWidth = 1; edit->EditRoot->addChild(DrawStyle); - + // add the group where all the information entity has its SoSeparator edit->infoGroup = new SoGroup(); edit->infoGroup->setName("InformationGroup"); edit->EditRoot->addChild(edit->infoGroup); - + } void ViewProviderSketch::unsetEdit(int ModNum) @@ -6076,7 +6076,7 @@ void ViewProviderSketch::setEditViewer(Gui::View3DInventorViewer* viewer, int Mo viewer->setEditing(true); SoNode* root = viewer->getSceneGraph(); static_cast(root)->selectionRole.setValue(false); - + viewer->addGraphicsItem(rubberband); rubberband->setViewer(viewer); } @@ -6271,7 +6271,7 @@ bool ViewProviderSketch::onDelete(const std::vector &subList) // We stored the vertices, but is there really a coincident constraint? Check const std::vector< Sketcher::Constraint * > &vals = getSketchObject()->Constraints.getValues(); - + std::set::const_reverse_iterator rit; for (rit = delConstraints.rbegin(); rit != delConstraints.rend(); ++rit) { @@ -6331,24 +6331,24 @@ bool ViewProviderSketch::onDelete(const std::vector &subList) Base::Console().Error("%s\n", e.what()); } } - + int ret=getSketchObject()->solve(); - + if(ret!=0){ // if the sketched could not be solved, we first redraw to update the UI geometry as // onChanged did not update it. UpdateSolverInformation(); draw(false,true); - + signalConstraintsChanged(); signalElementsChanged(); } - + // Notes on solving and recomputing: // // This function is generally called from StdCmdDelete::activated // Since 2015-05-03 that function includes a recompute at the end. - + /*this->drawConstraintIcons(); this->updateColor();*/ diff --git a/src/Mod/Start/Gui/DlgStartPreferences.ui b/src/Mod/Start/Gui/DlgStartPreferences.ui index ad56c9d135..216c32cea9 100644 --- a/src/Mod/Start/Gui/DlgStartPreferences.ui +++ b/src/Mod/Start/Gui/DlgStartPreferences.ui @@ -66,7 +66,7 @@ - if you want the examples to show on the first page + If you want the examples to show on the first page Qt::RightToLeft @@ -107,7 +107,7 @@ - an optional custom folder to be displayed at the bottom of the first page + An optional custom folder to be displayed at the bottom of the first page Gui::FileChooser::Directory @@ -164,7 +164,7 @@ - the background of the main start page area + The background of the main start page area @@ -215,7 +215,7 @@ false - in external browser + In external browser InWeb @@ -246,7 +246,7 @@ - the color of the version text + The color of the version text @@ -273,7 +273,7 @@ - an optional image to display as background + An optional image to display as background BackgroundImage @@ -318,7 +318,7 @@ - the color of the text on he main pages + The color of the text on the main pages @@ -358,7 +358,7 @@ - the color of the links + The color of the links @@ -384,7 +384,7 @@ - the background color of the boxes inside the pages + The background color of the boxes inside the pages @@ -417,7 +417,7 @@ - the background color behind the panels + The background color behind the panels @@ -446,7 +446,7 @@ - the down gradient for the background color (currently unsupported) + The down gradient for the background color (currently unsupported) @@ -593,7 +593,7 @@ - Switch workbench after loafing + Switch workbench after loading