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.
Introducing "Keyway Generator" feature script
konstantin_shiriazdanov
Posts: 1,221 ✭✭✭✭✭
Would like to introduce to the community my FS for generation of prismatic key joints.
One may choose between 2 types of prismatic keys and prismatic key joint for open slot in the shaft.
It allows creation of key slots in shaft, optionaly adds the key itself, and optionaly adds corresponding key slot in the bushing.
Also could be specified: angular position of the key and slots, offset from the end of the shaft, depth for slots in the shaft and bushing, length and width of the key. Currently all key joint parameters requare numeric input, and have standart FS defaults for value with units.
https://cad.onshape.com/documents/10679a4084c4454fa9967774/w/a20ace13ef8c80fcab074d23/e/e3ca70a81d4e0ad794ad2359

One may choose between 2 types of prismatic keys and prismatic key joint for open slot in the shaft.
It allows creation of key slots in shaft, optionaly adds the key itself, and optionaly adds corresponding key slot in the bushing.
Also could be specified: angular position of the key and slots, offset from the end of the shaft, depth for slots in the shaft and bushing, length and width of the key. Currently all key joint parameters requare numeric input, and have standart FS defaults for value with units.
https://cad.onshape.com/documents/10679a4084c4454fa9967774/w/a20ace13ef8c80fcab074d23/e/e3ca70a81d4e0ad794ad2359

2
Comments
-
Neat! looks good, @konstantin_shiriazdanov, seems to me like a very handy/useful feature.
Maybe opDeleteBodies on both sketches might be an idea, so one doesn't have to hide the features?"A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools." - Douglas Adams, Mostly Harmless1 -
@leon_poot yep, it's definitely should be done. another thing I'm searching solution for - default values in input fields, they should instantly represent key geometry, instead of those barrel
0 -
Nice feature! Regarding default values, if you want different defaults, you'll have to create your own bounds (see, e.g. how MODULE_BOUNDS are defined in v2 of spur gear: https://cad.onshape.com/documents/5742c8cde4b06c68b362d748/v/16a222adf3cb9a3b33ed9536/e/01a666571e625f8b819fd75b)
If you want the defaults to auto-populate based on the selected geometry, you need to write an editing logic function. You can see how this is done in the standard modifyFillet feature here: https://cad.onshape.com/documents/12312312345abcabcabcdeff/v/f9422f9ffdaa4a7259396008/e/9fa139fb0be24611874fa080Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc0 -
@ilya_baran thanks, will dig this examples . one more thing I'd like to note - the signature of rotation matrix function in documentation is
rotationMatrix3d (axis is array, angle is ValueWithUnits) returns Matrix
but really axis is vector
0 -
The rotationMatrix3d thing looks like it was left over from very old code. I'll fix it. In any case, it shouldn't prevent any usage because a Vector is always an array.Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc0


