Gh.rotate not working properly

Hello everyone
I’m doing a project that needs to be done with coding in python and i’m kinda new to scripting in grasshopper python. I’m trying to rotate a Vector that i get from Evaluatecurve, in 90 degrees, but the results i’m getting are very strange and i can’t figure out the problem.

ghpython-rotate.gh (5.4 KB)

Vector rotation is not quite the same as geometry rotation. You may be converting the vector to a point, rotating the point through space, then converting the result back into a vector again.

There’s a specific component for vector rotation only, (also called “Rotate” unfortunately).

Thank you for the reply David
aha, so that’s the case ! Then is this vector rotation component included in the ghpythonlib.components ? can i access it through python ?

I don’t know, this is as far as my python knowledge goes. You can however create a Rhino.Geometry.Transform and apply it to the vector without relying on the components.

I will give it a try. Thanks you so much for your help

As discussed lately on the forum, I think you’ll find that it’s ultimately simpler to perform geometry computations directly in RhinoCommon (i.e. and not through ghpythonlib). Here’s an example of rotating a vector in GHPython:

181011_RotateVector_00.gh (4.1 KB)

I assume this method is what is implemented in the Grasshopper vector rotate component.

1 Like