# Python rs.ObjectsByType() bug

**URL:** <https://discourse.mcneel.com/t/python-rs-objectsbytype-bug/26314>\
**Category:** Scripting\
**Created:** [November 2, 2015, 4:24am UTC](https://discourse.mcneel.com/t/python-rs-objectsbytype-bug/26314 "2015-11-02T04:24:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![clement](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/clement/32/772979_2.png) [@clement](https://discourse.mcneel.com/u/clement)\
**Post date:** [November 2, 2015, 4:24am UTC](https://discourse.mcneel.com/t/python-rs-objectsbytype-bug/26314/1 "2015-11-02T04:24:12Z")

</div>

Hi @Alain,

there seems to be a “bug” with `rs.ObjectsByType()` method in python, it does not list any objects placed on hidden layers. eg. using the code below:

```auto
ids = rs.ObjectsByType(8 + 16 + 32, state=0)

```

with state=0, i get zero objects returned, compared to RhinoScript (vb), when i use this code:

```auto
Call Main()
Sub Main()
    Dim objs
    objs = Rhino.ObjectsByType(8 + 16 + 32)
    If IsNull(objs) Then 
        Rhino.Print "No Objects found"    
    Else
        Rhino.Print "Objects found: " & UBound(objs) + 1
    End If
End Sub

```

Objects on hidden layers are returned. IMHO Python behavior should not be different to RhinoScript (vb).

What do you think ?

- 

c.

---

<div class="post-metadata">

**Author:** ![menno](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/menno/32/770384_2.png) [@menno](https://discourse.mcneel.com/u/menno)\
**Post date:** [November 2, 2015, 6:09am UTC](https://discourse.mcneel.com/t/python-rs-objectsbytype-bug/26314/2 "2015-11-02T06:09:51Z")

</div>

This seems related

[http://discourse.mcneel.com/t/rs-objectsbytype-incorrect-for-clipping-planes/14920/](http://discourse.mcneel.com/t/rs-objectsbytype-incorrect-for-clipping-planes/14920/)

---

<div class="post-metadata">

**Author:** ![Alain](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/alain/32/512812_2.png) [@Alain](https://discourse.mcneel.com/u/Alain)\
**Post date:** [November 2, 2015, 10:49am UTC](https://discourse.mcneel.com/t/python-rs-objectsbytype-bug/26314/3 "2015-11-02T10:49:39Z")

</div>

Hi Clement,

Sorry the fix hasn’t made it’s way to Rhino 5 but it has been fixed in our code base as you can see following menno’s link. I’ll tag it so it’s included in SR13 if there is one.

Thanks  
Alain

---

<div class="post-metadata">

**Author:** ![clement](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/clement/32/772979_2.png) [@clement](https://discourse.mcneel.com/u/clement)\
**Post date:** [November 2, 2015, 5:14pm UTC](https://discourse.mcneel.com/t/python-rs-objectsbytype-bug/26314/4 "2015-11-02T17:14:48Z")

</div>

Thank you Menno and Alain, i am looking forward for the fix to make it into SR13 if there is one.

- 

c.
