POV-Ray : Newsgroups : povray.newusers : Problem with 'object' errors? Server Time
11 Oct 2026 22:20:49 EDT (-0400)
  Problem with 'object' errors? (Message 1 to 18 of 18)  
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

From: Jessie K  Blair
Subject: Re: Problem with 'object' errors?
Date: 16 Jun 2003 03:17:55
Message: <3eed6f23$1@news.povray.org>
I guess that never occurred to me, possibly since I have experience with web
development and some application development as well.
Normally when using objects I just put them all at the end of the file in a
long list of OBJECT statements. This is my first attempt at making a macro,
and I didn't realize that the multiple objects within the macro were trying
to be processed as a single object within the final object statement at the
end of the file.

"Hughes, B." <omn### [at] charternet> wrote in message
news: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: Warp
Subject: Re: Problem with 'object' errors?
Date: 16 Jun 2003 03:31:04
Message: <3eed7237@news.povray.org>
Jessie K. Blair <jbl### [at] earthlinknet> wrote:
> object { OrbitalSphere (MajorRadius, MinorRadius, Diff_Radius, SphereTex,
> OrbitlTex) }

  As people have already told you, that's your problem.
  'object' can hold only one object, while OrbitalSphere() creates many.

> #declare CountR=0;
> #declare CountN=0;

> #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

  By the way, is it intentional that you don't reset CountN at the
beginning of the inner loop?
  At the second loop of the outer loop, CountN will be equal to Num_Orbs
and thus the inner loop is not executed at all. This makes the outer loop
obsolete (because the inner loop is executed just once and that's it).

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Hughes, B 
Subject: Re: Problem with 'object' errors?
Date: 16 Jun 2003 03:34:11
Message: <3eed72f3@news.povray.org>
"Jessie K. Blair" <jbl### [at] earthlinknet> wrote in message
news:3eed6f23$1@news.povray.org...
> I guess that never occurred to me, possibly since I have experience with
web
> development and some application development as well.
> Normally when using objects I just put them all at the end of the file in
a
> long list of OBJECT statements. This is my first attempt at making a
macro,
> and I didn't realize that the multiple objects within the macro were
trying
> to be processed as a single object within the final object statement at
the
> end of the file.

Perfectly understandable. What it *does* allow for is to apply texture
(pigment, etc.) and/or use transformations, whatever else legal, so that any
premade object can always be reobjected (sorry, only way I could sum that up
in a word)and those things done to it.

#declare Sphere=
object {
    sphere {0,1}
}

#declare GreenSphere=
object {
    Sphere
    pigment { green 1 }
}

#declare MovedGreenSphere=
object {
    GreenSphere
    translate y
}

And that could go on and on. Probably best described as a container for
using object modifiers (per all other rules of how POV-Ray works) but only a
part of CSG if 'inverse' is used in it, or identifier needing a wrapper. Or
at least I think I can say that and not be wrong.  :-)

Bob H.


Post a reply to this message

From: Hughes, B 
Subject: Re: Problem with 'object' errors?
Date: 16 Jun 2003 03:40:36
Message: <3eed7474$1@news.povray.org>
"Hughes, B." <omn### [at] charternet> wrote in message
news:3eed72f3@news.povray.org...
> part of CSG if 'inverse' is used in it, or identifier needing a wrapper.
Or
> at least I think I can say that and not be wrong.  :-)

clipped_by and bounded_by, too. Just knew I was going to get into trouble if
I tried to say it had little to do with Constructive Solid Geometry just so
you'd think of it differently from the other CSG stuff.


Post a reply to this message

From: Jessie K  Blair
Subject: Re: Problem with 'object' errors?
Date: 16 Jun 2003 04:11:03
Message: <3eed7b97@news.povray.org>
Yes, I caught that problem as well.
Right now, my loop looks like this:

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

I'm not very good with Mathematics and what I'm trying to do is create
something like this:

Take a sphere and then place many smaller spheres around it, each a constant
distance from the surface of the larger sphere.
Basically, a sphere within a sphere of spheres... if you can imagine that.

