POV-Ray : Newsgroups : povray.general : while-loop in macro : Re: while-loop in macro Server Time
4 Aug 2024 18:21:07 EDT (-0400)
  Re: while-loop in macro  
From: Jellby
Date: 23 Feb 2003 16:52:00
Message: <3e59427f@news.povray.org>
Among other things, Lenx wrote:

> #macro Fence(Flength, Fheight, Fspace, Fdiam)
> 
>    #local i=0;
>    #while(i< Flength/Fspace+1 )
>       cylinder{ <0,0,0> <0,Fheight,0> Fdiam/2 }
>       translate <i*Fspace, 0, 0>
>      #local i=i+1;
>    #end
> 
> #end
> 
> 
> the macro itself is ok when rendered, but of course you only get a black
> screen.
> When i try to call the macro in an object as following, i get an error "no
> matching '}' in object, cylinder found instead".

So you finally have:

object {
  cylinder { }
  translate
  cylinder { }
  translate
  ...
}

This makes no sense, as far as I know. Try calling it as an union (instead 
of object) and moving the translate block inside the cylinder braces. So 
you have:

union {
  cylinder {
    translate
  }
  cylinder {
    translate
  }
  ...
}

-- 

Linux User #289967 (counter.li.org)
PGP Pub Key ID: 0x01A95F99 (pgp.escomplinux.org)


Post a reply to this message

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