![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
hello,
it ain't the first time i use macros, but now i think so.
in my code i make a call to a macro which itself is a loop which calls
another macro. special is that the first macro-call fails and povray does
not start render if i use the main-call in an object-construct:
object{mymacro(xd,yd) rotate y*90}
errormessage:
Parsing.... ein_fach([...]
/*[...]
*/
union <----ERROR
[...]no matching } in object, union found instead.
but if i use
mymacro(xd,yd)
the code is interpreted without errors. (but then i do not know how rotate
the object in macro).
does anybody know what i did wrong or how i can solve this?
thank for hints.
btw: do not search for macro "mymacro()" in code extract.
code follows (extract):
-----------------------------code---------------------
camera{cam1}
light_source{}
#declare ef_box_br = 0.31;
#declare ef_box_ho = 0.07;
#declare ef_box_ti = 0.4;
//------------------------------------------ein_fach
#macro ein_fach(ix,iy,iz)
/*
ix, iy, iz: verschiebung im raum
*/
union{ <----here the error is shown
difference{
box {}
box {}
pigment{color White}
}//difference
difference{
superellipsoid{}
superellipsoid{}
pigment{color White}
}//difference
translate <ix,iy,iz>
}//union
#end
//------------------------------------------ein_fach
//------------------------------------------fachwand
#macro fachwand(anz_x,anz_y,ix,iy,iz)
#local count_x = 0;
#local count_y = 0;
#while (count_x <= anz_x)
#while (count_y <= anz_y)
ein_fach(count_x*ef_box_br+ix,count_y*ef_box_ho+iy,iz)
#declare count_y = count_y + 1;
#end
#declare count_y = 0;
#declare count_x = count_x + 1;
#end
#end
//------------------------------------------fachwand
object{fachwand(37,35,-5.9,0,5.6)} <-------------fails
fachwand(37,35,0,0,0) <-------------okay
-----------------------------code end-----------------
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Marc-Hendrik Bremer
Subject: Re: object{macro()} fails because union
Date: 29 Nov 2001 07:26:40
Message: <3c062980@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Hi!
What you are ending with is something like this:
object{union{sphere {0,0}
sphere {0,0}
}
union{sphere {0,0}
sphere{0,0}
}
}
and Pov does not take it, because you have not one object in the
object{}-statement, but several.
If you enclose the while()-loop of fachwand() in another union, everything
should work okay, 'cause you get one union in the object statement.
Hth,
Marc-Hendrik
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Hi,
I think that the error message came at the second call of the macro. I would
write something like:
#declare tempobj = union{fachwand(37,35,-5.9,0,5.6)}
object{tempobj}
or modify the fachwand macro starting by a "union{" and ending by "}"
I hope that is correct, I didn't try it.
Chaps
"marabou" <not### [at] available yet> wrote in message
news:3c062665@news.povray.org...
>
> hello,
>
> it ain't the first time i use macros, but now i think so.
> in my code i make a call to a macro which itself is a loop which calls
> another macro. special is that the first macro-call fails and povray does
> not start render if i use the main-call in an object-construct:
> object{mymacro(xd,yd) rotate y*90}
> errormessage:
> Parsing.... ein_fach([...]
> /*[...]
> */
> union <----ERROR
> [...]no matching } in object, union found instead.
> but if i use
> mymacro(xd,yd)
> the code is interpreted without errors. (but then i do not know how rotate
> the object in macro).
> does anybody know what i did wrong or how i can solve this?
> thank for hints.
>
> btw: do not search for macro "mymacro()" in code extract.
>
> code follows (extract):
> -----------------------------code---------------------
>
> camera{cam1}
>
> light_source{}
>
> #declare ef_box_br = 0.31;
> #declare ef_box_ho = 0.07;
> #declare ef_box_ti = 0.4;
>
> //------------------------------------------ein_fach
> #macro ein_fach(ix,iy,iz)
> /*
> ix, iy, iz: verschiebung im raum
> */
> union{ <----here the error is shown
>
> difference{
> box {}
> box {}
> pigment{color White}
> }//difference
>
> difference{
> superellipsoid{}
> superellipsoid{}
> pigment{color White}
> }//difference
> translate <ix,iy,iz>
> }//union
> #end
> //------------------------------------------ein_fach
>
> //------------------------------------------fachwand
> #macro fachwand(anz_x,anz_y,ix,iy,iz)
> #local count_x = 0;
> #local count_y = 0;
> #while (count_x <= anz_x)
> #while (count_y <= anz_y)
> ein_fach(count_x*ef_box_br+ix,count_y*ef_box_ho+iy,iz)
> #declare count_y = count_y + 1;
> #end
> #declare count_y = 0;
> #declare count_x = count_x + 1;
> #end
>
> #end
> //------------------------------------------fachwand
>
> object{fachwand(37,35,-5.9,0,5.6)} <-------------fails
>
> fachwand(37,35,0,0,0) <-------------okay
>
> -----------------------------code end-----------------
>
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
thank you for solving!
marc-nedrik, your hint to enclose the while loop is no the right way in
this case because i have to translate evey single call of ein_fach(). but
your tip was worth gold for me.
i preferred chaps way, which is working fine!
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Well ... I suggested the same as chaps second way (not including the
declares), which is essentially nothing else but the way using tempobj.
It helps to look at a macro as if it is written at the place of it's call.
If you can cut the macro out #macro ... #end shell and place instead of the
call (providing the right variable declarations of course), then your macro
will most likely work. The only exception of this is IMO the use of local
variables (including parameter-variables).
Glad it works now.
Marc-Hendrik
marabou schrieb in Nachricht <3c063186@news.povray.org>...
thank you for solving!
marc-nedrik, your hint to enclose the while loop is no the right way in
this case because i have to translate evey single call of ein_fach(). but
your tip was worth gold for me.
i preferred chaps way, which is working fine!
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |