replace Part.Line with Part.LineSegment

This commit is contained in:
wmayer
2016-11-30 21:25:18 +01:00
parent 19237df7bf
commit c3fe2de155
40 changed files with 238 additions and 238 deletions

View File

@@ -112,7 +112,7 @@ def edgesForCommands(cmds, startPt):
if cmd.Name in movecommands:
pt = pointFromCommand(cmd, lastPt)
if cmd.Name in movestraight:
edges.append(Part.Edge(Part.Line(lastPt, pt)))
edges.append(Part.Edge(Part.LineSegment(lastPt, pt)))
elif cmd.Name in movearc:
center = lastPt + pointFromCommand(cmd, FreeCAD.Vector(0,0,0), 'I', 'J', 'K')
A = lastPt - center
@@ -210,7 +210,7 @@ class Chord (object):
return self.End - self.Start
def asLine(self):
return Part.Line(self.Start, self.End)
return Part.LineSegment(self.Start, self.End)
def asEdge(self):
return Part.Edge(self.asLine())
@@ -434,7 +434,7 @@ class ObjectDressup:
debugPrint("smooth: (%.2f, %.2f)-(%.2f, %.2f)" % (edge.Vertexes[0].Point.x, edge.Vertexes[0].Point.y, edge.Vertexes[1].Point.x, edge.Vertexes[1].Point.y))
for e in wire.Edges:
self.dbg.append(e)
if type(e.Curve) == Part.Line:
if type(e.Curve) == Part.LineSegment:
debugPrint(" (%.2f, %.2f)-(%.2f, %.2f)" % (e.Vertexes[0].Point.x, e.Vertexes[0].Point.y, e.Vertexes[1].Point.x, e.Vertexes[1].Point.y))
else:
debugPrint(" (%.2f, %.2f)^%.2f" % (e.Curve.Center.x, e.Curve.Center.y, e.Curve.Radius))
@@ -522,9 +522,9 @@ class ObjectDressup:
vb1 = FreeCAD.Vector(length, -self.toolRadius, 0)
vm2 = FreeCAD.Vector(length + self.toolRadius, 0, 0)
boneBot = Part.Line(vb1, vb0)
boneLid = Part.Line(vb0, vt0)
boneTop = Part.Line(vt0, vt1)
boneBot = Part.LineSegment(vb1, vb0)
boneLid = Part.LineSegment(vb0, vt0)
boneTop = Part.LineSegment(vt0, vt1)
# what we actually want is an Arc - but findIntersect only returns the coincident if one exists
# which really sucks because that's the one we're probably not interested in ....

View File

@@ -46,7 +46,7 @@ def findholes(obj):
for h in facelist:
for w in h.Wires:
for c in w.Edges:
if ( isinstance(c.Curve,Part.Line)):
if ( isinstance(c.Curve,Part.LineSegment)):
v0=Base.Vector(c.Vertexes[0].X, c.Vertexes[0].Y, c.Vertexes[0].Z); v1=Base.Vector(c.Vertexes[1].X,c.Vertexes[1].Y, c.Vertexes[1].Z)
if (v1.sub(v0).x == 0) and (v1.sub(v0).y == 0):
lsp = Base.Vector(h.BoundBox.Center.x,h.BoundBox.Center.y,h.BoundBox.ZMax)

View File

@@ -202,7 +202,7 @@ class ObjectDrilling:
for e in subobj.Edges:
if isinstance (e.Curve, Part.Circle):
cedge.append(e)
elif isinstance (e.Curve, Part.Line):
elif isinstance (e.Curve, Part.LineSegment):
ledge.append(e)
if len(cedge) == 2 and len(ledge) == 1:
drillable = True

View File

@@ -43,7 +43,7 @@ def makeAreaVertex(seg):
segtype = int(seg.Curve.Axis.z) # 1=ccw arc,-1=cw arc
vertex = area.Vertex(segtype, area.Point(seg.valueAt(seg.LastParameter)[0], seg.valueAt(
seg.LastParameter)[1]), area.Point(seg.Curve.Center.x, seg.Curve.Center.y))
elif isinstance(seg.Curve, Part.Line):
elif isinstance(seg.Curve, Part.LineSegment):
point1 = seg.valueAt(seg.FirstParameter)[
0], seg.valueAt(seg.FirstParameter)[1]
point2 = seg.valueAt(seg.LastParameter)[

View File

@@ -109,13 +109,13 @@ def silhouette(obj):
def isSameEdge(e1, e2):
"""isSameEdge(e1,e2): return True if the 2 edges are both lines or arcs/circles and have the same
points - inspired by Yorik's function isSameLine"""
if not (isinstance(e1.Curve, Part.Line) or isinstance(e1.Curve, Part.Circle)):
if not (isinstance(e1.Curve, Part.LineSegment) or isinstance(e1.Curve, Part.Circle)):
return False
if not (isinstance(e2.Curve, Part.Line) or isinstance(e2.Curve, Part.Circle)):
if not (isinstance(e2.Curve, Part.LineSegment) or isinstance(e2.Curve, Part.Circle)):
return False
if type(e1.Curve) != type(e2.Curve):
return False
if isinstance(e1.Curve, Part.Line):
if isinstance(e1.Curve, Part.LineSegment):
if (DraftVecUtils.equals(e1.Vertexes[0].Point, e2.Vertexes[0].Point)) and \
(DraftVecUtils.equals(e1.Vertexes[-1].Point, e2.Vertexes[-1].Point)):
return True
@@ -232,7 +232,7 @@ def filterArcs(arcEdge):
splitlist.append(eseg2)
else:
splitlist.append(s)
elif isinstance(s.Curve, Part.Line):
elif isinstance(s.Curve, Part.LineSegment):
pass
return splitlist