Trying to filter lines out of planar curves/surfaces selection

Edit: something went wrong there…

Trying to filter lines out of the selection of planar curves and surfaces… So far not working

import rhinoscriptsyntax as rs

#planar curves plus planar surfaces - exclude lines
def cpcs_filt(rhino_object, geometry, component_index):
    if geometry.IsPlanar():
        if isinstance(geometry,Rhino.Geometry.Line): #or LineCurve, doesn't matter
            return False
        if isinstance(geometry,Rhino.Geometry.Curve):
            if geometry.IsLinear: return False
        return True
    return False
    
test=rs.GetObjects("Select planar stuff",4+8+16,preselect=True,select=True,custom_filter=cpcs_filt)

Hang on, I just realized I forgot to import Rhino. I think it should work after that, will test again when I get back. Yes, that was it - so you can ignore this. I always forget that it doesn’t work without importing Rhino. For the record, here is what works.

import rhinoscriptsyntax as rs
import Rhino

#planar curves plus planar surfaces - exclude lines
def cpcs_filt(rhino_object, geometry, component_index):
    if geometry.IsPlanar():
        if isinstance(geometry,Rhino.Geometry.Curve):
            if geometry.IsLinear(): return False
        return True
    return False
    
test=rs.GetObjects("Select some planar stuff",4+8+16,preselect=True,select=True,custom_filter=cpcs_filt)