函数Workplane.spline()
基于点集在当前工作平面上构建样条曲线。
Workplane.spline(points, tangents=None)
points
: 由点组成的列表。每个点必须是由两个浮点数组成的元组。列表中至少需要传入两个点以构建曲线,最多可以传入16个点。tangents
: 可选参数,包含曲线首尾的切线向量。如果传入两个向量,它们将分别被用作曲线起点和终点处的切线向量。返回一个新的Workplane
对象,该对象表示由给定点集生成的曲线。
import cadquery as cq
points = [(0, 0), (10, 5), (15, 10), (20, 25)]
path = cq.Workplane("XY").spline(points)
solid = path.rect(5, 5).extrude(10)
show_object(solid)
Workplane.spline()
生成的曲线经过点集中的每个点,并在每个点处平滑过渡。ValueError
: 当点列表中的元素数少于2或多于16时抛出。