POV-Ray : Newsgroups : povray.general : cannot recognize defined object / help, please : Re: cannot recognize defined object / help, please Server Time
29 Jul 2024 16:22:01 EDT (-0400)
  Re: cannot recognize defined object / help, please  
From: Robert Baer
Date: 7 Jan 2011 02:15:01
Message: <web.4d26bd3f96c55a409ded892d0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 06.01.2011 23:10, schrieb Robert Baer:
>
> >    Declared variables now do not pass between .ini and .inc; worse a declared
> > variable gets reset to zero inside the .inc .
>
> ...
> >        #declare PN=4006;   // Frame "U"<--NOTE DEFINED!!!!
> >
> > // U-bar modified with look-up table by product number PN
> >   #declare A=0; #declare B=0; #declare C= 0.; #declare Angle=0;  // default zero
> > aize
> >   #declare Shl=0; #declare Crv=0;                                // default zero
> > aize
> >    #debug concat("Start search; PN=", str(B,9,3), "\n")
>
> If you want to output PN, then why do you output B ?! ;-)
>
>
> > ** SNIP
> >    Debug file "true" (no other name possible) shows that PN=0 !!
>
> >    Furthermore POVray barfs on undefined variable Ulong in Tank.inc .
> >    How can i fix this?
>
> By defining it /before/ you include the file??
>
> But from the code I guess you'll also want more than one "U-bar" in the
> long run anyway, with different lengths - your current code cannot
> accomplish that anyway. You should have a look at POV-Ray's macro
> mechanism for that. Essentially, macros are the only way in POV-Ray to
> "pre-define" anything without specifying all the parameters beforehand.

  I finally discovered that.
  I thought i could be "cute" and include the .inc file right away and thus make
it global.
  So, thanks.
  Now i have an #if..#end problem that is bugging me:
//                             Tank.POV
//                    z
//                    |
// y arrow tip------> .-- x

//        NOTE: Change output filename in Tank.INI for output scene name
//              Save change, then run Tank.INI

#include "colors.inc"
#include "metals.inc"
global_settings { adc_bailout 0.05 max_trace_level 9 }

// Uses "Tank.inc" for subroutines
//      Subroutines for making the tank
// * Ubar         vars: Ulong , ucolor; declare PN to Speedy Metals part number
// * Lbar         vars: Ulong , ucolor; declare PN to Speedy Metals part number
// * UpFtBk       observer, at left end "Y", top looking to right Y=0
// * UpLfRt       observer, at left end "Y", top looking to right Y=0
// * Ttop         observer, at left end looking up to right middle of rectangle

#declare PN=3990;   // Chosen "U"
#declare Ulong = 48.0;  #declare ucolor = Cyan;

// object {Scribe  pigment {Cyan} rotate < 0, 0,90>}
// object {Scribe  pigment {Magenta} rotate < 0,90,0>}
// object {Scribe  pigment {Yellow} }


// clock 1..9 Make and show tank construction

    #if (clock=91)
      light_source {<  0,150,  0> White*100}
camera {
        perspective
        location < 0,65,-9>
        look_at  < 0, 0, 0>
        angle 0
        }
#include "Tank.inc"
  object {UpFtBk}
    #end

    #if (clock=92)
      light_source {<  0,150,  0> White*5.5}
      light_source {<  0, 10, 20> White*8.5}
      light_source {<  0, 10,-20> White*8.5}
camera {
        perspective
        location < 0, 65,-9>
        look_at  < 0, 0, 0>
        angle 0
        }
#include "Tank.inc"
  object {UpLfRt}
    #end

    #if (clock=93)
      light_source {<  0,150,  0> White*5.5}
      light_source {<  0, 10, 20> White*8.5}
      light_source {<  0, 10,-20> White*8.5}
camera {
        perspective
        location < 0, 65,-9>
        look_at  < 0, 0, 0>
        angle 0
        }
  object {Ttop rotate < 0, 0,45> translate < 20, 0,  0>}
    #end

    #if (clock>3)
      light_source {<  0, 50,  0> White*9.5}
      light_source {<  0, 10, 20> White*8.5}
      light_source {<  0, 10,-20> White*8.5}
camera {
        perspective
        location < 0, 5, 0>
        look_at  < 0, 0, 0>
        angle 0
        }
#include "Tank.inc"
                               //    5  10
  object {Ttop rotate < 0, 0,90> translate <-00,-00,  0>}
    #end
                    // MATCHED #if..#end recognized to here..
    #if (clock>=1)
      light_source {<  0, 50,  0> White*9.5}
      light_source {<  0, 10, 20> White*8.5}
      light_source {<  0, 10,-20> White*8.5}
camera {
        perspective
        location < 0.5,49,.1>
        look_at  < 0.5, 0,.1>
        angle 0
        }
#declare Ulong = 1.0;
//#declare PN=3990;   // Chosen "U"
#declare PN=4006;   // Frame "U"
#include "Tank.inc"
   object {Ubar} //object {Lbar)
    #end
                    // but not to here..
// get "Parse Error: End of file reached but #end expected."
sky_sphere {pigment {rgb <0.859,0.910,0.831>}}
*** END FILE ***


Post a reply to this message

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