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.
How can I optimize this FS?
EFish
Member Posts: 16 EDU
I am currently finishing up a Belt and Pulley generating FS for FRC and have noticed a few areas that add a lot of generation time, some I know why, but others I don't quite understand (such as line 350's extrude). If anyone has any suggestions on where I can optimize the FS, or if there are any tips on good optimization methods, I'd love to know! Thanks in advance!
Here is a link:
https://cad.onshape.com/documents/028ca8fb10baf53e1f6fce96/w/b1250a450d0ba88f0a8b1811/e/2a05bf271725b7afd76cabe0
Here is a link:
https://cad.onshape.com/documents/028ca8fb10baf53e1f6fce96/w/b1250a450d0ba88f0a8b1811/e/2a05bf271725b7afd76cabe0
FRC Team 2471 Designer - Alumni
Seattle Pacific University - Mechanical Engineering
efishg2020@gmail.com
Seattle Pacific University - Mechanical Engineering
efishg2020@gmail.com
Tagged:
0
Best Answer
-
Alex_Kempen Member Posts: 248 EDU
https://cad.onshape.com/documents/9cffa92db8b62219498f89af/w/06b332ccabc9d2e0aa0abf88/e/99672d1e329b38e647d90146
Don't mind me, I'm just pulling your leg.
In terms of optimization, calling the onshape extrude feature is almost always less performant than calling opExtrude followed by opBoolean. The same goes for mirror; fortunately, you can make your own mirror pretty easily using mirrorAcross and opPattern (mirror is actually just an opPattern under the hood. The more you know!).
Also, I see you're using sketch constraints, which are probably worse for performance when compared to just using math to figure out where things should go. The hardest part is doing the circle tangents, but you could probably figure those out by stealing the math from my FeatureScript posted above, or by taking advantage of the circle to circle function (which I stole from the official belt fs) here:
https://cad.onshape.com/documents/4c21d0c3c89c0a81aadfdac6/w/a7ccf556a74ce09cd04151e0/e/2a1cde3849e2f7d4ef1b6676
If you want to nerd out about FeatureScripts, I've also been doing a little thinking regarding updating my own belt FS. There's some cool advanced things that could be done, like adding support for multiple pulleys and maybe even adding savable pulley profiles. If you were interested, I would be totally down to collab and make something super cool. Just a thought.
CS Student at UT DallasAlex.Kempen@utdallas.eduCheck out my FeatureScripts here:1
Answers
Seattle Pacific University - Mechanical Engineering
efishg2020@gmail.com
https://cad.onshape.com/documents/9cffa92db8b62219498f89af/w/06b332ccabc9d2e0aa0abf88/e/99672d1e329b38e647d90146
Don't mind me, I'm just pulling your leg.
In terms of optimization, calling the onshape extrude feature is almost always less performant than calling opExtrude followed by opBoolean. The same goes for mirror; fortunately, you can make your own mirror pretty easily using mirrorAcross and opPattern (mirror is actually just an opPattern under the hood. The more you know!).
Also, I see you're using sketch constraints, which are probably worse for performance when compared to just using math to figure out where things should go. The hardest part is doing the circle tangents, but you could probably figure those out by stealing the math from my FeatureScript posted above, or by taking advantage of the circle to circle function (which I stole from the official belt fs) here:
https://cad.onshape.com/documents/4c21d0c3c89c0a81aadfdac6/w/a7ccf556a74ce09cd04151e0/e/2a1cde3849e2f7d4ef1b6676
If you want to nerd out about FeatureScripts, I've also been doing a little thinking regarding updating my own belt FS. There's some cool advanced things that could be done, like adding support for multiple pulleys and maybe even adding savable pulley profiles. If you were interested, I would be totally down to collab and make something super cool. Just a thought.
Seattle Pacific University - Mechanical Engineering
efishg2020@gmail.com