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.
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.
Hmm - different behaviour, but still awkward 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
Lol, that’s just what I was playing with 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
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.
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.
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