LDView Using CommandLinesList and ExportFile


Using CommandLinesList and ExportFile
#1
Hello.




I'm trying to use LDView command line to do batch pov generation. I have 2 problems



the first one is that the pov file I get using command line with ExportFile is not the same I get using the same command line  and manual export.




Case 1 :

Code:
D:\Installations\LDRAW\LDView64\LDView64.exe D:\LEGO\Python\data\3001.ldr -DefaultLatitude=20 -DefaultLongitude=45 -WindowWidth=504 -WindowHeight=563 -ExportFile=D:\LEGO\Python\data\3001.pov



vs :

Case 2 :

Code:
D:\Installations\LDRAW\LDView64\LDView64.exe D:\LEGO\Python\data\3001.ldr -DefaultLatitude=20 -DefaultLongitude=45 -WindowWidth=504 -WindowHeight=563



Of course, the second line give me exactly what I want in the LDView window.




they're only two differences :


the first line of the header is not the same (it's not a problem, but it's strange)




Case 1 :



Code:
// Generated By: LDView Copyright (C) 2018 Travis Cobbs & Peter Bartfai
vs :



Case 2 :



Code:
// Generated By: LDView 4.3 Copyright (C) 2018 Travis Cobbs & Peter Bartfai


the camera settings are wrong in case 2 :



Case 1 :



Code:
#declare LDXCameraLoc = < 447.158142,-351.187286,-446.14975 >;    // Camera Location vector
#declare LDXCameraLookAt = < 4.58077876387164906191,10.17561232900345657981,-3.57247258550586366255 >;    // Camera look-at point vector
#declare LDXCameraSky = < -0.35355329881115843405,-0.86602543005723520153,0.35355341802042911103 >;    // Camera sky vector (<0,-1,0> will usually work for standard "up")
vs :



Case 2 :



Code:
#declare LDXCameraLoc = < 707.842224,-354.348816,-707.842224 >; // Camera Location vector
#declare LDXCameraLookAt = < 2.24497200047949263535,8.84444866651756456122,-2.24497200047949263535 >; // Camera look-at point vector
#declare LDXCameraSky = < -0.24184478580022841787,-0.93969260886871053273,0.24184478580022841787 >; // Camera sky vector (<0,-1,0> will usually work for standard "up")




Obviously, in the first case, the camera is too close and my renders are cropped. I bypass the problem by tweaking LDXCamAspect and angle, but the result is not what I want and what I've set up. I can go with it for now, but it's strange.







The other problem is that I'm not able to use the -commandLinesList functionnality.



I've created a file  named commandlist.txt :







Code:
Common: -DefaultLatitude=20 -DefaultLongitude=45 -WindowWidth=504 -WindowHeight=563
D:\LEGO\Python\data\3001.ldr -ExportFile=D:\LEGO\Python\data\3001.pov
D:\LEGO\Python\data\3002.ldr -ExportFile=D:\LEGO\Python\data\3002.pov
D:\LEGO\Python\data\3003.ldr -ExportFile=D:\LEGO\Python\data\3003.pov
D:\LEGO\Python\data\3002.ldr -ExportFile=D:\LEGO\Python\data\3004.pov
D:\LEGO\Python\data\3002.ldr -ExportFile=D:\LEGO\Python\data\3005.pov
D:\LEGO\Python\data\3002.ldr -ExportFile=D:\LEGO\Python\data\3006.pov
D:\LEGO\Python\data\3002.ldr -ExportFile=D:\LEGO\Python\data\3007.pov
D:\LEGO\Python\data\3002.ldr -ExportFile=D:\LEGO\Python\data\3008.pov




My command line is :



Code:
D:\Installations\LDRAW\LDView64\LDView64.exe -CommandLinesList=D:\LEGO\Python\data\commandlist.txt




LDview just pop up like usualy, asking me to open a file. I'm lost.
Reply
RE: Using CommandLinesList and ExportFile
#2
(2021-02-23, 21:11)Bertrand Lequy Wrote: the first one is that the pov file I get using command line with ExportFile is not the same I get using the same command line  and manual export.

Case 1 :

