POV-Ray : Newsgroups : povray.newusers : Problem with the EXTRUDE Server Time
29 Jul 2024 16:31:43 EDT (-0400)
  Problem with the EXTRUDE (Message 1 to 4 of 4)  
From: Ziyan
Subject: Problem with the EXTRUDE
Date: 25 Apr 2005 22:35:00
Message: <web.426da894f3d9b99a1362b3f50@news.povray.org>
My program is below, but something wrong happens when I replace the A(...)
with object{A(...)} as I want to translate the object {A(...)}and it shows
"Prase Error: No matching } in 'object', box found instead."  Could someone
here hele me solve the problem?(Without object{} but just with A(...) it
runs smoothly and I guess I could invoke the macro with ".inc" but don't
know how to invoke it.)

#include "colors.inc"
#include "textures.inc"
#include "metals.inc"

camera{
       location <0,10,-20>
       direction <0,0,1>
       up <0,1,0>
       right <4/3,0,0>
       look_at <0,0,0>
      }

background {color rgb <0.5,0.5,0.5>}

object {light_source {<20,100,-200> colour White}}

#macro A(Angle,Radius,y_rotate,A_rotate)

#local Index=0;
#while (Index<=y_rotate/Angle)
 #local x_delta_move=-Radius*(1-cos(Angle*Index));
 #local z_delta_move=-Radius*sin(Angle*Index);
 #local y_delta_rotate=Index*Angle;
 box{<-0.4,-0.4,-0.4>,<0.4,0.4,0.4>
     translate <x_delta_move,0,z_delta_move>
     rotate y_delta_rotate*y
     pigment{colour White}
     rotate A_rotate*y
     scale 0.2}
 #local Index=Index+1;
#end
#end

object{A (0.01*3.14/180,100,26*3.14/180,180)}
object{A (0.01*3.14/180,100,26*3.14/180,0)}


Post a reply to this message

From: Jim Charter
Subject: Re: Problem with the EXTRUDE
Date: 25 Apr 2005 23:45:53
Message: <426db971$1@news.povray.org>
Ziyan wrote:
> My program is below, but something wrong happens when I replace the A(...)
> with object{A(...)} as I want to translate the object {A(...)}and it shows
> "Prase Error: No matching } in 'object', box found instead."  Could someone
> here hele me solve the problem?(Without object{} but just with A(...) it
> runs smoothly and I guess I could invoke the macro with ".inc" but don't
> know how to invoke it.)
> 
> #include "colors.inc"
> #include "textures.inc"
> #include "metals.inc"
> 
> camera{
>        location <0,10,-20>
>        direction <0,0,1>
>        up <0,1,0>
>        right <4/3,0,0>
>        look_at <0,0,0>
>       }
> 
> background {color rgb <0.5,0.5,0.5>}
> 
> object {light_source {<20,100,-200> colour White}}
> 
> #macro A(Angle,Radius,y_rotate,A_rotate)
> 
> #local Index=0;
> #while (Index<=y_rotate/Angle)
>  #local x_delta_move=-Radius*(1-cos(Angle*Index));
>  #local z_delta_move=-Radius*sin(Angle*Index);
>  #local y_delta_rotate=Index*Angle;
>  box{<-0.4,-0.4,-0.4>,<0.4,0.4,0.4>
>      translate <x_delta_move,0,z_delta_move>
>      rotate y_delta_rotate*y
>      pigment{colour White}
>      rotate A_rotate*y
>      scale 0.2}
>  #local Index=Index+1;
> #end
> #end
> 
> object{A (0.01*3.14/180,100,26*3.14/180,180)}
> object{A (0.01*3.14/180,100,26*3.14/180,0)}
> 
> 
> 
I think you need  a union { } block


Post a reply to this message

