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.
How to Transform Sketch points/curves
First, I am very new to FeatureScript, so please be patient. I need to transform several points in a sketch and have not been able to find any examples or documentation (that I can understand enough to piece together into something useful... yet). My thought was to simply use the 2D rotation matrix, something like what is shown below (which I know will not work!). In general, if someone could point me to where I can find examples on how to do linear algebra like operations (e.g. create matrices and multiply them) and transforms on points/lines/curves within a sketch I would greatly appreciate it. It appears there is lots of functionality (even SVD, which is great!), although I am struggling on how to utilize it.
// create 2D rotation "matrix"<br>const rotMat = [ [cos(angle), -sin(angle)], [sin(angle), cos(angle)] ];<br><br>// create a 2D "vector"<br>var point1 = vector(0 , 1) * inch;<br>// or maybe:<br>var point1 = [0 * inch, 1 * inch];<br><br>// now rotate/transform the vector with the rotation matrix<br>point1 *= rotMat;