Export/import sublayers with .dxf/dwg, .iges, step, etc

Hi all,

Just revising my batch import script a bit, and I noticed that when exporting a file with sublayers from Rhino and then re-importing it, it loses the sublayer structure.

If it’s a dxf/dwg, the layer names of sublayers become layer$sublayer, with the others it’s the Rhino sublayer notation layer::sublayer which is literally translated…

I’m assuming the first “translation” of the layer tree structure occurs on export, but then the import process does not seem to recognize the separator symbols so all layers get imported as top-level layers.

Are there any workarounds to this, or is it just “the way it is”? I could try to parse the layer names once imported and try to reestablish the tree structure, but that’s a lot of work.

Sublayers work fine of course with standard 3dm files.

Thanks, --Mitch

2 Likes

Well, it certainly makes sense that for a Rhino->“foreign export”->Rhino round trip that the user would want the sublayer notation to be reconstructed in Rhino. But what about about the import of a “foreign” file that includes the :: in a layer name that isn’t exported from Rhino?

Maybe a stretch, but just trying to suggest that the sublayer reconstruction might want to be an option. Also might be a reason beyond simple developer oversight or laziness why it’s the way it is.

Indeed seems the only option. I’m not sure if it’s very much work:

Before import collect current layers. (Make sure none have a $ symbol else flag them)

Import

Get all layers filter out previous to get new layers

For all new layers with $ : replace $ with ::
Check if new :: layername exists
If so move objs to that layer delete imported layer
Else rename import layer to new layername

-Willem

Just came across the same weird behaviour when exporting/importing .dxf files.

The exporter doesn’t create the proper layers, instead flattening to “layer$sublayer$sublayer” in the dxf and the importer doesn’t import them correctly even if they DO exist in the dxf and once again just creates a layer in Rhino called “layer$sublayer$sublayer”.

If I reimport the dxf file with sublayers into Rhino it now decides to instead create blocks out of everything that is in a sublayer, which in theory is a neat feature, but not really what I would want.

But does DXF even support sublayers? Or does it somehow consider things in sublayers to be something like groups? Otherwise why would Rhino decide to turn things in sublayers into nested blocks??

I just noticed if I export a dxf file with sublayers in Illustrator and then open it again now the structure is still there, but all the sublayers have been renamed to “INSERT”.

This is really weird.

Can someone at McNeel who coded the DXF import/export tell us how its supposed to work and why please.

I think it’s AutoCAD that does not support sublayers, but maybe that is incorrect - not an AutoCAD user.

I tried to find out, but the specs for the DXF file format are of course not the easiest to read. They don’t mention sublayers anywhere, but do mention Blocks, so that might be the reason.

I just tried to export as .ai Illustrator file. Those most definitely support sublayers, but if you open it in Illustrator it just gets saved into a layer formatted “layer::sublayer::sublayer”.

Wait, so is there any 2D vector format that I can export from Rhino which preserves the sublayers?

Also tried .svg, but that just gets put into 1 layer called “layer1”, which seems even more lazy than at least flattening the name.

PDF? Not sure if it supports sublayers, maybe worth a try?

Nope, again, not even trying. Everything gets put into a layer simply named (very creatively) “Layer1” :expressionless:

So its not even that Rhino doesnt export sublayers it doesnt even export any layer.

Has there been any development in this or custom made script have been shared that I missed?

I need to be constantly exporting to CAD and re-importing to RHINO and losing the layer structure is a pain.

Also having layers be layer$sublayer is not nice, which often means the CAD person hating me.

1 Like