I’d like to introduce our new Digital LEGO builder called MOC Builder.


Re: I’d like to introduce our new Digital LEGO builder called MOC Builder.
#10
I've found my first bug: it looks like when you write floats into the file, they get the decimal separator defined by Locale, instead of the dot. Here's what i find in a file saved with MOC Builder:

Code:
0
0 Name: spaceship2.ldr
0 Author:
0 ROTATION CENTER 0 0 0 1 "Custom"
0 ROTATION CONFIG 0 0
1 8 0,000 -8,000 -10,000 1,000 0,000 0,000 0,000 1,000 0,000 0,000 0,000 1,000 3032.dat
0
1 8 0,000 -8,000 40,000 1,000 0,000 0,000 0,000 1,000 0,000 0,000 0,000 1,000 3666.dat

The problem is in the method in LDrawUtilities, here's one of the possible solutions:

Code:
public static String outputStringForFloat(float f) {
        // Locale.US ensure using dot as decimal separator
        return String.format(Locale.US, "%.3f",
                Math.round(f / LDrawGlobalFlag.DecimalPoint)
                        * LDrawGlobalFlag.DecimalPoint);
    }
Reply
« Next Oldest | Next Newest »



Messages In This Thread
Re: I’d like to introduce our new Digital LEGO builder called MOC Builder. - by Nicola - 2014-11-16, 17:45

Forum Jump:


Users browsing this thread: 7 Guest(s)