-
How to revolve a closed shape? I tried to follow the basic guide on the website. Here I learned that you can add thickness to a sketch with an extrude or revolve. I tried these methods in the following code, but I get a kernel error once I try to revolve a circle to create a donut. // addthickness experiments
/** @typedef { typeof import("replicad") } replicadLib */
/** @type {function(replicadLib, typeof defaultParams): any} */
function main(
{
Sketcher,
sketchRectangle,
sketchCircle,
})
{
let length = 60;
let width = 15;
let height = 10;
let radius = 20;
let fillet = 4;
// create a sketch to be revolved
let sketch = new Sketcher("XZ")
.hLine(width)
.threePointsArc(0,2*fillet,fillet,fillet)
.hLine(-width)
.close()
let revolved = sketch.revolve()
// create a sketch to be extruded
let rectangle = sketchRectangle(length,width,{plane: "XZ"})
let box = rectangle.extrude(30)
// create sketch of circle offset from x-axis and extrude this
let wheel = sketchCircle(radius,{plane:"XZ",origin: [30,0,0]}).extrude(2).translateY(-10)
// use same sketch and try to revolve this to create a donut => FAIL??
// let donut = sketchCircle(radius,{plane:"XZ",origin: [30,0,0]}).revolve()
box = box.fuse(wheel)
box = box.fuse(revolved)
// box = box.fuse(donut)
return box
} |
Beta Was this translation helpful? Give feedback.
Answered by
sgenoud
Jun 9, 2022
Replies: 1 comment
-
The reason is that the revolve uses the origin of the sketch for its revolution axis. You need to specify another origin like that: sketchCircle(20, {
plane: "XZ",
origin: [30, 0, 0],
}).revolve([0, 0, 1], { origin: [0, 0, 0] }); It actually might be a better default to rotate on |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
raydeleu
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The reason is that the revolve uses the origin of the sketch for its revolution axis. You need to specify another origin like that:
It actually might be a better default to rotate on
[0, 0, 0]
always by default.