tcobbs/ldview

Impossible to save snapshot with LatLong parameters

Closed this issue · 24 comments

Hello,

I can't save an image with latitude and longitude parameters

LDView ~/Downloads/3001.dat -DefaultLatLong=0,0 -SaveSnapshot=./image.jpg

The image is saved but without the latitude and longitude value, it works normally without SaveSnapshot.

I want to do a batch to shoot images in all positions

Thank you

I'm not able to reproduce the problem on my Mac using LDView 4.4.1. Are you using 4.4.1? Are you using Linux?

Hello, yes LDView 4.4.1 on Linux Ubuntu 20.04

With :
LDView ~/Téléchargements/3001.dat -DefaultLatLong=0,0 -defaultZoom=0,7 -SaveWidth=367 -SaveHeight=367 -Lighting=1 -LightVector=-1,1,1 -OptionalStandardLight=1 -TextureStuds=1 -PolygonOffset=1 -UseQualityLighting=1 -DefaultLatitude=0 -DefaultLongitude=0 -ExamineMode=1

capture_one

With :
LDView ~/Téléchargements/3001.dat -DefaultLatLong=0,0 -defaultZoom=0,7 -SaveWidth=367 -SaveHeight=367 -Lighting=1 -LightVector=-1,1,1 -OptionalStandardLight=1 -TextureStuds=1 -PolygonOffset=1 -UseQualityLighting=1 -DefaultLatitude=0 -DefaultLongitude=0 -ExamineMode=1 -SaveSnapshot=./dataset/3001_Brick_2x4/3001_Brick_2x4_0_0.jpg

capture_two

For information, without save and without -DefaultLatitude=0 -DefaultLongitude=0 -ExamineMode=1 the result in LDView is incorrect :

capture_three

@pbartfai Does the Qt version not properly process all the command line arguments for command line snapshots?

@tcobbs Qt passes all parameters to the underlaying layer except a few one which is Qt specific.

@pbartfai Can you reproduce the problem using a command line similar to the one here?

@jdevosMagento Not really related, but I notice you are expecting the decimal separator to be comma in your -defaultZoom setting. Please note that LDView uses a period as the decimal separator. Also, I'm not sure if settings are case sensitive or not. (It may actually be platform-specific.) But "defaultZoom" should be "DefaultZoom".

Hello @tcobbs ,

Its Ok with comma, but not with a point :
-DefaultZoom=0,7

3001_Brick_2x4_-90_-360

-DefautZoom=0.7
3001_Brick_2x4_-90_-360

Its OK with defaultZoom or DefaultZoom

@pbartfai I don't understand how it can be defaulting to the system decimal separator. The setlocale man page states that "C" is the default, and we never set LC_NUMERIC to "" (which would make it default to the system locale instead of "C"). My LDraw model loading code sets LC_NUMERIC to "C" before loading the first LDraw model, but that shouldn't be necessary. I can add code to do that in the TCUserDefault initialization, but I don't understand why it would be necessary. Any ideas?

@jdevosMagento I'm going to be changing it so that decimal numbers on the command line always use a period as the decimal separator. It was supposed to be that way already. That's definitely preventing correct parsing of -DefaultLatLong, but -DefaultLatitude=0 and -DefaultLongitude=0 in your command line should have made that not matter, so something else is going wrong.

@pbartfai I added a setlocale call early in the startup:

f89053a

Hello @tcobbs is it possible to change something at home to make the tool work? Or do I have to wait for a new release?

Thank you

@jdevosMagento You could in theory compile from source, but doing so would likely require you to install a bunch of development packages. Also, since you already had -DefaultLatitude=0 and -DefaultLongitude=0 on your command line, and they aren't working, I don't really expect this to truly fix -DefaultLatLong for you. (-DefaultLatLong=0,0 should be equivalent to -DefaultLatitude=0 -DefaultLongitude=0.)

