Pattern grooves on cylindrical surfaces

368 views
Skip to first unread message

shrekuntu

unread,
Dec 4, 2021, 10:43:35 AM12/4/21
to CadQuery
In cadquery, is it possible to do grooved patterns on cylinders. Typically, these are pattern grooves in rubber lagging on conveyor pulleys, like attached pic shows. These patterns can be diamond, herringbone, chevron
lagging-grooves.jpg

Adam Urbanczyk

unread,
Dec 6, 2021, 4:14:04 PM12/6/21
to CadQuery
You could try: 2xsketch + 2xtwistExtrude + union to get the final shape.

Adam Urbanczyk

unread,
Dec 9, 2021, 12:39:20 PM12/9/21
to CadQuery
Here is some code if it helps:

import cadquery as cq

r = 20

s1 = cq.Sketch().circle(r).edges().distribute(20).rect(1,2).clean()
s2 = cq.Sketch().circle(r,mode='c',tag='c').edges(tag='c').distribute(20).rect(1,2).clean()

w = cq.Workplane()

w1 = w.placeSketch(s1).twistExtrude(2*r, 90)
w2 = w.placeSketch(s2).twistExtrude(2*r, -90)

res = w1.union(w2, clean=True, tol=1e-2)

show_object(res)

Roger Maitland

unread,
Dec 22, 2021, 4:16:57 PM12/22/21
to shrekuntu, CadQuery
Is this the type of thing you are looking for?
r = 10
c = 2 * pi * r
d = 4 * (c / 10) / 3
pattern_wires = (
cq.Workplane("XY")
.hexArray(d, 10, 5, center=(True, False))
.polygon(6, 0.8 * d)
.wires()
.vals()
)
mapped_wires = [w.mapToCylinder(r) for w in pattern_wires]
mapped_faces = [cq.Face.makeNSidedSurface(w.Edges(), []) for w in mapped_wires]
pos_pattern = cq.Compound.makeCompound(
[f.thicken(f.flipNormal() * 1) for f in mapped_faces]
)
pos_patterned_cylinder = cyl.fuse(pos_pattern, glue=True)

if "show_object" in locals():
show_object(pattern_wires, name="pattern_wires")
show_object(pos_patterned_cylinder, name="pos_patterned_cylinder")

which results in:
patterned_cylinder.png
The pattern is arbitrary, as long as you can draw it, it should be mappable. This code took 2.13s to run on my old laptop. As the pattern is a Compound object it could be cut from the cylinder as well (which takes a few seconds longer).

I still have more work to do to integrate it with the workplane class but I'd appreciate any feedback you have.

Cheers,
Roger
P.S. I'm actually working on writing text on a cylinder to label parts in one of my projects and this just kind of fell out.
On Sat, Dec 4, 2021 at 10:43 AM shrekuntu <shre...@gmail.com> wrote:
In cadquery, is it possible to do grooved patterns on cylinders. Typically, these are pattern grooves in rubber lagging on conveyor pulleys, like attached pic shows. These patterns can be diamond, herringbone, chevron

--
cadquery home: https://github.com/CadQuery/cadquery
post issues at https://github.com/CadQuery/cadquery/issues
run it at home at : https://github.com/CadQuery/CQ-editor
---
You received this message because you are subscribed to the Google Groups "CadQuery" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cadquery+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cadquery/ad59c34f-f430-4e52-8a45-642ad750c9c2n%40googlegroups.com.

shrekuntu

unread,
Dec 24, 2021, 10:33:08 AM12/24/21
to CadQuery
Hey Adam and Roger. Thank you both very much for your generous help, I appreciate it.
I tried both of your solutions but coudn't run either due to an error.

In Adam's code I get AttributeError: module 'cadquery' has no attribute 'Sketch'. I tried to run the skecth example from the cq docs, same error. It must be something wrong with my setup then, eh?
With Roger's code I get AttributeError: 'Workplane' object has no attribute 'hexArray'

I'm running this in cq-editor

One observation in Roger's code. Would it be possible to have partial hexes at the edge of the cylinders, this code only fits whole hex and leaves a gap where it can't fit the whole hex, is patrial hex with cut-off possible?

Thanks again to both of you.
Reply all
Reply to author
Forward
0 new messages