Reading text from turned off layer

I have a couple of texts in 3D space on “Numbers” layer.

I would like to read each one of them with aDoc.Objects.FindByLayer("Numbers"). An interesting bug happens: if “Numbers” layer is turned off when Rhino file is opened, then FindByLayer method returns texts as if their TextEntity.Text property is empty ("").
If I turn on the “Numbers” layer, everything is fine.
If I turn it off, then again everything is fine.

The problem exists only if the “Numbers” layer has been turned off on the very beginning of opening of the Rhino file (and still not turned on).

I can always check if the layer is turned off/on, but still is it possible to fix this in the next release of Rhino 6?

Here is the code I am running:

import rhinoscriptsyntax as rs
import Rhino

layer = "Numbers"
id_L = [rhObj.Id  for rhObj in Rhino.RhinoDoc.ActiveDoc.Objects.FindByLayer(layer)]

for id2 in id_L:
    textEnt = rs.coercegeometry(id2)
    print "text: ", textEnt.Text

And the .3dm file: ObjectsByLayer.3dm (39.4 KB)

Hi @djordje - I couldn’t reproduce that here. Which version of Rhino 6 are you running?

Hi Wim,
You were right. Updating it to the latest Rhino solved the problem.

1 Like