Menu

#8 STL is exported with 10x smaller scale

Dev Version
open
nobody
5
2015-04-19
2015-04-17
Tomas Dulik
No

Hi,

in LDView 4.1, I tried to export a simple model to STL, but the result has wrong scale - the dimensions are 10x smaller, e.g. 0.8mm instead of 8mm.

In 4.2 Beta 1, I tried to set the "Scale" options in the Export dialog to mm, but it does not make any difference. You can see the problem in the attached example - the file generated with "mm" setting is identical to the one generated with "cm" setting.

The problem is in the "mm" implementation - when user selects "mm", you probably forgot to multiply the exported dimensions by 10.

IMO, the "cm" and "inches" work correctly, but are useless - I did not find any way to set the input file units while importing STL into Altium, Solidworks or an online STL viewer (http://www.viewstl.com/, http://www.3dvieweronline.com/).

When resolving the bug, you can quickly check the resulting file using
http://www.viewstl.com/
It shows the model size in mm.
E.g., the "Technic beam 15" should have about 119.2 x 8 x 7.2mm, but in your current STL, it has only 11.92x0.8x0.72 mm (viewstl.com rounds it to integers, so it displays 12x1x1mm)

Thanks for the great work you are doing!

1 Attachments

Discussion

  • Tomas Dulik

    Tomas Dulik - 2015-04-19

    I checked the code from CVS and it looks OK:

        case 2: // cm
            scale = 0.04f;
            break; 
        case 3: // mm
            scale = 0.4f;
            break;
    

    I looked to Windows registry and after setting the Scale to mm, the key
    HKCU\Software\Travis Cobbs\LDView\StlExporter\Scale
    is really set to
    3
    but the resulting STL file is still generated with "cm" scale.

    I was lazy to install MS Visual Studio and all Qt libraries on Windows to debug this, so I rebooted to Ubuntu 14.04 Trusty and compiled LDView from CVS there.

    Because I did not find any way to set the Options for STLExporter in Ubuntu, I had to edit the file

    ~/.config/LDView/LDView.conf
    (which is used by QSettings as persistent storage on Ubuntu)
    I added the following line:

    StlExporter\Scale=3

    And now the STL export works correctly - see the attachment.

    So maybe this bug is already solved in the CVS trunk version?

     
  • Tomas Dulik

    Tomas Dulik - 2015-04-19

    I have just tried the "official" binary 4.2Beta1 package for Linux (http://downloads.sourceforge.net/ldview/ldview-4.2-beta1.x64.deb?download) with the same ~/.config/LDView/LDView.conf setting for Scale, which I used with the compiled CVS trunk version.

    And the bug is there too: STL export generates same scale as with the "cm" setting.

    This means that the bug is present in 4.2Beta1 for Windows and Linux.

    The bug is corrected in the CVS version, at least on Linux.

    If this is the case, you can close the bug as solved.

     

Log in to post a comment.