Hi All!
Have been trying to call Rhino5 by Cpython 2.7.10 COM calls to automate some items. Have tried to implement the following code from discussion above but get the following error:
AttributeError: ‘NoneType’ object has no attribute ‘QueryInterface’ upon execution at the line: rs = RS.QueryInterface(IRhinoScript.IRhinoScript)
Has anyone encountered a similar problem? Seems like I must be missing something simple.
import comtypes.client
from comtypes.client import GetModule
from comtypes.client import CreateObject
name="Rhino5x64.Interface"
tlb = "C:\Program Files\Rhinoceros 5.0 (64-bit)\System\Rhino5.tlb"
tls = "C:\Program Files\Rhinoceros 5.0 (64-bit)\Plug-ins\RhinoScript.tlb"
IRhino = GetModule(tlb)
IRhinoScript = GetModule(tls)
from comtypes.client import CreateObject
Rhino = CreateObject(name)
RS = Rhino.QueryInterface(IRhino.IRhino5x64Interface).GetScriptObject()
rs = RS.QueryInterface(IRhinoScript.IRhinoScript)
rs.Print(“Hello Rhino”)