I have the same problem. Linux Version 4.4.1 Qt version 5.12.8.
LDView -SaveWidth=1000 -SaveHeight=1000 -DefaultLatLong=0,0 -SaveSnapshot=ldview_snapshots/m1.png 857_motorcycle_c.ldr goves the same output as LDView -SaveWidth=1000 -SaveHeight=1000 -DefaultLatLong=90,90 -SaveSnapshot=ldview_snapshots/m1.png 857_motorcycle_c.ldr

And guys, This bug is more than one year long.

I have an important business project to do. If You cannot fix it, I might find resource, but You will need to teach me how to debug and compile a new version.

-DefaultMatrix does not work as well

The terminal gives:

Failed to load translation pl
qt5ct: D-Bus global menu: no```

I made it work. I had to set -ExamineMode=1
I suggest suggesting updating the help for this option. It is not descibed clearly.

No, sorry, it is stil not working.
LDView -SaveWidth=1000 -SaveHeight=1000 -DefaultLatLong=50,90 -ExamineMode=1 -PreferenceSet=zdjecia1 857_motorcycle_c.ldr gives me:
image
whereas LDView -SaveWidth=1000 -SaveHeight=1000 -DefaultLatLong=50,90 -ExamineMode=1 -PreferenceSet=zdjecia1 857_motorcycle_c.ldr -SaveSnapshot=ldview_snapshots/m1.png gives:

image

(Sorry, this comment was posted from the wrong account. I redid the comment from my personal account to try to avoid confusion.)

@jerzyorlowskimim Some things. First of all, this is a hobby project. Second, I don't run Linux (although Peter does). Third, I'm in the US, and the problem appears to be due to a localization bug. I haven't been able to reproduce it, personally. Finally, try the following (one at a time or together):

  • Set your locale to English in the shell from which you run LDView. I believe that this is done by setting the LANG environment variable to "en-US".
  • Use -DefaultLatitude=50 -DefaultLongitude=90 instead of -DefaultLatLong. (Assuming it is a locale problem, then the problem is that commas and periods on the command line are causing problems.)
  • Try using the OSMesa ldview command line program instead of the Qt version of LDView.

I have tested the latest source code built on Fedora 37 using Qt 5.15.7 and create different snapshot with different LatLong settings:

./LDView -platform xcb -SaveWidth=1000 -SaveHeight=1000 -DefaultLatLong=0,0 -SaveSnapshot=/tmp/0.png ../../857_motorcycle_c.ldr
0

./LDView -platform xcb -SaveWidth=1000 -SaveHeight=1000 -DefaultLatLong=90,90 -SaveSnapshot=/tmp/90.png ../../857_motorcycle_c.ldr

90

After setting $LANG to EN_US.utf8
this doeas not work: LDView -platform xcb -SaveWidth=1000 -SaveHeight=1000 -DefaultLatitude=90 -DefaultLongitude=90 -PreferenceSet=zdjecia1 857_motorcycle_c.ldr  -SaveSnapshot=ldview_snapshots/m1.png

but this does work:
LDView -platform xcb -SaveWidth=1000 -SaveHeight=1000 -DefaultLatLong=90,90 -PreferenceSet=zdjecia1 857_motorcycle_c.ldr -SaveSnapshot=ldview_snapshots/m1.png

Tested last command with -DefaultLatitude=90 -DefaultLongitude=90 and same problem on both Fedora 37 & Windows. @tcobbs please check.

@jerzyorlowskimim Just to confirm: things are working for you with the LANG setting and -DefaultLatLong, correct? I am able to reproduce the problem with -DefaultLatitude and -DefaultLongitude, and will fix it. I believe that the locale-based problem is already fixed in the source code, but that the fix has not yet made it into a release. I'm not sure when the next release will be, but hopefully not too long.

Yes, I was able to make a correct orientation with corrected LANG settings and -DefaultLatLong.

BTW, I am planning a big R&D project that will combine AI and LEGO design. This will try to use LDView (as well as other LD.com programs) and we would also like to contribute. If any of ld developers is willing to take part of the project, please send me a private messsage.

tcobbs commented

Fixed in LDView 4.5.