Added support for bezier curves for isHorizontal/isVertical.

This commit is contained in:
Markus Lampert
2017-09-27 21:39:26 -07:00
parent e6927d7979
commit 6bf9a9758f
2 changed files with 28 additions and 2 deletions

View File

@@ -154,10 +154,13 @@ class PathGeom:
PathLog.error(translate('PathGeom', "face isVertical(%s) not supported") % type(obj.Surface))
return None
if obj.ShapeType == 'Edge':
if type(obj.Curve) == Part.Line:
if type(obj.Curve) == Part.Line or type(obj.Curve) == Part.LineSegment:
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)
if type(obj.Curve) == Part.BezierCurve:
# the current assumption is that a bezier curve is vertical if its end points are vertical
return cls.isVertical(obj.Curve.EndPoint - obj.Curve.StartPoint)
PathLog.error(translate('PathGeom', "edge isVertical(%s) not supported") % type(obj.Curve))
return None
PathLog.error(translate('PathGeom', "isVertical(%s) not supported") % obj)
@@ -180,10 +183,12 @@ class PathGeom:
PathLog.error(translate('PathGeom', "face isHorizontal(%s) not supported") % type(obj.Surface))
return None
if obj.ShapeType == 'Edge':
if type(obj.Curve) == Part.Line:
if type(obj.Curve) == Part.Line or type(obj.Curve) == Part.LineSegment:
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)
if type(obj.Curve) == Part.BezierCurve:
return cls.isRoughly(obj.BoundBox.ZLength, 0)
PathLog.error(translate('PathGeom', "edge isHorizontal(%s) not supported") % type(obj.Curve))
return None
PathLog.error(translate('PathGeom', "isHorizontal(%s) not supported") % obj)