Grasshopper

algorithmic modeling for Rhino

I wonder if it's possible to run only once this component? in practice I would just determine the area of closed curves and know the layer to which they belong (I apologize but I'm really a beginner with programming C #). thanks in advance

Views: 1074

Attachments:

Replies to This Discussion

What if the curves change? Don't you want to update the data?

Hi David, thanks for your answer,

My problem is that if you select three or more curves, the component performs the operations (the same) for a number of times equal to the selected objects, but the result I want to get it right from the first "run". So i have to use Branch component:

Nope, I still don't get it, sorry.

If I understand you question correctly. Then here is my solution:

1. Change the first input (obj) to a List input. (this will now make the component run only once)

2. After you make the change, close the script editor and reopen it. Line 68 will now be automatically changed to:

private void RunScript(List<Guid> obj, ...

3. Change line 76 to:

int lIndex = doc.Objects.Find(obj[0]).Attributes.LayerIndex;

(So basically still the same code except that you replace "obj" with "obj[0]")

I hope it this answers your specific question. I think what you are trying to achieve is a bit odd but without understand fully what your end goal is, I am afraid I cannot advise futher. :)

Hi Long Nguyen, Thank you for your help it seems to solve my problems. However I apologize for the lack of clarity, but I'm really a beginner with programming in GH. Thank you all for the support.

My pleasure. Glad it helped :)

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2021   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service