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.

# translate sketch points

simon_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

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.

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

- Create a point at X = eccentricity, using:
var eccentricity = definition.eccentricity;

eccentricity /= millimeter; var pointPoint = vector(eccentricity, 0) * millimeter;

- Rotate by the amount equivalent to the "rolling" of the small circle around the large one, using the matrix rotation method linked above:
var twist2 = [[cos(pointAngle2), -sin(pointAngle2)],[sin(pointAngle2), -cos(pointAngle2)]] as Matrix ;

**Translate the point in X by large_radius + small_radius + eccentricity. This is what I am stuck on...**- 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.

0

## Comments

954✭✭✭✭✭https://cad.onshape.com/documents/d8aab1e0e7ae10038a6830e0/w/9dfdd631d025960813b8f2df/e/6b31655a7a9d2f16aa0f4cc9

1,419Instead of multiplying, add the translation vector to the point in question:

As far as matrix math goes, 2D translation is not a Linear transformation in two dimensions, but it is in three dimensions, so you could use the following formula to construct an equation:

but it's a lot of extra work when you can just add the desired translation to the point you already have.

https://en.wikipedia.org/wiki/Translation_(geometry)

3✭Thank you too, @Jake_Rosenfeld; I remembered/worked out the vector addition after submitting the discussion but it was stuck with the moderator so I couldn't update with my solution. Glad I didn't otherwise I wouldn't have found out about the Curve generator.

954✭✭✭✭✭https://cad.onshape.com/documents/f10204aa10d2bbfffb901440/w/2b4f74ba225afb77672c06aa/e/62f90c4c46ddc1dd5986025c