CadQuery / cadquery

A python parametric CAD scripting framework based on OCCT
https://cadquery.readthedocs.io
Other
3.05k stars 284 forks source link

Cannot create a free standing bezier curve #1637

Open lenianiva opened 1 month ago

lenianiva commented 1 month ago

In Sketch.bezier, the previous _endPoint has to exist before a bezier can be generated:

    def bezier(
        self: T,
        pts: Iterable[Point],
        tag: Optional[str] = None,
        forConstruction: bool = False,
    ) -> T:
        """
        Construct an bezier curve.

        The edge will pass through the last points, and the inner points
        are bezier control points.
        """
        p1 = self._endPoint()
        val = Edge.makeBezier([Vector(*p) for p in pts])

        return self.edge(val, tag, forConstruction)

Is there any particular reason for this? With this I can't create a loop consisting entirely of bezier curves, for example

adam-urbanczyk commented 1 month ago

No good reason. For now you could create your bezier using cq.Edge.makeBezier and add it using cq.Sketch.edge.