Grasshopper

algorithmic modeling for Rhino

Hi everyone, I'm struggling with using Python to extract a series of isocurves from some surfaces using the rs.extractisocurve command. As you can see in the file/image, I'm able to start getting curves on the rectangles, but they come out wrong on a non-orthogonal surface. The exact thing I want to achieve is shown with the two Grasshopper IsoCurve components in the file. I feel I'm close, but just missing something. 

I'd greatly appreciate any help, thanks!

Views: 1414

Attachments:

Replies to This Discussion

It's because AddPlanarSrf creates a trimmed surface, which takes the UVs of the "untrimmed" surface, not what you actually see there.

A way to get around it would be to replace (line 17):

boun_srf_plot = rs.AddPlanarSrf(i)[0]

With:

boun_srf_plot = rs.AddNetworkSrf(rs.coercecurve(i).Explode())

Not guaranteed in all cases, but should work for you here.

Thanks, that solved that problem. Very useful to know. But now for some reason I cannot get the full list of isocurves to extract. I've set my 'xrange' and 'yrange' variables to generate uv extraction coordinates based on the input sliders. This works perfectly when they output to the native Grasshopper isocurve components, as shown. But I can't get them to successfully feed into the extractisocurve function in my script. Is there a simple way to replicate what the Grasshopper isocurve components are doing in this file?

Thanks for any help!

Attachments:

Basically I see the problem as not being able to iterate through my list of 'xrange', 'yrange' values when evaluating the surfaces. I can choose any of the individual values by stating, for example, xrange[0], but not all. 

If my 'xrange' list of u values is:

{0.8, 0.0, 0.0}
{0.6, 0.0, 0.0}
{0.4, 0.0, 0.0}
{0.2, 0.0, 0.0}

and 'yrange' list of v values is:

{0.0, 0.8, 0.0}
{0.0, 0.6, 0.0}
{0.0, 0.4, 0.0}
{0.0, 0.2, 0.0}

Then how would I be able to evaluate each surface for each of these? The following will not work:

myisolist = []

for i in plot_surface:

myiso = rs.EvaluateSurface(i,xrange,yrange)

myisolist.append(myiso)

Thanks again to anyone who could lend a hand. 

Do you want to iterate over all of the u & v values for each surface?

Try something like:

for srf in plotSurface:

    for u in uRange:

        for v in vRange:

            myIsoList.append(rs.EvaluateSurface(srf, u, v))

Hi wil, ah yes, that makes perfect sense. I will try this when I get to work. To extract each isocurve, would I then just continue this as follows?:

for srf in plotSurface:

   for u in uRange:

      for v in vRange:

         myIsoList.append(rs.EvaluateSurface(srf, u, v))

         for i in myIsoList:

            myIsoCurves.append(rs.ExtractIsoCurve(srf, i, 2))

After trying many different methods, I cannot get these isocurves to extract. I thought a data tree structure was avoidable, but if it is not (I'm receiving ironpython.list errors, which I hope my correct curves are hiding in), I've tried to implement a data tree structure without success. What am I doing wrong? I've began to have dreams (nightmares) in code, haha. Thanks so much to anyone who can help me solve this, I'm sure the answer to this will pave the way to a greater understanding for how GH and Python work. 

Attachments:

I've attached an example to show how data trees work inside python. It's a little more complicated than it needs to be (especially considering how simple it is to do with the gh component) but it should show the concept well enough.

Attachments:

Thanks wil, that's what I was struggling with. I need to take some time and absorb this data tree syntax. Much appreciated. 

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service