Replies: 1 comment
-
You were right you can use an helix to sweep a profile (in that case a triangle, but you can be more creative, for instance with 45 degrees angles for better 3D printing): const {sketchHelix, draw, Plane} = replicad
function simpleThread({ innerRadius, pitch, threadHeight, toothSide }) {
const drawProfile = (plane, origin) => {
const originPlane = new Plane(origin, [0, 0, -1], plane.zDir);
return draw()
.hLine(-toothSide)
.polarLine(toothSide, 60)
.close()
.sketchOnPlane(originPlane);
};
const threadBase = sketchHelix(
pitch,
threadHeight,
innerRadius,
[0, 0, 0],
[0, 0, 1],
false
);
return threadBase.sweepSketch(drawProfile, { frenet: true });
} I then fuse it this was with the main cylinder: const thread = simpleThread({
innerRadius: 44.65,
pitch: 1.7,
threadHeight: 6.2,
toothSide: 0.8,
});
const top = R.makeCylinder(44.65, 7)
.cut(R.makeCylinder(44.65 - 1.6, 10))
.rotate(2)
.fuse(thread.clone(), { optimisation: "sameFace" }); Note that I rotate the cylinder of 2 degrees to avoid having the end of our thread start on the cylinder seam which breaks the kernel. I also use the This is the easiest way to do this - but I am not sure this is the best. The freeCAD wiki has some different method and tricks that translate quite well on what can be done in replicad. Ideally, one could port this code to replicad to make it easy for anyone to import helper functions as a library. |
Beta Was this translation helpful? Give feedback.
-
It is hard to understand the way how a thread is drawn in this example https://replicad.xyz/docs/examples/occt-bottle.
Is there an easy solution for a simple thread?
You know, I just need to revolve and lift up in the same time the triangle.
Probably sweep is what I need to learn, but was not able to till now. :(
In this example you can see the path:
Beta Was this translation helpful? Give feedback.
All reactions