POV-Ray : Newsgroups : povray.text.scene-files : UniversalBeams and a MAcro Question : Re: UniversalBeams and a MAcro Question Server Time
3 Jul 2024 02:48:46 EDT (-0400)
  Re: UniversalBeams and a MAcro Question  
From: Bob H 
Date: 3 Oct 2001 17:27:44
Message: <3bbb82d0@news.povray.org>
"Rob Brown-Bayliss" <on_### [at] clearnetnz> wrote in message
news:3bbaf02d@news.povray.org...
>
> I also have a question (I'm a regular newbi to POV-ray, and 3d in
> general) about default values in macros.
>
> Can I do this:
>
> #macro MyMacro(A, B, C=0, D=1, E=2)
>
> and have C, D and E default to the values if the user leave them out, eg
> user calls
>
> MyMacro(3,6,2)
>
> And pov trates this as MyMacro(3,6,2,1,2)?

No, can't be.  C=0 is meaningless.  A #declare would be needed but even that
is impossible to actually put into the macro declaration.  You can only add
those in the macro item area and still the person using the macro has to use
all parameters.

It would be a good thing I believe if macro could accept any number of them
instead and default to something when there aren't enough or too many.  Not
sure if that's been considered before but most likely has been thought about
over the past couple years.

> Any way here is the I beam macro...  It would be nice if people caould
> point out ways to improve it as well. Thanks

You might use the following instead since spheres don't lend well to cutting
through varying thicknesses.

//object // commented out because isn't needed.
//{
// sphere {<0,0,Start - Pos>, Hole/2}
cylinder {<0,-T/0.499,Start - Pos>,<0,T/0.499,Start - Pos>, Hole/2}
//}

Also, it would be advisable to add your name (even if a nickname), date and
POV version just so people know those things.  Thanks for posting it.

Bob H.


Post a reply to this message

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