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

Method toSplines

cadquery/occ_impl/shapes.py:1638–1664  ·  view source on GitHub ↗

Approximate shape with b-splines of the specified degree. :param degree: Maximum degree. :param tolerance: Approximation tolerance. :param nurbs: Use rational splines.

(
        self: T, degree: int = 3, tolerance: float = 1e-3, nurbs: bool = False
    )

Source from the content-addressed store, hash-verified

1636 return vertices, triangles
1637
1638 def toSplines(
1639 self: T, degree: int = 3, tolerance: float = 1e-3, nurbs: bool = False
1640 ) -> T:
1641 """
1642 Approximate shape with b-splines of the specified degree.
1643
1644 :param degree: Maximum degree.
1645 :param tolerance: Approximation tolerance.
1646 :param nurbs: Use rational splines.
1647 """
1648
1649 params = ShapeCustom_RestrictionParameters()
1650
1651 result = ShapeCustom.BSplineRestriction_s(
1652 self.wrapped,
1653 tolerance, # 3D tolerance
1654 tolerance, # 2D tolerance
1655 degree,
1656 1, # dumy value, degree is leading
1657 ga.GeomAbs_C0,
1658 ga.GeomAbs_C0,
1659 True, # set degree to be leading
1660 not nurbs,
1661 params,
1662 )
1663
1664 return self.__class__(result)
1665
1666 def toNURBS(self: T,) -> T:
1667 """

Callers 3

add_shapeMethod · 0.80
circlesFunction · 0.80
trimmed_circlesFunction · 0.80

Calls

no outgoing calls

Tested by 2

circlesFunction · 0.64
trimmed_circlesFunction · 0.64