|
![](/i/fill.gif) |
"Jim Charter" <jrc### [at] msn com> 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
|
![](/i/fill.gif) |