POV-Ray : Newsgroups : povray.general : printing object's identifier : Re: printing object's identifier Server Time
5 May 2024 11:02:10 EDT (-0400)
  Re: printing object's identifier  
From: clipka
Date: 16 Mar 2016 19:50:42
Message: <56e9f152$1@news.povray.org>
Am 16.03.2016 um 23:35 schrieb jr:
> hi,
> 
> I'm trying to print, from a macro, the declared name of an object passed
> to it, ie.
> 
> #declare Tobj = torus { ... };
> 
> object { Tobj }
> 
> mymacro(Tobj)
> 
> and in the macro (where the parameter is ObjId)
> 
> #debug concat("object's name:", ObjId)
> 
> that doesn't work, POV complains "expected string, oid found instead",
> so is there a way to get the name string ('Tobj') from the ObjId?

This question has been asked before.

Short answer: It's not possible.

Almost equally short answer: It doesn't make sense. If it would work,
POV-Ray would print "ObjId" instead of "Tobj", because the macro has no
knowledge of any prior name of the object.

What you /could/ do is approach it the other way round, converting a
string to an identifier:

#declare Tobj = torus { ... };
object { Tobj }
mymacro("Tobj")

and in mymacro use the Parse_String macro (from string.inc... or is it
strings.inc? I never can remember) to convert the string to an identifier.
Note however that in this case you must somehow make sure that you don't
pass the name of an identifier that is also declared locally in the macro.


Post a reply to this message

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