Issue #1:
With a new blank file containing just one layer “Default”…
In vb Rhinoscript, run the following code:
Option Explicit
Call TestAddSubLayer()
Sub TestAddSubLayer()
Call Rhino.AddLayer("Default::NewLayer")
End Sub
The layer NewLayer is added as a sublayer of Default.
Now, do the same thing with Python rhinoscriptsyntax (start with a new file):
import rhinoscriptsyntax as rs
rs.AddLayer("Default::NewLayer")
A new top-level layer is added with the name Default::NewLayer… Not how it’s supposed to work IMO…
Issue #2:
In the file created in the first step above - with a Top layer “Default” and a sublayer “NewLayer” - put one object (anything) on the sublayer “NewLayer”
In vb rhinoscript run the following and choose the object:
Option Explicit
Call TestGetObjectLayer()
Sub TestGetObjectLayer()
Dim obj : obj = Rhino.GetObject()
Call Rhino.Print(Rhino.ObjectLayer(obj))
End Sub
Returns: Default::NewLayer
Now, run the Python equivalent and do the same:
import rhinoscriptsyntax as rs
obj = rs.GetObject()
print rs.ObjectLayer(obj)
Returns: NewLayer
These sublayer issues are driving me nuts - making it very hard to script layer operations with sublayers in python rhinoscript syntax…
IMO, all rhinoscriptsyntax methods need to return the full layer path. Also, for both vb and python, optional arguments to return the layer ID instead of the name would be good.
Thanks,
–Mitch