@emilio wrote:
Hi all
There might be something strange with rhinoscriptsyntax.LayerVisible
Calling rs.LayerVisible seems to clear user strings attached to the layerimport Rhino import scriptcontext import rhinoscriptsyntax as rs def main(): name = rs.GetString( 'Layer name ?' ) index = scriptcontext.doc.Layers.FindByFullPath( name, -1 ) layer = scriptcontext.doc.Layers[ index ] print( 'Set user string' ) ok = layer.SetUserString( 'KEY', 'VALUE' ) if not ok: print( 'SetUserString failed' ) val = layer.GetUserString( 'KEY' ) print( 'KEY => %s' % val ) print( 'Call rs.LayerVisible' ) rs.LayerVisible( name, False ) print( 'Get user string' ) val = layer.GetUserString( 'KEY' ) print( 'KEY => %s' % val ) main()
( I’ve found that if I use the code from Rhino 5’s rhinoscriptsyntax, that is
Layer.CommitChanges instead of Layer.SetPersistentVisibility, all works fine )(6.1.18037.13441, 06/02/2018)
EvaluationThanks
Posts: 1
Participants: 1