Grasshopper

algorithmic modeling for Rhino

Hello,

 

I am new to scripting in GH, but have some experience in scripting.

 

I am having trouble making a simple boolean conditional that outputs one of two inputs, based on a boolean value.

 

I am not getting errors on the "out" channel, but I am not getting any Curves out of the output channel, either.

 

Any help would be greatly appreciated.

 

private void RunScript(Curve Curve1, Curve FlipCurve, bool Bool, ref object CurveOut) 

{   

Curve CurveOut;   

if (Bool){     

CurveOut = FlipCurve;    }   

 

else {     

CurveOut = Curve1;    } 

}



 

aaron

Views: 401

Attachments:

Replies to This Discussion

Hi Aaron,

The output argument is passed by reference, so you should not declare a local variable CurveOut inside the RunScript method. Remove the first line (Curve CurveOut;) and it should work.

Cheers,
Sridevi

 

Sridevi,

 

That fixed it, Thanks!

 

aaron

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