SVG import questions.

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

SVG import questions.

nophead
When I export a simple shape centered around the origin in SVG format and then import it again it comes in with an offset, different for X and Y.

image.png
If I import it into InkScape it ends up with a corner at the origin.

image.png

Is there no standard for interpreting the coordinates?

Another problem I have is when I import a panel with holes that was made from a PDF using InkScape it imports outlines instead of a solid.

image.png

What determines if a path is interpreted as an outline of a polygon or a stroke with finite width?




_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
dpa
Reply | Threaded
Open this post in threaded view
|

Re: SVG import questions.

dpa

Hi nop.head,
first question:
I don't have an answer but importing the SVG into Inkscape and looking for  "Document Properties.." looks like this (what is strange):
Bildschirmfoto 2020-06-18 um 17.01.16.png
In the Scale/Viewbox section is set X and Y = -10 what should be both =0
That is the reason for the offset. I think that's a bug in OpenSCAD export.
And a minor thing: I have the Display Units always set to "mm". The SVG-export from OpenSCAD should do that too.


About your second question:
I don't know what caused the form you showed but if I read "PDF".. well.. I think that's complicated and pretty error-like.
Maybe there are several equal forms on top of each other?

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: SVG import questions.

nophead
I found this definition of viewBox:

The viewBox attribute defines the position and dimension, in user space, of an SVG viewport. 
The value of the viewBox attribute is a list of four numbers: min-xmin-ywidth and height. The numbers separated by whitespace and/or a comma, which specify a rectangle in user space which is mapped to the bounds of the viewport established for the associated SVG element
 
That seems to be correct because the object starts and -10,-10 and is 20 wide. So it looks more like InkScape and the SVG import are both wrong.

Perhaps the PDF is not simply a line drawing, i.e. the lines are actually thin filled rectangles rather than a line with stroke.



On Thu, 18 Jun 2020 at 16:51, dpa <[hidden email]> wrote:

Hi nop.head,
first question:
I don't have an answer but importing the SVG into Inkscape and looking for  "Document Properties.." looks like this (what is strange):
Bildschirmfoto 2020-06-18 um 17.01.16.png
In the Scale/Viewbox section is set X and Y = -10 what should be both =0
That is the reason for the offset. I think that's a bug in OpenSCAD export.
And a minor thing: I have the Display Units always set to "mm". The SVG-export from OpenSCAD should do that too.


About your second question:
I don't know what caused the form you showed but if I read "PDF".. well.. I think that's complicated and pretty error-like.
Maybe there are several equal forms on top of each other?
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: SVG import questions.

Troberg
In reply to this post by nophead
I've been importing and exporting SVG files, using OpenSCAD, InkScape,
Scribus, LightBurn and a few other tools a lot recently, and it seems to me
that the file itself has no origin, at least not that any of them care
about, they all just use their own method (usually center, bottom left or
top left).



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: SVG import questions.

nophead
Well the viewport is supposed to give the origin indirectly, OpenSCAD seems to set it correctly on export but interprets it wrongly on import. I am surprised there isn't a test in the test suite that notices.

InkScape does seem to ignore it and makes the bottom left the origin. Also if I convert it to DXF with https://cloudconvert.com/ it also puts the bottom left on the origin.

It is probably a mess because SVG is designed to represent pictures, not CAD data. I think OpenSCAD should be consistent with itself though.

On Thu, 25 Jun 2020 at 10:54, Troberg <[hidden email]> wrote:
I've been importing and exporting SVG files, using OpenSCAD, InkScape,
Scribus, LightBurn and a few other tools a lot recently, and it seems to me
that the file itself has no origin, at least not that any of them care
about, they all just use their own method (usually center, bottom left or
top left).



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
dpa
Reply | Threaded
Open this post in threaded view
|

Re: SVG import questions.

