difference() shown in preview but not rendered

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

difference() shown in preview but not rendered

ZeGuigui

Hello and thank you for accepting me on this forum/mailing list

I am new to OpenScad and 3DPrinting so I wanted to start with something "easy"... a die!

I wrote the code and everything was nice on the preview pane. Nevertheless when I build the object (F6) the difference disapears. Please see below:

  • preview (https://extranet.zeguigui.com/owncloud/s/0cUF5zJTvLK77WA)
  • built (https://extranet.zeguigui.com/owncloud/s/aoiPI3GxcYT3HX4)
  • code (https://extranet.zeguigui.com/owncloud/s/Mo9fSfy9g7tjMiD)

You will need the mana font if you want to test it: https://github.com/andrewgioia/Mana

When I switch difference() for union() on line 21 the full die face is correctly rendered. If I remove the planeswalker logo (\ue625) and add a circle instead it works both for union() and difference()

Any idea what the problem might be? This is probably a noob question but with openscad well... I am just a beginer

Thanks
Guillaume



Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: difference() shown in preview but not rendered

ZeGuigui
I have done further tests and after checking the preview from multiple
orientations found that the problem is font related. \ue625 is probably not
"closed" or something similar and line extrusion creates manifolds. Using
\ue626 as an alternative works

It's sufficient for me to test 3D printing it!



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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: difference() shown in preview but not rendered

Ronaldo
In reply to this post by ZeGuigui
I have no way to test your code now but it seems the trouble is the difference() inside magic_text. If your intention is to have an outline of the symbol \ue625 it may be simpler to do an offset()  of it instead of the difference(). 

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: difference() shown in preview but not rendered

MichaelPFrey
In reply to this post by ZeGuigui
Am 14.02.2018 um 19:45 schrieb ZeGuigui:
I have done further tests and after checking the preview from multiple
orientations found that the problem is font related. \ue625 is probably not
"closed" or something similar and line extrusion creates manifolds. Using
\ue626 as an alternative works
I also did some tests.
Strangely, one (positive as in not used in a difference) instance of your "shield" works.
Only when I try to have two or more of those shield I get

WARNING: Object may not be a valid 2-manifold and may need repair!

and thus errors.

When you want to debug the font, I would start with the bottom:





With Kind regards,
Michael Frey


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: difference() shown in preview but not rendered

Ronaldo
In reply to this post by Ronaldo
I don't know where I had my mind. Offset would not preclude the difference to get an outline. Sorry about that. 

Em 14 de fev de 2018 5:08 PM, "Ronaldo Persiano" <[hidden email]> escreveu:
I have no way to test your code now but it seems the trouble is the difference() inside magic_text. If your intention is to have an outline of the symbol \ue625 it may be simpler to do an offset()  of it instead of the difference(). 


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: difference() shown in preview but not rendered

MichaelPFrey
In reply to this post by ZeGuigui
I found the issue.
Open the font in a font editor like FontForge. It is the bottom:


The other corners aren´t exactly perfect either, but at least not self intersecting.

Report the issue upstream to the font maintainer, fix it with FontForge yourself - it is up to you.

I will write a note for our documentation, that OpenSCAD is sensitive to geometric imperfections in fonts.
It is really hard to handle within OpenSCAD, as the language and UI are to some extend just wrappers for the underlaying geometry libraries.
Those libraries expect clean geometry and it is hard to blame them for not handling someone elses mistakes.

With Kind regards
Michael Frey

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: difference() shown in preview but not rendered

nophead
I think offset() is resilient to these types of error because the Clipper library uses a very robust algorithm. I have fixed broken SVG files by applying a very small offset.

On 15 February 2018 at 05:48, Michael Frey <[hidden email]> wrote:
I found the issue.
Open the font in a font editor like FontForge. It is the bottom:


The other corners aren´t exactly perfect either, but at least not self intersecting.

Report the issue upstream to the font maintainer, fix it with FontForge yourself - it is up to you.

I will write a note for our documentation, that OpenSCAD is sensitive to geometric imperfections in fonts.
It is really hard to handle within OpenSCAD, as the language and UI are to some extend just wrappers for the underlaying geometry libraries.
Those libraries expect clean geometry and it is hard to blame them for not handling someone elses mistakes.

With Kind regards
Michael Frey

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: difference() shown in preview but not rendered

ZeGuigui
I will give offset() a try. It looks like it's a better way to achieve what I
wanted to do!

Once tested I will report back here the result



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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: difference() shown in preview but not rendered

kintel
Administrator
In reply to this post by Ronaldo
> On Feb 14, 2018, at 2:20 PM, Ronaldo Persiano <[hidden email]> wrote:
>
> I don't know where I had my mind. Offset would not preclude the difference to get an outline. Sorry about that.
>
Otoh, offset may help clean up self-intersections.
This seems to do the trick:

difference() {
  offset(-0.1) text(text = "\ue625”, size = size, halign = "center”, valign = "center”, font="mana:style=Regular");
  offset(-1) text(text = "\ue625”, size = size, halign = "center”, valign = "center”, font="mana:style=Regular");
}

In this case, you could also wrap the text in a module as it’s the exact same symbol instantiated twice.

 -Marius


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: difference() shown in preview but not rendered

kintel
Administrator
In reply to this post by Ronaldo
Another trick:

You can "use <mana.ttf>” directly in the scad file. This allows you to distribute the ttf file with your OpenSCAD file and you won’t have to install the font system-wide.

 -Marius


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org