POV-Ray : Newsgroups : povray.newusers : All the brackets are there but still get errors : All the brackets are there but still get errors Server Time
13 May 2024 16:57:43 EDT (-0400)
  All the brackets are there but still get errors  
From: gharryh
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

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