Export to SVG challenge


#1

Continuing the discussion from AI export morphs lines - bug?:

Here you go:

Karte.3dm (693.7 KB)

The goal is to get an SVG with smooth curves, which I can send to the folks at Mr. Beam.

When exporting scale as follows:

  • Paper: 1.00

  • Model: 1.05


How to get 2D export to Inkscape at high quality?
#2

Try this two files (I’ve detected some errors in some numbers but at very close levels of Zoom).

Workflow: PDF printed with Adobe Printer from Rhino in High Quality settings, then opened in Illustrator and saved as SVG 1.1.

Let me know if this helps…

P.S.: It was not scaled, just window croped, but if the SVG is correct to correct the scale is not complicated.

Karte.7z (67.1 KB)


#3

PDF looks fine. SVG export seems to have failed, at least when looking at the file in Xara or Inkscape.

I should be able to convert that to SVG myself though. So it’s very helpful - thanks!

Now, try without a PDF printer driver that costs half as much as Rhino itself.

[quote]P.S.: It was not scaled, just window croped, but if the SVG is correct to correct the scale is not complicated.
[/quote]
Still, one more step.


#4

I think that @Helvetosaur found the way to go converting the curves before exporting (in the other post: How to get 2D export to Inkscape at high quality? )

I’ll try to find the way without Adobe PDF too :stuck_out_tongue: It’s the problem about having it as student and then in the offices where I’ve been working…you get use to this expensive tools…


#5

I made a basic SVG export to get curves into Fusion, you can download here.
http://forums.autodesk.com/t5/design-and-documentation/basic-rhino-svg-export/m-p/5739565#M28694

Anything that’s not a line or arc is linearized

Mark


#6

Yes, that seems to work. Although instead of way, I’d call it workaround. :wink:

Rhino’s export to AI and PDF is bug-ridden in 5.0 and WIP, at least on my system.

Awesome, thanks for the link! Still, I’d prefer a solution that exports smooth splines.


#7

Unfortunately I don’t understand how to turn Rhino curves into Bézier curves for SVG, something to investigate when I have some time.

You could try convert to arcs on the spline before export. The export from the plug in are unitless so for me I work in mm in Rhino and Fusion and they come in the correct size. Some programs use pixel or points and will need scaling.

Mark


(Wim Dekeyser) #8

Just for fun, I dug up a script that I wrote in 2001 (and later slightly modified for RH5). It was tailor-made for my own purposes and consequently doesn’t handle everything equally well.
This is my result (renamed by adding .txt behind the .svg extension to be able to upload it here):
Karte-0.1.0004.svg.txt (113.4 KB)

This is the version that was produced with @Hughes_Tooling’s version:
Karte - ExportSVG test.svg.txt (89.6 KB)


#9

Thanks for uploading the 2 sample files, I noticed the lines in my version where missing, after some investigation I found I was using Line instead of line. Fusion read everything OK but it didn’t work in chrome.

I’ve updated the plugin also borrowed a line from your example so it scales to fit the browser window.

Here’s the output now, one tip run simplify on the curves first.
Karte - ExportSVG test2.svg.txt (109.4 KB)

And the Plugin
ExportSVG.rhp (23.5 KB)


Slicing workflow for Lasercutting (Glowforge)?
(Wim Dekeyser) #10

Just FWIW, here is an example - my curve in green, yours in black. Zoom in on a high-curvature part.
curve test.svg.txt (5.6 KB)

Here is my code - it’s probably messy…
rh5.0 SVG 0.1.0004.rvb (14.4 KB)


#11

That looks really good. I see that arcs stay arcs, and curves are approximated by line segments. In Inkscape the encircled CC is displayed warped, but in Xara it displays correctly.

Thanks for the suggestion! Admittedly I wasn’t aware of this very useful command, despite using Rhino for almost two decades now.

Curves look good in Inkscape, only some are missing, and one is in the wrong color. I assume you post processed the SVG manually?

How I did it in the end was to post process curves with ConvertToBeziers prior to exporting to .ai format, which I then converted to SVG using Xara Designer Pro X11:

beta_Karte.zip (20.4 KB)

Curves look fine to me, except for the small circle in front of Berlin. In the SVG it looks like a rounded square, but that may be a Xara issue.


(Wim Dekeyser) #12

There was no manual post-processing of the svg file, no. For reasons I don’t remember, my script tries to join curves together. Apparently sometimes this causes the joined curve to end up on a different layer.

That shows like that in Inkscape as well.


#13

I’m talking about the conversion done with Xara. However, when I open the .ai-file in Rhino, then I see the same issue:

beta_Karte.zip (23.7 KB)

So it looks like a Rhino export bug.


(Laurent Delrieu) #14

Hello everybody,
here is my first program for Rhino. I did components for Grasshopper, but my last UI was with Borland C++. So I have still a lot to learn.
So here is an SVG exporter with a what you see is what you get. It is still a WIP but some advices could be interesting.
I use Rhinocommon with c#, XMLdocument to put the SVG in memory, Winform and SVG rendering library 2.2.1 for rendering SVG (https://www.nuget.org/packages/Svg/).


Hope it will work on your computer and options are quite easy to understand.

  • At the moment everything is converted in mm (like linewidth unit). It is easy to change but I have a bug so I disable option.
  • Point could be filled but it doesn’t work with SVG renderer which use option of group rather than option on object) but works on Inkscape.
  • Text as SVG text is not at the good scale nor the good position, text as curve is OK
  • Hatch is copied to SVG
  • Annotation, texdot, dimensions are not copied
  • Nurbs are converted to Bezier
  • Circle to Circle
  • Layer have the same organisation as Rhino but rendering is inverse.
  • There is not the option button on savefile dialog
  • The zoom of SVG render and move is with text box. Not mouse yet !!

Hope it could help
I must put it on Github when I will understand how to do it !


(Wim Dekeyser) #15

I installed the rhp in Rhino 5 (and tried the WIP also) by dragging and dropping it into Rhino and then ran the SaveAsSVGCommand command but nothing happens. Are there any special steps I have to take to get it to start?


(Laurent Delrieu) #16

Excuse me it is not in a command it is in the menu
Save as or
Export selected
And thanks for your program I didn t exploit all of it
Best regards


#17

Looks good, but why didn’t you just start a new thread?


(Wim Dekeyser) #18

That works, thanks!

Two immediate comments:

  • When in model space, perhaps saving things in layouts is not optimal. I understand that a SaveAs is just saving everything in the file to another file but it seems counter-productive for the SVG format. I suppose the easy way out for me is to use export selected… But still… :wink:
  • The file header is making Chrome not render the SVG but rather print the xml. It seems like it doesn’t like the width and height properties in the <svg xmnls=“http://www.w3.org/2000/svg” width="[X]" height="[Y]" viewBox="[…]> header line. Would throwing these out cause problems elsewhere? Inkscape seems to be reading both without problems…

#19

Looks awesome!

Only, it doesn’t work for me (version 5, 64 bit, Windows 7):

Error writing file C:\Temp\Karte2.svg
Error saving file C:\Temp\Karte2.svg

How I installed the plugin:

  1. Extracted the zip file.

  2. Unblocked the .rhp and .dll files.

  3. Restarted Rhino.

  4. Dragged the .rhp file into Rhino.


(Wim Dekeyser) #20

I’m also running that combination. I’m on the latest version of SR13 of Rhino - which SR are you on?