discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

OpenSCAD generates non-manifold objects when importing .svg

G
gabr42
Sun, Mar 8, 2020 5:44 PM

I have a very simple heart-shape Bezier, stored in an Inkskape .svg file. [
heart4.svg https://www.dropbox.com/s/h9127d32bjpks8r/heart4.svg?dl=1  ]

My program is offseting and linear_extruding this object with various
thicknesses and differences one from another. It generates a broken object
("Object may not be a valid 2-manifold") and I don't understand why.

This simple program works correctly:

module heart () {
import("heart4.svg", convexity=10);
}

for(i=[1:1])
translate([20i, 0, 0])
linear_extrude(10)
difference () {
offset(r=2
i)
heart();

heart();
}

Result is rendered correctly, F6 works:

http://forum.openscad.org/file/t2769/heart4_1.jpg

If I change just the 'for' command to:

for(i=[1:2])

... I get two hearts that seem fine in a preview, but render warns about a
non-manifold objects and indeed if I export the .STL file it is completely
broken.

http://forum.openscad.org/file/t2769/heart4_2.jpg

Interestingly, if I change the 'for' to:

for(i=[2:2])

... program generates just the second heart and F6 works again!

http://forum.openscad.org/file/t2769/heart4_5.jpg

Does anyone has a workaround for this problem? Indeed, in this simple case I
could run the program twice and export two separate objects but in reality I
want to do something like this:

!
difference () {
for(i=[1:2])
linear_extrude(10-5*(i-1))
offset(r=2*i)
heart();

translate([0, 0, -0.01])
linear_extrude(10.02)
heart();
}

This works in F5:

http://forum.openscad.org/file/t2769/heart4_3.jpg

... but again fails in F6:

http://forum.openscad.org/file/t2769/heart4_4.jpg

Primož

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

I have a very simple heart-shape Bezier, stored in an Inkskape .svg file. [ heart4.svg <https://www.dropbox.com/s/h9127d32bjpks8r/heart4.svg?dl=1> ] My program is offseting and linear_extruding this object with various thicknesses and differences one from another. It generates a broken object ("Object may not be a valid 2-manifold") and I don't understand why. This simple program works correctly: module heart () { import("heart4.svg", convexity=10); } for(i=[1:1]) translate([20*i, 0, 0]) linear_extrude(10) difference () { offset(r=2*i) heart(); heart(); } Result is rendered correctly, F6 works: <http://forum.openscad.org/file/t2769/heart4_1.jpg> If I change just the 'for' command to: for(i=[1:2]) ... I get two hearts that seem fine in a preview, but render warns about a non-manifold objects and indeed if I export the .STL file it is completely broken. <http://forum.openscad.org/file/t2769/heart4_2.jpg> Interestingly, if I change the 'for' to: for(i=[2:2]) ... program generates just the second heart and F6 works again! <http://forum.openscad.org/file/t2769/heart4_5.jpg> Does anyone has a workaround for this problem? Indeed, in this simple case I could run the program twice and export two separate objects but in reality I want to do something like this: ! difference () { for(i=[1:2]) linear_extrude(10-5*(i-1)) offset(r=2*i) heart(); translate([0, 0, -0.01]) linear_extrude(10.02) heart(); } This works in F5: <http://forum.openscad.org/file/t2769/heart4_3.jpg> ... but again fails in F6: <http://forum.openscad.org/file/t2769/heart4_4.jpg> Primož -- Sent from: http://forum.openscad.org/
TP
Torsten Paul
Sun, Mar 8, 2020 6:01 PM

The "does not happen with single hard object" is just an illusion as
the linear_extrude of 2d geometry does not involve the CSG engine
(this is not really advertised but sort-of visible by the different
summary output).

As the problem goes away when adding offset(0.1) to the differenced
part, I suspect it might be an overlap at the sharp edge at the top.

ciao,
Torsten.

The "does not happen with single hard object" is just an illusion as the linear_extrude of 2d geometry does not involve the CSG engine (this is not really advertised but sort-of visible by the different summary output). As the problem goes away when adding offset(0.1) to the differenced part, I suspect it might be an overlap at the sharp edge at the top. ciao, Torsten.
RP
Ronaldo Persiano
Sun, Mar 8, 2020 6:14 PM

To confirm that a rendered (F6) object is really correct (and it is a
manyfold) just do any boolean operation with it like:

union() {
object();
cube();
}

To confirm that a rendered (F6) object is really correct (and it is a manyfold) just do any boolean operation with it like: union() { object(); cube(); }
G
gabr42
Sun, Mar 8, 2020 7:41 PM

Thank you! Offsetting differenced object indeed does the trick!

I tried "everything" :) but never though of that.

Primož

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

Thank you! Offsetting differenced object indeed does the trick! I tried "everything" :) but never though of that. Primož -- Sent from: http://forum.openscad.org/