|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
now i'm pulling out my hear on this problem
i just started with this macro to create a fence:
#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".
I allready found out the problem has to do with the #while loop. but i can't
find how to fix. Please can someone guide me throug this?
object{
Fence(400, 150, 20, 1.5)
pigment{ rgb .1 }
}
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Jellby wrote:
>
>So you finally have:
>
>object {
> cylinder { }
> translate
> cylinder { }
> translate
> ...
>}
>
i don't understand how you come to that :-s
>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
> }
> ...
>}
>
calling it as a union doesn't work. but the problem is something with the
while-loop and not with the cylinder. when i remove the #while and #end,
everything works fine.
when i add that while, i get the error.
it's very strange...
thx for the reply!
lenx
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Lenx" <lenx_@hotmail.com> wrote:
> i don't understand how you come to that :-s
It's called loop unrolling... He (Jellby) is right, your code is not
supposed to work; I'm surprised you say it compiles.
Enclosing this in a 'union' is not that necessary -- as long as you, at
least, put your 'translate' statements inside 'cylinder' blocks.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <web.3e594598d27a3e2ede2a6cfb0@news.povray.org>,
"Lenx" <lenx_@hotmail.com> wrote:
> Jellby wrote:
> >
> >So you finally have:
> >
> >object {
> > cylinder { }
> > translate
> > cylinder { }
> > translate
> > ...
> >}
>
> i don't understand how you come to that :-s
Your macro:
#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
It loops over a cylinder and translate statement. You then call it in an
object block...and get the expected result.
Since your translate statement is apparently intended to translate the
cylinder, it should go in the cylinder block. And an object block can
only contain one object, you need to put either the macro call or the
loop itself in a union.
BTW, your "i" variable is poorly named. It is a good idea to always use
at least one upper-case letter in a variable name, which will prevent
conflicts with future keywords.
--
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <3e594ae8@news.povray.org>,
"Vadim Sytnikov" <syt### [at] rucom> wrote:
> It's called loop unrolling... He (Jellby) is right, your code is not
> supposed to work; I'm surprised you say it compiles.
Huh? He didn't. Nobody mentioned anything compiling, which is good,
because POV doesn't compile anything. He did say it didn't work.
> Enclosing this in a 'union' is not that necessary -- as long as you, at
> least, put your 'translate' statements inside 'cylinder' blocks.
Putting it in a union has the advantage that the entire group of
cylinders can be transformed and textured as a single object. Not
strictly necessary, but more flexable.
--
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Christopher James Huff" <cja### [at] earthlinknet> wrote:
>
> Huh? He didn't. Nobody mentioned anything compiling, which is good,
> because POV doesn't compile anything. He did say it didn't work.
I was referring to his words that "the macro itself is ok when rendered, but
of course you only get a black screen.". That is, it seemed like he was
complaining about the macro not working in some particular case. Maybe I
just misundertood him.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <3e5958e2@news.povray.org>,
"Vadim Sytnikov" <syt### [at] rucom> wrote:
> > Huh? He didn't. Nobody mentioned anything compiling, which is good,
> > because POV doesn't compile anything. He did say it didn't work.
>
> I was referring to his words that "the macro itself is ok when rendered, but
> of course you only get a black screen.". That is, it seemed like he was
> complaining about the macro not working in some particular case. Maybe I
> just misundertood him.
Ah, I see...I understood this as "when I don't call the macro". His
macro will parse fine, as long as it isn't actually called. It won't
parse if it is called outside an object block, which might be what you
meant. (I don't think it will parse anywhere)
--
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
thanks Christopher, you made it clear to me.
i was complaining about the macro, working on itsself, but not working when
called in an object.
so the macro renders without errors, but called in an object it gives error.
thanks to you all!
//code is now:
#macro Fence(Flength, Fheight, Fspace, Fdiam)
union{
#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
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <web.3e5a5c25d27a3e2e293f3c960@news.povray.org>,
"Lenx" <lenx_@hotmail.com> wrote:
> i was complaining about the macro, working on itsself, but not working when
> called in an object.
> so the macro renders without errors, but called in an object it gives error.
When a macro is just defined, very little parsing is done. The contents
of the macro only really exist to the parser when the macro is called
--
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|