POV-Ray : Newsgroups : povray.general : Parse Error: No matching } in 'pigment', string identifier found instead : Re: Parse Error: No matching } in 'pigment', string identifier found instea= Server Time
26 Apr 2024 00:03:49 EDT (-0400)
  Re: Parse Error: No matching } in 'pigment', string identifier found instea=  
From: Chris B
Date: 2 Feb 2009 06:01:34
Message: <4986d28e@news.povray.org>
"societyofrobots" <nomail@nomail> wrote in message 
news:web.498698f97b9bdab4e977d74a0@news.povray.org...
> Mike Williams <nos### [at] econymdemoncouk> wrote:
>> It looks like you've declared color_sub to be a text string rather than
>> a pigment identifier.
>
> Ok I ran this below code, but still got the same error:
>
> #declare color_sub = pigment {rgb <1,0,0>};
> #macro DIODE_SMD_CHIP_0805(color_sub)
>  union{
>  object{CAP_SMD_CHIP_GRND(2.0,1.25,1.3,0.5)}
>  }
> #end
>

The change you've shown here doesn't materially change things because, when 
this macro is called it simply creates a local variable named 'color_sub' 
and uses that in preference to your previously declared value until the 
macro ends. The important thing is the value that you pass into the 
DIODE_SMD_CHIP_0805 macro when you call it (which you haven't yet shown in 
your code snippets). The parse error from your first posting indicates that 
the 'color_sub' macro parameter is being set in a way that is incompatible 
with the way it is being used in the pigment statement within the 
CAP_SMD_CHIP_GRND macro.

I think if you call the macro using:
  DIODE_SMD_CHIP_0805(rgb <1,0,0>)
It should avoid this error.

You also need to take a look at the value you're passing as the 5th 
parameter into CAP_SMD_CHIP_GRND. You pass in an RGB color value, which is 
assigned to the parameter 'K'. Then, instead of being used in a pigment 
statement this value is subsequently used to scale and translate objects, 
which seems to me to be all wrong.

>
> and if I run this:
> #macro DIODE_SMD_CHIP_0805(1)
>  union{
>  object{CAP_SMD_CHIP_GRND(2.0,1.25,1.3,0.5)}
>  }
> #end
>
> I get this error:
> "Parse Error: Expected 'identifier or expression.', float function 'float
> constant' found instead
>

The #macro directive is used to define a macro. The macro definition expects 
a list of comma separated identifiers. In this case you've defined the macro 
specifying a number (a float constant) instead of a valid identifier - hence 
the error message.

If you wish to be passing one or more parameters into the macro then you 
need to specify a comma separated list of valid identifiers. Then, when you 
call the macro you can specify numbers or other values in each of those 
parameter positions.


Regards,
Chris B.


Post a reply to this message

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