Hi,
I'm experimenting with extruded SVG's to engrave symbols into my
objects. Most SVG's work, but this specific one results in an error when
rendering (F6) and the engraving disappears. However, in preview it
looks fine.
The error message is:
ERROR: The given mesh is not closed! Unable to convert to
CGAL_Nef_Polyhedron.
I've created a minimal example to reproduce the issue (see below).
Looking at the SVG, the path ends with command "Z", this means it is in
fact closed.
Any ideas ?
The example:
--- mesh_not_closed.scad ---
// render parameters
$fa = 2.5;
$fs = 0.1;
// customizable thing properties
script_depth = 1.0;
script_scale_factor = 0.35;
extrude_scale_factor = 0.95;
svg_dpi = 96;
// the thing
difference() {
extrude_height = 2 * script_depth;
cube_height = 4 * script_depth;
translate( [ 0, 0, - cube_height / 2 ] ) {
cube( [ 20, 20, cube_height ], center = true );
}
linear_extrude( height = extrude_height, convexity = 10, center =
true, scale = extrude_scale_factor ) {
import( file = "symbol.svg", center = true, dpi = svg_dpi );
}
}
--- symbol.svg ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!-- Created with Inkscape (http://www.inkscape.org/) --><svg
width="210mm"
height="297mm"
viewBox="0 0 210 297"
version="1.1"
id="svg936"
sodipodi:docname="symbol.svg"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04, custom)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview938"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:document-units="mm"
showgrid="false"
inkscape:zoom="5"
inkscape:cx="345.02667"
inkscape:cy="125.91313"
inkscape:current-layer="layer1" />
<defs
id="defs933" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<path
id="path1"
style="clip-rule:evenodd;fill:#000000;fill-rule:nonzero;image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
d="M 6.2968,6.1943
C 5.7793,5.4328 5.2278,5.0521 4.6421,5.0521 4.2223,5.0521
3.6316,5.2815 2.8702,5.7403 1.8451,6.3554 1.1177,6.7458 0.6882,6.9119
L 0.366,6.5896
C 1.44,5.8575 2.3235,4.847 3.0165,3.5584 3.4754,2.7188
3.9,1.64 4.2906,0.3221
L 4.6128,0
c 0.2245,0 0.3368,0.2684 0.3368,0.8053
v 0
C 4.9496,0.4148 4.93,0.8249 4.891,2.0354 4.8812,2.5333
4.9204,2.8995 5.0082,3.1337 5.1156,3.4558 5.3255,3.6072 5.6378,3.5877
7.0144,3.49 8.0931,3.7341 8.8741,4.3198 9.5967,4.8665 9.9577997,5.6231
9.9577997,6.5896 9.9577997,8.1321 9.1328,9.6161 7.4829,11.0415
5.6086,12.6717 3.1142,13.7506 0,14.2778
V 13.8384
C 1.8841,13.0769 3.4705,12.0518 4.7592,10.7632 5.9991,9.5038
6.619,8.342 6.619,7.278 6.619,6.8679 6.5116,6.5067 6.2968,6.1943
Z" />
</g>
</svg>
Try offset()ing it by a minute amount. That often fixes polygons.
On Fri, 1 Apr 2022 at 16:51, Markus Näher markus.naeher@gmx.net wrote:
Hi,
I'm experimenting with extruded SVG's to engrave symbols into my
objects. Most SVG's work, but this specific one results in an error when
rendering (F6) and the engraving disappears. However, in preview it
looks fine.
The error message is:
ERROR: The given mesh is not closed! Unable to convert to
CGAL_Nef_Polyhedron.
I've created a minimal example to reproduce the issue (see below).
Looking at the SVG, the path ends with command "Z", this means it is in
fact closed.
Any ideas ?
The example:
--- mesh_not_closed.scad ---
// render parameters
$fa = 2.5;
$fs = 0.1;
// customizable thing properties
script_depth = 1.0;
script_scale_factor = 0.35;
extrude_scale_factor = 0.95;
svg_dpi = 96;
// the thing
difference() {
extrude_height = 2 * script_depth;
cube_height = 4 * script_depth;
translate( [ 0, 0, - cube_height / 2 ] ) {
cube( [ 20, 20, cube_height ], center = true );
}
linear_extrude( height = extrude_height, convexity = 10, center =
true, scale = extrude_scale_factor ) {
import( file = "symbol.svg", center = true, dpi = svg_dpi );
}
}
--- symbol.svg ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!-- Created with Inkscape (http://www.inkscape.org/) --><svg
width="210mm"
height="297mm"
viewBox="0 0 210 297"
version="1.1"
id="svg936"
sodipodi:docname="symbol.svg"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04, custom)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview938"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:document-units="mm"
showgrid="false"
inkscape:zoom="5"
inkscape:cx="345.02667"
inkscape:cy="125.91313"
inkscape:current-layer="layer1" />
<defs
id="defs933" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<path
id="path1"
style="clip-rule:evenodd;fill:#000000;fill-rule:nonzero;image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
d="M 6.2968,6.1943
C 5.7793,5.4328 5.2278,5.0521 4.6421,5.0521 4.2223,5.0521
3.6316,5.2815 2.8702,5.7403 1.8451,6.3554 1.1177,6.7458 0.6882,6.9119
L 0.366,6.5896
C 1.44,5.8575 2.3235,4.847 3.0165,3.5584 3.4754,2.7188
3.9,1.64 4.2906,0.3221
L 4.6128,0
c 0.2245,0 0.3368,0.2684 0.3368,0.8053
v 0
C 4.9496,0.4148 4.93,0.8249 4.891,2.0354 4.8812,2.5333
4.9204,2.8995 5.0082,3.1337 5.1156,3.4558 5.3255,3.6072 5.6378,3.5877
7.0144,3.49 8.0931,3.7341 8.8741,4.3198 9.5967,4.8665 9.9577997,5.6231
9.9577997,6.5896 9.9577997,8.1321 9.1328,9.6161 7.4829,11.0415
5.6086,12.6717 3.1142,13.7506 0,14.2778
V 13.8384
C 1.8841,13.0769 3.4705,12.0518 4.7592,10.7632 5.9991,9.5038
6.619,8.342 6.619,7.278 6.619,6.8679 6.5116,6.5067 6.2968,6.1943
Z" />
</g>
</svg>
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
The SVG has a bad spike, see screenshot.
It shows up in Inkscape too, so it seems to be an issue with the actual SVG, not the OpenSCAD import.
ciao,
Torsten.
works fine for me. The svg file itself renders in anything i have that
shows svg, and it renders fine in openscad.
version 2021.07.25.ci8357 (git bb54b9743)
On 01/04/2022 16:51, Markus Näher wrote:
// render parameters
$fa = 2.5;
$fs = 0.1;
// customizable thing properties
script_depth = 1.0;
script_scale_factor = 0.35;
extrude_scale_factor = 0.95;
svg_dpi = 96;
// the thing
difference() {
extrude_height = 2 * script_depth;
cube_height = 4 * script_depth;
translate( [ 0, 0, - cube_height / 2 ] ) {
cube( [ 20, 20, cube_height ], center = true );
}
linear_extrude( height = extrude_height, convexity = 10, center =
true, scale = extrude_scale_factor ) {
import( file = "symbol.svg", center = true, dpi = svg_dpi );
}
}
On 01.04.22 19:00, Torsten Paul wrote:
The SVG has a bad spike, see screenshot.
Yep, after removing this loop it renders without issues.
ciao,
Torsten.
I copied the svg code from Marcus's post. I made no alterations - it
rendered as I showed in my previous post. Is it a case that my version
of openscad is more fault tolerant than others? The spike is still
there, but makes no visible difference, unless zooming in.
That fixed it for me too. Thanks a lot.
On 01.04.22 21:23, Torsten Paul wrote:
On 01.04.22 19:00, Torsten Paul wrote:
The SVG has a bad spike, see screenshot.
Yep, after removing this loop it renders without issues.
ciao,
Torsten.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
On 01.04.22 22:04, Raymond West wrote:
I copied the svg code from Marcus's post. I made no alterations
Your console window screenshot shows "Compile and preview finished."
Did you try F6? Preview works fine as it mostly skips calculating
meshes.
ciao,
Torsten.
Hi Torsten,
The svg on it's own renders in f5 and f6. and displays in every svg
viewer that I have - which is what I first tried, and then II added in
the other code for the difference with the block. That, i thought
rendered OK too, no warning message that I noticed, and the usual
completion audio signal. Having revisited the problem, checking for f6
only, it only shows the block, and there is an error message , but
only when running the code with the block for the first time,. i.e.
warning message is not persistent, and I missed it as it scrolled past
the narrow console window. So, it seems my software version is just as
fussy as everyone's,
Best wishes,
Ray
On 01/04/2022 22:03, Torsten Paul wrote:
On 01.04.22 22:04, Raymond West wrote:
I copied the svg code from Marcus's post. I made no alterations
- it rendered as I showed in my previous post.
Your console window screenshot shows "Compile and preview finished."
Did you try F6? Preview works fine as it mostly skips calculating
meshes.
ciao,
Torsten.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org