SOLVESPACE -- parametric 2d/3d CAD

(you are viewing a thread; or go back to list of threads)

Make a gear (by normandajc)
I realise a gear. I give you a example
alpha = 20 degres
module m= 0.5 or 0.6 or 0.8 or 1 or 1.25 or ......
number of teeth z = 17 or more
pitch diameter d = m * z
base diameter db = d*cos(alpha)
outside diameter do = d + 2*m
root diameter dr = d - 2.5 *m
angle = 360 / z /2

with alpha =20 m=5 z=20
d=100 db=93.97 do=110 dr=87.5 angle=9

active "g002-sketch-in-plane " modified the value
active "g004-rotate" changed repeat ( z number of teeth )
you can try
Sat Jul 18 2015, 02:31:16, download attachment gear.slvs
(no subject) (by whitequark)
The entity hit testing is really slow on this file. I wonder if it could be easily improved...
Sat Jul 18 2015, 03:57:45
(no subject) (by Jonathan Westhues)
That gear (a) steps and repeats all the construction geometry, not just the final tooth form, and (b) assembles all the teeth together as solid Boolean operations, instead of just piecing together curves. So with some small changes, the regeneration time and entity count can be greatly reduced, as attached.

Though hit testing could be improved too. You could accelerate the existing code with a bounding box test, or with an O(log n) data structure for the entities, but either of those would add complexity. The simplest option might be to let gl do the test with a selection buffer. That might even be a net reduction in lines of code, and might benefit naturally from any later work to speed up rendering.
Sat Jul 18 2015, 13:23:58, download attachment gear_faster.slvs
(no subject) (by normandajc)
your version is better my initial program a lot.
I modified slightly your program. gear_faster2.slvs

Thank you
Mon Jul 20 2015, 05:09:05, download attachment gear_faster2.slvs
(no subject) (by Jonathan Westhues)
gear_faster2 still steps and repeats the construction geometry; so you have one copy per tooth of all the circles and stuff, even though they're all exactly coincident. So regeneration is faster, but entity selection is still slow.

I was lazy and just retraced the tooth form in a second group, since you'd already sketched it in the first one. The cleanest way to draw the gear would be to put only the construction geometry in one group, put the tooth form in a second group, and then step and repeat the second group. That's fast, avoids duplication, and also makes the constraints easier to follow (since the tooth form can depend on the construction geometry but not vice versa).
Mon Jul 20 2015, 10:07:39
(no subject) (by normandajc)
Actually, it is better.
Thank you for the explanations
Mon Jul 20 2015, 14:06:48
Post a reply to this comment:
Your Name:
Your Email:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):
© 2008-2018 SolveSpace contributors. Most recent update Nov 22 2018.