Export objects in a particular order to SVG/DXF/PDF


I want to be able to export objects (formats of interest are SVG/DXF/PDF) but maintain their order in the exported file. I.e. if I draw objects in the sequence 1,2,3,4 then I want them exported to the file in the same sequence 1,2,3,4. Reason - one application is to export to SVG and then output to an AxiDraw pen plotter from within Inkscape.

I’ve experimented with this in v7, but there does not appear to be any logic to the sequence in which Rhino processes objects for export. I would have thought that it would process them in the order they were created, but this doesn’t appear to be the case. Nor does it follow a “last modified” order either.

The only way around this I found was to put each object into its own layer, then export the lot. The layer order gets preserved (in reverse order) so for small numbers of objects I can do it that way. However, it’s laborious to do many objects - I wrote a script to allow selection in a particular order, then copy to new layers, but even then it’s time-consuming.

Would be very grateful to hear if anyone has some suggestions on this.

Best regards,

Lindsay Wilson

Hello - I would experiment with selection order - start Export with no selection, select the objects one by one and see if that is respected, reversed, or ignored in the output.


Hi, I’m afraid it seems to be completely ignored! Quick video here:

I drew 1,2,3,4,5, then went to Export and selected them in that order. Open in Inkscape, look at the XML, and the order is 3,2,1,5,4.

Hello- I would try with dxf - that does not go throught the Print interface, which may be getting its own ordering into the mix.


Try this from GH, i think this works prima for SVG’s
After install, there components are under ‘Display’ tab

Hmm - different behaviour, but still awkward :wink: DXF export seems to be based on the order in which the objects were last modified. For example, I create objects 1,2,3, it exports them in the order 3,2,1. If I move object 2 slightly, it then exports in the order 2,3,1 since #2 was the most recently modified.

Thanks for the tip - I’m afraid I haven’t used Grasshopper at all, and was hoping to do it with just Rhino. I think I should start learning GH at some point though :wink:

Right - ok - that is something at least - so Cut/Paste in the order you like, then export all. I make have a script that does that.


Lol, that’s just what I was playing with :wink: I just wish there was a more automatic way of doing it for larger numbers of objects.

Dim arrObjects, strObject, n

’ Select objects one at a time in the sequence you’d like them exported in
arrObjects = Rhino.GetObjects

If IsArray(arrObjects) Then
’ Go through each object in reverse order, cut and paste in place
For n=ubound(arrObjects) To 0 Step -1
End If

1 Like

DrawOrder commands are paid attention to for SVG and PDF export. I know this is also not the best option, but it is an option

1 Like

Thanks, I’ll keep that in mind!

I have played a bit with Grasshopper Player and GH plugin Bitmap+
File attached
! Needs BoundingBox for picture size
SVGEx.gh (10.4 KB)

1 Like

Hi @lindsay.wilson.88, did you ever find an answer to your issue? I am having the exact same issue with SVG and Axidraw/Inkscape

Hi @Nick_Tyrer , I’m afraid not! The best I could get was using the layer sequence, but that’s no good if you have many different layers.

There is a plot optimiser inside the AxiDraw extensions (Extensions > AxiDraw Utilities > Plot optimisation), but that’s no good if you want a specific drawing order.

Ahh thats a shame, I need very specific order for thousands of lines. I am aiming for an axidraw performance, so I design both the ‘reveal’ and the final design.

Anyway, thanks for getting back to me!

How are you generating the design, is it with scripting inside Rhino? Depending on complexity, it might be possible to port it to something like Processing which can “draw” to an SVG file directly, then use that for the AxiDraw.

Edit: sorry, just realised you didn’t mention generative design, I was assuming you were creating it with a program!

no worries, its is generative (www.instagram.com/tyrer.io), i primarily use grasshopper. My definition is outputting the curves in the order i want them drawn. Its just frustrating that svg export throws it out. I will look into processing.

You’ve got a new follower! Those are fantastic - very reminiscent of rose engine/guilloche type patterns.

Have you tried the SVG writing component that @laurent_delrieu wrote? It is a completely different implementation of svg writing than what ships with Rhino and may better suit your needs

I did see it when looking for answer, but had assumed it was superseded now that the function was in R7. I will give it a go!

Save As Scalable Vector Graphics | Food4Rhino