Grasshopper

algorithmic modeling for Rhino

i want to creat a new list in c# component,but how to declare it?

For example (just for example),the input "dis" is list access of "double",i need to creat a new list the same stucture but in "int" in the C# component....Thank you very much!

 

Views: 433

Replies to This Discussion

Hi Andrea,

 

If you right click in the middle of the C# Script component you will get this context menu:

Where you will be able to:

1) define the inputs

2) change the specific input's properties

3) Change the name of the input

4) access the type of input menu

5) change the structure of inputs

6) select the type of input.

    Danny,Thank you very much for rapid reply,but,may be i didnot show it clearly.....so change the way in another case:i just want the "A"(output)to be "int" instead of"double"(i know i can use "int component",but i dont know how to do it the same in C#),,,,so,in this case i must to creat a List of "int" in C#...then transfer it to A.

 

You cannot associate a type with script outputs. They will accept whatever you shove in there. If you shove in doubles, you'll get doubles. If you shove in integers, you'll get integers. If you shove in IEnumerable(Of Integer), you'll get lists of integers.

 

If you want to convert doubles into ints, you can use:

 

A = Convert.ToInt32(myDoubleValue)

 

The System.Math namespace provides some methods for specific rounding behaviour if you don't like Convert.ToInt32().

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

i understand,Thank u David

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service