POV-Ray : Newsgroups : povray.newusers : All the brackets are there but still get errors Server Time
28 Apr 2024 21:37:54 EDT (-0400)
  All the brackets are there but still get errors (Message 1 to 6 of 6)  
From: gharryh
Subject: All the brackets are there but still get errors
Date: 4 Jul 2013 10:50:00
Message: <web.51d58b0d7877dcfd520168c30@news.povray.org>
I have made some code to construct a part to be used in Eagle3D.

If the part where i create the pins is placed outside the macro that creates the
shell all goes fine.
But when i place it all inside the macro it complains that the closing bracket
for the object cant be found and it finds object instead.
[code]
#macro TOOLS_RECT_BOGEN(i_radius,winkel,dicke,breite,laenge1,laenge2)
union{
    difference {
        cylinder{<(breite/2) * -1,0,0><breite/2,0,0>(i_radius + dicke)}
        cylinder{<(breite/2 + 0.1) * -1,0,0><breite/2 + 0.1,0,0>i_radius}
        box{ <(breite/2 + 0.1) * -1,(i_radius + dicke + 0.1) * -1, 0>,
             <breite/2 + 0.1, (i_radius + dicke + 0.1), (i_radius + dicke +
0.1)>
        }
        box{ <(breite/2 + 0.1) * -1,(i_radius + dicke + 0.1) * -1, 0>,
             <breite/2 + 0.1, (i_radius + dicke + 0.1), (i_radius + dicke +
0.1)> rotate <winkel,0,0>}
        }
        box{<(breite/2) * -1,i_radius, 0>, <breite/2,i_radius + dicke, laenge1
>}
        box{<(breite/2) * -1, 0, i_radius * -1>, <breite/2,laenge2 * -1,
(i_radius + dicke) * -1>
            rotate <(90 - winkel) * -1,0,0>
        }
        translate < 0,(i_radius + dicke/2) * -1,(i_radius + dicke/2)> rotate
<0,-90,180>
    }
#end

#declare myTrapiziod =
// this is a isosceles trapezoid
// here the base angles have the same measure pairwise
#local base1 = 1.2;
#local base2 = 0.8;
// the height of the trapezoid = (base1-base2)/2 becourse the base angles are 45
degrees
#local Altetude = (base1 - base2)/2;

object{
    union{
        box{<base1/2,0,base1/2><-base1/2,8.5,-base1/2> }
        difference{
            box{<base1/2,.05,base1/2><-base1/2,-(Altetude+.05),-base1/2> }
            union{
                box{<base2/2,0,base2><0,-base2,-base2> rotate<0,0,45>
translate<base2/2,0,0> rotate<0,  0,0> }
                box{<base2/2,0,base2><0,-base2,-base2> rotate<0,0,45>
translate<base2/2,0,0> rotate<0, 90,0> }
                box{<base2/2,0,base2><0,-base2,-base2> rotate<0,0,45>
translate<base2/2,0,0> rotate<0,180,0> }
                box{<base2/2,0,base2><0,-base2,-base2> rotate<0,0,45>
translate<base2/2,0,0> rotate<0,270,0> }
            } // end inner union
        } // end difference
    } rotate<180,0,0> translate<0,-Altetude,0> // end union
} // end object

#macro BB02JS_GRND(Pins)
//#local Pins = 7;
#local Pitch = 2.54;
#local H = .4;      // Pin height
#local W = .6;      // Pin width
#local L1 = 5;      // Total lenght outside main body
#local L2 = 1.27;   // Lenght of pin on solder area
#local L3 = 1.25;   // Height pin center above PCB
#local i = 0;

object{
    union{
        difference{
        //box{<Outermax,0,Pitch/2><-Outermax,-8.5,-Pitch/2> }
        //box{<Outermax+.025,-8,0.5><-Outermax-.25,-8.55,-0.5> }
        union{
#while(i<Pins)
            object{myTrapiziod translate<i*Pitch,0,0>}
            #local i = i + 1;
#end
            translate<-(Pins-1)*Pitch/2,0,0>
            } // end inner union
        } rotate<90,180,0> translate<0,1.27,-7.68> texture{ e3d_tex_ic_body_1 }
        // end difference
    } // end union
// start of creating Pins
    object{
#local i = 0;
        union{
            #while(i<Pins)
            object{
                TOOLS_RECT_BOGEN(0.25,135,H,W,L2,L2-(H/2))
                rotate<0,90,0>
                translate<0,0,0>
                translate<i*Pitch,0,0>
                } // end object
            object{ TOOLS_RECT_BOGEN(0.25,135,H,W,L2+.2,L2-(H/2))
                rotate<0,270,180>
                translate<0,L3-(H/3),L3/2-.05>
                translate<i*Pitch,0,0>
                } // end object
            #local i = i + 1;
            #end
        } translate<-(Pins-1)*Pitch/2,0,0> rotate<0,0,180> translate<0,L3,L1/2>
pigment{OldGold} // end union
    } // end inner object
// End creating pins
} // end object
#end
[/code]
Maybe my use of object/union/difference is faulty but i cant see it.
Its sometimes not logical i think but maybe i am not thinking locical.
p.s. It looks that i am the only one using this newsgroup


