algorithmic modeling for Rhino


There must be some way to easily switch a surfaces UV coordinate reference plane (so U values will become V values and V values will become U values) but Im drawing a blank. Is there an easy way to do it?


Views: 7856

Replies to This Discussion

I have asked for this before to have a component to do this:

but if your actually after turning your rows into columns and vice versa then there is a component in the latest version of GH (0.7.00030) which will transpose the data structure. Or if using 0.6 then the path mapper can do this as well.

Hi danny and brian

If srf Is Nothing Then
End If
A = srf

srf is onsurface
Thanks to], I can add it to my user components

thanks for the help, BUT I actually dont know what you mean... I dont use any scripting tools beyond grasshopper... So is this a VBnet thing or something else? thanks!
brian, yes, bring down a component and copy the code to] wrote. Change one of the input names to srf.

how would you do that with the path mapper (for some reasons I am not usign version 0.7) it seems you can´t turn the indexes into path outputs in the lexical operation.

Hi miguel
you could also use my code or you use the pathmapper with e.g {A;B;C}(n) ->{A;B;n}(C)
Would you be able to do it with a guide surface as an input to compare UV directions against and only transpose if they are different?
hi danny
code is for 06.0059
adapt accordingly for 07

srf as Onsurface = surface to check
G as Onsurface = guide surface

If srf Is Nothing Then
End If

Dim vec01 As On3dVector = New On3dVector
Dim vec02 As On3dVector = New On3dVector

If G Is Nothing Then
srf.SetDomain(0, 0, 1)
srf.SetDomain(1, 0, 1)
G.SetDomain(0, 0, 1)
G.SetDomain(1, 0, 1)
Dim num1 As Integer = 0
vec01.Set((srf.PointAt(0.5, 0.5).x - srf.PointAt(0.0, 0.5).x), (srf.PointAt(0.5, 0.5).y - srf.PointAt(0.0, 0.5).y), (srf.PointAt(0.5, 0.5).z - srf.PointAt(0.0, 0.5).z))
vec02.Set((G.PointAt(0.5, 0.5).x - G.PointAt(0.0, 0.5).x), (G.PointAt(0.5, 0.5).y - G.PointAt(0.0, 0.5).y), (G.PointAt(0.5, 0.5).z - G.PointAt(0.0, 0.5).z))
num1 = vec01.IsParallelTo(vec02, 1.5707963267948966)
If num1 < 0 Then
End If
End If

A = srf

and for 07

if (S == null)

Vector3d vec01 = new Vector3d();
Vector3d vec02 = new Vector3d();

if(G == null)
A = S.Transpose();
B = true;
Interval I = new Interval(0, 1);
S.SetDomain(0, I);
S.SetDomain(1, I);
G.SetDomain(0, I);
G.SetDomain(1, I);
int num1 = 0;
vec01.Set((S.PointAt(0.5, 0.5).X - S.PointAt(0.0, 0.5).X), (S.PointAt(0.5, 0.5).Y - S.PointAt(0.0, 0.5).Y), (S.PointAt(0.5, 0.5).Z - S.PointAt(0.0, 0.5).Z));
vec02.Set((G.PointAt(0.5, 0.5).X - G.PointAt(0.0, 0.5).X), (G.PointAt(0.5, 0.5).Y - G.PointAt(0.0, 0.5).Y), (G.PointAt(0.5, 0.5).Z - G.PointAt(0.0, 0.5).Z));
num1 = vec01.IsParallelTo(vec02, 1.5707963267948966);
if (num1 > 0)
if (!vec01.Equals(vec02))
Surface T ;
T = S.Reverse(0);
A = T.Transpose();
B = true;
A = S.Transpose();
B = true;
//if (vec01.
A = S;
B = false;
Hi to],

I'm not that familiar with c# components in GH so please bare with me on this.

All I'm getting is NULL outputs on both A and B when I connect up surfaces to the component.

This is what I've done:

I've gone into the Input manager and removed x and y and added S and G. Then I have set the hints to surfaces for both of these inputs (v0.7). I have also added B to the output manager. Your code has not been altered in anyway.

I have created some very simple surfaces in Rhino and swapped a couple of the UV directions and used these as my inputs with the first one being the guide.
should work
you did everything fine
is your path mismatching?






  • Add Photos
  • View All

© 2021   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service