diff --git a/src/Mod/Ship/shipAreasCurve/TaskPanel.py b/src/Mod/Ship/shipAreasCurve/TaskPanel.py index 01389551a..e027f5f9e 100644 --- a/src/Mod/Ship/shipAreasCurve/TaskPanel.py +++ b/src/Mod/Ship/shipAreasCurve/TaskPanel.py @@ -31,7 +31,6 @@ from PyQt4 import QtGui,QtCore import Preview, Plot import Instance from shipUtils import Paths, Translator -from surfUtils import Geometry from shipHydrostatics import Tools as Hydrostatics class TaskPanel: @@ -114,7 +113,7 @@ class TaskPanel: """ Set initial values for fields """ # Get objects - selObjs = Geometry.getSelectedObjs() + selObjs = Gui.Selection.getSelection() if not selObjs: msg = Translator.translate("Ship instance must be selected (no object selected)\n") App.Console.PrintError(msg) diff --git a/src/Mod/Ship/shipLoadExample/TaskPanel.py b/src/Mod/Ship/shipLoadExample/TaskPanel.py index 2ab325d7d..b325a9236 100644 --- a/src/Mod/Ship/shipLoadExample/TaskPanel.py +++ b/src/Mod/Ship/shipLoadExample/TaskPanel.py @@ -28,7 +28,6 @@ import FreeCADGui as Gui from PyQt4 import QtGui,QtCore # Module from shipUtils import Paths, Translator -from surfUtils import Geometry class TaskPanel: def __init__(self): diff --git a/src/Mod/Ship/shipOutlineDraw/Plot.py b/src/Mod/Ship/shipOutlineDraw/Plot.py index 682c15678..004ab9b40 100644 --- a/src/Mod/Ship/shipOutlineDraw/Plot.py +++ b/src/Mod/Ship/shipOutlineDraw/Plot.py @@ -27,7 +27,6 @@ from FreeCAD import Base, Vector import Part # FreeCADShip modules from shipUtils import Paths, Translator -from surfUtils import Geometry def Plot(scale, sections, shape): """ Creates the outline draw. @@ -52,7 +51,7 @@ def Plot(scale, sections, shape): x0 = xMid - 0.5*xTot y0 = 297.0 - yMid - 0.5*yTot # 297 = A3_width # Get border - edges = Geometry.getEdges([shape]) + edges = self.getEdges([shape]) border = edges[0] for i in range(0,len(edges)): border = border.oldFuse(edges[i]) # Only group objects, don't try to build more complex entities @@ -95,3 +94,31 @@ def Plot(scale, sections, shape): FreeCAD.ActiveDocument.OutlineDrawPlot.addObject(FreeCAD.ActiveDocument.OutlineDrawUpView) FreeCAD.ActiveDocument.recompute() return obj + +def getEdges(self, objs=None): + """ Returns object edges (list of them) + @param objs Object to get the faces, none if selected + object may used. + @return Selected edges. None if errors happens + """ + edges = [] + if not objs: + objs = FreeCADGui.Selection.getSelection() + if not objs: + return None + for i in range(0, len(objs)): + obj = objs[i] + if obj.isDerivedFrom('Part::Feature'): + # get shape + shape = obj.Shape + if not shape: + return None + obj = shape + if not obj.isDerivedFrom('Part::TopoShape'): + return None + objEdges = obj.Edges + if not objEdges: + continue + for j in range(0, len(objEdges)): + edges.append(objEdges[j]) + return edges diff --git a/src/Mod/Ship/shipOutlineDraw/TaskPanel.py b/src/Mod/Ship/shipOutlineDraw/TaskPanel.py index 834738a0c..c49abcd0d 100644 --- a/src/Mod/Ship/shipOutlineDraw/TaskPanel.py +++ b/src/Mod/Ship/shipOutlineDraw/TaskPanel.py @@ -30,7 +30,6 @@ from PyQt4 import QtGui,QtCore import Preview, Plot import Instance from shipUtils import Paths, Translator -from surfUtils import Geometry class TaskPanel: def __init__(self): @@ -116,7 +115,7 @@ class TaskPanel: """ Set initial values for fields """ # Get selected objects - selObjs = Geometry.getSelectedObjs() + selObjs = Gui.Selection.getSelection() if not selObjs: msg = Translator.translate("Ship instance must be selected (no object selected)\n") App.Console.PrintError(msg)