ldview icon indicating copy to clipboard operation
ldview copied to clipboard

Impossible to save snapshot with LatLong parameters

Open jdevosMagento opened this issue 3 years ago • 11 comments
trafficstars

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

jdevosMagento avatar Apr 19 '22 22:04 jdevosMagento

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?

tcobbs avatar Apr 20 '22 06:04 tcobbs

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

jdevosMagento avatar Apr 20 '22 07:04 jdevosMagento

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

capture_three

jdevosMagento avatar Apr 20 '22 08:04 jdevosMagento

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

tcobbs avatar Apr 20 '22 15:04 tcobbs

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

pbartfai avatar Apr 20 '22 15:04 pbartfai

@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".

tcobbs avatar Apr 21 '22 03:04 tcobbs

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

jdevosMagento avatar Apr 21 '22 07:04 jdevosMagento

@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.

tcobbs avatar Apr 21 '22 08:04 tcobbs

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

https://github.com/tcobbs/ldview/commit/f89053a18735f091592489b63d192756c23cc613

tcobbs avatar Apr 21 '22 08:04 tcobbs

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 avatar Apr 26 '22 15:04 jdevosMagento

@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.)

tcobbs avatar Apr 27 '22 19:04 tcobbs

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

jerzyorlowskimim avatar Dec 20 '22 16:12 jerzyorlowskimim

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.

jerzyorlowskimim avatar Dec 20 '22 16:12 jerzyorlowskimim

-DefaultMatrix does not work as well

The terminal gives:

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

jerzyorlowskimim avatar Dec 20 '22 16:12 jerzyorlowskimim

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

jerzyorlowskimim avatar Dec 20 '22 17:12 jerzyorlowskimim

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

jerzyorlowskimim avatar Dec 20 '22 17:12 jerzyorlowskimim

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

tcobbs-bentley avatar Dec 20 '22 17:12 tcobbs-bentley

@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.

tcobbs avatar Dec 20 '22 17:12 tcobbs

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

pbartfai avatar Dec 20 '22 19:12 pbartfai

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

jerzyorlowskimim avatar Dec 20 '22 23:12 jerzyorlowskimim

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

pbartfai avatar Dec 21 '22 06:12 pbartfai

@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.

tcobbs avatar Dec 21 '22 20:12 tcobbs

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.

jerzyorlowskimim avatar Dec 22 '22 08:12 jerzyorlowskimim

Fixed in LDView 4.5.

tcobbs avatar Apr 23 '23 21:04 tcobbs