LDView Different behaviour between command line and call from php application


Different behaviour between command line and call from php application
#1
Hi,

When I create a snapshot from the command line, like so:

Code:
C:\>LDView64.exe "temp_3001-4.ldr" -SaveSnapshot="3001-4.png"

then LDView uses all the settings and preferences which I defined previously via the GUI.

When I use the same command from within a php application like so:

PHP Code:
system('LDView64.exe "temp_3001-4.ldr" -SaveSnapshot="3001-4.png"'); 

then LDView obviously uses default paramters. What could be a reason for this behaviour. Maybe an issue with environment variables?

Hans

PS: I tried some additional command line preferences to overcome the issue:

PHP Code:
system('LDView64.exe -SaveZoomToFit=1 -SaveAlpha=1 -AutoCrop=1 -EdgeThickness=5 "temp_3001-4.ldr" -SaveSnapshot="3001-4.png"'); 

but not every setting can be controlled via Command line preferences (Edge Lines on, FieldOfView=0.1, Texture Studs off). Or did I miss something?
Reply
RE: Differnt behaviour between command line and call from php application
#2
(2023-03-11, 8:43)Hans Willison Wrote: Hi,

When I create a snapshot from the command line, like so:

Code:
C:\>LDView64.exe "temp_3001-4.ldr" -SaveSnapshot="3001-4.png"

then LDView uses all the settings and preferences which I defined previously via the GUI.

When I use the same command from within a php application like so:

PHP Code:
system('LDView64.exe "temp_3001-4.ldr" -SaveSnapshot="3001-4.png"'); 

then LDView obviously uses default paramters. What could be a reason for this behaviour. Maybe an issue with environment variables?

Hans

PS: I tried some additional command line preferences to overcome the issue:

PHP Code:
system('LDView64.exe -SaveZoomToFit=1 -SaveAlpha=1 -AutoCrop=1 -EdgeThickness=5 "temp_3001-4.ldr" -SaveSnapshot="3001-4.png"'); 

but not every setting can be controlled via Command line preferences (Edge Lines on, FieldOfView=0.1, Texture Studs off). Or did I miss something?

Almost certainly the process (I assume a web server) running PHP is running under a different user account, and therefore has a different registry. LDView's settings are (by design) user-specific. If you find out what user account PHP is running under, and you are allowed to log into that account, you can in theory export LDView's registry settings from HKEY_CURRENT_USER/Software/Travis Cobbs/LDView, and then import the settings into the other account. That may not be possible or convenient, though.

I believe that all the settings in the UI are controllable from the command line. LDView's help.html has a list of all of them. Most of them that include a UI for setting them list the title of the UI element in LDView's preferences. For example, if you search the help file for "texture studs", one of the hits is for the TextureStuds command line option. A search for "edge lines" will (eventually) lead you to the ConditionalHighlights command line option. A search for "field of view" will bring you to the FOV command line option.
Reply
RE: Differnt behaviour between command line and call from php application
#3
I set all of the LDView options on the command line for the Parts Tracker (to avoid exactly the issue you're running into). Everything is settable and the documentation is extensive. If you have a question, ask and I can help.
Reply
RE: Different behaviour between command line and call from php application
#4
(2023-03-13, 1:12)Travis Cobbs Wrote: Almost certainly the process (I assume a web server) running PHP is running under a different user account, and therefore has a different registry. LDView's settings are (by design) user-specific.

That's the solution! I am currently not on my PC so I can't check it there, but on my laptop it works as desired without changing anything!

The reason is: on my laptop I start my webserver environment (xampp) manually via xampp_start.exe. So webserver and PHP run under the user account I'm logged in.

On my PC xampp is started as a service at startup and is running under whatever user account windows services are running (Local System?). I will check as soon as I regain access to my PC.

On the other hand the -FOV setting works on my laptop, but didn't on my PC. I will also recheck on my PC.

Thank you all for your help
Reply
RE: Different behaviour between command line and call from php application
#5
(2023-03-13, 17:38)Hans Willison Wrote: That's the solution! I am currently not on my PC so I can't check it there, but on my laptop it works as desired without changing anything!
The reason is: on my laptop I start my webserver environment (xampp) manually via xampp_start.exe. So webserver and PHP run under the user account I'm logged in.
On my PC xampp is started as a service at startup and is running under whatever user account windows services are running (Local System?). I will check as soon as I regain access to my PC.
On the other hand the -FOV setting works on my laptop, but didn't on my PC. I will also recheck on my PC.
Thank you all for your help

Short summary:

1) I'm back on my PC and changed the user account for the apache service from 'system' to my own user account and ldview works as desired when called from within my PHP application.
2) I also rechecked the -FOV setting and it works as desired. I obviously made a mistake on my previous attempts. Blush
3) Now having two working solutions for my problem I decided on a third variant Wink : I let my PHP application write all ldview commands to a batch file which I execute manually from a command prompt (which turns out better for mass creation of part images).

Regards
Hans
Reply
« Next Oldest | Next Newest »



Forum Jump:


Users browsing this thread: 1 Guest(s)