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

Hello,

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.

-Pascal

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.

-Pascal

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.

-Pascal

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
rhino.copyobject(arrObjects(n))
rhino.DeleteObject(arrobjects(n))
Next
End If

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)