# Selecting Curves without User Input

**URL:** <https://discourse.mcneel.com/t/selecting-curves-without-user-input/58357>\
**Category:** Rhino for Windows\
**Tags:** rhinopython\
**Created:** [March 19, 2018, 5:34am UTC](https://discourse.mcneel.com/t/selecting-curves-without-user-input/58357 "2018-03-19T05:34:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ZKislost](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/zkislost/32/148493_2.png) [@ZKislost](https://discourse.mcneel.com/u/ZKislost)\
**Post date:** [March 19, 2018, 5:34am UTC](https://discourse.mcneel.com/t/selecting-curves-without-user-input/58357/1 "2018-03-19T05:34:48Z")

</div>

I want to be able to select objects in a layer without the get object command. I realize I can make use of the select object by layer command, but i have more then one curve in the layer. So after i select the objects in the layer, i want to further select just a few of them.  
I was hoping to just pick by length or draw a bounding box and list them and then select.  
But i have no idea how to do both. I want to do this without having to select the curve myself, trying to automate a small bit in a modelling process. Any help/examples would be greatly appreciated. Preferably in code form, i always understand better that way.

---

<div class="post-metadata">

**Author:** ![Helvetosaur](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/helvetosaur/32/635974_2.png) [@Helvetosaur](https://discourse.mcneel.com/u/Helvetosaur)\
**Post date:** [March 19, 2018, 8:40am UTC](https://discourse.mcneel.com/t/selecting-curves-without-user-input/58357/2 "2018-03-19T08:40:12Z")

</div>

Well, one way to go about this would be to first get the objects on the layer as a general list, then use one or more criteria to filter that list into what you want…

```python
import rhinoscriptsyntax as rs

target_len=100.0
tolerance=1.0
#get a list of all objects on the layer you want
layer_objs=rs.ObjectsByLayer("LayerName")
if layer_objs:
    #create an empty list
    good=[]
    for obj in layer_objs:
        #find curves among the objects
        if rs.IsCurve(obj):
            if abs(rs.CurveLength(obj)-target_len)<tolerance:
                #curve meets selection criteria, append to "good" list
                good.append(obj)
#the object IDs in [good] (if any) will be the curves on specified layer
#that also meet the length criteria within tolerance
print "{} curves found with target length".format(len(good) if good else "No")

```

---

<div class="post-metadata">

**Author:** ![ZKislost](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/zkislost/32/148493_2.png) [@ZKislost](https://discourse.mcneel.com/u/ZKislost)\
**Post date:** [May 8, 2018, 1:23am UTC](https://discourse.mcneel.com/t/selecting-curves-without-user-input/58357/3 "2018-05-08T01:23:34Z")

</div>

Hey Sorry for thelate reply but thank you so so much 😄 definitely helped me out at work 🙂
