-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
26 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,8 +17,7 @@ def torus_knot(p, q): | |
), | ||
auxSpine = Workplane().rect(1, 1) | ||
) | ||
).clean() | ||
|
||
) | ||
p = 3 | ||
q = 2 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |