MCPcopy
hub / github.com/CadQuery/cadquery / bezier

Method bezier

cadquery/cq.py:1574–1605  ·  view source on GitHub ↗

Make a cubic Bézier curve by the provided points (2D or 3D). :param listOfXYTuple: Bezier control points and end point. All points except the last point are Bezier control points, and the last point is the end point :param includeCurrent: Use the cur

(
        self: T,
        listOfXYTuple: Iterable[VectorLike],
        forConstruction: bool = False,
        includeCurrent: bool = False,
        makeWire: bool = False,
    )

Source from the content-addressed store, hash-verified

1572 return self.newObject([p])
1573
1574 def bezier(
1575 self: T,
1576 listOfXYTuple: Iterable[VectorLike],
1577 forConstruction: bool = False,
1578 includeCurrent: bool = False,
1579 makeWire: bool = False,
1580 ) -> T:
1581 """
1582 Make a cubic Bézier curve by the provided points (2D or 3D).
1583
1584 :param listOfXYTuple: Bezier control points and end point.
1585 All points except the last point are Bezier control points,
1586 and the last point is the end point
1587 :param includeCurrent: Use the current point as a starting point of the curve
1588 :param makeWire: convert the resulting bezier edge to a wire
1589 :return: a Workplane object with the current point at the end of the bezier
1590
1591 The Bézier Will begin at either current point or the first point
1592 of listOfXYTuple, and end with the last point of listOfXYTuple
1593 """
1594 allPoints = self._toVectors(listOfXYTuple, includeCurrent)
1595
1596 e = Edge.makeBezier(allPoints)
1597
1598 if makeWire:
1599 rv_w = Wire.assembleEdges([e])
1600 if not forConstruction:
1601 self._addPendingWire(rv_w)
1602 elif not forConstruction:
1603 self._addPendingEdge(e)
1604
1605 return self.newObject([rv_w if makeWire else e])
1606
1607 # line a specified incremental amount from current point
1608 def line(self: T, xDist: float, yDist: float, forConstruction: bool = False) -> T:

Callers 2

test_bezier_curveMethod · 0.45
test_bezierFunction · 0.45

Calls 6

_toVectorsMethod · 0.95
_addPendingWireMethod · 0.95
_addPendingEdgeMethod · 0.95
newObjectMethod · 0.95
makeBezierMethod · 0.80
assembleEdgesMethod · 0.80

Tested by 2

test_bezier_curveMethod · 0.36
test_bezierFunction · 0.36