POV-Ray : Newsgroups : povray.general : How to pass a string from the command line - help? : Re: How to pass a string from the command line - help? Server Time
30 Jul 2024 18:22:03 EDT (-0400)
  Re: How to pass a string from the command line - help?  
From: Chris B
Date: 2 Oct 2008 05:22:02
Message: <48e492ba$1@news.povray.org>
"Mathuin" <mat### [at] gmailcom> wrote in message 
news:web.48e3fa9f79b5340cd8a103ef0@news.povray.org...
> Now what I really want to do is have "content.inc" and "othercontent.inc" 
> and
> "stillothercontent.inc" then modify the template to contain '#include 
> Content'
> and have the specific include file chosen via the command line something 
> like
> this:  povray -Itemplate.pov Declare=Content="content.inc"  Alas, the
> command-line version of Declare appears to be limited to floats.

Three approaches immediately spring to mind.

1. Write a two line script that first writes the name of your include file 
into another include file then calls POV-Ray. For example, a DOS .bat file 
could be something like:

  echo #include "%1">contentwrapper.inc
  povray -Itemplate.pov ....

This would write an #include statement embedding the first parameter passed 
to the script into the file 'contentwrapper.inc' then it would invoke 
POV-Ray with your template.pov scene which would #include contentwrapper.inc 
which would, in turn, #include the nested file of your choice.

2. Use floats with an #if or #switch directive to select the #include file 
statement of your dreams.

3. Number your include files (e.g. content42.inc) and use the concat 
function within your #include statement e.g.

  #include concat("content",Content,".inc")

Regards,
Chris B.


Post a reply to this message

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