Patch to fix OpenSCAD STL export in some non-English locales

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

Patch to fix OpenSCAD STL export in some non-English locales

Jonathan Marsden
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

It was pointed out to me on IRC in #reprap (of irc.freenode.net) that
OpenSCAD was creating invalid ASCII STL files in some circumstances,
files that had commas as the radix separator in the "facet normal" lines
instead of periods.  Running

  LANG=fr_FR.utf8 openscad &

and then opening any .scad file, rendering it, and exporting to STL, is
enough to trigger this bug.  Many European locales where "a little bit
less than a million" is written as 999.999,99 (rather than the USA/UK
way 999,999.99) will be affected by this, not just French.

The fix for this seems trivial, so I made it, and it "works for me".  It
is at http://crosswire.org/~jmarsden/openscad-stl-export-locale-fix.diff
- -- all this does is call setlocale(LC_NUMERIC, "POSIX") at the start of
the STL export method, and setlocale(LC_NUMERIC, "") at the end.  I
tested this on 32 and 64bit Ubuntu and it works.  No idea if this breaks
anything for Windows, though!

I have also made personal patched OpenSCAD Ubuntu Lucid packages in my
PPA that include this patch (and others that work around the "Reload
loses my work" issue which I see is now also mitigated OpenSCAD svn, but
not in the 2010.05 release tarball).
http://launchpad.net/~jmarsden/+archive/ppa/ is where to find that.

If there is an OpenSCAD bugtracker I should be posting this to, please
let me know where it is :)

Thanks for OpenSCAD!

Jonathan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwcN7oACgkQUGfT4+mKBLIr5gCeKvcBSobYXqHRiYSTgMO3p5rg
iHgAnjcRK2IfLPQ6Ru1rkS/jGaCFY4bi
=qmvJ
-----END PGP SIGNATURE-----

Reply | Threaded
Open this post in threaded view
|

Re: Patch to fix OpenSCAD STL export in some non-English locales

Jestin Stoffel
I have also wondered where patches to OpenSCAD can be posted and bugs
can be tracked.  I went through a few FIXME's in the code last weekend,
but I'm unsure how I am supposed to get my patches applied.  Should
there be a developers section on the wiki?

On Fri, 2010-06-18 at 20:21 -0700, Jonathan Marsden wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> It was pointed out to me on IRC in #reprap (of irc.freenode.net) that
> OpenSCAD was creating invalid ASCII STL files in some circumstances,
> files that had commas as the radix separator in the "facet normal" lines
> instead of periods.  Running
>
>   LANG=fr_FR.utf8 openscad &
>
> and then opening any .scad file, rendering it, and exporting to STL, is
> enough to trigger this bug.  Many European locales where "a little bit
> less than a million" is written as 999.999,99 (rather than the USA/UK
> way 999,999.99) will be affected by this, not just French.
>
> The fix for this seems trivial, so I made it, and it "works for me".  It
> is at http://crosswire.org/~jmarsden/openscad-stl-export-locale-fix.diff
> - -- all this does is call setlocale(LC_NUMERIC, "POSIX") at the start of
> the STL export method, and setlocale(LC_NUMERIC, "") at the end.  I
> tested this on 32 and 64bit Ubuntu and it works.  No idea if this breaks
> anything for Windows, though!
>
> I have also made personal patched OpenSCAD Ubuntu Lucid packages in my
> PPA that include this patch (and others that work around the "Reload
> loses my work" issue which I see is now also mitigated OpenSCAD svn, but
> not in the 2010.05 release tarball).
> http://launchpad.net/~jmarsden/+archive/ppa/ is where to find that.
>
> If there is an OpenSCAD bugtracker I should be posting this to, please
> let me know where it is :)
>
> Thanks for OpenSCAD!
>
> Jonathan
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkwcN7oACgkQUGfT4+mKBLIr5gCeKvcBSobYXqHRiYSTgMO3p5rg
> iHgAnjcRK2IfLPQ6Ru1rkS/jGaCFY4bi
> =qmvJ
> -----END PGP SIGNATURE-----
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad


Reply | Threaded
Open this post in threaded view
|

Re: Patch to fix OpenSCAD STL export in some non-English locales

kintel
Administrator
In reply to this post by Jonathan Marsden
On Jun 19, 2010, at 05:21 AM, Jonathan Marsden wrote:

> The fix for this seems trivial, so I made it, and it "works for me".  It
> is at http://crosswire.org/~jmarsden/openscad-stl-export-locale-fix.diff
> - -- all this does is call setlocale(LC_NUMERIC, "POSIX") at the start of
> the STL export method, and setlocale(LC_NUMERIC, "") at the end.

This problem was also present on Mac. The Windows situation is unknown, but I've applied your patch after changing the "POSIX" locale to the equivalent "C", as Windows is less likely to understand "POSIX" as it's not POSIX conformant.

> If there is an OpenSCAD bugtracker I should be posting this to, please
> let me know where it is :)

Our state-of-the-art combined issue tracker and task management system can be accessed here :)

http://svn.clifford.at/openscad/trunk/doc/TODO.txt

~/= Marius

--
We are Elektropeople for a better living.





Reply | Threaded
Open this post in threaded view
|

Re: Patch to fix OpenSCAD STL export in some non-English locales

kintel
Administrator
In reply to this post by Jestin Stoffel
On Jun 21, 2010, at 16:13 PM, Jestin Stoffel wrote:

> I have also wondered where patches to OpenSCAD can be posted and bugs
> can be tracked.  I went through a few FIXME's in the code last weekend,
> but I'm unsure how I am supposed to get my patches applied.  Should
> there be a developers section on the wiki?
>
Please post any docs to this list for now.
The wiki (wikibooks) is just for the docs, so I don't think it makes sense to extend it to development issues.

As long as there are so few developers, there isn't, IMO, a great need for a more complex system, but in the longer run I'd personally be all for having a more coherent project hosting solution for OpenSCAD.

~/= Marius

--
We are Elektropeople for a better living.


Reply | Threaded
Open this post in threaded view
|

Re: Patch to fix OpenSCAD STL export in some non-English locales

Jestin Stoffel


On Sat, Jun 26, 2010 at 11:21 AM, Marius Kintel <[hidden email]> wrote:
On Jun 21, 2010, at 16:13 PM, Jestin Stoffel wrote:

> I have also wondered where patches to OpenSCAD can be posted and bugs
> can be tracked.  I went through a few FIXME's in the code last weekend,
> but I'm unsure how I am supposed to get my patches applied.  Should
> there be a developers section on the wiki?
>
Please post any docs to this list for now.
The wiki (wikibooks) is just for the docs, so I don't think it makes sense to extend it to development issues.

Sure.  I posted my patch to:

One fix has to do with the color of the axis cross in the lower left, and the other fix calls maybeSave during actionOpen, actionOpenRecent, and actionNew (when appropriate for SDI mode).
Reply | Threaded
Open this post in threaded view
|

Re: Patch to fix OpenSCAD STL export in some non-English locales

kintel
Administrator
On Jun 28, 2010, at 04:12 AM, Jestin Stoffel wrote:

> Sure.  I posted my patch to:
> http://www.jestinstoffel.com/files/various_fixmes.diff 
>
> One fix has to do with the color of the axis cross in the lower left, and the other fix calls maybeSave during actionOpen, actionOpenRecent, and actionNew (when appropriate for SDI mode).

Thanks! It's committed more or less as it is. The color stuff improved a bit, but it still broken when the background is gray. Other colors have similar issues, so I sprinkled some more fixmes around.

~/= Marius

--
We are Elektropeople for a better living.