Grasshopper

algorithmic modeling for Rhino

Preface: As a curious beginner to C# in GH I have a question or comment that is more about my curiosity than anything else...

I've noticed that the c# component, when written with 2 inputs (ie. x, y) will always return two outputs even when the processes involved do not depend upon the inputs.

For example: input x inputs a single brep and input y inputs a single curve, while a completely independent process that does not draw from x or y takes place and example of which is below:

// Declare array1 as 1,2,3,1

int [] array1 = {1,2,3,1};

// Optional test processes to send to A output

int aL = array1.Length;

int ai = array1[3];

// If or when either of these values are sent to A (output), A will return the correct answer in each case but in each case the answer appears twice rather than just once.  For example let's send ai to A.

A = ai;

The result ai appears at A as a two line solution of '1' and '1'.  If the output y is removed then only '1' is shown, etc.  It seems that the two inputs (x, y) cause the A to output twice, regardless of the process that is associated with A.

It'd be nice if this weren't the case...

Views: 388

Replies to This Discussion

How is Grasshopper supposed to figure out which instructions in the code should be performed only once and which should be performed for every input?

--

David Rutten

david@mcneel.com

The process of authoring a program can be described as going from ambiguous and informal representations about purpose and approach (mostly contained in the minds of programmers) to unambiguous, highly structured representations of instructions (mostly contained in computers).

Kenneth C. Arnold

The key phrase here is unambiguous.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2025   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service