From fc8442d75e66a77d9ee666c4ad7160006ce3eaaa Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Thu, 21 Sep 2017 21:21:44 -0700 Subject: [PATCH] Added support for Sphere and SurfaceOfExtrusion to isVertical/isHorizontal. --- src/Mod/Path/PathScripts/PathGeom.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathGeom.py b/src/Mod/Path/PathScripts/PathGeom.py index 3ab7a549cc..0b4f120998 100644 --- a/src/Mod/Path/PathScripts/PathGeom.py +++ b/src/Mod/Path/PathScripts/PathGeom.py @@ -147,16 +147,21 @@ class PathGeom: return cls.isHorizontal(obj.Surface.Axis) if type(obj.Surface) == Part.Cylinder: return cls.isVertical(obj.Surface.Axis) - PathLog.error(translate('PathGeom', "isVertical(%s) not supported") % type(obj.Surface)) + if type(obj.Surface) == Part.Sphere: + return True + if type(obj.Surface) == Part.SurfaceOfExtrusion: + return cls.isVertical(obj.Surface.Direction) + PathLog.error(translate('PathGeom', "face isVertical(%s) not supported") % type(obj.Surface)) return None if obj.ShapeType == 'Edge': if type(obj.Curve) == Part.Line: return cls.isVertical(obj.Vertexes[1].Point - obj.Vertexes[0].Point) if type(obj.Curve) == Part.Circle or type(obj.Curve) == Part.Ellipse: return cls.isHorizontal(obj.Curve.Axis) - PathLog.error(translate('PathGeom', "isVertical(%s) not supported") % type(obj.Curve)) + PathLog.error(translate('PathGeom', "edge isVertical(%s) not supported") % type(obj.Curve)) return None PathLog.error(translate('PathGeom', "isVertical(%s) not supported") % obj) + return None @classmethod def isHorizontal(cls, obj): @@ -168,16 +173,21 @@ class PathGeom: return cls.isVertical(obj.Surface.Axis) if type(obj.Surface) == Part.Cylinder: return cls.isHorizontal(obj.Surface.Axis) - PathLog.error(translate('PathGeom', "isHorizontal(%s) not supported") % type(obj.Surface)) + if type(obj.Surface) == Part.Sphere: + return True + if type(obj.Surface) == Part.SurfaceOfExtrusion: + return cls.isHorizontal(obj.Surface.Direction) + PathLog.error(translate('PathGeom', "face isHorizontal(%s) not supported") % type(obj.Surface)) return None if obj.ShapeType == 'Edge': if type(obj.Curve) == Part.Line: return cls.isHorizontal(obj.Vertexes[1].Point - obj.Vertexes[0].Point) if type(obj.Curve) == Part.Circle or type(obj.Curve) == Part.Ellipse: return cls.isVertical(obj.Curve.Axis) - PathLog.error(translate('PathGeom', "isHorizontal(%s) not supported") % type(obj.Curve)) + PathLog.error(translate('PathGeom', "edge isHorizontal(%s) not supported") % type(obj.Curve)) return None PathLog.error(translate('PathGeom', "isHorizontal(%s) not supported") % obj) + return None @classmethod