Code:
D:\Installations\LDRAW\LDView64\LDView64.exe D:\LEGO\Python\data\3001.ldr -DefaultLatitude=20 -DefaultLongitude=45 -WindowWidth=504 -WindowHeight=563 -ExportFile=D:\LEGO\Python\data\3001.pov

vs :

Case 2 :

Code:
D:\Installations\LDRAW\LDView64\LDView64.exe D:\LEGO\Python\data\3001.ldr -DefaultLatitude=20 -DefaultLongitude=45 -WindowWidth=504 -WindowHeight=563

Of course, the second line give me exactly what I want in the LDView window.

they're only two differences :

the first line of the header is not the same (it's not a problem, but it's strange)

Case 1 :
Code:
// Generated By: LDView Copyright (C) 2018 Travis Cobbs & Peter Bartfai
vs :

Case 2 :
Code:
// Generated By: LDView 4.3 Copyright (C) 2018 Travis Cobbs & Peter Bartfai

This is a bug (although obviously relatively minor). When setting things up for the command line, it skips the step where it figures out what version of LDView is being used to generate the POV file. I should be able to fix this fairly easily. The POV generation code is shared by the Windows, Mac and Qt versions of LDView, and doesn't know what the application version is. The code that injects that version into the POV section isn't being run when generating a POV from the command line.


(2021-02-23, 21:11)Bertrand Lequy Wrote: the camera settings are wrong in case 2 :

Case 1 :
Code:
#declare LDXCameraLoc = < 447.158142,-351.187286,-446.14975 >;    // Camera Location vector
#declare LDXCameraLookAt = < 4.58077876387164906191,10.17561232900345657981,-3.57247258550586366255 >;    // Camera look-at point vector
#declare LDXCameraSky = < -0.35355329881115843405,-0.86602543005723520153,0.35355341802042911103 >;    // Camera sky vector (<0,-1,0> will usually work for standard "up")
vs :

Case 2 :
Code:
#declare LDXCameraLoc = < 707.842224,-354.348816,-707.842224 >; // Camera Location vector
#declare LDXCameraLookAt = < 2.24497200047949263535,8.84444866651756456122,-2.24497200047949263535 >; // Camera look-at point vector
#declare LDXCameraSky = < -0.24184478580022841787,-0.93969260886871053273,0.24184478580022841787 >; // Camera sky vector (<0,-1,0> will usually work for standard "up")

Obviously, in the first case, the camera is too close and my renders are cropped. I bypass the problem by tweaking LDXCamAspect and angle, but the result is not what I want and what I've set up. I can go with it for now, but it's strange.

What you describe sounds like it is "works as designed". (In other words, good or bad, I think it is doing what I intended it to do.) The WindowWidth and WindowHeight settings are ignored for command line exports. You should instead use SaveWidth and SaveHeight. Additionally, I suspect that you have LDView's POV Aspect Ratio setting set to "Current LDView aspect ratio". You may or may not want it to be set to this. If you set it to Automatic, the POV aspect ratio will always match the aspect ratio of the image you instruct POV to generate.


(2021-02-23, 21:11)Bertrand Lequy Wrote: The other problem is that I'm not able to use the -commandLinesList functionnality.

I've created a file  named commandlist.txt :
Code:
Common: -DefaultLatitude=20 -DefaultLongitude=45 -WindowWidth=504 -WindowHeight=563
D:\LEGO\Python\data\3001.ldr -ExportFile=D:\LEGO\Python\data\3001.pov
D:\LEGO\Python\data\3002.ldr -ExportFile=D:\LEGO\Python\data\3002.pov
D:\LEGO\Python\data\3003.ldr -ExportFile=D:\LEGO\Python\data\3003.pov
D:\LEGO\Python\data\3002.ldr -ExportFile=D:\LEGO\Python\data\3004.pov
D:\LEGO\Python\data\3002.ldr -ExportFile=D:\LEGO\Python\data\3005.pov
D:\LEGO\Python\data\3002.ldr -ExportFile=D:\LEGO\Python\data\3006.pov
D:\LEGO\Python\data\3002.ldr -ExportFile=D:\LEGO\Python\data\3007.pov
D:\LEGO\Python\data\3002.ldr -ExportFile=D:\LEGO\Python\data\3008.pov

