Hi Giulio. Thank you for your excellent work! I have similar problem as RetroPost.LT @RetroPost.LT.
Here is the code:
from ghpythonlib.componentbase import executingcomponent as component
import Grasshopper, GhPython
import rhinoscriptsyntax as rs
def RunScript(self, genetic):
author = “XXX”
gh_env = ghenv gh_env.Component.Name = "Fitness Function" gh_env.Component.NickName = "Fitness Function" out_fitness = None if genetic is None: in_genetic = None else: in_genetic = genetic # ============================================================================== # ============================= START ======================================== sum_val = None if in_genetic is not None: sum_val = 0 for g in in_genetic: sum_val += g out_fitness = sum_val return out_fitness
When I put this component into canvas and loaded input it get red and says:
- Solution exception:global name ‘ghenv’ is not defined
Do you know why?