discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Import() of SVG files with "holes" in them

T
Troberg
Thu, Jun 11, 2020 7:10 PM

I'm trying to import an SVG logo, and when I look at the result, any holes in
it are filled. For example, an 8 would look like two stacked solid circles,
not two rings.

Am I doing something wrong, or is this "behaviour by design" and I can stop
trying to find problems in my SVG file?

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

I'm trying to import an SVG logo, and when I look at the result, any holes in it are filled. For example, an 8 would look like two stacked solid circles, not two rings. Am I doing something wrong, or is this "behaviour by design" and I can stop trying to find problems in my SVG file? -- Sent from: http://forum.openscad.org/
NH
nop head
Thu, Jun 11, 2020 7:23 PM

There are two ways of specifying holes in an SVG. One is winding order and
the other is counting from the inside out. Perhaps OpenSCAD is expecting
one and your file is using the other. It is specified by an attribute IIRC,
so readers should work with both.

On Thu, 11 Jun 2020 at 20:11, Troberg troberg.anders@gmail.com wrote:

I'm trying to import an SVG logo, and when I look at the result, any holes
in
it are filled. For example, an 8 would look like two stacked solid circles,
not two rings.

Am I doing something wrong, or is this "behaviour by design" and I can stop
trying to find problems in my SVG file?

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


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

There are two ways of specifying holes in an SVG. One is winding order and the other is counting from the inside out. Perhaps OpenSCAD is expecting one and your file is using the other. It is specified by an attribute IIRC, so readers should work with both. On Thu, 11 Jun 2020 at 20:11, Troberg <troberg.anders@gmail.com> wrote: > I'm trying to import an SVG logo, and when I look at the result, any holes > in > it are filled. For example, an 8 would look like two stacked solid circles, > not two rings. > > Am I doing something wrong, or is this "behaviour by design" and I can stop > trying to find problems in my SVG file? > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
TP
Torsten Paul
Thu, Jun 11, 2020 7:30 PM

On 11.06.20 21:10, Troberg wrote:

Am I doing something wrong, or is this "behaviour by design" and
I can stop trying to find problems in my SVG file?

It behaves just like circle() in OpenSCAD. If you only stack them
they will union and the smaller one will vanish.

For SVG to import with the inner circle cut out, the SVG file needs
to be a single path for the whole 8 shape. E.g. in Inkscape it's
possible to do Path->Difference.
This is also visible in Inkscape if the shape is filled. Just
overlapping will show the fill everywhere. Doing the difference
will show the background though the cut out.

ciao,
Torsten.

On 11.06.20 21:10, Troberg wrote: > Am I doing something wrong, or is this "behaviour by design" and > I can stop trying to find problems in my SVG file? It behaves just like circle() in OpenSCAD. If you only stack them they will union and the smaller one will vanish. For SVG to import with the inner circle cut out, the SVG file needs to be a single path for the whole 8 shape. E.g. in Inkscape it's possible to do Path->Difference. This is also visible in Inkscape if the shape is filled. Just overlapping will show the fill everywhere. Doing the difference will show the background though the cut out. ciao, Torsten.
T
Troberg
Fri, Jun 12, 2020 5:16 AM

Thanks, everybody. In the end, I solved it by cheating, I simply made two
SVGs, with the outer shapes removed in the second, and diffed them. I had to
put a dot in opposite corners to make them scale the same, but I suspect
that's an artifact of the export, not the import in OpenSCAD.

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

Thanks, everybody. In the end, I solved it by cheating, I simply made two SVGs, with the outer shapes removed in the second, and diffed them. I had to put a dot in opposite corners to make them scale the same, but I suspect that's an artifact of the export, not the import in OpenSCAD. -- Sent from: http://forum.openscad.org/
F
fred
Fri, Jun 12, 2020 8:22 AM

Another option is to use Inkscape extension "Paths to OpenSCAD" which also fills in the holes. the extension creates individual modules for each component of the build. This enables one to move the holes to a difference operation, providing the desired result.

On Friday, June 12, 2020, 1:17:20 AM EDT, Troberg <troberg.anders@gmail.com> wrote:  

Thanks, everybody. In the end, I solved it by cheating, I simply made two
SVGs, with the outer shapes removed in the second, and diffed them. I had to
put a dot in opposite corners to make them scale the same, but I suspect
that's an artifact of the export, not the import in OpenSCAD.

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


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Another option is to use Inkscape extension "Paths to OpenSCAD" which also fills in the holes. the extension creates individual modules for each component of the build. This enables one to move the holes to a difference operation, providing the desired result. On Friday, June 12, 2020, 1:17:20 AM EDT, Troberg <troberg.anders@gmail.com> wrote: Thanks, everybody. In the end, I solved it by cheating, I simply made two SVGs, with the outer shapes removed in the second, and diffed them. I had to put a dot in opposite corners to make them scale the same, but I suspect that's an artifact of the export, not the import in OpenSCAD. -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list Discuss@lists.openscad.org http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org