My command line is :
Code:
D:\Installations\LDRAW\LDView64\LDView64.exe -CommandLinesList=D:\LEGO\Python\data\commandlist.txt

LDview just pop up like usualy, asking me to open a file. I'm lost.

I'm not sure what is going on here; I'll have to test. Your commandlist.txt file works for me on my Mac after I edit the filenames to be valid for my Mac. The behavior you describe is what would happen if LDView cannot find any of the files you are specifying (D:\LEGO\Python\data\3001.ldr, etc.), or if it cannot find D:\LEGO\Python\data\commandlist.txt. Basically, during startup, it tries to determine if there is anything on the command line requesting snapshots or exports. If is successfully generates any snapshots or exports, it then simply exits. If not, it runs as normal, which seems to be what you are seeing. I'll test in Windows to see if I somehow broke the CommandLinesList functionality there.

As an aside, I do notice that you have an apparent copy-and-paste error, in that only the first three LDR filenames match the target POV filenames, and the rest reuse 3002.ldr.
Reply
RE: Using CommandLinesList and ExportFile
#3
Thank you for your answers.

(2021-02-24, 0:26)Travis Cobbs Wrote: What you describe sounds like it is "works as designed". (In other words, good or bad, I think it is doing what I intended it to do.) The WindowWidth and WindowHeight settings are ignored for command line exports. You should instead use SaveWidth and SaveHeight. Additionally, I suspect that you have LDView's POV Aspect Ratio setting set to "Current LDView aspect ratio". You may or may not want it to be set to this. If you set it to Automatic, the POV aspect ratio will always match the aspect ratio of the image you instruct POV to generate.

I tryed different configurations to solve the problem by myself before bothering somebody here Big Grin I probably messed some settings up.

I made a quick test right now with automatic setting and there're still camera differences. I'm going to perform more tests later according to your suggestions. And report here if necessary.

(2021-02-24, 0:26)Travis Cobbs Wrote: I'm not sure what is going on here; I'll have to test. Your commandlist.txt file works for me on my Mac after I edit the filenames to be valid for my Mac. The behavior you describe is what would happen if LDView cannot find any of the files you are specifying (D:\LEGO\Python\data\3001.ldr, etc.), or if it cannot find D:\LEGO\Python\data\commandlist.txt. Basically, during startup, it tries to determine if there is anything on the command line requesting snapshots or exports. If is successfully generates any snapshots or exports, it then simply exits. If not, it runs as normal, which seems to be what you are seeing. I'll test in Windows to see if I somehow broke the CommandLinesList functionality there.
I'm going to check the paths but everything is in the same folder right now. Do you need some more config infos ?


(2021-02-24, 0:26)Travis Cobbs Wrote: As an aside, I do notice that you have an apparent copy-and-paste error, in that only the first three LDR filenames match the target POV filenames, and the rest reuse 3002.ldr.

Thank you (I would probably have facepalm later for that)
Reply
RE: Using CommandLinesList and ExportFile
#4
Well.

I made some tests according to your comments.

the problem is partialy solved.

the good news is that I do not have cropping anymore, the aspect, latitude, longitude are good. But the render is still different. I understood what you said about the fact that I got what I'm supposed to got, but some pics may be more accurate :

I set the aspect ratio on automatic.
My command line is  (with or without the -ExportFile command):
D:\Installations\LDRAW\LDView64\LDView64.exe D:\LEGO\Python\data\3001.ldr -DefaultLatLong=20,45 -SaveWidth=500-SaveHeight=500

Without -Exportfile, LDview open like that :
[Image: ldview.png]

At this point, I hit Ctrl+E, then Return and I got this render with Pov-ray
[Image: 3001pymanual.png]
The render and the visual on LDview are the same  (Gimp involved here):
[Image: layers.png]
With -ExportFile, LDview doens't show up (obviously)

The render with pov-ray is :
[Image: 3001pylatlon20-45sw500sh500.png]
See the difference (Gimp again):
[Image: colordiff.png]

