POV-Ray : Newsgroups : povray.general : Parse Error: No matching } in 'pigment', string identifier found instead Server Time
4 Nov 2024 23:15:26 EST (-0500)
  Parse Error: No matching } in 'pigment', string identifier found instead (Message 1 to 8 of 8)  
From: societyofrobots
Subject: Parse Error: No matching } in 'pigment', string identifier found instead
Date: 1 Feb 2009 02:30:00
Message: <web.49854e434ba44896e977d74a0@news.povray.org>
I'm running Eagle3D that compiles using POV-Ray.

This is the error I'm getting:

Parse Error: No matching } in 'pigment', string identifier found instead


I'm calling this code I wrote:

#macro DIODE_SMD_CHIP_0805(color_sub)
  union{
  object{CAP_SMD_CHIP_GRND(2.0,1.25,1.3,rgb <0.8, 0.1, 0.2>)}
  }
#end


which references this default library that already works:

#macro CAP_SMD_CHIP_GRND(L,W,T,K)
union{
 superellipsoid{<0.25-(L+W)/150, 0.25-(L+W)/150> pigment{color_sub}
scale<L/2,W/2,T/2> }     //Grundkoerper braun
 superellipsoid{<0.25-(L+W)/200, 0.25-(L+W)/200> scale<(K+L/100)/2,W/2,T/2>
translate <(L-K)/2,0,0> texture{col_silver}}      //rechter Anschluss
 superellipsoid{<0.25-(L+W)/200, 0.25-(L+W)/200> scale<(K+L/100)/2,W/2,T/2>
translate <-(L-K)/2,0,0> texture{col_silver}}      //linker Anschluss
 rotate<90,0,0>
 translate<0,T/2,0>
}
#end

//2220
#macro CAP_SMD_CHIP_2220(color_sub)
object{CAP_SMD_CHIP_GRND(5.7,5.0,2.7,0.5)}
#end
//1825
#macro CAP_SMD_CHIP_1825(color_sub)
object{CAP_SMD_CHIP_GRND(4.5,6.4,1.7,0.5)}
#end
//1812
#macro CAP_SMD_CHIP_1812(color_sub)
object{CAP_SMD_CHIP_GRND(4.5,3.2,1.7,0.5)}
#end



When I get the error, POV-Ray highlights this line:
 superellipsoid{<0.25-(L+W)/150, 0.25-(L+W)/150> pigment{color_sub}
scale<L/2,W/2,T/2> }     //Grundkoerper braun


Anyone know what I'm doing wrong?


ps - for reference, this is Eagle3D:
http://www.societyofrobots.com/electronics_Eagle3D_tutorial.shtml


Post a reply to this message

From: Mike Williams
Subject: Re: Parse Error: No matching } in 'pigment', string identifier found instead
Date: 1 Feb 2009 02:46:07
Message: <p8t8ZbD1MVhJFwBw@econym.demon.co.uk>
Wasn't it societyofrobots who wrote:
>I'm running Eagle3D that compiles using POV-Ray.
>
>This is the error I'm getting:
>
>Parse Error: No matching } in 'pigment', string identifier found instead

It looks like you've declared color_sub to be a text string rather than
a pigment identifier.

E.g. you can't to this is you want to use color_sub as a pigment
identifier

        #declare color_sub = "rgb <1,0,0>";

but you can do this instead

        #declare color_sub = pigment {rgb <1,0,0>};

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: societyofrobots
Subject: Re: Parse Error: No matching } in 'pigment', string identifier found instea=
Date: 2 Feb 2009 02:00:05
Message: <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.
>
> E.g. you can't to this is you want to use color_sub as a pigment
> identifier
>
>         #declare color_sub = "rgb <1,0,0>";
>
> but you can do this instead
>
>         #declare color_sub = pigment {rgb <1,0,0>};
>

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


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

ideas?


Post a reply to this message

