Export SVG with Object Name

I am looking for a way to export SVG files from Rhino that retain the Object Name. This will allow me to bring floor plans from Rhino into Power BI that attach back to room data created in Excel using Synoptic Designer.

Currently, I can bring a Rhino floor plan into Illustrator via either .ai or .svg export and manually add object names to attach to closed room polylines. I would much rather automate this using Grasshopper and export the .svg file including object names into Synoptic to then visualize in Power BI.

Does anyone know how the Rhino exporter writes .svg files so I can properly attach data before exporting?

Just by curiosity, what is the SVG attribute that has the Name ?
Have you an example file ?

See attached for the “Synoptic Designer” interface, which receives an .svg file and reads the “Name” in the first row, pointed out in red on that screenshot.

In Illustrator, if I select a closed path and change the name of the path and then export the file to .svg, Synoptic will read that path name in the proper row.

What I want is to export a Rhino file to either an Illustrator or an .svg file such that the name comes in automatically (in this example, that would mean every polyline currently shown as “<Pa.th>” in Illustrator would instead be the room number). I can get Grasshopper to apply attributes in basically whatever configuration is needed to accomplish this, as long as the exporter retains the right data in the .svg file.

Have you some example of where is the Name in the SVG file ?
a group in SVG has an id


Not sure where to put the Name in the Path ?
In a text editor can you open a file with names on the path (Romm Number 101) and make a screen copy ?

Name seems to be in “title” but there is also an id
image

That could be very easy to implement

I don’t fully understand your question; I don’t know much about SVG files. Here is an example of an SVG file opened in Illustrator with Names properly attached to each polyline:

Here is that same SVG graphic opened in Synoptic Designer, proving that the names are carrying through to the top row of data:

And then that same file opened in Google Chrome, with polyline #21 selected. I do not see where in the file the shape is labeled as 21:

Screenshot from text editor:

Synoptic 01 processed

Ok I am getting a better understanding how this works. I drew a simple polyline in Rhino, named it “test” and exported that to an .svg:

Opening the .svg in the text editor reveals that the “id” was never sent:

Any chance the exporter has a typo? For instance, should the below screenshot actually read “<path id”?
image
test from Rhino 04

Next step, I have opened that .svg in Illustrator and renamed the path, and exported again. Text editor shows the composition of that .svg file has changed significantly and now includes the path id:


test from Rhino 04_renamed

No it is not a typo “d” is where the geometry is put.
From what I understand
In Designer the first text is ID
and the second is Title
image

Here what is inside a rhino geometry
image

Strangely Rhino is reading ID of SVG and put it in the name of Rhino object and it seems it doesn’t output when it export SVG. @wim could it be impoved in the next release of Rhinoceros ?
2 files
SVG with name

Well readed by Rhino

SVG with name Saved by Rhino

Yes, would love to see this implemented. I cannot think of a good workaround as of now; years ago Doodlebug for Grasshopper maybe could have assisted in naming objects inside of an Illustrator file, thereby relying instead on the Illustrator SVG exporter which would be better for Synoptic. Without being able to export this info to SVG from Rhino, I don’t know how to accomplish this workflow.

1 Like

The following plugins all support SVG export, but none of them allow users to specify a Path ID:

(noticed this is yours @laurent_delrieu !)

I have to believe there is some way to script the Path ID or Title with one of these, can anyone out there think of a workaround? I can send each path to a new Rhino layer and then to Illustrator, but that send each path to an SVG Group which Synoptic doesn’t seem to like inside of Power BI.

Yes it is mine it is why I asked. You are the first to ask and it is very simple to do it I manage to do it tonight in the project I have for Rhino 6.
It put in an ID attribute having the Rhinoceros Object Name.
Not really tested !! Seems to work on Rhino6

SaveAsSVG_LD.rhp (84.5 KB)

Note : I have many things to improve
Add it in Rhino 7
Change GUI to ETO and some other stuffs

But I have quite no use of this tool. So it is not my priority.

2 Likes

This is great, thank you! Except I am seeing that it retains layers by grouping SVG geometries; Synoptic seems to prefer simple files with just paths and no groups. Would it be possible to have the exporter only include the item name? Otherwise all geometries seem to be put under a layer name.

Yes this is one of the advantage of my plugin other the Rhino plugin !!
Let’s wait some day to see if Rhino team could add the Name in the ID. They use it when reading SVG so they could also output it when exporting. And they also didn’t use the grouping !

Not at my computer but I’d try to create a block and export that as SVG.

Hi Laurent -

I suppose it could but, as you say, it’s not very often this request is made. We’ve had it on the list for a while and I’ve added this thread: RH-40791 Option to use object name as tag in SVG export

Added to the list: RH-71860 File IO: SVG Export - Add option to not group by layer
-wim

2 Likes

Bump.

I´m here with the same problem.

@wim,

bump, me too. Object names are nice to have but not unique, so it would be useful if the API of CaptureToSvg allows to include the guid of an object in a seperate attribute eg. guid="..." or just use the id=guid so we can query the name or other custom stuff from a node in the svg before it is written to disk.

thanks,
c.