POV-Ray : Newsgroups : povray.windows : how to run povray from command line : Re: how to run povray from command line Server Time
28 Jun 2024 22:33:25 EDT (-0400)
  Re: how to run povray from command line  
From: andrel
Date: 5 Jun 2004 12:12:30
Message: <40C1F0FB.3090608@hotmail.com>
If you have found your pvengine.exe you can wrap the
pov call in a script file, like the one below.
(I think I am not allowed to use an attachment here,
so I split a couple of the lines to fit in a
reasonable width).

You can call this function as:
povray(filename)
or with name-value pairs
povray(filename,'Width',320,'Height',240,'Options','+V')

you can use any number of name-value pairs. I have defined
only three, but you can easily add your own.

Note: this assumes that you have set your inifile in povray
and that you have selected
'Render/On Completion .../Exit POV-Ray for Windows'
from the menu.
There must be a way to specify the inifile you want to use
and that you want to exit after completion from the command
line, but I can not find how.

Actually, your mail prompted me to investigate some more.
After writing the above I found that I can specify the
inifile. There are still a number of problems however,
so I can not give a working version of the matlabscript
that includes the inifile yet.
- You have to specify the complete path for the inifile
- The commandline parser does not parse quotes. You can
  therefore not use a long filename that includes spaces
  and put "" around them. In fact you have to use the
  DOSfilename. In my case "c:\progra~1\pov-ra~1.5\" etc
- it still complains that "never found section '' in file..."
  This is where I give up :(

	Andrel

nomail@nomail wrote:
> I want to make a matlab program that creates a povray file for a face mesh
> and then renders it. To do this , I need to able to run povray from the
> command line (not the GUI command line but DOS command line). The
> documentation example says: POVRAY +Isimple.pov +V +W80 +H60, but when I
> try this on dos, I get:
> 'povray' is not recognized as an internal or external command,
> operable program or batch file.
> 
> I searched for povray.exe, but it doesn't exist anywhere. I will appreciate
> if someone could tell me the way to do this.
> thanks,
> Ankur
> 


---
function povray(povfile,varargin)
oldwho = [];
oldwho = who; % remember existing variables
% enter modifiable arguments below
Width=320;
Height= 240;
Options =[];
% end of modifiable arguments
ModVars   =   setdiff(who,oldwho);
clear oldwho
for k  = 1 :2: length(varargin)
    if ~isempty(strmatch(varargin{k},ModVars,'exact'))
       eval(sprintf('%s=varargin{k+1};',varargin{k}));
    else
       disp(sprintf('valid variables for %s:',mfilename));
       disp(ModVars)
       error(sprintf('Illegal argument :%s for %s.',...
          varargin{k},mfilename));
    end
end

eval(sprintf(['!"c:\\program files\\'...
    'pov-ray for windows v3.5\\bin\\pvengine.exe"'...
	' +W%d +H%d +I%s %s'],...
	Width,Height,povfile,Options));


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.