Layer Order DXF Export

Hello,
my standalone cam system (Sheetcam) uses the layers to map the individual milling operations. For this I have to export a DXF file. When I import this file into my CAM program, the order of the layers is messed up. So far I have ignored the problem but now I have a complicated milling file with 40 different layers. The problem definitely comes from Rhino export. As far as I can see in the DXF with a file editor, the layers are no longer in the desired order. Even if I import the DXF file back into rhino, the order is messed up.
What could cause this problem?

Best regards from Germany

Jan

The only layer order i’m aware of is alphabetical, or the DRAWORDER in autocad.

Hey alphabetical would be also ok, as I could specify my layer names according to that. But the Rhino export filter does not behave alphabetical.

Yes, this doesn’t surprise me. Layers in Rhino are stored in a table in their order of creation. You can re-order them in Rhino’s window, but that is only a display thing, it doesn’t change their order in the layer table.

Looks like that on export, they are exported in the order they are found in the layer table - i.e. chronological according to the layer’s creation. It looks like this order is even reversed - so last in, first out. So no matter what you actually do in the Rhino layer window, it seems like it’s not going to change the export output layer order for now… :confounded:

I don’t know if this might be addressable via scripting, I’ll have a look, but I’m not optimistic…

:worried:

J J, if thats the case we could try a quick grasshopper script that would recreate the layers and geometry in a new file.

Can you provide a sample file?

I found this topic that has the same problem:

Did you try saving the file, closing it, re-opening it and then doing your export?

–Mitch

I tried saving and reopening the file and the problem remains.
Here is a sample file with the exported dxf file:
http://designandresearch.de/Schwarz_40mm.zip

Thanks in advance,
Jan

Give this a go.

RE_Schwarz_40mm.3dm (554.4 KB)

I reversed the creation order per Helvetoasaurs comment. If it works i’ll clean it up a bit and post specifics.

OK, the layer display order in your posted file Rhino file does correspond with the layer order in the layer table…

Unfortunately, either the export or the re-import in this case is not the same as the original… So I don’t know what is going on here… @lowell, @dale can you shed some light here?

Layer order in dwg/dxf export and import is undefined.
I’ll add a wish to make it predictable.
https://mcneel.myjetbrains.com/youtrack/issue/RH-48103

https://mcneel.myjetbrains.com/youtrack/issue/RH-48103

image

Try now… ?

-Pascal

Yep, thanks!

That works, beside the fact that the order is on opposite way.
I`m not into grasshopper, but the file seems to be not that complicated.

Thanks in advance,

Jan

Well i’m confused.

The plugins used are Human and Elefront. I don’t have a quick way to get the layer table in the right order in Elefront. Hence the Human Component.

I used worksessions to link the original file into a blank Rhino file.

Do note: once you activate the bake component it assigns a bake name, which will delete previously baked objects with the same name. I also right clicked the Ref by Layer and set it to only referenced objects, to eliminate the possibility of it doubling up once you baked – since it would find the referenced and new layers once baked.

RE_Schwarz_40mm.gh (10.6 KB)

You can reference any file, refresh the Ref By Layer component, Activate Bake, and have the same result – a new file with the same objects and layers.

Let me know if you have any questions or complications.