POV-Ray : Newsgroups : povray.newusers : Problem with 'object' errors? Server Time
4 Nov 2024 13:00:19 EST (-0500)
  Problem with 'object' errors? (Message 1 to 10 of 18)  
Goto Latest 10 Messages Next 8 Messages >>>
From: Jessie K  Blair
Subject: Problem with 'object' errors?
Date: 16 Jun 2003 01:51:19
Message: <3eed5ad7$1@news.povray.org>
/*==========================================================================
==========*/

// Change these variables to indicate deisered sizes and textures.

// Radius of the large sphere.
#declare MajorRadius = 10;

// Radius of the orbital spheres.
#declare MinorRadius = 1;

// Radius of the orbit path.
#declare Diff_Radius = 12;

// Textures of the Sphere and it orbitals, respectively.
#declare SphereTex = texture { pigment { color rgb <.8, .1, .3> } finish
{ambient 0.1 diffuse 0.85 phong 1.0 } }
#declare OrbitlTex = texture { pigment { color rgb <.3, .1, .8> } finish
{ambient 0.1 diffuse 0.85 phong 1.0 } }

/*==========================================================================
==========*/

// Macro for creating the spherical orbitals.
#macro OrbitalSphere (MainR, OrbitalR, OrbitR, T1, T2)
#declare CountR=0;
#declare CountN=0;
#local Orbited = sphere { <0, 0, 0>, MainR texture { T1 } }
#local Orbital = sphere { <0, 0, 0>, OrbitalR texture { T2 } }
#declare Num_Orbs = 360/(OrbitR/OrbitalR);
#declare Row_Orbs = MainR;

object{Orbited}

#while (CountR <= Row_Orbs)
   #while (CountN <= Num_Orbs)
      object { Orbital translate <OrbitR, CountR, 0> rotate <0, CountN, 0> }
      #declare CountN = CountN+1;
   #end
   #declare CountR = CountR+1;
#end

#end

/*==========================================================================
==========*/

object { OrbitalSphere (MajorRadius, MinorRadius, Diff_Radius, SphereTex,
OrbitlTex) }






When I run this code I get an error from the parser that states "Parse
error: No matching } in 'object', object found instead.
The error highlights the object statement nested within the #WHILE loops.
Anyone have any clue why this problem is occuring, when it should not be a
problem at all?


Post a reply to this message

From: Jessie K  Blair
Subject: Re: Problem with 'object' errors?
Date: 16 Jun 2003 02:10:40
Message: <3eed5f60@news.povray.org>
Oddly enough, the problem vanishes if I simply put a union around the entire
thing. I would still like to know why that error would have occurred in the
first place.


Post a reply to this message

From: Hughes, B 
Subject: Re: Problem with 'object' errors?
Date: 16 Jun 2003 02:28:17
Message: <3eed6381@news.povray.org>
"Jessie K. Blair" <jbl### [at] earthlinknet> wrote in message
news:3eed5f60@news.povray.org...
> Oddly enough, the problem vanishes if I simply put a union around the
entire
> thing. I would still like to know why that error would have occurred in
the
> first place.

'object' isn't like a union at all, it's more of a container for a single
"object" so more can be done with it (scale, rotate, translate, add texture,
etc.), although it seems you might have thought so or at least figured it
could "union" everything. If you remove it from the macro call, at the very
end of your script, it's okay; or union around just that part is okay, but
not needed (unless you intend to do more things with it as a whole,
afterward).

Bob H.


Post a reply to this message

From: Lutz-Peter Hooge
Subject: Re: Problem with 'object' errors?
Date: 16 Jun 2003 02:36:50
Message: <3eed6582$1@news.povray.org>
Jessie K. Blair <jbl### [at] earthlinknet> wrote:

> When I run this code I get an error from the parser that states "Parse
> error: No matching } in 'object', object found instead.

There can be exactly one object inside 'object{...}'. Your macro 
generates many objects, so you must use a union instead.

Lutz-Peter


Post a reply to this message

