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.

Feature Script way to generate a curve pattern with linear instance spacing?

imants_smidchensimants_smidchens Member Posts: 63 EDU
Hi! I'm working on a chain generator feature script, (also belt) which takes sprocket location inputs, the chain pitch, and teeth at each sprocket, (plus the chain wrap orientation) and generates an accurate model of a chain/belt. (https://cad.onshape.com/documents/1be886df2e36b431c92b2d61/w/791200d47653055fd5d51eb7/e/17a1b8e5fd0b4440efc1c3de?configuration=pitch%3D0.008%2Bmeter%3Bteeth%3D10.0)

I am struggling to space the chain link instances evenly in such a way that the linear distance remains constant, not the distance along a curve path (i.e. not the curve pattern) 
Any suggestions on how to achieve this? i essentially need to segment a curve into a bunch of linear approximations.

Thanks in advance!

-Imants Smidchens
(some screenshots of work in progress)


Tagged:

Best Answer

  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    edited June 2021 Answer ✓
    You don't need the fs itself, the feature studio just contains chordSolver() function which you could use for searching chord end point path parameter. But if the method with arc intersection is OK for your purposes then you probably don't need it. Though if you were trying to distribute N points along path with even arc lengths you would unevitably face the need to numerically solve the system of N equations.

Answers

  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    edited June 2021
    Basically the problem is getting the coordinate of the end of the chord of a given length on a given path, starting from a given point.
    There may be two basic approaches: create a function which draws a circular arc in some angle sector in sketch coordinate system which xAxis is a path tangent line and zAxis is a path plane normal and evaluate a distance from this arc to the path. If you are lucky the arc will have one and only intersection with the path curve and you get your chord end point coordinate.
    The second approach is using some numeric solver which would take a pure function chordDiff(s) = chord(s) - chordTargetLength and solve the equation chordDiff(s)==0.

  • imants_smidchensimants_smidchens Member Posts: 63 EDU
    thanks! I can't say for sure that I understand what's going on in your FS, but I'll take a closer look at it :)

    For the time being I'm using a bunch of arcs and evdistance to find the intersections. Next up on my plate is creating accurate sag to account for differences in length between the path and the replicated instances (the last point is always too close to the start)


  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    edited June 2021 Answer ✓
    You don't need the fs itself, the feature studio just contains chordSolver() function which you could use for searching chord end point path parameter. But if the method with arc intersection is OK for your purposes then you probably don't need it. Though if you were trying to distribute N points along path with even arc lengths you would unevitably face the need to numerically solve the system of N equations.
Sign In or Register to comment.