Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5791

Reading text from turned off layer

$
0
0

@djordje wrote:

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)

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 5791

Trending Articles