POV-Ray : Newsgroups : povray.newusers : newbie question Server Time
6 Nov 2024 18:25:08 EST (-0500)
  newbie question (Message 1 to 5 of 5)  
From: Joe Conklin
Subject: newbie question
Date: 1 Feb 1998 12:31:34
Message: <34d4be8e.0@news.povray.org>
is there a way to make an object and call it when u need it.  like if you
are making a room full of chairs.  instead of making 100 chairs, you could
make one chair and just call it 100 times(about 100 times easier).  this is
called a pre-fab (prefabricated design)
please reply via email thanks

                                    joe conklin


--
http://www.geocities.com/siliconvalley/horizon/7128
visit and sign the book
remove "spam" to reply
                                                                    Joe


Post a reply to this message

From: Ian
Subject: Re: newbie question
Date: 2 Feb 1998 00:38:52
Message: <34d56945.0@news.povray.org>
Joe Conklin wrote in message <34d4be8e.0@news.povray.org>...
>is there a way to make an object and call it when u need it.  like if you
>are making a room full of chairs.  instead of making 100 chairs, you could
>make one chair and just call it 100 times(about 100 times easier).  this is
>called a pre-fab (prefabricated design)
>please reply via email thanks
>
>                                    joe conklin
>
>
>--
>http://www.geocities.com/siliconvalley/horizon/7128
>visit and sign the book
>remove "spam" to reply
>                                                                    Joe
>
>

    I'm new myself, but I believe I can help a little.
    I'm pretty darn sure there is a way to create an object and then use it as a
pre-fab.  I think it has something to do with the
define statement. . .

                                            Good luck,
                                            Ian


Post a reply to this message

From: Ian
Subject: Re: newbie question
Date: 2 Feb 1998 00:56:17
Message: <34d56d59.0@news.povray.org>
>
>I think it has something to do with the #define statement. . .
>
>                                            Good luck,
>                                            Ian
>

    Uh, did I say #define?  I meant #declare!  Sheesh!  C++ is rubbing off on me!!!

                                                I feel stupid,
                                                Ian


Post a reply to this message

From: Eric Pascual
Subject: Re: newbie question
Date: 2 Feb 1998 18:46:54
Message: <34d667e8.0@news.povray.org>
Hello Ian

As you have guessed, the solution uses #declare. You can define an abject as
follows :

#declare Object_Foo = object {
... a lot of statements to create you object here ...
}

then use it by writing :

// a yellow foo object located at  <0, 100, 0>
object {
  Object_Foo
  pigment {
    color Yellow
  }
  translate <0, 100, 0>
}

// now a red one located at <100, 0, 0> and rotated a bit
object {
  Object_Foo
  pigment {
    color Red
  }
  rotate z*30
  translate <100, 0, 0>
}

To replicate a lot of objects on a regular basis, you can use the loop
statements, so that creating a theater with all its seats will not require
10,000 lines of POV source code but just a small amount of looping code :-)

I have not validated this snippet but I have written stuff similar to it,
and it works.

Hope this will help
Eric


Post a reply to this message

From: Nieminen Mika
Subject: Re: newbie question
Date: 8 Feb 1970 13:49:13
Message: <34ddfe29.0@news.povray.org>
Ian (JBu### [at] sceinetcom) wrote:
:     Uh, did I say #define?  I meant #declare!  Sheesh!  C++ is rubbing off on me!!!

  Every time I code in C and I want to type a #define -line, I instead
type a #declare line... I think I have used too much povray... ;)

--
                                                              - Warp. -


Post a reply to this message

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