rs.SelectObjects GUID problem

Hello
I have a problem with selecting curves via rhinoscript and its driving me nuts. I imported a dxf and want to select the curves for trimming (not with GetObjects). After importing I select all objects, check for curves, get rid of empty lists and flatten it because its nested.

 # create curves-list
 kat_objs = []
 kat_sublayers = rs.LayerChildren("01_Kataster")
 for l in kat_sublayers:
     objs = rs.ObjectsByLayer(l)
     if objs:
         objs = [rs.coercecurve(x) for x in objs if rs.IsCurve(x) == True]
         kat_objs.append(objs)
 
 # remove emty lists in list
 kat_crvs = [x for x in kat_objs if x != []]

def flatten(list):
    return [item for sublist in list for item in sublist]
crvs = flatten(kat_crvs)

# tried also with coercing items as guid, curve, object etc.
ids = [rs.coercecurve(id) for id in crvs]

crvs looks like this: [<Rhino.Geometry.PolylineCurve object at 0x0000000000001090 [Rhino.Geometry.PolylineCurve]>, <Rhino.Geometry.PolylineCurve object at 0x0000000000001091 [Rhino.Geometry.PolylineCurve]>]

When I want to select them with rs.SelectObjects(crvs) or rs.SelectObjects(ids) I get the “Parameter must be a Guid or string representing a Guid” error.

I also tried all kinds of rs.coerceXXX with the crvs-list but can’t get the “id’s”

Any help very welcome, thanks!

HI
You have used the rs.coercecurve() function to convert the guid to Geometry. So try this code
objs = [x for x in objs if rs.IsCurve(x) == True]

hey naruto, thank you very much, you were rigth of course!