ObjectsByName in GH Python

Hi,

I constantly get the Error:

Runtime error (MissingMemberException): 'CustomTable' object has no attribute 'GetObjectList'
Traceback:
  line 641, in ObjectsByName, "C:\Users\Martin\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\selection.py"
  line 3, in script

When executing this script in the GHPython Component

import rhinoscriptsyntax as rs

objects = rs.ObjectsByName("1027")

print objects

If I execute the same script in “regular” Python - it works.

I know, that I cannot select objects in GHPython through User Input, but I would like to select a bunch of objects from a RhinoDocument to make change the input to a GH Document by Script.

Is there a way around it with pure “Rhino Common”

Thanks
Martin

You can select objects in GHPyhton with user input. Try this :

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Grasshopper as gh
import Rhino as rh
sc.doc = rh.RhinoDoc.ActiveDoc
curves = rs.GetObjects("Select curves", 4, preselect=True)
c=[]
for obj in curves :
    c.append(rs.coercecurve(obj))
sc.doc = ghdoc 

Then to select by name, this should work :

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Grasshopper as gh
import Rhino as rh
sc.doc = rh.RhinoDoc.ActiveDoc
objects = rs.ObjectsByName("1027")
print objects
sc.doc = ghdoc