dpa
In reply to this post by Troberg
I work with inkscape and have a setting (Viewbox X and Y=0, as I mentioned here before) which is exactly what it should be!
The disadvantage is that the object is not made for "to look at".
Attached a simple circle around [0,0] with an unchanged document size (A4).
The preview (on mac) shows the 'empty' A4 sheet and I have to scroll down, at the bottom left you can see a quarter circle.
In Inkscape this is also in the lower left, just where [0,0] is. In OpenSCAD it is nicely centered, as expected with center at [0,0].
That's the thing about coordinates...

Am Do., 25. Juni 2020 um 11:54 Uhr schrieb Troberg <[hidden email]>:
I've been importing and exporting SVG files, using OpenSCAD, InkScape,
Scribus, LightBurn and a few other tools a lot recently, and it seems to me
that the file itself has no origin, at least not that any of them care
about, they all just use their own method (usually center, bottom left or
top left).



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

circle_around_origin[0,0].svg (2K) Download Attachment
dpa
Reply | Threaded
Open this post in threaded view
|

Re: SVG import questions.

dpa
..so OpenSCAD import is fine.
I think OpenSCAD exports in a way for better "look at", moves the content to >=0 (by adding some View x,y to it) so that the content appears on the "light side"
If you import the attached svg in OpenSCAD and export it back to svg and open it elsewhere you can see what I mean.

Am Do., 25. Juni 2020 um 17:47 Uhr schrieb dpa <[hidden email]>:
I work with inkscape and have a setting (Viewbox X and Y=0, as I mentioned here before) which is exactly what it should be!
The disadvantage is that the object is not made for "to look at".
Attached a simple circle around [0,0] with an unchanged document size (A4).
The preview (on mac) shows the 'empty' A4 sheet and I have to scroll down, at the bottom left you can see a quarter circle.
In Inkscape this is also in the lower left, just where [0,0] is. In OpenSCAD it is nicely centered, as expected with center at [0,0].
That's the thing about coordinates...

Am Do., 25. Juni 2020 um 11:54 Uhr schrieb Troberg <[hidden email]>:
I've been importing and exporting SVG files, using OpenSCAD, InkScape,
Scribus, LightBurn and a few other tools a lot recently, and it seems to me
that the file itself has no origin, at least not that any of them care
about, they all just use their own method (usually center, bottom left or
top left).



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: SVG import questions.

nophead
So basically you can't display anything with negative coordinates without shifting it in SVG?

The OpenSCAD export coordinates range from -10 to +10. The viewBox starts at -10 and has an extent of 20, which seems correct to me. I would expect to see the full circle, not a quarter, but I don't expect the circle to be moved. I expect the viewPort to range from -10 to plus 10 and the circle stay on the origin in InkScape. 

OpenSCAD has an infinite viewport, so I think it should ignore the viewBox on import. I have no idea why it doesn't treat X and Y the same either.

On Thu, 25 Jun 2020 at 16:59, dpa <[hidden email]> wrote:
..so OpenSCAD import is fine.
I think OpenSCAD exports in a way for better "look at", moves the content to >=0 (by adding some View x,y to it) so that the content appears on the "light side"
If you import the attached svg in OpenSCAD and export it back to svg and open it elsewhere you can see what I mean.

Am Do., 25. Juni 2020 um 17:47 Uhr schrieb dpa <[hidden email]>:
I work with inkscape and have a setting (Viewbox X and Y=0, as I mentioned here before) which is exactly what it should be!
The disadvantage is that the object is not made for "to look at".
Attached a simple circle around [0,0] with an unchanged document size (A4).
The preview (on mac) shows the 'empty' A4 sheet and I have to scroll down, at the bottom left you can see a quarter circle.
In Inkscape this is also in the lower left, just where [0,0] is. In OpenSCAD it is nicely centered, as expected with center at [0,0].
That's the thing about coordinates...

Am Do., 25. Juni 2020 um 11:54 Uhr schrieb Troberg <[hidden email]>:
I've been importing and exporting SVG files, using OpenSCAD, InkScape,
Scribus, LightBurn and a few other tools a lot recently, and it seems to me
that the file itself has no origin, at least not that any of them care
about, they all just use their own method (usually center, bottom left or
top left).



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: SVG import questions.