Post a reply to this message

From: scott
Subject: Re: All the brackets are there but still get errors
Date: 4 Jul 2013 11:35:35
Message: <51d59647$1@news.povray.org>
> If the part where i create the pins is placed outside the macro that creates the
> shell all goes fine.
> But when i place it all inside the macro it complains that the closing bracket
> for the object cant be found and it finds object instead.

You can't have more than one object inside another object. You need to 
put them inside a union instead.

> #macro BB02JS_GRND(Pins)
> //#local Pins = 7;
> #local Pitch = 2.54;
> #local H = .4;      // Pin height
> #local W = .6;      // Pin width
> #local L1 = 5;      // Total lenght outside main body
> #local L2 = 1.27;   // Lenght of pin on solder area
> #local L3 = 1.25;   // Height pin center above PCB
> #local i = 0;
>
> object{

That line should be union{ and then it seems to work.


Post a reply to this message

From: Paolo Gibellini
Subject: Re: All the brackets are there but still get errors
Date: 4 Jul 2013 11:46:47
Message: <51d598e7$1@news.povray.org>
>gharryh  on date 04/07/2013 16.47 wrote:
> I have made some code to construct a part to be used in Eagle3D.
>
> If the part where i create the pins is placed outside the macro that creates the
> shell all goes fine.
> But when i place it all inside the macro it complains that the closing bracket
> for the object cant be found and it finds object instead.
> [code]
> #macro TOOLS_RECT_BOGEN(i_radius,winkel,dicke,breite,laenge1,laenge2)
> union{
>      difference {
>          cylinder{<(breite/2) * -1,0,0><breite/2,0,0>(i_radius + dicke)}
>          cylinder{<(breite/2 + 0.1) * -1,0,0><breite/2 + 0.1,0,0>i_radius}
>          box{ <(breite/2 + 0.1) * -1,(i_radius + dicke + 0.1) * -1, 0>,
>               <breite/2 + 0.1, (i_radius + dicke + 0.1), (i_radius + dicke +
> 0.1)>
>          }
>          box{ <(breite/2 + 0.1) * -1,(i_radius + dicke + 0.1) * -1, 0>,
>               <breite/2 + 0.1, (i_radius + dicke + 0.1), (i_radius + dicke +
> 0.1)> rotate <winkel,0,0>}
>          }
>          box{<(breite/2) * -1,i_radius, 0>, <breite/2,i_radius + dicke, laenge1
>> }
>          box{<(breite/2) * -1, 0, i_radius * -1>, <breite/2,laenge2 * -1,
> (i_radius + dicke) * -1>
>              rotate <(90 - winkel) * -1,0,0>
>          }
>          translate < 0,(i_radius + dicke/2) * -1,(i_radius + dicke/2)> rotate
> <0,-90,180>
>      }
> #end
>
> #declare myTrapiziod =
> // this is a isosceles trapezoid
> // here the base angles have the same measure pairwise
> #local base1 = 1.2;
> #local base2 = 0.8;
> // the height of the trapezoid = (base1-base2)/2 becourse the base angles are 45
> degrees
> #local Altetude = (base1 - base2)/2;
>
> object{
>      union{
>          box{<base1/2,0,base1/2><-base1/2,8.5,-base1/2> }
>          difference{
>              box{<base1/2,.05,base1/2><-base1/2,-(Altetude+.05),-base1/2> }
>              union{
>                  box{<base2/2,0,base2><0,-base2,-base2> rotate<0,0,45>
> translate<base2/2,0,0> rotate<0,  0,0> }
>                  box{<base2/2,0,base2><0,-base2,-base2> rotate<0,0,45>
> translate<base2/2,0,0> rotate<0, 90,0> }
>                  box{<base2/2,0,base2><0,-base2,-base2> rotate<0,0,45>
> translate<base2/2,0,0> rotate<0,180,0> }
>                  box{<base2/2,0,base2><0,-base2,-base2> rotate<0,0,45>
> translate<base2/2,0,0> rotate<0,270,0> }
>              } // end inner union
>          } // end difference
>      } rotate<180,0,0> translate<0,-Altetude,0> // end union
> } // end object
>
> #macro BB02JS_GRND(Pins)
> //#local Pins = 7;
> #local Pitch = 2.54;
> #local H = .4;      // Pin height
> #local W = .6;      // Pin width
> #local L1 = 5;      // Total lenght outside main body
> #local L2 = 1.27;   // Lenght of pin on solder area
> #local L3 = 1.25;   // Height pin center above PCB
> #local i = 0;
>
> object{
>      union{
>          difference{
>          //box{<Outermax,0,Pitch/2><-Outermax,-8.5,-Pitch/2> }
>          //box{<Outermax+.025,-8,0.5><-Outermax-.25,-8.55,-0.5> }
>          union{
> #while(i<Pins)
>              object{myTrapiziod translate<i*Pitch,0,0>}
>              #local i = i + 1;
> #end
>              translate<-(Pins-1)*Pitch/2,0,0>
>              } // end inner union
>          } rotate<90,180,0> translate<0,1.27,-7.68> texture{ e3d_tex_ic_body_1 }
>          // end difference
>      } // end union
> // start of creating Pins
>      object{
> #local i = 0;
>          union{
>              #while(i<Pins)
>              object{
>                  TOOLS_RECT_BOGEN(0.25,135,H,W,L2,L2-(H/2))
>                  rotate<0,90,0>
>                  translate<0,0,0>
>                  translate<i*Pitch,0,0>
>                  } // end object
>              object{ TOOLS_RECT_BOGEN(0.25,135,H,W,L2+.2,L2-(H/2))
>                  rotate<0,270,180>
>                  translate<0,L3-(H/3),L3/2-.05>
>                  translate<i*Pitch,0,0>
>                  } // end object
>              #local i = i + 1;
>              #end
>          } translate<-(Pins-1)*Pitch/2,0,0> rotate<0,0,180> translate<0,L3,L1/2>
> pigment{OldGold} // end union
>      } // end inner object
> // End creating pins
> } // end object
> #end
> [/code]
> Maybe my use of object/union/difference is faulty but i cant see it.
> Its sometimes not logical i think but maybe i am not thinking locical.
> p.s. It looks that i am the only one using this newsgroup
>
>
Perhaps the problem is in a missing union?
Paolo

object{
     union{
	    union{
	        difference{
		        //box{<Outermax,0,Pitch/2><-Outermax,-8.5,-Pitch/2> }
		        //box{<Outermax+.025,-8,0.5><-Outermax-.25,-8.55,-0.5> }
		        union{
					#while(i<Pins)
		            	object{myTrapiziod translate<i*Pitch,0,0>}
		            #local i = i + 1;
					#end
		            translate<-(Pins-1)*Pitch/2,0,0>
		        } // end inner union
	        }
	        rotate<90,180,0> translate<0,1.27,-7.68> texture{ 
e3d_tex_ic_body_1 }
	        // end difference
	    } // end union
		// start of creating Pins
	    object{
			#local i = 0;
	        union{
	            #while(i<Pins)
		            object{
		                TOOLS_RECT_BOGEN(0.25,135,H,W,L2,L2-(H/2))
		                rotate<0,90,0>
		                translate<0,0,0>
		                translate<i*Pitch,0,0>
		                } // end object
		            object{ TOOLS_RECT_BOGEN(0.25,135,H,W,L2+.2,L2-(H/2))
		                rotate<0,270,180>
		                translate<0,L3-(H/3),L3/2-.05>
		                translate<i*Pitch,0,0>
		                } // end object
		            #local i = i + 1;
	            #end
	        }
	        translate<-(Pins-1)*Pitch/2,0,0> rotate<0,0,180> 
translate<0,L3,L1/2>
			pigment{OldGold}
	    } // end inner object
	}// end union
	// End creating pins
} // end object
#end


Post a reply to this message

From: Paolo Gibellini
Subject: Re: All the brackets are there but still get errors
Date: 4 Jul 2013 11:48:16
Message: <51d59940$1@news.povray.org>
>scott  on date 04/07/2013 17.35 wrote:
> That line should be union{ and then it seems to work.
>
Your answer is more elegant.
Paolo


Post a reply to this message

From: Cousin Ricky
Subject: Re: All the brackets are there but still get errors
Date: 4 Jul 2013 12:00:02
Message: <web.51d59abc6877c969540235480@news.povray.org>
"gharryh" <h.a### [at] harry-arendsnl> wrote:
> I have made some code to construct a part to be used in Eagle3D.
>
> If the part where i create the pins is placed outside the macro that creates the
> shell all goes fine.
> But when i place it all inside the macro it complains that the closing bracket
> for the object cant be found and it finds object instead.
> [snip code]
> Maybe my use of object/union/difference is faulty but i cant see it.

In macro BB02JS_GRND(), the outermost object contains more than one object.
Change the outermost object to union, and it renders to completion.

> Its sometimes not logical i think but maybe i am not thinking locical.
> p.s. It looks that i am the only one using this newsgroup

We were all newbies once.


Post a reply to this message

From: Thomas de Groot
Subject: Re: All the brackets are there but still get errors
Date: 5 Jul 2013 03:24:56
Message: <51d674c8@news.povray.org>
On 4-7-2013 17:54, Cousin Ricky wrote:
> "gharryh" <h.a### [at] harry-arendsnl> wrote:
>> Its sometimes not logical i think but maybe i am not thinking locical.
>> p.s. It looks that i am the only one using this newsgroup
>
> We were all newbies once.

Absolutely.

And even after many years of use, we can still make simple errors...

Thomas


Post a reply to this message

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