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.

rotate a vector and points

otaolafrotaolafr Member Posts: 113 EDU
hello,
how can I rotate vectors and points around a line with a given angle in FS? (to move them by the angle given)
as opTransform only accepts bodies....

Tagged:

Answers

  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,173
    opTransform is for rotating geometry in the context.  For transforming vectors (and other things like lines and planes) you can just multiply the transform by the point:
    var myTransform = rotationAround(myLine, 30 * degree);
    var newPoint = myTransform * (vector(1, 2, 3) * meter);
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • otaolafrotaolafr Member Posts: 113 EDU
    edited August 2019
    opTransform is for rotating geometry in the context.  For transforming vectors (and other things like lines and planes) you can just multiply the transform by the point:
    var myTransform = rotationAround(myLine, 30 * degree);
    var newPoint = myTransform * (vector(1, 2, 3) * meter);
    i cant succed to make it work....
    trying this :(point1 and 2 are previously defined)
    var Line1=line(point1,point2);
    var transf=rotationAround(X_AXIS,definition.xangle);
    var linerotated= transf*Line1;

    it needed a unit. thanks!
  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,173
    Without the specific error (including line number) and the whole feature, it's impossible to debug.  Please post a link to a public document.
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • otaolafrotaolafr Member Posts: 113 EDU
    Without the specific error (including line number) and the whole feature, it's impossible to debug.  Please post a link to a public document.
    it is okey, actually when i tried same thing that you told me with vectors, it didnt work, but after i gave them units it worked. so, i solved to translate the points and after do the line.

    thanks anyway
  • yudhi_ariadiyudhi_ariadi Member Posts: 1
    Yes, we can do with a line, but I hope I dont have to create a line only for rotating the entity. 
    using point and vector would be fantastic.
    Thank you.
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,308
    Yes, we can do with a line, but I hope I dont have to create a line only for rotating the entity. 
    using point and vector would be fantastic.
    Thank you.
    You don’t have to create a physical line - the Line object is a point (with units) and a vector (unitless)
    Senior Director, Technical Services, EMEAI
Sign In or Register to comment.