LDraw.org Discussion Forums

Full Version: Animated Rotation of Model
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I was wondering if there was a way to make LDView export a series of images showing a rotation around the model incrementally.

Could it be accomplished using the batch command (which I know next to nothing about)?
(2016-05-14, 1:59)Tanner S. Wrote: [ -> ]I was wondering if there was a way to make LDView export a series of images showing a rotation around the model incrementally.

Could it be accomplished using the batch command (which I know next to nothing about)?

I did such an animation a couple of years ago.
 
There must be somewhere a script for this animation on one of my harddisks, but I can't remember the right one.

Maybe I can find it the next days, but there is no guarantee for this task ;-)

If I remember right, you need to export to a Povray file and manually edit this file to load the POV script.

/Max
(2016-05-14, 1:59)Tanner S. Wrote: [ -> ]I was wondering if there was a way to make LDView export a series of images showing a rotation around the model incrementally.

Could it be accomplished using the batch command (which I know next to nothing about)?

LDView doesn't support this inherently. A batch file could be made relatively easily, with a constant latitude and increasing longitude from 0 to 360. This would be done with the -cg option, like -cg 30,0 for 30 degrees latitude, 0 degrees longitude. I'll try to get back to you with actual batch file contents.
OK, here is the contents of a batch file:

Code:
@echo off
SET LDVIEW=C:\Program Files\LDView\LDView64.exe
FOR %%F IN (%*) DO (
   FOR /L %%L IN (0,1,359) DO (
        ECHO %%~nF-%%L.png
       "%LDVIEW%" -SaveSnapshot="%%~nF-%%L.png" -SaveZoomToFit=0 -ZoomToFit=0 -SaveSeries=1 -SaveWidth=1024 -SaveHeight=1024 -DefaultLatLong=30,%%L "%%F"
    )
)

I'm not batch file expert, and I haven't tested it with filenames with spaces (although it might work), nor have I tested it with full paths. Specify an LDraw file (or LDraw files) as the parameters for the program. It will generate PNG files from 0 to 359. Note that this is set up for a 64-bit LDView. Change the second line to the correct full path to your LDView.
(2016-05-15, 5:31)Travis Cobbs Wrote: [ -> ]I'm not batch file expert, and I haven't tested it with filenames with spaces (although it might work), nor have I tested it with full paths. Specify an LDraw file (or LDraw files) as the parameters for the program. It will generate PNG files from 0 to 359. Note that this is set up for a 64-bit LDView. Change the second line to the correct full path to your LDView.

This is the code that I put in:

Code:
@echo off
SET LDVIEW=C:\Program Files (x86)\LDraw\LDView\LDView.exe
FOR %%F IN (%*) DO (
  FOR /L %%L IN (0,22.5,360) DO (
       ECHO %%~nF-%%L.png
      "%LDVIEW%" -SaveSnapshot="%%~nF-%%L.png" -SaveZoomToFit=0 -ZoomToFit=0 -SaveSeries=1 -SaveWidth=1024 -SaveHeight=1024 -DefaultLatLong=30,%%L "%%F"
   )
)

The code runs when I open a file with the batch file, but the rendered images are blank. Is the code wrong or is something else going on?
(2016-05-17, 0:43)Tanner S. Wrote: [ -> ]The code runs when I open a file with the batch file, but the rendered images are blank. Is the code wrong or is something else going on?

Try deleting all the text between "%LDVIEW%" and "%%F" and see if LDView opens the file interactively. If not, that means that LDView can't find the file. If the filename (or path to the file) contains spaces, try renaming the file to not contain any spaces, and storing it in a path where nothing in the path contains spaces.
(2016-05-17, 1:38)Travis Cobbs Wrote: [ -> ]Try deleting all the text between "%LDVIEW%" and "%%F" and see if LDView opens the file interactively. If not, that means that LDView can't find the file. If the filename (or path to the file) contains spaces, try renaming the file to not contain any spaces, and storing it in a path where nothing in the path contains spaces.

Sure enough, it was the space in the file path. Thanks. By the way, am I correct in assuming that it renders using the last selected preference setting?
(2016-05-18, 20:48)Tanner S. Wrote: [ -> ]
(2016-05-17, 1:38)Travis Cobbs Wrote: [ -> ]Try deleting all the text between "%LDVIEW%" and "%%F" and see if LDView opens the file interactively. If not, that means that LDView can't find the file. If the filename (or path to the file) contains spaces, try renaming the file to not contain any spaces, and storing it in a path where nothing in the path contains spaces.

Sure enough, it was the space in the file path. Thanks. By the way, am I correct in assuming that it renders using the last selected preference setting?

Good to hear. And yes, it uses the last settings. You can easily change that by creating a Preference Set in LDView with all the settings you want, then adding a -PreferenceSet=<PrefSetName> to the command line in the bat file. I would strongly suggest not having spaces in the preference set name.

Note that the bat file can almost certainly be fixed to deal with spaces in input filenames, but I don't know off-hand how to do so.
Cool, and thanks so much for your help. I'm sorry, but I have one last question.

Is there a way to make it render at specific angles, rather than using a "counter" per say. It doesn't appear that the program is able to render half-degrees, and I need it to output a series of images at the angles: 0, 22, 45, 67, 90, etc. Can this be done?
(2016-05-19, 2:43)Tanner S. Wrote: [ -> ]Cool, and thanks so much for your help. I'm sorry, but I have one last question.

Is there a way to make it render at specific angles, rather than using a "counter" per say. It doesn't appear that the program is able to render half-degrees, and I need it to output a series of images at the angles: 0, 22, 45, 67, 90, etc. Can this be done?

First of all, I believe that the LDView command line supports real numbers there, not just integers, so 22.5 should work fine. Secondly, I think you can update the following line to use specific values instead of a loop from 0 to 359:

Code:
FOR /L %%L IN (0,1,359) DO (

Change it to look like this instead:

Code:
FOR %%L IN (0,22.5,45,67.5,90) DO (

Put whatever angles you want inside the parentheses. (Don't forget to also remove the /L.)
Pages: 1 2