Animated Rotation of Model

RE: Animated Rotation of Model
(2018-03-22, 6:04)Travis Cobbs Wrote:
(2018-03-22, 4:03)AdamM Wrote: As a newbie to this forum and LDraw/Cad etc, this is exactly what I'm interested in achieving.
How do i actually implement this batch script?
From LCad/LView or POV?
Do i need to open a file in a text editor and add this or do I do it from within one of the mention software apps?
And how would I implement incremental angles less than 1 degree. (Reading earlier posts suggests this is possible)

I'm completely computer literate but not a "coder", though happy to open and modify etc if pointed in the right direction.

Advance thanks (and apologies).

The text in the Code sections is designed to be saved in a file with a file extension of .bat. You can copy from the forum here, and then paste into (for example) an empty file in Notepad. When you save the file in Notepad, include .bat at the end of the filename. Once you have the file, you should be able to just drop .ldr files onto it in Windows Explorer if you don't know how to use the command prompt. But if you do that, make sure there aren't any spaces anywhere in the filename or the path to the filename, because my batch file doesn't work if there are.

Note that if you install the 64-bit version of LDView, the second line of the file would look like this:

SET LDVIEW=C:\Program Files\LDraw\LDView\LDView64.exe

If you don't have a 64-bit version of Windows, it would look like this:

SET LDVIEW=C:\Program Files\LDraw\LDView\LDView.exe

As can hopefully be inferred from above, LDView's -DefaultLatLong option supports floating point values, so you could make it do fractional degrees. However, doing so in the batch file I originally presented would be most easily accomplished by copying and pasting the LDView command line inside the for loop, and then adding a hard-coded decimal part, and making the image filename unique for each line. So, for example, the following does a 45-degree spin in half-degree increments:

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

Note that the -SaveZoomToFit=0 and -ZoomToFit=0 options are there so that all angles will have the same zoom level. LDView's default zoom level allows a model to be rotated to any angle without going outside the view boundaries. The AutoCrop=0 is option is there to make sure that all the images that are generated are the same size.

This will generate a bunch of PNG files. You will have to use some other program to combine them together into a movie file. To do it on the command line, you can use ffmpeg, but you're going to definitely going to have to read up on what the appropriate options would be to use with that.

Thanks so much.
I'll keep you posted with my success or failure.
« Next Oldest | Next Newest »

Messages In This Thread
Animated Rotation of Model - by Tanner S. - 2016-05-14, 1:59
RE: Animated Rotation of Model - by Tanner S. - 2016-05-19, 19:39
RE: Animated Rotation of Model - by Tanner S. - 2016-05-18, 20:48
RE: Animated Rotation of Model - by Tanner S. - 2016-05-19, 19:54
RE: Animated Rotation of Model - by - 2018-03-24, 5:14
RE: Animated Rotation of Model - by P Ko - 2020-12-17, 18:33

Forum Jump:

Users browsing this thread: 1 Guest(s)