I do not understand how to plot points around a sphere at a constant
distance from the surface of the sphere.
I've been trying to take one band of the smaller spheres and rotate them
along the z-axis, which does what I want it to, but then I have the problem
of spheres overlapping at the poles.


"Warp" <war### [at] tagpovrayorg> wrote in message
news:3eed7237@news.povray.org...
> Jessie K. Blair <jbl### [at] earthlinknet> wrote:
> > object { OrbitalSphere (MajorRadius, MinorRadius, Diff_Radius,
SphereTex,
> > OrbitlTex) }
>
>   As people have already told you, that's your problem.
>   'object' can hold only one object, while OrbitalSphere() creates many.
>
> > #declare CountR=0;
> > #declare CountN=0;
>
> > #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
>
>   By the way, is it intentional that you don't reset CountN at the
> beginning of the inner loop?
>   At the second loop of the outer loop, CountN will be equal to Num_Orbs
> and thus the inner loop is not executed at all. This makes the outer loop
> obsolete (because the inner loop is executed just once and that's it).
>
> --
> #macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb
x]
> [1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
> -1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// -
Warp -


Post a reply to this message

From: Hughes, B 
Subject: Re: Problem with 'object' errors?
Date: 17 Jun 2003 15:02:07
Message: <3eef65af@news.povray.org>
"Jessie K. Blair" <jbl### [at] earthlinknet> wrote in message
news:3eed7b97@news.povray.org...
>
> Take a sphere and then place many smaller spheres around it, each a
constant
> distance from the surface of the larger sphere.
> Basically, a sphere within a sphere of spheres... if you can imagine that.

Ah yes, too bad you hadn't said that first because if you were to search
these povray newsgroups you'd possibly had found the answer. It's been
something discussed many times in the past.

Easiest way to search is through the web page at http://news.povray.org/

And here is a find from one such search (after you've already set your
preferences up via link above):
http://news.povray.org/povray.general/28127/

I noticed you were asking about this sort of thing before, back in January
of this year.


Post a reply to this message

From: Jessie K  Blair
Subject: Re: Problem with 'object' errors?
Date: 17 Jun 2003 22:51:58
Message: <3eefd3ce@news.povray.org>
Indeed, and thank you.
When I asked about it earlier this year, I was on a military computer in
Afghanistan. Once I came home, I lost all that data, and for some reason, my
Outlook Express doesn't download all the messages properly even when
synchronize and have it set to "All Messages".

Anyhow, thank you for the information, and I'm off to run that search just
as you mentioned.

"Hughes, B." <omn### [at] charternet> wrote in message
news:3eef65af@news.povray.org...
> "Jessie K. Blair" <jbl### [at] earthlinknet> wrote in message
> news:3eed7b97@news.povray.org...
> >
> > Take a sphere and then place many smaller spheres around it, each a
> constant
> > distance from the surface of the larger sphere.
> > Basically, a sphere within a sphere of spheres... if you can imagine
that.
>
> Ah yes, too bad you hadn't said that first because if you were to search
> these povray newsgroups you'd possibly had found the answer. It's been
> something discussed many times in the past.
>
> Easiest way to search is through the web page at http://news.povray.org/
>
> And here is a find from one such search (after you've already set your
> preferences up via link above):
> http://news.povray.org/povray.general/28127/
>
> I noticed you were asking about this sort of thing before, back in January
> of this year.
>
>


Post a reply to this message

From: skrillian
Subject: Re: Problem with 'object' errors?
Date: 19 Jun 2003 07:07:11
Message: <3ef1995f$1@news.povray.org>
On Mon, 16 Jun 2003 01:51:31 -0400, Jessie K. Blair wrote:

> 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?
 
	Almost every editer has a way to match up ([{ with [{) on the other
side. 

	Search the help on the one you are using or get one that does do the
matching for you. 

	It is a standard feature because almost all code is copied and
programmers certainly include the feature as it saves so many of them
from insanity for exactly the same error message you are getting.


Post a reply to this message

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