Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. 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.

Timing Belt Pulley (New FeatureScript)

TLDR: Featurescript to create timing belt pulleys. Currently supports GT2-2M and GT2-3M profiles. I'd appreciate feedback on which other profiles to support next.




This feature was created by analytically solving for points for the timing belt profile using Sympy. An iPython notebook giving more details about this process is located here:

Additional tooth profiles can be supported if the profiles are solved for. Feel free to create a PR with additional solutions if you'd like to get a profile added, or post a comment here about a profile you would like supported.

P.S.

This feature was quite the slough. Maybe it didn't need to be this difficult, but I'd love for some feedback on how to do this better. You might think that a timing belt featurescript should be around as easy as a spur gear one, except that all of the formulas for spur gears have been calculated centuries ago, and timing belt profiles are defined by modern CAD systems as sketches. Going from a drawing to a mathematically defined entity without using skConstraint (since I'd like the solution to not be dependent on initial conditions) proved to be very complex, even for a simple drawing. I'll walk through briefly how I solved for the

Here's the specification for the GT2-2M and GT2-3M belt profiles I found.


First, I convert the drawing from cartesian to polar, and define a set of variables which need to be solved.






Then I begin mathematically defining constraints as a system of equations.

At the end of the day, the pulley profile was barely solvable. I was trying to create a closed-form solution for the center distance of two pulleys given the belt length and two pulley radii, and was defeated by a (likely) unsolvable system.

Is there a better way to do this kind of drawing-defined feature in Featurescript, without having to try to analytically solve for the points? I know that I *could* use skConstraint, but I then need to guess at a good set of initial conditions to make sure the sketch doesn't become wonky at some set of parameters. I could also make a configurable part studio with a sketch inside it defining one tooth, but then how do I associate each variable with the points in the sketch?

Hopefully this can at least be guidance/a warning for others thinking of attempting the analytical solutions route.

Cheers,

Max



Comments

  • antlu65antlu65 Member Posts: 59 EDU
    edited August 2022
    Thanks for sharing and great work!

    Wanted to drop a few suggestions (just thinking out loud) on some of the things you mentioned.

    It seems like a lot of effort deriving analytical solutions to different belt geometries - perhaps it would be easier to create a configurable part studio, and then import into FeatureScript if desired. But if you enjoy it, then go for it!



    "I could also make a configurable part studio with a sketch inside it defining one tooth, but then how do I associate each variable with the points in the sketch?"
    - If you are referring to the radii and lengths that define the belt tooth profile (in the table you provided), then perhaps you could use a List Configuration Variable to set those. I've provided an example here if interested.

    "I'd like the solution to not be dependent on initial conditions... I know that I *could* use skConstraint, but I then need to guess at a good set of initial conditions to make sure the sketch doesn't become wonky at some set of parameters."
    - Perhaps your 'initial values' that you assign to the sketch geometry before applying constraints could be one of the belt profiles in your table - they already serve as a solution to the constraints, so there shouldn't be any unexpected behavior as constraints are applied.

    "I was trying to create a closed-form solution for the center distance of two pulleys given the belt length and two pulley radii"
    - I may have made a mistake in my algebra, but the expressions I'm getting are:
    φ + cot(φ) = (Lπ(R1 + R2)) / (2 * (R2 - R1)),
    d = (R2 - R1) / sin(
    φ).
    for belt-pulley angle φ, pulley radii R1, R2, total belt length L, center-center distance d, and R2 >= R1.
    I think you are correct - there probably is no explicit expression for φ and d. You can find φ numerically (φ + cot(φ) is monotonically decreasing).

    Hopefully some ideas to explore!
  • @antlu65 My original reason for solving analytically was for performance, but it seems that Circular Pattern is much faster than I expected, and scales much better than larger sketches. Well that's the answer then, thank you for this!
  • "Given the tooth count of the entire belt N, the tooth counts of the pulleys n1, n2, and the belt pitch p, one may derive the center-center distance between two pulleys from the following diagram (assuming perfectly tensioned belts):"

    - How can you solve for the center-to-center distance? I get that it's possible to make the diagram, but the actual solution I think may not be possible.

    " Could you clarify what you mean by 'initial conditions' - I usually see this term in the context of kinematics/dynamics problems?"

    - Sketches are "solved" by taking a set of initial conditions (the initial locations that the user draws the objects in), and then using an iterative optimizer to move all of the sketch bodies until the constraints given by the user converge. This is why sometimes when regenerating a sketch, if a variable is changed, the result can become very messed up from it's original design. It's because a different solution was converged to by the optimizer. The initial conditions (initial locations of the sketch entities) are what determine what solution is chosen. One advantage of an analytical solution is that this is guaranteed not to happen, since the particular solution is chosen explicitly.
  • Alex_KempenAlex_Kempen Member Posts: 248 EDU
    The center to center distance between two pulleys can be found using the equation found here:

    I also have my own belt calculator FS which you may be interested in here:
    https://cad.onshape.com/documents/9cffa92db8b62219498f89af/w/06b332ccabc9d2e0aa0abf88/e/99672d1e329b38e647d90146

    As a side note, looking at the performance analysis for your FeatureScript, it seems like you might be able to speed things up pretty dramatically by combining your extrudes into a single operation:
    opExtrude(context, id + "extrude", {<br>"entities" : ...,<br>"direction" : ...,<br>"endBound" : BoundingType.BLIND,<br>"endDepth" : (isSymmetric) ? extrudeDist / 2 : extrudeDist,<br>"startBound" : BoundingType.BLIND,<br>"startDepth" : (isSymmetric) ? extrudeDist / 2 : undefined<br>});<br>
    I'm definitely interested to see how your work progresses, particularly if you're able to make any headway in regards to supporting belts with multiple pulleys/idlers. Very impressive work so far!
    CS Student at UT Dallas
    Alex.Kempen@utdallas.edu
    Check out my FeatureScripts here:



  • antlu65antlu65 Member Posts: 59 EDU
    edited August 2022
    " Sketches are "solved" by taking a set of initial conditions (the initial locations that the user draws the objects in), and then using an iterative optimizer to move all of the sketch bodies until the constraints given by the user converge..."
    Ah, gotcha. Thanks!

    "How can you solve for the center-to-center distance? I get that it's possible to make the diagram, but the actual solution I think may not be possible."
    I think you're right - a closed-form analytical solution is probably not possible. Alex Kempen provided a link to an approximate solution which may be sufficient for your needs. Or it could serve as a great place to begin your search algorithm if you want to go the numerical route.

    The function in question is f(x) = x + cot(x) - a, and we just want to find the root. cot(x) diverges at 0 and PI, and is monotonically decreasing, so we know one and only one root exists on that interval. [Graph here]. You could use, for example, a bisection search to get as close as you like to the solution. That's the method I'm most familiar with - I use it for f(x) = x + tan(x) - a in a gear script.

    Just throwing out ideas for you to play with - keep up the great work!
  • Thank you @Alex_Kempen and @antlu65 for your responses!

    I just wanted to clarify that my main goal here was an exploration of whether analytical solutions for geometry problems was an easy thing to do. I posted this partially to warn people away from this method, since it seemed that simple seeming geometry problems can easily be un-solvable.

    I appreciate both of your numerical approaches, and they work out very well in practice!
Sign In or Register to comment.