Sketcher: Cleanup commented-out code
Remove the TestSketcherGui file entirely, it contained only commented lines. Delete commented out debugging output. Remove other commented-out code that didn't have any explanation or justification for leaving it in.
This commit is contained in:
@@ -57,8 +57,6 @@
|
||||
test: xvfb-run /usr/bin/FreeCAD -t TestPartGui
|
||||
/TestPartDesignGui :
|
||||
test: xvfb-run /usr/bin/FreeCAD -t TestPartDesignGui
|
||||
/TestSketcherGui :
|
||||
test: xvfb-run /usr/bin/FreeCAD -t TestSketcherGui
|
||||
/TestTechDrawGui :
|
||||
test: xvfb-run /usr/bin/FreeCAD -t TestTechDrawGui
|
||||
/Workbench :
|
||||
|
||||
@@ -59,7 +59,6 @@ private:
|
||||
std::string EncodedName = std::string(Name);
|
||||
PyMem_Free(Name);
|
||||
|
||||
// Base::Console().log("Open in Part with %s",Name);
|
||||
Base::FileInfo file(EncodedName.c_str());
|
||||
|
||||
// extract extension
|
||||
@@ -82,7 +81,6 @@ private:
|
||||
PyMem_Free(Name);
|
||||
|
||||
try {
|
||||
// Base::Console().log("Insert in Part with %s",Name);
|
||||
Base::FileInfo file(EncodedName.c_str());
|
||||
|
||||
// extract extension
|
||||
|
||||
@@ -63,8 +63,6 @@ std::unique_ptr<GeometryFacade> GeometryFacade::getFacade(const Part::Geometry*
|
||||
else {
|
||||
return std::unique_ptr<GeometryFacade>(nullptr);
|
||||
}
|
||||
// make_unique has no access to private constructor
|
||||
// return std::make_unique<GeometryFacade>(geometry);
|
||||
}
|
||||
|
||||
void GeometryFacade::setGeometry(Part::Geometry* geometry)
|
||||
@@ -84,9 +82,6 @@ void GeometryFacade::initExtension()
|
||||
if (!Geo->hasExtension(SketchGeometryExtension::getClassTypeId())) {
|
||||
|
||||
getGeo()->setExtension(std::make_unique<SketchGeometryExtension>()); // Create getExtension
|
||||
|
||||
// Base::Console().warning("%s\nSketcher Geometry without Extension: %s \n",
|
||||
// boost::uuids::to_string(Geo->getTag()).c_str());
|
||||
}
|
||||
|
||||
SketchGeoExtension = std::static_pointer_cast<const SketchGeometryExtension>(
|
||||
|
||||
@@ -367,12 +367,6 @@ void Sketch::fixParametersAndDiagnose(std::vector<double*>& params_to_block)
|
||||
GCSsys.declareUnknowns(Parameters);
|
||||
GCSsys.declareDrivenParams(DrivenParameters);
|
||||
GCSsys.initSolution(defaultSolverRedundant);
|
||||
/*GCSsys.getConflicting(Conflicting);
|
||||
GCSsys.getRedundant(Redundant);
|
||||
GCSsys.getPartlyRedundant(PartiallyRedundant);
|
||||
GCSsys.getDependentParams(pDependentParametersList);
|
||||
|
||||
calculateDependentParametersElements();*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -496,7 +490,6 @@ void Sketch::calculateDependentParametersElements()
|
||||
|
||||
for (auto param : pDependentParametersList) {
|
||||
|
||||
// auto element = param2geoelement.at(param);
|
||||
auto element = param2geoelement.find(param);
|
||||
|
||||
if (element != param2geoelement.end()) {
|
||||
@@ -1700,7 +1693,6 @@ int Sketch::addEllipse(const Part::GeomEllipse& elip, bool fixed)
|
||||
double dist_C_F = sqrt(radmaj * radmaj - radmin * radmin);
|
||||
// solver parameters
|
||||
Base::Vector3d focus1 = center + dist_C_F * radmajdir; //+x
|
||||
// double *radmin;
|
||||
|
||||
GCS::Point c;
|
||||
|
||||
@@ -4593,12 +4585,6 @@ void Sketch::updateLineSegment(const GeoDef& def)
|
||||
void Sketch::updateArcOfCircle(const GeoDef& def)
|
||||
{
|
||||
GCS::Arc& myArc = Arcs[def.index];
|
||||
// the following 4 lines are redundant since these equations are already included in
|
||||
// the arc constraints *myArc.start.x = *myArc.center.x + *myArc.rad *
|
||||
// cos(*myArc.startAngle); *myArc.start.y = *myArc.center.y + *myArc.rad *
|
||||
// sin(*myArc.startAngle); *myArc.end.x = *myArc.center.x + *myArc.rad *
|
||||
// cos(*myArc.endAngle); *myArc.end.y = *myArc.center.y + *myArc.rad *
|
||||
// sin(*myArc.endAngle);
|
||||
GeomArcOfCircle* aoc = static_cast<GeomArcOfCircle*>(def.geo);
|
||||
aoc->setCenter(Vector3d(*Points[def.midPointId].x, *Points[def.midPointId].y, 0.0));
|
||||
aoc->setRadius(*myArc.rad);
|
||||
@@ -5428,23 +5414,6 @@ TopoShape Sketch::toShape() const
|
||||
TopoShape result;
|
||||
std::vector<GeoDef>::const_iterator it = Geoms.begin();
|
||||
|
||||
#if 0
|
||||
|
||||
bool first = true;
|
||||
for (; it!=Geoms.end(); ++it) {
|
||||
if (!it->geo->Construction) {
|
||||
TopoDS_Shape sh = it->geo->toShape();
|
||||
if (first) {
|
||||
first = false;
|
||||
result.setShape(sh);
|
||||
}
|
||||
else {
|
||||
result.setShape(result.fuse(sh));
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
#else
|
||||
std::list<TopoDS_Edge> edge_list;
|
||||
std::list<TopoDS_Vertex> vertex_list;
|
||||
std::list<TopoDS_Wire> wires;
|
||||
@@ -5528,7 +5497,6 @@ TopoShape Sketch::toShape() const
|
||||
}
|
||||
result.setShape(comp);
|
||||
}
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ set(Sketcher_TestScripts
|
||||
if(BUILD_GUI)
|
||||
list (APPEND Sketcher_Scripts
|
||||
InitGui.py
|
||||
TestSketcherGui.py
|
||||
)
|
||||
list (APPEND Sketcher_TestScripts
|
||||
SketcherTests/TestPlacementUpdate.py
|
||||
|
||||
@@ -106,7 +106,6 @@ PyMOD_INIT_FUNC(SketcherGui)
|
||||
Gui::BitmapFactory().addPath(QStringLiteral(":/icons/elements"));
|
||||
Gui::BitmapFactory().addPath(QStringLiteral(":/icons/general"));
|
||||
Gui::BitmapFactory().addPath(QStringLiteral(":/icons/geometry"));
|
||||
// Gui::BitmapFactory().addPath(QStringLiteral(":/icons/obsolete"));
|
||||
Gui::BitmapFactory().addPath(QStringLiteral(":/icons/pointers"));
|
||||
Gui::BitmapFactory().addPath(QStringLiteral(":/icons/splines"));
|
||||
Gui::BitmapFactory().addPath(QStringLiteral(":/icons/tools"));
|
||||
|
||||
@@ -236,8 +236,6 @@ void CmdSketcherNewSketch::activated(int iMsg)
|
||||
if (bAttach) {
|
||||
|
||||
std::vector<Gui::SelectionObject> objects = Gui::Selection().getSelectionEx();
|
||||
// assert (objects.size() == 1); //should have been filtered out by SuggestAutoMapMode
|
||||
// Gui::SelectionObject &sel_support = objects[0];
|
||||
App::PropertyLinkSubList support;
|
||||
Gui::Selection().getAsPropertyLinkSubList(support);
|
||||
std::string supportString = support.getPyReprString();
|
||||
|
||||
@@ -922,8 +922,6 @@ void DrawSketchHandler::createAutoConstraints(
|
||||
if (createowncommand) {
|
||||
Gui::Command::commitCommand();
|
||||
}
|
||||
// Gui::Command::updateActive(); // There is already an recompute in each command
|
||||
// creation, this is redundant.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -479,7 +479,6 @@ void EditModeInformationOverlayCoinConverter::addNode(const Result& result)
|
||||
|
||||
SoSwitch* sw = new SoSwitch();
|
||||
|
||||
// hGrpsk->GetBool("BSplineControlPolygonVisible", true)
|
||||
sw->whichChild = isVisible<Result::calculationType>() ? SO_SWITCH_ALL : SO_SWITCH_NONE;
|
||||
|
||||
SoSeparator* sep = new SoSeparator();
|
||||
|
||||
@@ -35,21 +35,6 @@ using namespace Gui::TaskView;
|
||||
TaskSketcherCreateCommands::TaskSketcherCreateCommands(QWidget* parent)
|
||||
: TaskBox(Gui::BitmapFactory().pixmap("document-new"), tr("Appearance"), true, parent)
|
||||
{
|
||||
// we need a separate container widget to add all controls to
|
||||
// proxy = new QWidget(this);
|
||||
// ui = new Ui_TaskAppearance();
|
||||
// ui->setupUi(proxy);
|
||||
// ui->textLabel1_3->hide();
|
||||
// ui->changePlot->hide();
|
||||
// QMetaObject::connectSlotsByName(this);
|
||||
|
||||
// this->groupLayout()->addWidget(proxy);
|
||||
|
||||
// std::vector<Gui::ViewProvider*> views;
|
||||
// setDisplayModes(views);
|
||||
// setPointSize(views);
|
||||
// setLineWidth(views);
|
||||
// setTransparency(views);
|
||||
Gui::Selection().Attach(this);
|
||||
}
|
||||
|
||||
@@ -62,9 +47,6 @@ TaskSketcherCreateCommands::~TaskSketcherCreateCommands()
|
||||
void TaskSketcherCreateCommands::changeEvent(QEvent* e)
|
||||
{
|
||||
TaskBox::changeEvent(e);
|
||||
// if (e->type() == QEvent::LanguageChange) {
|
||||
// ui->retranslateUi(proxy);
|
||||
// }
|
||||
}
|
||||
|
||||
/// @cond DOXERR
|
||||
|
||||
@@ -780,11 +780,6 @@ void ViewProviderSketch::moveCursorToSketchPoint(Base::Vector2d point)
|
||||
|
||||
QPoint newPos = viewer->getGLWidget()->mapToGlobal(QPoint(x, height - y));
|
||||
|
||||
|
||||
// QScreen *screen = view->windowHandle()->screen();
|
||||
// QScreen *screen = QGuiApplication::primaryScreen();
|
||||
|
||||
// QCursor::setPos(screen, newPos);
|
||||
QCursor::setPos(newPos);
|
||||
}
|
||||
|
||||
@@ -1014,22 +1009,18 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe
|
||||
case STATUS_NONE: {
|
||||
bool done = false;
|
||||
if (preselection.isPreselectPointValid()) {
|
||||
// Base::Console().log("start dragging, point:%d\n",this->DragPoint);
|
||||
setSketchMode(STATUS_SELECT_Point);
|
||||
done = true;
|
||||
}
|
||||
else if (preselection.isPreselectCurveValid()) {
|
||||
// Base::Console().log("start dragging, point:%d\n",this->DragPoint);
|
||||
setSketchMode(STATUS_SELECT_Edge);
|
||||
done = true;
|
||||
}
|
||||
else if (preselection.isCrossPreselected()) {
|
||||
// Base::Console().log("start dragging, point:%d\n",this->DragPoint);
|
||||
setSketchMode(STATUS_SELECT_Cross);
|
||||
done = true;
|
||||
}
|
||||
else if (!preselection.PreselectConstraintSet.empty()) {
|
||||
// Base::Console().log("start dragging, point:%d\n",this->DragPoint);
|
||||
setSketchMode(STATUS_SELECT_Constraint);
|
||||
done = true;
|
||||
}
|
||||
@@ -1078,7 +1069,6 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe
|
||||
switch (Mode) {
|
||||
case STATUS_SELECT_Point:
|
||||
if (pp) {
|
||||
// Base::Console().log("Select Point:%d\n",this->DragPoint);
|
||||
// Do selection
|
||||
std::stringstream ss;
|
||||
ss << "Vertex" << preselection.getPreselectionVertexIndex();
|
||||
@@ -1089,7 +1079,6 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe
|
||||
return true;
|
||||
case STATUS_SELECT_Edge:
|
||||
if (pp) {
|
||||
// Base::Console().log("Select Point:%d\n",this->DragPoint);
|
||||
std::stringstream ss;
|
||||
if (preselection.isEdge())
|
||||
ss << "Edge" << preselection.getPreselectionEdgeIndex();
|
||||
@@ -1102,7 +1091,6 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe
|
||||
return true;
|
||||
case STATUS_SELECT_Cross:
|
||||
if (pp) {
|
||||
// Base::Console().log("Select Point:%d\n",this->DragPoint);
|
||||
std::stringstream ss;
|
||||
switch (preselection.PreselectCross) {
|
||||
case Preselection::Axes::RootPoint:
|
||||
@@ -1216,19 +1204,15 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe
|
||||
switch (Mode) {
|
||||
case STATUS_NONE: {
|
||||
if (preselection.isPreselectPointValid()) {
|
||||
// Base::Console().log("start dragging, point:%d\n",this->DragPoint);
|
||||
setSketchMode(STATUS_SELECT_Point);
|
||||
}
|
||||
else if (preselection.isPreselectCurveValid()) {
|
||||
// Base::Console().log("start dragging, point:%d\n",this->DragPoint);
|
||||
setSketchMode(STATUS_SELECT_Edge);
|
||||
}
|
||||
else if (preselection.isCrossPreselected()) {
|
||||
// Base::Console().log("start dragging, point:%d\n",this->DragPoint);
|
||||
setSketchMode(STATUS_SELECT_Cross);
|
||||
}
|
||||
else if (!preselection.PreselectConstraintSet.empty()) {
|
||||
// Base::Console().log("start dragging, point:%d\n",this->DragPoint);
|
||||
setSketchMode(STATUS_SELECT_Constraint);
|
||||
}
|
||||
break;
|
||||
@@ -1258,7 +1242,6 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe
|
||||
return true;
|
||||
case STATUS_SELECT_Point:
|
||||
if (pp) {
|
||||
// Base::Console().log("Select Point:%d\n",this->DragPoint);
|
||||
// Do selection
|
||||
std::stringstream ss;
|
||||
ss << "Vertex" << preselection.getPreselectionVertexIndex();
|
||||
@@ -1270,7 +1253,6 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe
|
||||
return true;
|
||||
case STATUS_SELECT_Edge:
|
||||
if (pp) {
|
||||
// Base::Console().log("Select Point:%d\n",this->DragPoint);
|
||||
std::stringstream ss;
|
||||
if (preselection.isEdge()) {
|
||||
ss << "Edge" << preselection.getPreselectionEdgeIndex();
|
||||
@@ -1286,7 +1268,6 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe
|
||||
return true;
|
||||
case STATUS_SELECT_Cross:
|
||||
if (pp) {
|
||||
// Base::Console().log("Select Point:%d\n",this->DragPoint);
|
||||
std::stringstream ss;
|
||||
switch (preselection.PreselectCross) {
|
||||
case Preselection::Axes::RootPoint:
|
||||
|
||||
@@ -55,5 +55,3 @@ class SketcherWorkbench(Workbench):
|
||||
|
||||
|
||||
Gui.addWorkbench(SketcherWorkbench())
|
||||
|
||||
FreeCAD.__unit_test__ += ["TestSketcherGui"]
|
||||
|
||||
@@ -27,9 +27,6 @@ if FreeCAD.GuiUp:
|
||||
import FreeCADGui
|
||||
from PySide import QtCore
|
||||
|
||||
# s=os.path.dirname(__file__)
|
||||
# s=os.path.join(s,"ProfileLib")
|
||||
# FreeCADGui.addIconPath(s)
|
||||
|
||||
__title__ = "Sketcher profile lib handling"
|
||||
__author__ = "Juergen Riegel"
|
||||
@@ -44,9 +41,6 @@ def getSketch():
|
||||
edit = FreeCADGui.ActiveDocument.getInEdit()
|
||||
if edit and edit.isDerivedFrom("SketcherGui::ViewProviderSketch"):
|
||||
return edit.Object
|
||||
# act = FreeCAD.ActiveDocument.ActiveObject
|
||||
# if act and act.isDerivedFrom('Sketcher::SketchObject'):
|
||||
# return act
|
||||
return None
|
||||
|
||||
|
||||
|
||||
@@ -144,11 +144,6 @@ class TestSketchFillet(unittest.TestCase):
|
||||
SketchFeature.addConstraint(Sketcher.Constraint("Distance", 0, 2, 1, 1, 0.25))
|
||||
self.Doc.recompute()
|
||||
|
||||
# SketchFeature.fillet(0,1, App.Vector(0.75,0.75,0), App.Vector(1.22,0.66,0), 0.25, True, True)
|
||||
# Make sure the fillet happened
|
||||
# self.Doc.recompute()
|
||||
# self.assertAlmostEqual(SketchFeature.Geometry[2].Radius, 0.25)
|
||||
|
||||
# The following tests are mostly about verifying that transferFilletConstraints
|
||||
# does the right thing with pre-existing constraints when a fillet is created.
|
||||
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
# **************************************************************************
|
||||
# Copyright (c) 2011 Juergen Riegel <[email protected]> *
|
||||
# *
|
||||
# This file is part of the FreeCAD CAx development system. *
|
||||
# *
|
||||
# This program is free software; you can redistribute it and/or modify *
|
||||
# it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# as published by the Free Software Foundation; either version 2 of *
|
||||
# the License, or (at your option) any later version. *
|
||||
# for detail see the LICENCE text file. *
|
||||
# *
|
||||
# FreeCAD is distributed in the hope that it will be useful, *
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# GNU Library General Public License for more details. *
|
||||
# *
|
||||
# You should have received a copy of the GNU Library General Public *
|
||||
# License along with FreeCAD; if not, write to the Free Software *
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# USA *
|
||||
# **************************************************************************
|
||||
|
||||
# import FreeCAD, FreeCADGui, os, sys, unittest, Sketcher, SketcherGui
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# define the test cases to test the FreeCAD Sketcher module
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
# class SketcherGuiTestCases(unittest.TestCase):
|
||||
# def setUp(self):
|
||||
# self.Doc = FreeCAD.newDocument("SketchGuiTest")
|
||||
#
|
||||
# def testBoxCase(self):
|
||||
# self.Box = self.Doc.addObject('Sketcher::SketchObject','SketchBox')
|
||||
# self.Box.addGeometry(Part.LineSegment(App.Vector(-99.230339,36.960674,0),App.Vector(69.432587,36.960674,0)))
|
||||
# self.Box.addGeometry(Part.LineSegment(App.Vector(69.432587,36.960674,0),App.Vector(69.432587,-53.196629,0)))
|
||||
# self.Box.addGeometry(Part.LineSegment(App.Vector(69.432587,-53.196629,0),App.Vector(-99.230339,-53.196629,0)))
|
||||
# self.Box.addGeometry(Part.LineSegment(App.Vector(-99.230339,-53.196629,0),App.Vector(-99.230339,36.960674,0)))
|
||||
#
|
||||
# def tearDown(self):
|
||||
# #closing doc
|
||||
# FreeCAD.closeDocument("SketchGuiTest")
|
||||
|
||||
Reference in New Issue
Block a user