Updating CadQuery library for the polyline change to CadQuery in #121.
This commit is contained in:
parent
6490e84974
commit
d40344b738
|
@ -992,12 +992,12 @@ class Workplane(CQ):
|
||||||
* If an Edge is on the stack, its end point is used.yp
|
* If an Edge is on the stack, its end point is used.yp
|
||||||
* if a vector is on the stack, it is used
|
* if a vector is on the stack, it is used
|
||||||
|
|
||||||
WARNING: only the first object on the stack is used.
|
WARNING: only the last object on the stack is used.
|
||||||
|
|
||||||
NOTE:
|
NOTE:
|
||||||
"""
|
"""
|
||||||
obj = self.objects[0]
|
obj = self.objects[-1]
|
||||||
p = None
|
|
||||||
if isinstance(obj, Edge):
|
if isinstance(obj, Edge):
|
||||||
p = obj.endPoint()
|
p = obj.endPoint()
|
||||||
elif isinstance(obj, Vector):
|
elif isinstance(obj, Vector):
|
||||||
|
@ -1657,23 +1657,33 @@ class Workplane(CQ):
|
||||||
|
|
||||||
:param listOfXYTuple: a list of points in Workplane coordinates
|
:param listOfXYTuple: a list of points in Workplane coordinates
|
||||||
:type listOfXYTuple: list of 2-tuples
|
:type listOfXYTuple: list of 2-tuples
|
||||||
:param forConstruction: should the new wire be reference geometry only?
|
:param forConstruction: whether or not the edges are used for reference
|
||||||
:type forConstruction: true if the wire is for reference, false if they are creating
|
:type forConstruction: true if the edges are for reference, false if they are for creating geometry
|
||||||
part geometry
|
part geometry
|
||||||
:return: a new CQ object with the new wire on the stack
|
:return: a new CQ object with a list of edges on the stack
|
||||||
|
|
||||||
*NOTE* most commonly, the resulting wire should be closed.
|
*NOTE* most commonly, the resulting wire should be closed.
|
||||||
|
|
||||||
Future Enhancement:
|
|
||||||
This should probably yield a list of edges, not a wire, so that
|
|
||||||
it is possible to combine a polyline with other edges and arcs
|
|
||||||
"""
|
"""
|
||||||
vecs = [self.plane.toWorldCoords(p) for p in listOfXYTuple]
|
|
||||||
w = Wire.makePolygon(vecs)
|
|
||||||
if not forConstruction:
|
|
||||||
self._addPendingWire(w)
|
|
||||||
|
|
||||||
return self.newObject([w])
|
# Our list of new edges that will go into a new CQ object
|
||||||
|
edges = []
|
||||||
|
|
||||||
|
# The very first startPoint comes from our original object, but not after that
|
||||||
|
startPoint = self._findFromPoint(False)
|
||||||
|
|
||||||
|
# Draw a line for each set of points, starting from the from-point of the original CQ object
|
||||||
|
for curTuple in listOfXYTuple:
|
||||||
|
endPoint = self.plane.toWorldCoords(curTuple)
|
||||||
|
|
||||||
|
edges.append(Edge.makeLine(startPoint, endPoint))
|
||||||
|
|
||||||
|
# We need to move the start point for the next line that we draw or we get stuck at the same startPoint
|
||||||
|
startPoint = endPoint
|
||||||
|
|
||||||
|
if not forConstruction:
|
||||||
|
self._addPendingEdge(edges[-1])
|
||||||
|
|
||||||
|
return self.newObject(edges)
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user