Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
Bevel gear pair generator
fma
Member Posts: 87 ✭✭
Hi!
I started to learn FeatureScript by writing a bevel gear pair generator. I already did such generator using OpenScad, so this is more a port than a complete writing. So far, I successfully generate the gear pair without teeth; gears are represented by their primitive diameters. Here is my code:
https://cad.onshape.com/documents/9b04fb889def400dfd4a693f/w/dfc27fc3b2e79b5b8271c77f/e/786005a281331572a0efe88b
Even if I have a teeth routine in my Openscad design (not written by me), I think it would be better to use code from the FeatureScript 'Spur Gear', written by Neil:
https://cad.onshape.com/documents/5742c8cde4b06c68b362d748/v/c65839fc6078faeb4d2aece1/e/01a666571e625f8b819fd75b
Before going further, I would be interested by your feedback about my code; as it is my first FeatureScript, it is certainly not optimized! Feel free to comment; the idea is to have a good base to implement the next stop: adding teeth! Any advice for this welcome to.
Thanks,
PS : my OpenScad design is at the end of the FeatureScript.
I started to learn FeatureScript by writing a bevel gear pair generator. I already did such generator using OpenScad, so this is more a port than a complete writing. So far, I successfully generate the gear pair without teeth; gears are represented by their primitive diameters. Here is my code:
https://cad.onshape.com/documents/9b04fb889def400dfd4a693f/w/dfc27fc3b2e79b5b8271c77f/e/786005a281331572a0efe88b
Even if I have a teeth routine in my Openscad design (not written by me), I think it would be better to use code from the FeatureScript 'Spur Gear', written by Neil:
https://cad.onshape.com/documents/5742c8cde4b06c68b362d748/v/c65839fc6078faeb4d2aece1/e/01a666571e625f8b819fd75b
Before going further, I would be interested by your feedback about my code; as it is my first FeatureScript, it is certainly not optimized! Feel free to comment; the idea is to have a good base to implement the next stop: adding teeth! Any advice for this welcome to.
Thanks,
PS : my OpenScad design is at the end of the FeatureScript.
0
Comments
Looks like a great project! One suggestion: when you post a link to your document in the forum, please make a version first and post a link to the version. Otherwise, we can't see the functioning state -- it looks like you're in the middle of editing your code and it's temporarily broken.
https://cad.onshape.com/documents/9b04fb889def400dfd4a693f/v/f4e7bddcdb7b3b08522113d5/e/786005a281331572a0efe88b
One note -- I'm not an expert on gear math, but the bevel gear tooth shape is different than the spur gear tooth shape. Googling talks about something called an "octoid", but finding equations for it seems harder.
What about the code? I don't like much the duplication; any advice to avoid that?
Regarding code duplication, I think the way to avoid it is similar to what you did in OpenSCAD: write a function that creates a single beveled gear and call it twice, once for each in the pair. Making the function argument a map tends to make the code more readable IMO (that's why definition for feature is a map).
It's a great resource that explains the theories and formulas for a bunch of different gear types.
The stiffer the material/geometry and the more critical the applications - the greater the need for accurate profiles. Gear designers usually don't worry about trying to model gear teeth accurately for those scenarios. They usually have a symbolic representation of the model and place the qualifying information on a drawing that is meant for manufacturing information and QA requirements based on the manufacturing equipment and inspection equipment being used to make/validate the parts. I've attached a sample set of qualifying information for a simple spur gear set
Another set of good resource on gears and profile information is any book by one of the pioneers of modern gear design: Earle Buckingham. Here's one: https://www.amazon.com/Analytical-Mechanics-Gears-Earle-Buckingham/dp/0486657124
By the way, kudos on approaching this as designing a set of gears - you're best off with this approach.
I successfully generated the teeth; how do I tell Onshape to add them to the main part? Do I have to specifically use a boolean operator? I'm using opPattern() to copy the tooth all around...
https://cad.onshape.com/documents/9b04fb889def400dfd4a693f/v/7e4070a95d663f4afeb156f3/e/786005a281331572a0efe88b
Next step will be to use a better profile, and correct little mis-alignements.
Could we trouble you for options of shaft diameters and woodruff key slots?
Happy coding,
OwS.
Edited for speeling and addition of "key"
HWM-Water Ltd
Along these lines:-
Regards, Owen S.
HWM-Water Ltd
Certainly learned a thing or two reading through the code.
https://cad.onshape.com/documents/9b04fb889def400dfd4a693f/v/dd7d70b022551e8a30474897/e/786005a281331572a0efe88b
In this snapshot, the shaft hole is done between all entities, so it makes a hole in another part:
Line 318, I tried to set the defaultScope param to false, and give the booleanScope param, but doing that, I get a INVALID_INPUT...
Any help welcome.
Owen S.
HWM-Water Ltd
Also note that the ends of the teeth are flat, so don't match the bore, which is circular.
As said, this is mainly for 3D-printing, so it is OK. And I guess it is enough for design visualisation too.
Good work!