When one exports a Rhino document into DWG the whole layer tree is flattened - the parent/sublayer hierarchy is lost. The information can be preserved by using the proper export option so that the layers are named like this:
toplayer$sublayer$subsublayer
The problem:
When importing the DWG back into Rhino6, the parent/child hierarchy is not reconstructed, developers please fix that!
Failed attempt at a workaround:
I replace every $
with ::
by running a script:
import rhinoscriptsyntax as rs
from scriptcontext import doc
def rename():
currentLayersAll = rs.LayerNames()
for currentLayerName in currentLayersAll:
#print(currentLayerName)
newLayerName = currentLayerName.replace("$","::")
#print(newLayerName)
rs.RenameLayer(currentLayerName, newLayerName)
rename()
All the layers are renamed, but they do not get nested! The double colon becomes part of the layer name.
However when I print() the name of actual nested layer with rs.LayerNames() this is the output:
toplayer::sublayer::subsublayer
I am confused, how can I reconstruct the layer hierarchy when Rhino does not bother tot?