From: Hughes, B 
Subject: Re: Problem with 'object' errors?
Date: 16 Jun 2003 02:42:55
Message: <3eed66ef$1@news.povray.org>
I don't know why I didn't say this too, probably because I thought you would
already know what's needed: if you use 'union' around the macro statement
(more precisely, it's contents, so the union is part of the macro) then you
can do an 'object {macro(here)}' so it can still be worked with further,
after all is done. Instead of like I was saying before, which was to union
the macro call or leaving it unencapsulated.

Idea is... a 'while' loop should be considered for 'union' (or merge, or
whatever CSG you have in mind) to collect it into a single entity, except
when you intentionally want it ungrouped.

Bob H.


Post a reply to this message

From: Jessie K  Blair
Subject: Re: Problem with 'object' errors?
Date: 16 Jun 2003 02:48:07
Message: <3eed6827@news.povray.org>
I know the difference between a union and an object, but for some reason,
the code is giving me an object error when logically the code makes sense. I
was able to get around the error by placing a union block around the object
and the nested #while loops. This is what the code looks like after I put in
the union block:

union {
object{Orbited}

#while (CountR <= Row_Orbs)
   #while (CountN <= Num_Orbs)
      object { Orbital translate <OrbitR, CountR, 0> rotate <0, CountN, 0> }
      #declare CountN = CountN+1;
   #end
   #declare CountR = CountR+1;
#end
}

For some reason I do not understand, that simple fix removes the error
without me changing the pairing of brackets nor any of the code despite the
union block.



----- Original Message -----
From: "Hughes, B." <omn### [at] charternet>
Newsgroups: povray.newusers
Sent: Monday, June 16, 2003 2:28 AM
Subject: Re: Problem with 'object' errors?


> "Jessie K. Blair" <jbl### [at] earthlinknet> wrote in message
> news:3eed5f60@news.povray.org...
> > Oddly enough, the problem vanishes if I simply put a union around the
> entire
> > thing. I would still like to know why that error would have occurred in
> the
> > first place.
>
> 'object' isn't like a union at all, it's more of a container for a single
> "object" so more can be done with it (scale, rotate, translate, add
texture,
> etc.), although it seems you might have thought so or at least figured it
> could "union" everything. If you remove it from the macro call, at the
very
> end of your script, it's okay; or union around just that part is okay, but
> not needed (unless you intend to do more things with it as a whole,
> afterward).
>
> Bob H.
>
>


Post a reply to this message

From: Jessie K  Blair
Subject: Re: Problem with 'object' errors?
Date: 16 Jun 2003 02:51:40
Message: <3eed68fc$1@news.povray.org>
This is a little more towards my understanding... However, I'm not sure I
understand why there would be a limitation on the objects in a macro. If I'm
following the coding correctly as I understand it, it should be creating one
object for each loop that it makes, which would mean, yes it makes several
objects, but each object is its own entity, or at least I would think it
should be.

"Lutz-Peter Hooge" <lpv### [at] gmxde> wrote in message
news:3eed6582$1@news.povray.org...
> Jessie K. Blair <jbl### [at] earthlinknet> wrote:
>
> > When I run this code I get an error from the parser that states "Parse
> > error: No matching } in 'object', object found instead.
>
> There can be exactly one object inside 'object{...}'. Your macro
> generates many objects, so you must use a union instead.
>
> Lutz-Peter


Post a reply to this message

From: Hughes, B 
Subject: Re: Problem with 'object' errors?
Date: 16 Jun 2003 03:01:22
Message: <3eed6b42@news.povray.org>
"Lutz-Peter Hooge" <lpv### [at] gmxde> wrote in message
news:3eed6582$1@news.povray.org...
> Jessie K. Blair <jbl### [at] earthlinknet> wrote:
>
> > When I run this code I get an error from the parser that states "Parse
> > error: No matching } in 'object', object found instead.
>
> There can be exactly one object inside 'object{...}'. Your macro
> generates many objects, so you must use a union instead.

Glad you knew that, I think a lot of people might believe you could group
things into a single object statement for it to act similar to union. It's
something I had to think twice about although I knew that was the obvious
answer, because if I were to write this:

#declare AllObjects=
object {
 object {Object1}
 object {Object2}
 texture {ObjTex)
}

couldn't you imagine the object wrappers might collect them into a group
same as union does? Perhaps not if there weren't 'object' for each
(identifier alone)...  Just one of those things that seems plausible until
the error proves otherwise.

Bob H.


Post a reply to this message

From: Lutz-Peter Hooge
Subject: Re: Problem with 'object' errors?
Date: 16 Jun 2003 03:07:40
Message: <3eed6cbc$1@news.povray.org>
Jessie K. Blair <jbl### [at] earthlinknet> wrote:

> This is a little more towards my understanding... However, I'm not sure I
> understand why there would be a limitation on the objects in a macro.

There isn't. The problem is not with the objects IN your macro, it is with 
the object inside wich the macro is called.

Wrong:
#macro foo()
	sphere{0,1}
	sphere{0,2}
#end
object{foo()}

Correct:
#macro foo()
	sphere{0,1}
	sphere{0,2}
#end
union{foo()}

Also correct:
#macro foo()
union{
	sphere{0,1}
	sphere{0,2}
}
#end
object{foo()}

Lutz-Peter


Post a reply to this message

From: Jessie K  Blair
Subject: Re: Problem with 'object' errors?
Date: 16 Jun 2003 03:14:33
Message: <3eed6e59$1@news.povray.org>
Okay, I can understand that.
With my code, it was similar to the code in label Wrong:
By adding the union statement to my macro, I got the same effect as with
your "Also Correct:"

"Lutz-Peter Hooge" <lpv### [at] gmxde> wrote in message
news:3eed6cbc$1@news.povray.org...
> Jessie K. Blair <jbl### [at] earthlinknet> wrote:
>
> > This is a little more towards my understanding... However, I'm not sure
I
> > understand why there would be a limitation on the objects in a macro.
>
> There isn't. The problem is not with the objects IN your macro, it is with
> the object inside wich the macro is called.
>
> Wrong:
> #macro foo()
> sphere{0,1}
> sphere{0,2}
> #end
> object{foo()}
>
> Correct:
> #macro foo()
> sphere{0,1}
> sphere{0,2}
> #end
> union{foo()}
>
> Also correct:
> #macro foo()
> union{
> sphere{0,1}
> sphere{0,2}
> }
> #end
> object{foo()}
>
> Lutz-Peter


Post a reply to this message

Goto Latest 10 Messages Next 8 Messages >>>

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