Create a polyline from a list of points :param listOfXYTuple: a list of points in Workplane coordinates (2D or 3D) :param forConstruction: whether or not the edges are used for reference :type forConstruction: true if the edges are for reference, false if they are f
(
self: T,
listOfXYTuple: Sequence[VectorLike],
forConstruction: bool = False,
includeCurrent: bool = False,
)
| 2690 | return self.eachpoint(lambda loc: p.moved(loc), True) |
| 2691 | |
| 2692 | def polyline( |
| 2693 | self: T, |
| 2694 | listOfXYTuple: Sequence[VectorLike], |
| 2695 | forConstruction: bool = False, |
| 2696 | includeCurrent: bool = False, |
| 2697 | ) -> T: |
| 2698 | """ |
| 2699 | Create a polyline from a list of points |
| 2700 | |
| 2701 | :param listOfXYTuple: a list of points in Workplane coordinates (2D or 3D) |
| 2702 | :param forConstruction: whether or not the edges are used for reference |
| 2703 | :type forConstruction: true if the edges are for reference, false if they are for creating geometry |
| 2704 | part geometry |
| 2705 | :param includeCurrent: use current point as a starting point of the polyline |
| 2706 | :return: a new CQ object with a list of edges on the stack |
| 2707 | |
| 2708 | *NOTE* most commonly, the resulting wire should be closed. |
| 2709 | """ |
| 2710 | |
| 2711 | # Our list of new edges that will go into a new CQ object |
| 2712 | edges = [] |
| 2713 | |
| 2714 | if includeCurrent: |
| 2715 | startPoint = self._findFromPoint(False) |
| 2716 | points = listOfXYTuple |
| 2717 | else: |
| 2718 | startPoint = self.plane.toWorldCoords(listOfXYTuple[0]) |
| 2719 | points = listOfXYTuple[1:] |
| 2720 | |
| 2721 | # Draw a line for each set of points, starting from the from-point of the original CQ object |
| 2722 | for curTuple in points: |
| 2723 | endPoint = self.plane.toWorldCoords(curTuple) |
| 2724 | |
| 2725 | edges.append(Edge.makeLine(startPoint, endPoint)) |
| 2726 | |
| 2727 | # We need to move the start point for the next line that we draw or we get stuck at the same startPoint |
| 2728 | startPoint = endPoint |
| 2729 | |
| 2730 | if not forConstruction: |
| 2731 | self._addPendingEdge(edges[-1]) |
| 2732 | |
| 2733 | return self.newObject(edges) |
| 2734 | |
| 2735 | def close(self: T) -> T: |
| 2736 | """ |