POV-Ray : Newsgroups : povray.newusers : Calling a #macro gives error Server Time
22 Dec 2024 06:55:24 EST (-0500)
  Calling a #macro gives error (Message 1 to 3 of 3)  
From: gharryh
Subject: Calling a #macro gives error
Date: 16 Jun 2013 07:30:01
Message: <web.51bda10dec77e24c520168c30@news.povray.org>
For a scene i would like to include a floor.
Therefore is modified the superellipsoid  example.
Running this whitout the #macro and #end the schene renders perfect

[code]
#macro Floor(MaxTile, MaxRow)
#declare Offset = 2.1;

  #declare Tile = superellipsoid { <0.5, 0.1>
    scale <1, .05, 1>
  }

#declare Row = union {
    object { Tile }

#declare index =-MaxTile;

#while(index <= MaxTile)
    object { Tile translate z*Offset*index }
#declare index = index + 1;
#end
  }

#declare index = -MaxRow;

  union{
    object { Row }

#while(index <= MaxRow)
    object { Row translate x*Offset*index }
#declare index = index + 1;
#end

    pigment { White_Marble }
    finish { phong 1 phong_size 50 reflection .35 }
  }

  plane {
    y, 0  //this is the grout
    pigment { color White }
    finish { ambient .4 diffuse .7 }
  }
#end
[/code]

But if i call it as a macro like object{Floor(10,10) } it produces a error at
the plane command. It puzzles me how this is possible. Anny help is welcome.


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Calling a #macro gives error
Date: 16 Jun 2013 10:20:00
Message: <web.51bdc8e91f7bf73a11b13fda0@news.povray.org>
"gharryh" <h.a### [at] harry-arendsnl> wrote:
> For a scene i would like to include a floor.
> Therefore is modified the superellipsoid  example.
> Running this whitout the #macro and #end the schene renders perfect
>
> [code]
>   union{
>     object { Row }
>
> #while(index <= MaxRow)
>     object { Row translate x*Offset*index }
> #declare index = index + 1;
> #end
>
>     pigment { White_Marble }
>     finish { phong 1 phong_size 50 reflection .35 }
>   }
>
>   plane {
>     y, 0  //this is the grout
>     pigment { color White }
>     finish { ambient .4 diffuse .7 }
>   }
> #end
> [/code]
>
> But if i call it as a macro like object{Floor(10,10) } it produces a error at
> the plane command. It puzzles me how this is possible. Anny help is welcome.

This is because you have two separate objects, the union{} and the plane{}, in
the macro.  When you are calling it inside your object{} wrapper, it is looking
for only one, so when it reaches the second, it returns an error.

Try calling it union{Floor(10,10) } instead, or put the plane and union together
in a union{} wrapper inside the macro.

-tgq


Post a reply to this message

From: gharryh
Subject: Re: Calling a #macro gives error
Date: 16 Jun 2013 13:00:01
Message: <web.51bdee271f7bf73a520168c30@news.povray.org>
I did the last solution. Thnx

"Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
> "gharryh" <h.a### [at] harry-arendsnl> wrote:
> > For a scene i would like to include a floor.
> > Therefore is modified the superellipsoid  example.
> > Running this whitout the #macro and #end the schene renders perfect
> >
> > [code]
> >   union{
> >     object { Row }
> >
> > #while(index <= MaxRow)
> >     object { Row translate x*Offset*index }
> > #declare index = index + 1;
> > #end
> >
> >     pigment { White_Marble }
> >     finish { phong 1 phong_size 50 reflection .35 }
> >   }
> >
> >   plane {
> >     y, 0  //this is the grout
> >     pigment { color White }
> >     finish { ambient .4 diffuse .7 }
> >   }
> > #end
> > [/code]
> >
> > But if i call it as a macro like object{Floor(10,10) } it produces a error at
> > the plane command. It puzzles me how this is possible. Anny help is welcome.
>
> This is because you have two separate objects, the union{} and the plane{}, in
> the macro.  When you are calling it inside your object{} wrapper, it is looking
> for only one, so when it reaches the second, it returns an error.
>
> Try calling it union{Floor(10,10) } instead, or put the plane and union together
> in a union{} wrapper inside the macro.
>
> -tgq


Post a reply to this message

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