From 4287cd490e3816fdf4a06bbdc2220808e05c322b Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Tue, 23 Nov 2021 17:11:56 +0800 Subject: [PATCH] remove clean --- examples/torus_knot.py | 3 +-- test.py | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 test.py diff --git a/examples/torus_knot.py b/examples/torus_knot.py index 75aca1d..9c30eb9 100644 --- a/examples/torus_knot.py +++ b/examples/torus_knot.py @@ -17,8 +17,7 @@ def torus_knot(p, q): ), auxSpine = Workplane().rect(1, 1) ) - ).clean() - + ) p = 3 q = 2 diff --git a/test.py b/test.py new file mode 100644 index 0000000..75aca1d --- /dev/null +++ b/test.py @@ -0,0 +1,25 @@ +from cqmore import Workplane +from cqmore.curve import torusKnot, parametricEquation +from cqmore.polygon import star + +from cadquery import Plane, Vector + +def torus_knot(p, q): + origin = torusKnot(0, p = p, q = q) + v1 = Vector(*torusKnot(0.9, p = p, q = q)) + v2 = Vector(*torusKnot(0.1, p = p, q = q)) + + return (Workplane(Plane(origin = origin, normal=(v2 - v1))) + .makePolygon([(p[0] * 0.5, p[1] * 0.5) for p in star()]) + .sweep( + Workplane().parametricCurve( + parametricEquation(torusKnot, p = p, q = q) + ), + auxSpine = Workplane().rect(1, 1) + ) + ).clean() + +p = 3 +q = 2 + +knot = torus_knot(p, q) \ No newline at end of file