Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Plugin Request] Gear Generator #1

Open
jmwright opened this issue Mar 8, 2021 · 5 comments
Open

[Plugin Request] Gear Generator #1

jmwright opened this issue Mar 8, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@jmwright
Copy link
Member

jmwright commented Mar 8, 2021

There has been some great work done on gears in the GitHub issues and on Discord. It would be nice to capture a gear generator as a plugin.

@jmwright jmwright added the enhancement New feature or request label Mar 8, 2021
@meadiode
Copy link
Contributor

Hi, I've been working on another CadQuery gear generator for some time.
Just released more or less usable version: CQ_Gears v0.45, no documentation or tests yet, but there are some commented examples.
Please feel free to try it out, any feedback appreciated. Thanks!

@jmwright
Copy link
Member Author

@meadiode Feel free to open a PR to add your plugin as a third-party plugin here.

@Jojain
Copy link
Contributor

Jojain commented Aug 26, 2021

I can't try this now but how stable is your version? Sometimes I have problems with script that won't produce the same shapes upon runs while not changing parameters. It is especially true for helical gears.

I've looked quickly the code for the bevel gear and im not sure what approach you use, the math associated are quite complex and figuring it out just by reading code is a bit of a pain. I would be interested in talking about it to see if we had similar approach and to try to understand why my approach would generate such bugs

@meadiode
Copy link
Contributor

@Jojain
When it comes to parameters that are proven to work at least once, then I would say it's stable. Honestly, I haven't seen such an issue where given parameters work one time and then fail the other time.
However, when constructing a gear (yeah, especially a bevel gear), it's quite often when some sets of parameters just don't work, especially if you give some close to extreme values. But suddenly they start to work if you modify that parameters by adding some miniscule values to them, like e.g. adding 0.0003 to the cone_angle parameter which is e.g. 72.0 degrees.

Generally, my approach is to construct each tooth face(cq.Face) individually, then clone that face in a circular pattern to form the whole gear face, then also construct top and bottom faces. Then, stitch the resulting faces together into a shell(cq.Shell) internally using BRepBuilderAPI_Sewing. Then, make a solid out of that shell and finally apply to that solid the usual CadQuery operations such as extrude, cutThruAll etc. to form a hub, a borehole, spokes etc.
To construct a tooth face, first I build a 2d array of 3d-points by sweeping a tooth profile curve along a line (or a helical curve). Then, to actually produce a cq.Face, the resulting array is passed to cq.Face.makeSplineApprox, which internally uses GeomAPI_PointsToBSplineSurface.
So, here it is, not much else to that, I think.
I haven't checked your code yet, but what is your approach?

@Jojain
Copy link
Contributor

Jojain commented Aug 31, 2021

@meadiode
Do you have such problems with your lib as needing to add miniscule value to some parameter to make it work ? If it's the case how does your lib fails ? You get an error or the resulting shape is not valid?

My approach is different in a way that I don't create surfaces and assemble them into a solid but directly use solid operations.
I think it's the main difference and probably what cause some troubles. For exemple the approach of the helical bevel gear is to create several wires of the tooth cross section along the tooth face width and male a loft passing by all the wires.
Once this done, in same way as you I clone this tooth in a circular pattern an union this with a base cone.

I have however experience the same problem on spur helical gears as a non valid shape for some run of the script (but not always, which is the weird part) even thought they don't use loft but twistedExtrude.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants