Grasshopper

algorithmic modeling for Rhino

Hi guys,

I am trying to write a script using C# in grasshopper. The script will have two inputs X and Y and one output A. X is a list of values and Y is the length of list X.

The puesdocode is like this and it should be very simple

Convert object X to list
For each value of X if value is greater than 2 add 1 to A.
Output A

I have some experience programming in Java but as much as I read the documentation I can't work out how to do this in C# would anyone be able to help me out with the code? My biggest issue is that I don't know how to convert object X into a list it appears that it is coming into C# as just a string and NOT and list of Strings.

Any suggestions would be most appreciated cheers!

Views: 363

Attachments:

Replies to This Discussion

Hi Anton,

select 'List Access' and choose Type Hint as Integer (int) in the scroll-down that appears right-clicking input (x).

Following the same procedure, set the rest of those inputs as needed.

Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

Giulio

Thanks very much that fixed it! Cheers

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service