In Rhino8(8.2), I found when I run
print (len(rs.ObjectsByType(4)))
it gets different results in python3 and python2(ironpython)
In python2 it works fine to get only curve objects, but in python3, it gets all objects.
Hi @tpuaup, i can repeat that using Rhino 8 (8.3.23360.13001, 2023-12-26)
_
c.
Hi,
That bug is logged here.
Thanks for reporting it.
On the latest Rhino8 I get false results using Python 3 and 2. Maybe the issue is not only related to the version of Python. For example:
blocks = rs.ObjectsByType(4096, False, 1) #4096 = blocks
for block in blocks:
print(rs.IsBlockInstance(block))
should output only True
, but I also get False
. ObjectByType actually catches all the object of the scene here.
The bitwise comparisons to geometry_filter like if geometry_filter & Rhino.DocObjects.ObjectType.Surface: bSurface = True
and elif object_type & geometry_filter:
are all evaluating to true, so it ends up including extra stuff.
This issue was reported before and is solved in 8.7 / 8.8 RC
RH-80145 ScriptEditor: Python 3 does not consider ObjectType.None as False
Would you mind installing and testing this? Thank you!