No announcement yet.

Using decimals in customizer internationally

  • Filter
  • Time
  • Show
Clear All
new posts

  • Using decimals in customizer internationally

    Dear all,
    while testing the customizer today I fell into a litte trap I'd like to point out for all to avoid.
    When entering variables make sure you use a dot "." as divider, e.g. 15.5 mm
    If you use a comma "," e.g. 15,5mm, like many of us do in Europe, you will get funny results.
    The model will render but objects that are affected by the value will be omitted.

    As this is only a minor inconvenience if you know it, I don't think it needs fixing.
    Just wanted to leave a note here so others running into the same thing find an explanation.

    Let's grow this community!

  • #2
    I think you have done a helpful thing. I am aware of this possible problem on other occasions too.


    • #3
      MaStr Great catch. I have to check the OpenSCAD spec to determine if this is a bug or a feature. I think the challenge is that variables can contain vectors in the format [x,y,z]. However, my first impression is that if there are no brackets I may be able to help the user by replacing a comma with a period. Need to do some testing but that you for pointing this out. I will add this to the backlog to investigate.



      • #4
        Irv Shapiro
        Dear Irv, dear all,
        There is an other interesting behaviour of decimals in OpenSCAD I stumbled during the research.
        If in the OpenSCAD model the creator has entered the default value as a whole number, it's for the user of the OpenSCAD customizer (in the OpenSCAD software) not possible to enter a value with decimals. (Unless you edit the source code, of course)
        See the corresponding Github thread:

        This restriction seems not to apply if customising through the customizer in
        Irv probably knows best why ;-)

        This is a unique advantage of models.MWT.


        • Alan
          Alan commented
          Editing a comment
          Nice! Maybe Mr. Shapiro can help them close that bug report!

        • irvshapiro
          irvshapiro commented
          Editing a comment
          Yep. The overall customizer subsystem in OpenSCAD feels like an add-on, which it was. I built a custom parser instead of using the build-in OpenSCAD parser which gives me a bit more flexibility which is why models does not restrict fractions even when the original script has a whole number.

        • CoreyPDX
          CoreyPDX commented
          Editing a comment
          irvshapiro - do you have a doc describing which notations MWT supports (and which ones it doesn't)?

      • #5
        @CoreyPDX. I need to revisit this area. For now, I suggest using US notation (periods) but I have just added fixing this in a future release. Coming soon are real-time previews of customizations. You can see an example in a test app here:

        I will implement this first in the customizer but eventually, you will be able to preview any OpenSCAD file on the platform.