From: Slime
Subject: Re: Parse Error: No matching } in 'pigment', string identifier found instead
Date: 2 Feb 2009 03:07:22
Message: <4986a9ba@news.povray.org>
> #macro CAP_SMD_CHIP_GRND(L,W,T,K)
> union{
> superellipsoid{<0.25-(L+W)/150, 0.25-(L+W)/150> pigment{color_sub}
...
> }
> #end

This macro uses the identifier "color_sub", but it hasn't been passed into 
the macro as an argument, and it hasn't been #define'd or #local'd.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: Chris B
Subject: Re: Parse Error: No matching } in 'pigment', string identifier found instea=
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

From: Chris B
Subject: Re: Parse Error: No matching } in 'pigment', string identifier found instea=
Date: 2 Feb 2009 06:05:47
Message: <4986d38b$1@news.povray.org>
"Chris B" <nom### [at] nomailcom> wrote in message 
news:4986d28e@news.povray.org...
>
> You also need to take a look at the value you're passing as the 5th 
> parameter into CAP_SMD_CHIP_GRND.

Sorry. I meant 4th.
Counting up to 4 is clearly not one of my key strengths on a Monday morning. 
:-)

Regards,
Chris B.


Post a reply to this message

From: societyofrobots
Subject: Re: Parse Error: No matching } in 'pigment', string identifier found instea=
Date: 18 Feb 2009 06:55:00
Message: <web.499bf5a7692c33e4832722510@news.povray.org>
Playing around with it, I managed to entirely avoid the macro call. Basically
using 100% Eagle3D code and nothing that I wrote.

Well, the code still had an error, meaning the parser bug is specifically in
this below code. It seems to not like pigment{color_sub}.

I suspect it has something to do with "neu Parameter K = Anschlussbreite", which
although I don't speak German, I assume it means a new parameter was added but
code not tested.

/**********************************************************************************************************************
**********************
//Grundmakro fuer SMD-Keramik-Chip-Kondensator (neu Parameter K =
Anschlussbreite)
//basiert auf Makro von Walter Muecke
***********************************************************************************************************************
*********************/
#macro CAP_SMD_CHIP_GRND(L,W,T,K)
union{
 superellipsoid{<0.25-(L+W)/150, 0.25-(L+W)/150> pigment{color_sub}
scale<L/2,W/2,T/2> }     //Grundkoerper braun
 superellipsoid{<0.25-(L+W)/200, 0.25-(L+W)/200> scale<(K+L/100)/2,W/2,T/2>
translate <(L-K)/2,0,0> texture{col_silver}}      //rechter Anschluss
 superellipsoid{<0.25-(L+W)/200, 0.25-(L+W)/200> scale<(K+L/100)/2,W/2,T/2>
translate <-(L-K)/2,0,0> texture{col_silver}}      //linker Anschluss
 rotate<90,0,0>
 translate<0,T/2,0>
}
#end

#macro CAP_SMD_CHIP_0805(color_sub)
object{CAP_SMD_CHIP_GRND(2.0,1.25,1.3,0.5)}
#end


Post a reply to this message

From: Chris B
Subject: Re: Parse Error: No matching } in 'pigment', string identifier found instea=
Date: 18 Feb 2009 10:01:01
Message: <499c22ad$1@news.povray.org>
"societyofrobots" <nomail@nomail> wrote in message 
news:web.499bf5a7692c33e4832722510@news.povray.org...
> Well, the code still had an error, meaning the parser bug is specifically 
> in
> this below code. It seems to not like pigment{color_sub}.
>

You're still not showing us the bit of code we'd need to see to help much.

If it's complaining about color_sub you need to say what value this local 
variable is being set to.
In this case color_sub is set to a value when the CAP_SMD_CHIP_0805 macro is 
called, so you need to find the place where this macro is called. If it's 
the same error as before, then it's probably that a string is being passed 
into the macro rather than a valid color value.

Regards,
Chris B.


Post a reply to this message

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