Closed Jojain closed 5 months ago
An exemple of parameters that lead to wrong geometry, even though the parameters should yield a valid result.
from gear_generator import Gear
m = 1.5
z = 22
b = 12
alpha = 14
helix_angle = 40
simple = Gear(m, z, b, alpha=alpha, raw = False, helix_angle=helix_angle).build()
@Jojain Is this ready to be reviewed?
@jmwright yes !
There is a serious bug here in cq/OCCT, I went to see why the windows Gear test was failing and the result is that upon runs without any changes the result is either valid or not.
I just hit twice the render button in cq-editor and I got the above result. And it's not a graphical bug but a kernel bug since the obtained volumes are respectively : 10033.574314576623 for the valid shape and -6642.4418367933495 for the wrong one
I gave it another look and the problem seems rather complicated to identify. The problem seems to be most likely happening on helical gears but by trying enough I also got a non valid spur gear.
If someone wants to look in depth in my implementation to try identify what's wrong that would be appreciate, otherwise I will let it like this for now, so you can reject the PR.
I might look at it again and more in depth in the future but right now I prefer focusing on other things.
Maybe this is interesting/helpful for you https://github.com/meadiode/cq_gears ?
I have seen that. I'm not planning to modify my implementation any time soon and he said that his were stable so if people needs gears I think we are better to lead them to his repo than mine.
That being said, (about the bevel gear at least) he created his gear by constructing faces and then assemble them into solid while I worked with 3D operation and the result is less stable.
It think its something to keep in memory that when you want to make something quite complex and very reusable it's probably better to use the face stiching approach
@Jojain I don't know that the conversation on this PR ever finished, but how would you feel about me merging this plugin? We could put a note at the top of the readme if it will be buggy for users.
@jmwright Feel free to merge it. The issue encountered back then were from the kernel which I have no control over it. The issue might have disappeared with newer version of OCCT.
I'm creating a new PR since I have rewrote most of the gear generator plugin (started here #13 ) with classes , becauseI think it is better to use and to work upon.
I have removed the gears that weren't mature enough, I may add them later as other PR but for now it will be easier to start with a few.
I've worked quite a lot on the maths of the bevel gears and they are now way more robust and flexible. However for the bevel gears and the spur gear, it happens that some set of parameters leads to non valid geometry. This happens mostly with helical gear. I don't have a set of parameter to reproduce the issue but one can try different value for the parameters and will enventually encounter it but I will post one when I got one I am quite confident with my modelization so I assume that on these cases the problem comes from OCP/OCCT