OpenSCAD mailing list-2
In reply to this post by dpa
This is one of those cases reading the manual has a value.

On 2020-06-25 11:47 a.m., dpa wrote:
I work with inkscape and have a setting (Viewbox X and Y=0, as I mentioned here before) which is exactly what it should be!
The disadvantage is that the object is not made for "to look at".
Attached a simple circle around [0,0] with an unchanged document size (A4).
The preview (on mac) shows the 'empty' A4 sheet and I have to scroll down, at the bottom left you can see a quarter circle.
In Inkscape this is also in the lower left, just where [0,0] is. In OpenSCAD it is nicely centered, as expected with center at [0,0].
That's the thing about coordinates...

Am Do., 25. Juni 2020 um 11:54 Uhr schrieb Troberg <[hidden email]>:
I've been importing and exporting SVG files, using OpenSCAD, InkScape,
Scribus, LightBurn and a few other tools a lot recently, and it seems to me
that the file itself has no origin, at least not that any of them care
about, they all just use their own method (usually center, bottom left or
top left).



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

-- 
Ron Wheeler
Artifact Software
438-345-3369
[hidden email]

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: SVG import questions.

nophead
The manual leads to here:  https://www.w3.org/TR/SVG/coords.html#ComputingAViewportsTransform

When I go through that algorithm I get translate(0, 0) scale(1,1) which should leave my geometry unchanged unless I am mistaken.

On Thu, 25 Jun 2020 at 17:57, Ron Wheeler via Discuss <[hidden email]> wrote:
This is one of those cases reading the manual has a value.

On 2020-06-25 11:47 a.m., dpa wrote:
I work with inkscape and have a setting (Viewbox X and Y=0, as I mentioned here before) which is exactly what it should be!
The disadvantage is that the object is not made for "to look at".
Attached a simple circle around [0,0] with an unchanged document size (A4).
The preview (on mac) shows the 'empty' A4 sheet and I have to scroll down, at the bottom left you can see a quarter circle.
In Inkscape this is also in the lower left, just where [0,0] is. In OpenSCAD it is nicely centered, as expected with center at [0,0].
That's the thing about coordinates...

Am Do., 25. Juni 2020 um 11:54 Uhr schrieb Troberg <[hidden email]>:
I've been importing and exporting SVG files, using OpenSCAD, InkScape,
Scribus, LightBurn and a few other tools a lot recently, and it seems to me
that the file itself has no origin, at least not that any of them care
about, they all just use their own method (usually center, bottom left or
top left).



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

-- 
Ron Wheeler
Artifact Software
438-345-3369
[hidden email]
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: SVG import questions.

OpenSCAD mailing list-2
Is this documented somewhere?

import("C:\Users\willa\Desktop\Design_Into_3D-master\box\fingerjoint\magazine\5_16_radius_half.svg");

I just tried it and didn't get anything.

I need to model a radiused endmill so that I can rotate extrude/revolve it
and not getting anything.

What about the previous technique of exporting a .scad file from Inkscape
using an extension such as:

https://github.com/fablabnbg/inkscape-paths2openscad

Does that still work in Inkscape 1.0?

It's a bit disconcerting to find:

https://inkscape.org/~arpruss/%E2%98%85openscad-cookie-cutter-file-output

but have the search:

https://inkscape.org/search/?q=openscad

come up empty.

William



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: SVG import questions.

lar3ry
On 22 Jul 2020 at 20:51, WillAdams via Discuss wrote:
> What about the previous technique of exporting a .scad file from Inkscape
> using an extension such as:
> https://github.com/fablabnbg/inkscape-paths2openscad
> Does that still work in Inkscape 1.0?

I just downloaded Inkscape 1.0, putting it into a separate directory so I can
run it in parallel. I did this because it looks like the Roland Cutstudio
extension is not compatible, or at least not mentioned in the release notes or
Wiki.

I think the only way to tell if any given extension works is to either look at the
repository or to try adding it to 1.0.

