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.

translate sketch points

simon_merrettsimon_merrett Member Posts: 3
Hi, I've had a search and can't see advice addressing my issue but happy if someone wants to point me to an existing solution.

In featurescript I'm trying to create a pattern of points upon which to base a spline. I have managed to use the matrix rotation technique here  with success and I have managed to use the for loop function to create several points rotated around an axis. 

The challenge I have is that the spline points should be eccentrically rotating around a smaller circle that is in turn rotation around the larger main circle:
The origin of the large circle is the 0,0 axis cross in the bottom left.

My approach was to set the loop to
  1. Create a point at X = eccentricity, using:
    </code>var eccentricity = definition.eccentricity; </pre><pre class="CodeBlock">eccentricity /= millimeter; 
    var pointPoint = vector(eccentricity, 0) * millimeter;</pre></li><li>Rotate by the amount equivalent to the "rolling" of the small circle around the large one, using the matrix rotation method linked above:<pre class="CodeBlock"><code>var twist2 = [[cos(pointAngle2), -sin(pointAngle2)],[sin(pointAngle2), -cos(pointAngle2)]] as Matrix  ;

  2. Translate the point in X by large_radius + small_radius + eccentricity. This is what I am stuck on...
  3. Rotate the now translated point again around the origin by the small angular amount to achieve a sufficient quantity of points to create a decent spline from.

I cannot fathom the translate/transform for the points in the sketch. There aren't any examples I can find ( does anyone know if there are some in a particular FS I could get?) and when I try to follow the matrix rotation pattern approach but for translation ( array "as Vector", rather than "as Matrix") my sketch fails and the error info says "Can not multiply Vector (array) and Vector (array)".

Grateful for any help you can give! Thank you.

Comments

Sign In or Register to comment.