I have try to convert program from Grasshopper in Rhino 7 with IronPython to Grasshopper in Rhino 8 with both IronPython and Python3 but not successful.
This error are intend after compiled it to a component
It would be great if anyone can suggest me on how to fixed it.
Here are what I have try
There are 5 different source:
- Code A, SDK and Class(component) with ghenv.Component in class
from ghpythonlib.componentbase import executingcomponent as component
import Grasshopper
import System
import Rhino
import rhinoscriptsyntax as rs
class MyComponent(component):
def RunScript(self, x, y):
a = 1
blWarn = ghenv.Component.RuntimeMessageLevel.Warning
ghenv.Component.AddRuntimeMessage(blWarn, "Balloon Message")
ghenv.Component.Message = "Component Message"
return a
- Code B, SDK and Class(component) but use self instead of ghenv.Compoent in class
from ghpythonlib.componentbase import executingcomponent as component
import Grasshopper
import System
import Rhino
import rhinoscriptsyntax as rs
class MyComponent(component):
def RunScript(self, x, y):
a = 1
blWarn = self.RuntimeMessageLevel.Warning
self.AddRuntimeMessage(blWarn, "Balloon Message")
self.Message = "Component Message"
return a
- Code C, SDK and Class(GH_ScriptInstance) with ghenv.Compoent in class
import System
import Rhino
import Grasshopper
import rhinoscriptsyntax as rs
class MyComponent(Grasshopper.Kernel.GH_ScriptInstance):
def RunScript(self, x, y):
blWarn = ghenv.Component.RuntimeMessageLevel.Warning
ghenv.Component.AddRuntimeMessage(blWarn, "Balloon Message")
ghenv.Component.Message = "Component Message"
a = 1
return a
- Code D, SDK and Class(GH_ScriptInstance) but use self instead of ghenv.Compoent in class
import System
import Rhino
import Grasshopper
import rhinoscriptsyntax as rs
class MyComponent(Grasshopper.Kernel.GH_ScriptInstance):
def RunScript(self, x, y):
blWarn = self.RuntimeMessageLevel.Warning
self.AddRuntimeMessage(blWarn, "Balloon Message")
self.Message = "Component Message"
a = 1
return a
- Code E, Procedure Mode with ghenv.Compoent
blWarn = ghenv.Component.RuntimeMessageLevel.Warning
ghenv.Component.AddRuntimeMessage(blWarn, "Balloon Message")
ghenv.Component.Message = "Component Message"
a = 1
On Rhino 7
-
Complied Component with Code A will give an error

-
Complied Component with Code B are working properly.
On Rhino 8
Build Target is Rhino 8
-
Complied Component with Code A or Code C, will give an error

-
Code B or Code D, Can’t Compile as an error
-
Complied Component with Code E are working properly. !!! this in procedure mode
Here are test overview and attached code
rh8_message.zip (80.5 KB)
Thank you very much



