Grasshopper

algorithmic modeling for Rhino

Hello,

I am having trouble with normals vector on my definition :

The element from the same tree branch have different plane orientation.

I would like to unify them to match a single vector direction.

Would you know how to do such thing ?

Thank you very much fro your time.

Marc.

Views: 3878

Replies to This Discussion

I've tried to open your definition, but it looks like I'm missing some plugin,

maybe it would be easier to help if you could "isolate" the problematic  part of definition?

Can you open the file without trouble now ?

Marc,
just had a thought, is your goal to cover the whole surface with planes oriented in the same direction?
Because it might be impossible due to the nature of the Moebius surface...

Attachments:

Dear Artyom,

I am trying to make some elements from my geometry avoid colission.

I am sure that it is a vector problem. What I don't know is how I should recompite the normal for them to match a proper orienation.

All red, orange and yellow should be oriented in respect to their group.

The problem I think is that each red, orange and yellow components are individually oriented. That creates collission between the elements. This is what I am trying to avoid

Marc,

I guess you don't get around doing this without a script.

You need to flip your surfaces with Surface.Transpose(), Surface.Reverse(0),Surface.Reverse(1).

 

This can be a bit tricky depending on how random your surface directions are.

You normally need to have a reference geometry as a guide.

In principle something like the code below. This works with a reference point and a surface. Please note that the script below works in principle and not for all conditions but could help you writing your own and give some guidance. Let me know if this is helpful. I can also assist later with getting it right.

 

There are also a few tools out there (including the flipComponent in Grasshopper) which could be helpful.

 

Best,

 

Ralf

 

private void RunScript(DataTree<Surface> treeSrfPanels, List<Point3d> treePtAll, ref object A)
  {

 

DataTree<Surface> treeSrfPanelsNewDomain = new DataTree<Surface>();

 

    for(int i = 0; i < treeSrfPanels.BranchCount; i++)

    {

      List<Surface> listBrepPanels = new List<Surface>();

      GH_Path path01 = new GH_Path(i);

 

      for(int j = 0; j < treeSrfPanels.Branch(i).Count; j++)

      {

        Surface panel;

        panel = treeSrfPanels.Branch(i)[j];

        double u;

        double v;

 

        panel.SetDomain(0, (new Interval(0, 1)));

        panel.SetDomain(0, (new Interval(0, 1)));

        panel.SetDomain(1, (new Interval(0, 1)));

        panel.SetDomain(1, (new Interval(0, 1)));

 

        panel.ClosestPoint(treePtAlln[j], out u, out v);

        Print("u: {0} v: {1}", u, v);

        u = Math.Round(u);

        v = Math.Round(v);

        Print("u: {0} v: {1}", u, v);

 

        if(u == 0 && v == 0)

        {

          panel = panel.Reverse(1);

          panel = panel.Transpose();

        }

        if(u == 1 && v == 0)

        {

          //panel = panel.Reverse(0);

        }

        if(u == 0 && v == 1)

        {

          panel = panel.Reverse(0);

          panel = panel.Reverse(1);

        }

        if(u == 1 && v == 1)

        {

          panel = panel.Transpose();

          panel = panel.Reverse(1);

          //panel = panel.Reverse(0);

        }

        listBrepPanels.Add(panel);

        treeSrfPanelsNewDomain.AddRange(listBrepPanels, path01);

        listBrepPanels.Clear();

      }

    }

 A = treeSrfPanelsNewDomain;
  }

Hello Ralf, I don't get anything about what you sent.

It seems fairly difficult to apply to my specifc problem don't you think ?

Thank you.

Hi Marc,

Ralf is not an alien, just another great architect with programming knowledge.
Those German architectural faculties seems to have pretty good program :)

He gave you a code for the C# component. You need to plug in the anchor points of your vectors and all those surfaces. Component will sort all their surface normal vectors into the same direction:

Attachments:

Thank you Djordje. I knew it was a script. However It is not what I needed.

I trying to make some elements from my geometry avoid colission.

I am sure that it is a vector problem. What I don't know is how I should recompute the normal for them to match a proper orientation.

All red, orange and yellow should be oriented in respect to their group.

The problem I think is that each red, orange and yellow components are individually oriented. That creates collission between the elements. This is what I am trying to avoid

Thank you.

Marc

That's exactly what Ralf's component does: flips the surface normals to a proper orientation.
Check his post bellow.

Marc,

My appologies. I had a brief look at your definition and saw a few c#/vb components etc. I thought you're not too far off to understand the script above.

And it's not really complicated. I should have explained it a bit better - djordje is right, it's a c#-script you need to paste into a c# component.

 

What it actually does is, it takes a surface, re-parametrizes it (Set.Domain) and with a reference point(closest point) it checks 4 conditions (4 possible positions of the first corner/vertex in the surface). Depending on the uv-coordinates of the closest point it flips the surface around.

 

The script I've posted takes 4 possible positions into account. The sketch below shows 8 possible orientations of a surface. With a reference geometry you need to isolate one condition and flip the surface with Transose(), Reverse(0) and Reverse(1) and a combination of the methods.

 

So far so good.

 

If I rightly understand your problem above, then you need to define let's say a reference point on the side your normals need to point to,  for each group and then re-orient your vectors. But I'm not entirely sure if that's what you want.

Could you isolate the definition and post it? Just right-click on the relevant input components and from the drop-down menu use internalize data.

 

Best,
Ralf

 

 

 

Attachments:

Thank you for the explanation.

I am also posting the internalise component.

It will be amazing if you could have a look.

Best regards.

Marc

Marc,

 

I'm not quite sure what you are trying to achieve. I can see that the ellipse normals have different directions but I can't tell from that what is the result that you would like to get at. In which direction do you want the normals to point? Which groups belong together? Do you want them to be aligned with the underlying mesh?

It would be great if you could do a little hand sketch that shows what you excactly want. I think I know how to do it but would need a bit more clarity.

There is also a "funny object" in your definition. Looks like one of your lists don't match up and produce additional ellipses in the highlighted location.

Cheers,

 

Ralf

 

 

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service