From df1011d94f1bd6d4fed6b2488639dde5721a92e2 Mon Sep 17 00:00:00 2001 From: pekkaroi Date: Thu, 16 Nov 2017 22:31:02 +0200 Subject: [PATCH 1/3] Path: Allow removing of all base objects in Circular hole tools --- .../Path/PathScripts/PathCircularHoleBase.py | 39 +++++++++++-------- .../PathScripts/PathCircularHoleBaseGui.py | 2 +- src/Mod/Path/PathScripts/PathDrilling.py | 1 + src/Mod/Path/PathScripts/PathHelix.py | 3 +- 4 files changed, 26 insertions(+), 19 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathCircularHoleBase.py b/src/Mod/Path/PathScripts/PathCircularHoleBase.py index fc64918fed..3edef6d19b 100644 --- a/src/Mod/Path/PathScripts/PathCircularHoleBase.py +++ b/src/Mod/Path/PathScripts/PathCircularHoleBase.py @@ -39,16 +39,19 @@ __author__ = "sliptonic (Brad Collette)" __url__ = "http://www.freecadweb.org" __doc__ = "Base class an implementation for operations on circular holes." + # Qt tanslation handling def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) + if False: PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) PathLog.trackModule(PathLog.thisModule()) else: PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) + class ObjectOp(PathOp.ObjectOp): '''Base class for proxy objects of all operations on circular holes.''' @@ -155,23 +158,7 @@ class ObjectOp(PathOp.ObjectOp): return len(obj.Locations) != 0 return False - if len(obj.Base) == 0 and not haveLocations(self, obj): - features = [] - if self.baseIsArchPanel(obj, self.baseobject): - holeshapes = self.baseobject.Proxy.getHoles(self.baseobject, transform=True) - tooldiameter = obj.ToolController.Proxy.getTool(obj.ToolController).Diameter - for holeNr, hole in enumerate(holeshapes): - PathLog.debug('Entering new HoleShape') - for wireNr, wire in enumerate(hole.Wires): - PathLog.debug('Entering new Wire') - for edgeNr, edge in enumerate(wire.Edges): - if PathUtils.isDrillable(self.baseobject, edge, tooldiameter): - PathLog.debug('Found drillable hole edges: {}'.format(edge)) - features.append((self.baseobject, "%d.%d.%d" % (holeNr, wireNr, edgeNr))) - else: - features = self.findHoles(obj, self.baseobject) - obj.Base = features - obj.Disabled = [] + # if len(obj.Base) == 0 and not haveLocations(self, obj): holes = [] @@ -195,6 +182,24 @@ class ObjectOp(PathOp.ObjectOp): Must be overwritten by subclasses.''' pass + def findAllHoles(self, obj): + features = [] + if self.baseIsArchPanel(obj, self.baseobject): + holeshapes = self.baseobject.Proxy.getHoles(self.baseobject, transform=True) + tooldiameter = obj.ToolController.Proxy.getTool(obj.ToolController).Diameter + for holeNr, hole in enumerate(holeshapes): + PathLog.debug('Entering new HoleShape') + for wireNr, wire in enumerate(hole.Wires): + PathLog.debug('Entering new Wire') + for edgeNr, edge in enumerate(wire.Edges): + if PathUtils.isDrillable(self.baseobject, edge, tooldiameter): + PathLog.debug('Found drillable hole edges: {}'.format(edge)) + features.append((self.baseobject, "%d.%d.%d" % (holeNr, wireNr, edgeNr))) + else: + features = self.findHoles(obj, self.baseobject) + obj.Base = features + obj.Disabled = [] + def findHoles(self, obj, baseobject): '''findHoles(obj, baseobject) ... inspect baseobject and identify all features that resemble a straight cricular hole.''' shape = baseobject.Shape diff --git a/src/Mod/Path/PathScripts/PathCircularHoleBaseGui.py b/src/Mod/Path/PathScripts/PathCircularHoleBaseGui.py index c733218056..234463e546 100644 --- a/src/Mod/Path/PathScripts/PathCircularHoleBaseGui.py +++ b/src/Mod/Path/PathScripts/PathCircularHoleBaseGui.py @@ -165,6 +165,7 @@ class TaskPanelHoleGeometryPage(PathOpGui.TaskPanelBaseGeometryPage): '''resetBase() ... push button callback''' self.obj.Base = [] self.obj.Disabled = [] + self.obj.Proxy.findAllHoles(self.obj) self.obj.Proxy.execute(self.obj) FreeCAD.ActiveDocument.recompute() @@ -180,4 +181,3 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage): def taskPanelBaseGeometryPage(self, obj, features): '''taskPanelBaseGeometryPage(obj, features) ... Return circular hole specific page controller for Base Geometry.''' return TaskPanelHoleGeometryPage(obj, features) - diff --git a/src/Mod/Path/PathScripts/PathDrilling.py b/src/Mod/Path/PathScripts/PathDrilling.py index 4015032df6..b1ac92a481 100644 --- a/src/Mod/Path/PathScripts/PathDrilling.py +++ b/src/Mod/Path/PathScripts/PathDrilling.py @@ -124,4 +124,5 @@ def Create(name): '''Create(name) ... Creates and returns a Drilling operation.''' obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name) proxy = ObjectDrilling(obj) + proxy.findAllHoles(obj) return obj diff --git a/src/Mod/Path/PathScripts/PathHelix.py b/src/Mod/Path/PathScripts/PathHelix.py index 3809caa22a..d2295d991f 100644 --- a/src/Mod/Path/PathScripts/PathHelix.py +++ b/src/Mod/Path/PathScripts/PathHelix.py @@ -45,7 +45,7 @@ class ObjectHelix(PathCircularHoleBase.ObjectOp): def circularHoleFeatures(self, obj): '''circularHoleFeatures(obj) ... enable features supported by Helix.''' - return PathOp.FeatureStepDown | PathOp.FeatureBaseEdges | PathOp.FeatureBaseFaces | PathOp.FeatureBasePanels + return PathOp.FeatureStepDown | PathOp.FeatureBaseEdges | PathOp.FeatureBaseFaces | PathOp.FeatureBasePanels def initCircularHoleOperation(self, obj): '''initCircularHoleOperation(obj) ... create helix specific properties.''' @@ -197,4 +197,5 @@ def Create(name): '''Create(name) ... Creates and returns a Helix operation.''' obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name) proxy = ObjectHelix(obj) + proxy.findAllHoles(obj) return obj From 0d1451f39d52e3471fc0ee04903d3d9ad946d344 Mon Sep 17 00:00:00 2001 From: luzpaz Date: Mon, 20 Nov 2017 20:29:49 -0500 Subject: [PATCH 2/3] User-facing typo fixes All user-facing strings that have double (consecutive) whitespace e.g. `\b \b`have been removed. Inspired by the error message in https://forum.freecadweb.org/viewtopic.php?f=3&t=5899&p=200309#p200309 --- src/Gui/Command.cpp | 2 +- src/Gui/CommandView.cpp | 4 ++-- src/Main/MainCmd.cpp | 2 +- src/Main/MainGui.cpp | 2 +- src/Main/MainPy.cpp | 2 +- src/Mod/Cam/App/best_fit.h | 2 +- src/Mod/Drawing/Gui/DrawingView.cpp | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Gui/Command.cpp b/src/Gui/Command.cpp index 2b48e96945..94eeb192f9 100644 --- a/src/Gui/Command.cpp +++ b/src/Gui/Command.cpp @@ -84,7 +84,7 @@ using namespace Gui::DockWnd; * * \section wayout Way out * To solve these problems we have introduced the command framework to decouple QAction and MainWindow. The base classes of the framework are - * \a Gui::CommandBase and \a Gui::Action that represent the link between Qt's QAction world and the FreeCAD's command world. + * \a Gui::CommandBase and \a Gui::Action that represent the link between Qt's QAction world and the FreeCAD's command world. * * The Action class holds a pointer to QAction and CommandBase and acts as a mediator and -- to save memory -- that gets created * (@ref Gui::CommandBase::createAction()) not before it is added (@ref Gui::Command::addTo()) to a menu or toolbar. diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp index 3276f339f6..00bb45ecb3 100644 --- a/src/Gui/CommandView.cpp +++ b/src/Gui/CommandView.cpp @@ -1865,9 +1865,9 @@ StdCmdViewCreate::StdCmdViewCreate() { sGroup = QT_TR_NOOP("Standard-View"); sMenuText = QT_TR_NOOP("Create new view"); - sToolTipText= QT_TR_NOOP("Creates a new view window for the active document"); + sToolTipText= QT_TR_NOOP("Creates a new view window for the active document"); sWhatsThis = "Std_ViewCreate"; - sStatusTip = QT_TR_NOOP("Creates a new view window for the active document"); + sStatusTip = QT_TR_NOOP("Creates a new view window for the active document"); sPixmap = "window-new"; eType = Alter3DView; } diff --git a/src/Main/MainCmd.cpp b/src/Main/MainCmd.cpp index 73c5462fb2..b588e54a10 100644 --- a/src/Main/MainCmd.cpp +++ b/src/Main/MainCmd.cpp @@ -97,7 +97,7 @@ int main( int argc, char ** argv ) catch (const Base::Exception& e) { std::string appName = App::Application::Config()["ExeName"]; std::stringstream msg; - msg << "While initializing " << appName << " the following exception occurred: '" << e.what() << "'\n\n"; + msg << "While initializing " << appName << " the following exception occurred: '" << e.what() << "'\n\n"; msg << "Python is searching for its runtime files in the following directories:\n" << Py_GetPath() << "\n\n"; msg << "Python version information:\n" << Py_GetVersion() << "\n"; const char* pythonhome = getenv("PYTHONHOME"); diff --git a/src/Main/MainGui.cpp b/src/Main/MainGui.cpp index fef7d42e4d..deac0628e6 100644 --- a/src/Main/MainGui.cpp +++ b/src/Main/MainGui.cpp @@ -208,7 +208,7 @@ int main( int argc, char ** argv ) QApplication app(argc,argv); QString appName = QString::fromLatin1(App::Application::Config()["ExeName"].c_str()); QString msg; - msg = QObject::tr("While initializing %1 the following exception occurred: '%2'\n\n" + msg = QObject::tr("While initializing %1 the following exception occurred: '%2'\n\n" "Python is searching for its files in the following directories:\n%3\n\n" "Python version information:\n%4\n") .arg(appName).arg(QString::fromUtf8(e.what())) diff --git a/src/Main/MainPy.cpp b/src/Main/MainPy.cpp index 33765f7375..e8e6965e78 100644 --- a/src/Main/MainPy.cpp +++ b/src/Main/MainPy.cpp @@ -215,7 +215,7 @@ PyMOD_INIT_FUNC(FreeCAD) catch (const Base::Exception& e) { std::string appName = App::Application::Config()["ExeName"]; std::stringstream msg; - msg << "While initializing " << appName << " the following exception occurred: '" + msg << "While initializing " << appName << " the following exception occurred: '" << e.what() << "'\n\n"; msg << "\nPlease contact the application's support team for more information.\n\n"; printf("Initialization of %s failed:\n%s", appName.c_str(), msg.str().c_str()); diff --git a/src/Mod/Cam/App/best_fit.h b/src/Mod/Cam/App/best_fit.h index 84a18df317..0987777453 100644 --- a/src/Mod/Cam/App/best_fit.h +++ b/src/Mod/Cam/App/best_fit.h @@ -59,7 +59,7 @@ public: /*! \brief Load the input-shapes. Must be called before running the main program \param InputMesh Input-mesh - \param CAD_Shape Input-shape + \param CAD_Shape Input-shape */ void Load(const MeshCore::MeshKernel &InputMesh, const TopoDS_Shape &CAD_Shape); diff --git a/src/Mod/Drawing/Gui/DrawingView.cpp b/src/Mod/Drawing/Gui/DrawingView.cpp index 381cd008ca..bbfb054656 100644 --- a/src/Mod/Drawing/Gui/DrawingView.cpp +++ b/src/Mod/Drawing/Gui/DrawingView.cpp @@ -567,7 +567,7 @@ void DrawingView::print(QPrinter* printer) if (doPrint && printer->orientation() != this->m_orientation) { int ret = QMessageBox::warning(this, tr("Different orientation"), - tr("The printer uses a different orientation than the drawing.\n" + tr("The printer uses a different orientation than the drawing.\n" "Do you want to continue?"), QMessageBox::Yes | QMessageBox::No); if (ret != QMessageBox::Yes) From 8ea6b92ea98bced2fcef2d099dd3a6d50ec4290c Mon Sep 17 00:00:00 2001 From: apeltauer Date: Tue, 21 Nov 2017 10:53:47 +0100 Subject: [PATCH 3/3] Comment set name of combiview tab 2 Comment set name of combiview tab 2 --> if some one adds a new tab this will always be overwritten. --> in line 83 the project widget is comment. So i think line 129 should also be comment --- src/Gui/CombiView.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Gui/CombiView.cpp b/src/Gui/CombiView.cpp index a46d10974b..c0e7a29349 100644 --- a/src/Gui/CombiView.cpp +++ b/src/Gui/CombiView.cpp @@ -126,7 +126,7 @@ void CombiView::changeEvent(QEvent *e) if (e->type() == QEvent::LanguageChange) { tabs->setTabText(0, trUtf8("Model")); tabs->setTabText(1, trUtf8("Tasks")); - tabs->setTabText(2, trUtf8("Project")); + //tabs->setTabText(2, trUtf8("Project")); } DockWindow::changeEvent(e);