My first try at using 1.0 was pretty disappointing. I thought I'd try it on a few
things, and got at least one very strange result. I first tried text. After entering
it, changing the font, I tried to move it. I could only move it with the keyboard,
and not with the mouse.

When I get a little more time, I will try it out in more depth, but so far, I am
not impressed.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
tp3
Reply | Threaded
Open this post in threaded view
|

Re: SVG import questions.

tp3
In reply to this post by OpenSCAD mailing list-2
On 23.07.20 05:51, WillAdams via Discuss wrote:
> Is this documented somewhere?

What is "this"? SVG import in general?

https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/SVG_Import

It's not complete, but should cover most basic things.

> import("C:\Users\willa\Desktop\Design_Into_3D-master\box\fingerjoint\magazine\5_16_radius_half.svg");

Without the actual file, it's not really possible to tell
what the issue could be.

ciao,
  Torsten.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
-- Torsten
Reply | Threaded
Open this post in threaded view
|

Re: SVG import questions.

tsingi
In reply to this post by lar3ry
That circle is not at the origin.  InkScape tries to do much that it shouldn't do.
<circle r="20" cy="296.99997" cx="1.3322676e-15" id="path32"
       style="opacity:0.662379;fill:#1fb801;fill-opacity:1;stroke:none;stroke-width:3.05269;stroke-linecap:round;stroke-opacity:0.955645" />

cx and cy default to zero, just remove them and you will have a circle centered at the origin.
InkScape is calling the bottom left of the viewspace the origin as it would be in Cartesian geometry.  The SVG working group, in its wisdom and bowing to Adobe has adopted page display geometry which has an origin at the top left.


On Thu, Jul 23, 2020 at 12:55 PM <[hidden email]> wrote:
On 22 Jul 2020 at 20:51, WillAdams via Discuss wrote:
> What about the previous technique of exporting a .scad file from Inkscape
> using an extension such as:
> https://github.com/fablabnbg/inkscape-paths2openscad
> Does that still work in Inkscape 1.0?

I just downloaded Inkscape 1.0, putting it into a separate directory so I can
run it in parallel. I did this because it looks like the Roland Cutstudio
extension is not compatible, or at least not mentioned in the release notes or
Wiki.

I think the only way to tell if any given extension works is to either look at the
repository or to try adding it to 1.0.

My first try at using 1.0 was pretty disappointing. I thought I'd try it on a few
things, and got at least one very strange result. I first tried text. After entering
it, changing the font, I tried to move it. I could only move it with the keyboard,
and not with the mouse.

When I get a little more time, I will try it out in more depth, but so far, I am
not impressed.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: SVG import questions.

OpenSCAD mailing list-2
In reply to this post by tp3
Posted the file to:

https://community.carbide3d.com/uploads/default/original/3X/3/8/38d68660a46c6fffcfcf491190c9ed57ef937a2e.svg

(It was written out of Inkscape 1.0 on Windows 10 build 1703)

Thanks for the link to the docs!

Will see what I can puzzle out.

William



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
tp3
Reply | Threaded
Open this post in threaded view
|

Re: SVG import questions.

tp3
On 23.07.20 23:11, WillAdams via Discuss wrote:
> https://community.carbide3d.com/uploads/default/original/3X/3/8/38d68660a46c6fffcfcf491190c9ed57ef937a2e.svg

Seems to work for me (using snapshot version of OpenSCAD).

ciao,
  Torsten.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

svg.png (230K) Download Attachment
-- Torsten
Reply | Threaded
Open this post in threaded view
|

Re: SVG import questions.

nophead
Shouldn't the tip be exactly at the origin if it is a milling bit?

On Thu, 23 Jul 2020 at 23:12, Torsten Paul <[hidden email]> wrote:
On 23.07.20 23:11, WillAdams via Discuss wrote:
> https://community.carbide3d.com/uploads/default/original/3X/3/8/38d68660a46c6fffcfcf491190c9ed57ef937a2e.svg

Seems to work for me (using snapshot version of OpenSCAD).

ciao,
  Torsten.
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org