Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"3mf mesh is invalid" from imported SVG #881

Open
adamcrume opened this issue Jan 27, 2025 · 4 comments
Open

"3mf mesh is invalid" from imported SVG #881

adamcrume opened this issue Jan 27, 2025 · 4 comments
Labels
wontfix This will not be worked on

Comments

@adamcrume
Copy link

Simply extruding one of the shapes from https://rustacean.net/assets/rustacean-flat-noshadow.svg and meshing it raises an error.

from build123d import Mesher, extrude, import_svg

shapes = import_svg("rustacean-flat-noshadow.svg")
Mesher().add_shape(extrude(shapes[3], 1))
Traceback (most recent call last):
  File "/home/adam/Documents/3d-printing/badge flair build123d/src/bug.py", line 16, in <module>
    Mesher().add_shape(extrude(shapes[3], 1))
  File "/home/adam/apps/build123d/lib/python3.12/site-packages/build123d/mesher.py", line 442, in add_shape
    raise RuntimeError("3mf mesh is invalid")
RuntimeError: 3mf mesh is invalid
@snoyer
Copy link
Contributor

snoyer commented Jan 27, 2025

shapes[3] comes from a self-intersecting path that would be a valid Wire but does not produce a valid Face

[w.is_valid() for w in shapes[3].wires()] = [True]
shapes[3].is_valid() = False
rustacean-flat-noshadow.mp4

@jdegenstein
Copy link
Collaborator

Related issue #842 with some discussion and advice

@gumyr gumyr added the wontfix This will not be worked on label Jan 27, 2025
@gumyr gumyr added this to the Not Gating Release 1.0.0 milestone Jan 27, 2025
@adamcrume
Copy link
Author

OH MY GOSH, no wonder I didn't see that, it's so tiny. Thanks! Is there a way to split apart the wire in code so that it would generate valid faces (i.e. if I want this to work for other SVGs)? #842 doesn't have much detail.

@gumyr
Copy link
Owner

gumyr commented Jan 29, 2025

Yes, both Edge or Wire have trim methods that can be used to shorten them but finding the right Edge/Wire and the right place and rebuilding the shape with the shorten shape look to be challenging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

4 participants