I do not understand why whith the same config, I don't have the same result.
Reply
RE: Using CommandLinesList and ExportFile
#5
(2021-02-24, 17:08)Bertrand Lequy Wrote: I set the aspect ratio on automatic.
My command line is  (with or without the -ExportFile command):
D:\Installations\LDRAW\LDView64\LDView64.exe D:\LEGO\Python\data\3001.ldr -DefaultLatLong=20,45 -SaveWidth=500-SaveHeight=500

If that's really your command line, the lack of a space between -SaveWidth=500 and -SaveHeight=500 will likely cause it not to work.
Reply
RE: Using CommandLinesList and ExportFile
#6
(2021-02-24, 9:28)Bertrand Lequy Wrote: I'm going to check the paths but everything is in the same folder right now. Do you need some more config infos ?

If you install LDView 4.4 Beta 3, it contains a new feature that will hopefully help track down what is wrong: LDView.com, a wrapper that allows you to see error messages when running LDView from the command line in Windows. Simply run LDView.com instead of LDView64.exe, and you should then get error messages if it runs into problems. Note also that if you include the LDView install path in your system path, you can just run LDView, and it will use LDView.com automatically (even with 32-bit LDView, although you're using 64-bit LDView).
Reply
RE: Using CommandLinesList and ExportFile
#7
(2021-02-24, 20:22)Travis Cobbs Wrote: If you install LDView 4.4 Beta 3, it contains a new feature that will hopefully help track down what is wrong: LDView.com, a wrapper that allows you to see error messages when running LDView from the command line in Windows. Simply run LDView.com instead of LDView64.exe, and you should then get error messages if it runs into problems. Note also that if you include the LDView install path in your system path, you can just run LDView, and it will use LDView.com automatically (even with 32-bit LDView, although you're using 64-bit LDView).

FYI, LDView.com supports -v to show errors and warnings (default is just errors), as well as -q to silence almost all errors, and -qq to silence all errors.
Reply
RE: Using CommandLinesList and ExportFile
#8
(2021-02-24, 20:19)Travis Cobbs Wrote: If that's really your command line, the lack of a space between -SaveWidth=500 and -SaveHeight=500 will likely cause it not to work.

Yes, I didn't notice the space. I'm going to try with a space inserted.

EDIT : Ok, it seems it was it. I gonna try with someother files.

EDIT 2 : in fact no, I forgot to switch of a factor I add in my pov file post processing script.
Reply
RE: Using CommandLinesList and ExportFile
#9
(2021-02-24, 20:26)Travis Cobbs Wrote: FYI, LDView.com supports -v to show errors and warnings (default is just errors), as well as -q to silence almost all errors, and -qq to silence all errors.

here is what I got :
Code:
Error: Repeated CommandLinesList=D:\lego\Python\data\commandlist.txt value would lead to infinite recursion; ignoring. Critical Error: Could not find main model file.
File:
Unknown Line
Warning: Part stu23 has been renamed to 8\stud3.
File: D:/LEGO/LDRAW//P/stu23.dat
Line #1 :  0 ~Moved to 8\stud3
Warning: Part stu2 has been renamed to 8\stud.
File: D:/LEGO/LDRAW//P/stu2.dat
Line #1 :  0 ~Moved to 8\stud
Error: Repeated CommandLinesList=D:\lego\Python\data\commandlist.txt value would lead to infinite recursion; ignoring. Critical Error: Could not find main model file.
...
The error repeat at each lines.

Do the errors comes from my ldr files ? Main models are for mpd files aren't they
Reply
RE: Using CommandLinesList and ExportFile
#10
(2021-02-24, 21:36)Bertrand Lequy Wrote: here is what I got :
Code:
Error: Repeated CommandLinesList=D:\lego\Python\data\commandlist.txt value would lead to infinite recursion; ignoring. Critical Error: Could not find main model file.
File:
Unknown Line
Warning: Part stu23 has been renamed to 8\stud3.
File: D:/LEGO/LDRAW//P/stu23.dat
Line #1 :  0 ~Moved to 8\stud3
Warning: Part stu2 has been renamed to 8\stud.
File: D:/LEGO/LDRAW//P/stu2.dat
Line #1 :  0 ~Moved to 8\stud
Error: Repeated CommandLinesList=D:\lego\Python\data\commandlist.txt value would lead to infinite recursion; ignoring. Critical Error: Could not find main model file.
...
The error repeat at each lines.

Do the errors comes from my ldr files ? Main models are for mpd files aren't they

The main model file is simply the file you instruct LDView to render. It can be an LDR, MPD, or DAT. All it's saying is that it can't find the specified file. However, something strange is going on, because the "filename" it can't load is not present. The "File:" line in the output is supposed to have a filename after it, and it doesn't. The output you're getting doesn't seem to match up with the contents of commandlist.txt that you posted earlier. The "infinite recursion" error should only happen if -CommandLinesList= is included in commandlist.xt with the path to commandlist.txt as its value.

Can you post here the EXACT command line you are using, as well as the EXACT contents of commandlist.txt?
Reply
RE: Using CommandLinesList and ExportFile
#11
(2021-02-25, 2:18)Travis Cobbs Wrote: The main model file is simply the file you instruct LDView to render. It can be an LDR, MPD, or DAT. All it's saying is that it can't find the specified file. However, something strange is going on, because the "filename" it can't load is not present. The "File:" line in the output is supposed to have a filename after it, and it doesn't. The output you're getting doesn't seem to match up with the contents of commandlist.txt that you posted earlier. The "infinite recursion" error should only happen if -CommandLinesList= is included in commandlist.xt with the path to commandlist.txt as its value.

Can you post here the EXACT command line you are using, as well as the EXACT contents of commandlist.txt?

I discovered that LDView's CommandLinesList processing wasn't properly dealing with lines with Windows line endings (CRLF). I will fix that, but hopefully if you can change commandlist.txt to have Unix line endings, the problem will go away.
Reply
RE: Using CommandLinesList and ExportFile
#12
(2021-02-25, 2:37)Travis Cobbs Wrote: I discovered that LDView's CommandLinesList processing wasn't properly dealing with lines with Windows line endings (CRLF). I will fix that, but hopefully if you can change commandlist.txt to have Unix line endings, the problem will go away.

To answer both of your answers (thanks again) here's a snapshot of everything you asked for

[Image: bug.png]
Reply
RE: Using CommandLinesList and ExportFile
#13
(2021-02-25, 7:26)Bertrand Lequy Wrote: To answer both of your answers (thanks again) here's a snapshot of everything you asked for

Thanks. I'll investigate further this evening, but I think that LDView is not properly handling the full lower case that you are using in the -commandlineslist argument. The code that recognizes that argument in the first place is not case sensitive, but some code that looks for it later (to remove it from the command line generated by each line in the list file) is. That should be easy for me to fix.

Having said that, it seems like the execution you showed succeeded in generating the POV files (as a result of you changing commandlineslist to Unix line endings). I would recommend removing the -v from the command line, after which LDView.com should only complain about the repeated CommandLinesList. And you can hopefully get rid of that error by using -CommandLinesList instead (capitalized to match LDView's Help.html) until I can get a fixed version released.
Reply
RE: Using CommandLinesList and ExportFile
#14
(2021-02-25, 21:06)Travis Cobbs Wrote: Thanks. I'll investigate further this evening, but I think that LDView is not properly handling the full lower case that you are using in the -commandlineslist argument. The code that recognizes that argument in the first place is not case sensitive, but some code that looks for it later (to remove it from the command line generated by each line in the list file) is. That should be easy for me to fix.

Having said that, it seems like the execution you showed succeeded in generating the POV files (as a result of you changing commandlineslist to Unix line endings). I would recommend removing the -v from the command line, after which LDView.com should only complain about the repeated CommandLinesList. And you can hopefully get rid of that error by using -CommandLinesList instead (capitalized to match LDView's Help.html) until I can get a fixed version released.

This is working fine right now. Thank you very much

(at the begining I used the capitalized version but I was Lazy in my last tests, sorry).
Reply
« Next Oldest | Next Newest »



Forum Jump:


Users browsing this thread: 1 Guest(s)