Grasshopper

algorithmic modeling for Rhino

Hello,

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?

Thanks!

Views: 8956

Replies to This Discussion

hi Danny
update on the code ... did a little mistake in the calculation now if the guid surface is in pi/4 parallel of the surface to flip than the surface has the same orientation (all other will be swapped)
which i didn't implemented yet is than it do not checks for the direction of the vector so maybe you have to reverse it


if (S == null)
return;

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

if(G == null)
{
A = S.Transpose();
B = true;
}
else
{
//Reparameterize
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 / 2));

if (num1 == 0)
{
A = S.Transpose();
B = true;
}
else
{
A = S;
B = false;
}
}
The new code works perfectly

Many thanks for your time and effort.
Danny

Hi Guys

 

Has this code ever been updated for the GH8.xxx Series and if not could someone post a working component containing the code  please as can't get the code to work in any C# Components , both the old legacy version or  new one.

 

All i get is Null outputs.

 

Thanks

Matt

Hi Matt

just change this two lines and it will work fine

Vector3d vec01 = new Vector3d((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));
Vector3d vec02 = new Vector3d((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));

and delete

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

on top

Hi Danny,

I'm getting the exact same problem but can't fix it. Can you post the v06.0059 component on here to download? I've wasted ages trying to sort it.

hope you can help

Thanks

Leon
I see, thanks
Hi daniel, can you upload the VB compont (SwapUV) , I copy the code to] wrote, but nothing happened. If you can upload the VB component instead of words, it would be greatly appreciated!!thanks~~
the code is c# ;)
See, thanks~~
Hi guys, I'm having some trouble with this script in v06.0059. Can someone please post a working component to download???

I have created a component but it only gives me untrimmed surfaces with no uv change. What's wrong?
just in case anyone missed it 7.0030 has a new component "flip matrix" which switches row/column or U/V

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service