Grasshopper Python Script

Hey everyone, I’m in the need of some help. I’m trying to transform a big grasshopper script to a single GH-Python script and I’m currently stuck at this Orient function.

So in the Orient component there are 3 inputs; G, A, B.
In my GH Script A and B are solved but I can’t seem to leave ‘G’ empty.
I tried putting “0”, “1”, an empty string, etc.
Nothing works, and when it does work, it only gives me the “generic” output.

Thanks in advance :slight_smile:

the orient tool works on geometry (G), and it take an initial plane (A) and moves, rotates and scales to the target plane (B)
it does not work without a geometry input

Yeah, I assumed so as well but in the script I received there it was without a geometry and the script works…

No sure how to help you without looking at the script. Maybe orient is not the best tool for what the script is trying to accomplish

The script itself is really big, my task is simply to make it as compact as possible with the use of GH-Python scripts… I guess I’ll try something else, but I appreciate that you took your time :slight_smile:

Hello

As we can see in the image you posted, that component is used to obtain the X output value, which is the transformation.

immagine

As Adel said, the Orient component transforms some geometry using as reference two planes.

I think in Python you can obtain that using either this method:

https://developer.rhino3d.com/api/rhinocommon/rhino.geometry.transform/planetoplane

With A as plane0 and B as plane1
or this one:

https://developer.rhino3d.com/api/rhinocommon/rhino.geometry.transform/changebasis

With B as plane0 and A as plane1

1 Like

in the screenshot looks like you are only using the X output of the Orient component, which carries the transformation of the plane A into the plane B, so if you want to rebuild that in Python I think you have to look into Transformations

1 Like

YESS! Thank you, I managed to use the transform function instead of the Orient function. I’m unsure why they used it in the first place… I appreciate you both taking your time and answering me :smiley:

1 Like

Ciao Alessandro,
haha … we replied at the same time,
and fortunately saying the same thing. :wink:

Ciao !

1 Like

Glad to help.
As I just told Alessandro, fortunately our two replies agreed. :grinning:

Yeah … don’t know … :confused: