discuss@lists.openscad.org

OpenSCAD general discussion

View all threads

Fwd: Problem with SVG import

JJ
Julien Jacquet
Thu, May 12, 2022 2:18 PM

Hello,
I would like to import this SVG file into OpenSCAD.
It's a pentagon (SVG generated by GeoGebra), but OpenSCAD displays a large
rectangle.
Do you know why?
Thank you!

Hello, I would like to import this SVG file into OpenSCAD. It's a pentagon (SVG generated by GeoGebra), but OpenSCAD displays a large rectangle. Do you know why? Thank you!
TP
Torsten Paul
Thu, May 12, 2022 2:33 PM

On 12.05.22 16:18, Julien Jacquet wrote:

Do you know why?

Yes, there's a big white background rectangle with empty stroke.

OpenSCAD treats SVG as CAD files, importing structure, it's
not possible to handle visual effects.

Removing that rectangle (rect7) seems to produce the import
result that is expected.

ciao,
Torsten.

On 12.05.22 16:18, Julien Jacquet wrote: > Do you know why? Yes, there's a big white background rectangle with empty stroke. OpenSCAD treats SVG as CAD files, importing structure, it's not possible to handle visual effects. Removing that rectangle (rect7) seems to produce the import result that is expected. ciao, Torsten.
JJ
Julien Jacquet
Thu, May 12, 2022 7:04 PM

Thank you very much for the answer.
Indeed, the rectangle "hide" the figure.

For all the segments, it's OK.
However, for this circle in attachment, and removing the rect tag, there is
still a problem, OpenSCAD interpreting it full when it is empty.

Do you know (again:) why? Thank you!

Le jeu. 12 mai 2022 à 16:33, Torsten Paul Torsten.Paul@gmx.de a écrit :

On 12.05.22 16:18, Julien Jacquet wrote:

Do you know why?

Yes, there's a big white background rectangle with empty stroke.

OpenSCAD treats SVG as CAD files, importing structure, it's
not possible to handle visual effects.

Removing that rectangle (rect7) seems to produce the import
result that is expected.

ciao,
Torsten.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Thank you very much for the answer. Indeed, the rectangle "hide" the figure. For all the segments, it's OK. However, for this circle in attachment, and removing the rect tag, there is still a problem, OpenSCAD interpreting it full when it is empty. Do you know (again:) why? Thank you! Le jeu. 12 mai 2022 à 16:33, Torsten Paul <Torsten.Paul@gmx.de> a écrit : > On 12.05.22 16:18, Julien Jacquet wrote: > > Do you know why? > > Yes, there's a big white background rectangle with empty stroke. > > OpenSCAD treats SVG as CAD files, importing structure, it's > not possible to handle visual effects. > > Removing that rectangle (rect7) seems to produce the import > result that is expected. > > ciao, > Torsten. > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
DP
David Phillip Oster
Thu, May 12, 2022 7:15 PM

If you open circle.svg in a text editor, you'll see it has:
<path fill="none" stroke="rgb(0,0,0)"…

OpenSCAD doesn't honor the fill and stroke attributes. Make a filled
smaller circle on the same center, difference the two, then save that to
get a ringed SVG path that OpenSCAD can see.

On Thu, May 12, 2022 at 12:05 PM Julien Jacquet jacquetjulien@gmail.com
wrote:

Thank you very much for the answer.
Indeed, the rectangle "hide" the figure.

For all the segments, it's OK.
However, for this circle in attachment, and removing the rect tag, there
is still a problem, OpenSCAD interpreting it full when it is empty.

Do you know (again:) why? Thank you!

Le jeu. 12 mai 2022 à 16:33, Torsten Paul Torsten.Paul@gmx.de a écrit :

On 12.05.22 16:18, Julien Jacquet wrote:

Do you know why?

Yes, there's a big white background rectangle with empty stroke.

OpenSCAD treats SVG as CAD files, importing structure, it's
not possible to handle visual effects.

Removing that rectangle (rect7) seems to produce the import
result that is expected.

ciao,
Torsten.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

If you open circle.svg in a text editor, you'll see it has: <path fill="none" stroke="rgb(0,0,0)"… OpenSCAD doesn't honor the fill and stroke attributes. Make a filled smaller circle on the same center, difference the two, then save that to get a ringed SVG path that OpenSCAD can see. On Thu, May 12, 2022 at 12:05 PM Julien Jacquet <jacquetjulien@gmail.com> wrote: > Thank you very much for the answer. > Indeed, the rectangle "hide" the figure. > > For all the segments, it's OK. > However, for this circle in attachment, and removing the rect tag, there > is still a problem, OpenSCAD interpreting it full when it is empty. > > Do you know (again:) why? Thank you! > > Le jeu. 12 mai 2022 à 16:33, Torsten Paul <Torsten.Paul@gmx.de> a écrit : > >> On 12.05.22 16:18, Julien Jacquet wrote: >> > Do you know why? >> >> Yes, there's a big white background rectangle with empty stroke. >> >> OpenSCAD treats SVG as CAD files, importing structure, it's >> not possible to handle visual effects. >> >> Removing that rectangle (rect7) seems to produce the import >> result that is expected. >> >> ciao, >> Torsten. >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
DP
David Phillip Oster
Thu, May 12, 2022 7:22 PM

just do: stroke to path in Inkscape and openSCAD imports it correctly

On Thu, May 12, 2022 at 12:15 PM David Phillip Oster <
davidphilliposter@gmail.com> wrote:

If you open circle.svg in a text editor, you'll see it has:
<path fill="none" stroke="rgb(0,0,0)"…

OpenSCAD doesn't honor the fill and stroke attributes. Make a filled
smaller circle on the same center, difference the two, then save that to
get a ringed SVG path that OpenSCAD can see.

On Thu, May 12, 2022 at 12:05 PM Julien Jacquet jacquetjulien@gmail.com
wrote:

Thank you very much for the answer.
Indeed, the rectangle "hide" the figure.

For all the segments, it's OK.
However, for this circle in attachment, and removing the rect tag, there
is still a problem, OpenSCAD interpreting it full when it is empty.

Do you know (again:) why? Thank you!

Le jeu. 12 mai 2022 à 16:33, Torsten Paul Torsten.Paul@gmx.de a écrit :

On 12.05.22 16:18, Julien Jacquet wrote:

Do you know why?

Yes, there's a big white background rectangle with empty stroke.

OpenSCAD treats SVG as CAD files, importing structure, it's
not possible to handle visual effects.

Removing that rectangle (rect7) seems to produce the import
result that is expected.

ciao,
Torsten.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

just do: *stroke to path* in Inkscape and openSCAD imports it correctly On Thu, May 12, 2022 at 12:15 PM David Phillip Oster < davidphilliposter@gmail.com> wrote: > If you open circle.svg in a text editor, you'll see it has: > <path fill="none" stroke="rgb(0,0,0)"… > > OpenSCAD doesn't honor the fill and stroke attributes. Make a filled > smaller circle on the same center, difference the two, then save that to > get a ringed SVG path that OpenSCAD can see. > > On Thu, May 12, 2022 at 12:05 PM Julien Jacquet <jacquetjulien@gmail.com> > wrote: > >> Thank you very much for the answer. >> Indeed, the rectangle "hide" the figure. >> >> For all the segments, it's OK. >> However, for this circle in attachment, and removing the rect tag, there >> is still a problem, OpenSCAD interpreting it full when it is empty. >> >> Do you know (again:) why? Thank you! >> >> Le jeu. 12 mai 2022 à 16:33, Torsten Paul <Torsten.Paul@gmx.de> a écrit : >> >>> On 12.05.22 16:18, Julien Jacquet wrote: >>> > Do you know why? >>> >>> Yes, there's a big white background rectangle with empty stroke. >>> >>> OpenSCAD treats SVG as CAD files, importing structure, it's >>> not possible to handle visual effects. >>> >>> Removing that rectangle (rect7) seems to produce the import >>> result that is expected. >>> >>> ciao, >>> Torsten. >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> >
TP
Torsten Paul
Thu, May 12, 2022 7:23 PM

On 12.05.22 21:15, David Phillip Oster wrote:

OpenSCAD doesn't honor the fill and stroke attributes. Make
a filled smaller circle on the same center, difference the
two, then save that to get a ringed SVG path that OpenSCAD
can see.

Yes, there is some limited support for stroke, but that's not
for closed polygons at this point.

OpenSCAD deals with closed polygons only, so there's no such
thing as a filled/not-filled circle once the data is imported
into OpenSCAD.

It might be an option considering that circles or other closed
path with no fill and a stroke width in SVG could be imported
as something like:

difference() {
offset(stroke_width / 2) shape();
offset(-stroke_width / 2) shape();
}

As said before, the main issue is that SVG is a visual graphics
format, mostly meant to be rendered to pixels and not a CAD
format. So we may slowly move to more useful translations for
common cases.

ciao,
Torsten.

On 12.05.22 21:15, David Phillip Oster wrote: > OpenSCAD doesn't honor the fill and stroke attributes. Make > a filled smaller circle on the same center, difference the > two, then save that to get a ringed SVG path that OpenSCAD > can see. Yes, there is some limited support for stroke, but that's not for closed polygons at this point. OpenSCAD deals with closed polygons only, so there's no such thing as a filled/not-filled circle once the data is imported into OpenSCAD. It might be an option considering that circles or other closed path with no fill and a stroke width in SVG could be imported as something like: difference() { offset(stroke_width / 2) shape(); offset(-stroke_width / 2) shape(); } As said before, the main issue is that SVG is a visual graphics format, mostly meant to be rendered to pixels and not a CAD format. So we may slowly move to more useful translations for common cases. ciao, Torsten.
TP
Torsten Paul
Thu, May 12, 2022 7:33 PM

On 12.05.22 21:22, David Phillip Oster wrote:

just do: stroke to path in Inkscape**and openSCAD imports
it correctly

That does not work for me. Stroke path still creates a single
path outlining the stroke.

I still have to "Path -> Break Apart" and "Path -> Difference"
to actually declare the inner path as a hole in the outer path.

ciao,
Torsten.

On 12.05.22 21:22, David Phillip Oster wrote: > just do: *stroke to path* in Inkscape**and openSCAD imports > it correctly That does not work for me. Stroke path still creates a single path outlining the stroke. I still have to "Path -> Break Apart" and "Path -> Difference" to actually declare the inner path as a hole in the outer path. ciao, Torsten.
DP
David Phillip Oster
Thu, May 12, 2022 8:22 PM

On Thu, May 12, 2022 at 12:35 PM Torsten Paul Torsten.Paul@gmx.de wrote:

On 12.05.22 21:22, David Phillip Oster wrote:

just do: stroke to path in Inkscape**and openSCAD imports
it correctly

That does not work for me. Stroke path still creates a single
path outlining the stroke.

Not 'stroke path', but 'stroke to path'. It is a single path, but has two
subpaths. I got:
<svg version="1.1" width="1532" height="974" xmlns=" http://www.w3.org/2000/svg">
<path

style="color:#000000;fill:#ff0000;fill-opacity:0.698039;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;-inkscape-stroke:none;paint-order:fill
stroke markers"
d="m 458,186.69141 c -76.37072,0 -138.30859,61.93787
-138.30859,138.30859 0,76.37072 61.93787,138.30859 138.30859,138.30859
76.37072,0 138.30859,-61.93787 138.30859,-138.30859 0,-76.37072
-61.93787,-138.30859 -138.30859,-138.30859 z
m 0,2.5 c 75.01962,0 135.80859,60.78897 135.80859,135.80859 0,75.01962
-60.78897,135.80859 -135.80859,135.80859 -75.01962,0 -135.80859,-60.78897
-135.80859,-135.80859 0,-75.01962 60.78897,-135.80859 135.80859,-135.80859
z" />
</svg>

which OpenSCAD did import correctly.

On Thu, May 12, 2022 at 12:35 PM Torsten Paul <Torsten.Paul@gmx.de> wrote: > On 12.05.22 21:22, David Phillip Oster wrote: > > just do: *stroke to path* in Inkscape**and openSCAD imports > > it correctly > > That does not work for me. Stroke path still creates a single > path outlining the stroke. > > Not 'stroke path', but 'stroke to path'. It is a single path, but has two subpaths. I got: <svg version="1.1" width="1532" height="974" xmlns=" http://www.w3.org/2000/svg"> <path style="color:#000000;fill:#ff0000;fill-opacity:0.698039;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;-inkscape-stroke:none;paint-order:fill stroke markers" d="m 458,186.69141 c -76.37072,0 -138.30859,61.93787 -138.30859,138.30859 0,76.37072 61.93787,138.30859 138.30859,138.30859 76.37072,0 138.30859,-61.93787 138.30859,-138.30859 0,-76.37072 -61.93787,-138.30859 -138.30859,-138.30859 z m 0,2.5 c 75.01962,0 135.80859,60.78897 135.80859,135.80859 0,75.01962 -60.78897,135.80859 -135.80859,135.80859 -75.01962,0 -135.80859,-60.78897 -135.80859,-135.80859 0,-75.01962 60.78897,-135.80859 135.80859,-135.80859 z" /> </svg> which OpenSCAD did import correctly.
TP
Torsten Paul
Thu, May 12, 2022 8:33 PM

Aha! It did do the "Stroke to path" but left the original causing
the issue. Deleting that left the working version. Good to know :-).

ciao,
Torsten.

Aha! It did do the "Stroke to path" but left the original causing the issue. Deleting that left the working version. Good to know :-). ciao, Torsten.
JB
Jordan Brown
Thu, May 12, 2022 8:35 PM

It would be nice to have what one might call a "1D" subsystem, that
would allow for lines that did not form closed polygons, much as you can
have incomplete polyhedra.

The CNC crew would thank us.

It would be nice to have what one might call a "1D" subsystem, that would allow for lines that did not form closed polygons, much as you can have incomplete polyhedra. The CNC crew would thank us.