From: Chris B
Subject: Re: Problem with the EXTRUDE
Date: 26 Apr 2005 04:53:35
Message: <426e018f@news.povray.org>
"Jim Charter" <jrc### [at] msncom> wrote in message
news:426db971$1@news.povray.org...
> Ziyan wrote:
> > My program is below, but something wrong happens when I replace the
A(...)
> > with object{A(...)} as I want to translate the object {A(...)}and it
shows
> > "Prase Error: No matching } in 'object', box found instead."  Could
someone
> > here hele me solve the problem?(Without object{} but just with A(...) it
> > runs smoothly and I guess I could invoke the macro with ".inc" but don't
> > know how to invoke it.)
> >
> > #include "colors.inc"
> > #include "textures.inc"
> > #include "metals.inc"
> >
> > camera{
> >        location <0,10,-20>
> >        direction <0,0,1>
> >        up <0,1,0>
> >        right <4/3,0,0>
> >        look_at <0,0,0>
> >       }
> >
> > background {color rgb <0.5,0.5,0.5>}
> >
> > object {light_source {<20,100,-200> colour White}}
> >
> > #macro A(Angle,Radius,y_rotate,A_rotate)
> >
> > #local Index=0;
> > #while (Index<=y_rotate/Angle)
> >  #local x_delta_move=-Radius*(1-cos(Angle*Index));
> >  #local z_delta_move=-Radius*sin(Angle*Index);
> >  #local y_delta_rotate=Index*Angle;
> >  box{<-0.4,-0.4,-0.4>,<0.4,0.4,0.4>
> >      translate <x_delta_move,0,z_delta_move>
> >      rotate y_delta_rotate*y
> >      pigment{colour White}
> >      rotate A_rotate*y
> >      scale 0.2}
> >  #local Index=Index+1;
> > #end
> > #end
> >
> > object{A (0.01*3.14/180,100,26*3.14/180,180)}
> > object{A (0.01*3.14/180,100,26*3.14/180,0)}
> >
> >
> >
> I think you need  a union { } block


I agree with Jim. Your macro 'A' just returns a series of boxes, which is
fine when you call the macro on it's own.
When you use   object{A(...)}  it complains because the series of boxes is
not a single object (so it complains when it finds the second box).
You could add a union inside your macro by adding    'union {'   just after
your line '#macro A(Angle,Radius,y_rotate,A_rotate)
'  and '}' just before the end.
OR
You could use a union as a wrapper when you call your macro  e.g. 'union{A
(0.01*3.14/180,100,26*3.14/180,180)}'

Regards,
Chris B.


Post a reply to this message

From: kurtz le pirate
Subject: Re: Problem with the EXTRUDE
Date: 27 Apr 2005 13:49:30
Message: <kurtzlepirate-0F77E6.19493027042005@news.povray.org>
In article <web.426da894f3d9b99a1362b3f50@news.povray.org>,
 "Ziyan" <beg### [at] hotmailcom> wrote:

>>My program is below, but something wrong happens when I replace the A(...)
>>with object{A(...)} as I want to translate the object {A(...)}and it shows
>>"Prase Error: No matching } in 'object', box found instead."  Could someone
>>here hele me solve the problem?(Without object{} but just with A(...) it
>>runs smoothly and I guess I could invoke the macro with ".inc" but don't
>>know how to invoke it.)
>>
>>#include "colors.inc"
>>#include "textures.inc"
>>#include "metals.inc"
>>
>>camera{
>>       location <0,10,-20>
>>       direction <0,0,1>
>>       up <0,1,0>
>>       right <4/3,0,0>
>>       look_at <0,0,0>
>>      }
>>
>>background {color rgb <0.5,0.5,0.5>}
>>
>>object {light_source {<20,100,-200> colour White}}
>>
>>#macro A(Angle,Radius,y_rotate,A_rotate)
>>
>>#local Index=0;
>>#while (Index<=y_rotate/Angle)
>> #local x_delta_move=-Radius*(1-cos(Angle*Index));
>> #local z_delta_move=-Radius*sin(Angle*Index);
>> #local y_delta_rotate=Index*Angle;
>> box{<-0.4,-0.4,-0.4>,<0.4,0.4,0.4>
>>     translate <x_delta_move,0,z_delta_move>
>>     rotate y_delta_rotate*y
>>     pigment{colour White}
>>     rotate A_rotate*y
>>     scale 0.2}
>> #local Index=Index+1;
>>#end
>>#end
>>
>>object{A (0.01*3.14/180,100,26*3.14/180,180)}
>>object{A (0.01*3.14/180,100,26*3.14/180,0)}


make union{} in your macro like that :

#macro ...
#local index=0;
union {
  #while()
    ...
    box { }
  #end
  }
#end

klp


Post a reply to this message

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