// **********************************************************************************
// ******************  Source http://heartygfx.blogspot.com *************************
// **********************************************************************************

#ifndef(inc_USB)      // le nom de fichier de la macro est USB.inc
#declare inc_USB=true; // idem, donc modifier en conséquence

#ifndef(inc_testmode)           //ne rien changer
#declare inc_testmode=true;     //idem
#include "tools.inc"            //idem
#undef inc_testmode             //idem
#end



#macro USB_FEM_B()               //nom que je défini pour ma macro

// ici commence le code de mon composant développé sous povray ou Moray
// les seules modifications à effectué pour moray sont les valeurs de couleurs

// *************************************//
// ********  Fiche USB Femelle   *******//
// *************************************//

#declare RndCube002 = merge {
  sphere { <0.4800, 0.4800, 0.4800>, 0.0200 }
  sphere { <0.4800, -0.4800, 0.4800>, 0.0200 }
  sphere { <-0.4800, -0.4800, 0.4800>, 0.0200 }
  sphere { <-0.4800, 0.4800, 0.4800>, 0.0200 }
  sphere { <0.4800, 0.4800, -0.4800>, 0.0200 }
  sphere { <0.4800, -0.4800, -0.4800>, 0.0200 }
  sphere { <-0.4800, -0.4800, -0.4800>, 0.0200 }
  sphere { <-0.4800, 0.4800, -0.4800>, 0.0200 }
  cylinder { <0.4800, 0.4800, 0.4800>, <-0.4800, 0.4800, 0.4800>, 0.0200 }
  cylinder { <0.4800, -0.4800, 0.4800>, <-0.4800, -0.4800, 0.4800>, 0.0200 }
  cylinder { <0.4800, -0.4800, -0.4800>, <-0.4800, -0.4800, -0.4800>, 0.0200 }
  cylinder { <0.4800, 0.4800, -0.4800>, <-0.4800, 0.4800, -0.4800>, 0.0200 }
  cylinder { <0.4800, 0.4800, -0.4800>, <0.4800, 0.4800, 0.4800>, 0.0200 }
  cylinder { <0.4800, -0.4800, -0.4800>, <0.4800, -0.4800, 0.4800>, 0.0200 }
  cylinder { <-0.4800, -0.4800, -0.4800>, <-0.4800, -0.4800, 0.4800>, 0.0200 }
  cylinder { <-0.4800, 0.4800, -0.4800>, <-0.4800, 0.4800, 0.4800>, 0.0200 }
  cylinder { <0.4800, 0.4800, 0.4800>, <0.4800, -0.4800, 0.4800>, 0.0200 }
  cylinder { <0.4800, 0.4800, -0.4800>, <0.4800, -0.4800, -0.4800>, 0.0200 }
  cylinder { <-0.4800, 0.4800, -0.4800>, <-0.4800, -0.4800, -0.4800>, 0.0200 }
  cylinder { <-0.4800, 0.4800, 0.4800>, <-0.4800, -0.4800, 0.4800>, 0.0200 }
  box { <-0.4800, -0.4800, -0.5000> <0.4800, 0.4800, 0.5000> }
  box { <-0.4800, -0.5000, -0.4800> <0.4800, 0.5000, 0.4800> }
  box { <-0.5000, -0.4800, -0.4800> <0.5000, 0.4800, 0.4800> }
  scale <2.215034, 2.251142, 2.28967>
  translate  <-0.03112, -0.20074, 0.008869>
  texture{T_Silver_1A finish {phong 1.0}}
}
#declare RndCube001 = merge {
  sphere { <0.4500, 0.4500, 0.4500>, 0.0500 }
  sphere { <0.4500, -0.4500, 0.4500>, 0.0500 }
  sphere { <-0.4500, -0.4500, 0.4500>, 0.0500 }
  sphere { <-0.4500, 0.4500, 0.4500>, 0.0500 }
  sphere { <0.4500, 0.4500, -0.4500>, 0.0500 }
  sphere { <0.4500, -0.4500, -0.4500>, 0.0500 }
  sphere { <-0.4500, -0.4500, -0.4500>, 0.0500 }
  sphere { <-0.4500, 0.4500, -0.4500>, 0.0500 }
  cylinder { <0.4500, 0.4500, 0.4500>, <-0.4500, 0.4500, 0.4500>, 0.0500 }
  cylinder { <0.4500, -0.4500, 0.4500>, <-0.4500, -0.4500, 0.4500>, 0.0500 }
  cylinder { <0.4500, -0.4500, -0.4500>, <-0.4500, -0.4500, -0.4500>, 0.0500 }
  cylinder { <0.4500, 0.4500, -0.4500>, <-0.4500, 0.4500, -0.4500>, 0.0500 }
  cylinder { <0.4500, 0.4500, -0.4500>, <0.4500, 0.4500, 0.4500>, 0.0500 }
  cylinder { <0.4500, -0.4500, -0.4500>, <0.4500, -0.4500, 0.4500>, 0.0500 }
  cylinder { <-0.4500, -0.4500, -0.4500>, <-0.4500, -0.4500, 0.4500>, 0.0500 }
  cylinder { <-0.4500, 0.4500, -0.4500>, <-0.4500, 0.4500, 0.4500>, 0.0500 }
  cylinder { <0.4500, 0.4500, 0.4500>, <0.4500, -0.4500, 0.4500>, 0.0500 }
  cylinder { <0.4500, 0.4500, -0.4500>, <0.4500, -0.4500, -0.4500>, 0.0500 }
  cylinder { <-0.4500, 0.4500, -0.4500>, <-0.4500, -0.4500, -0.4500>, 0.0500 }
  cylinder { <-0.4500, 0.4500, 0.4500>, <-0.4500, -0.4500, 0.4500>, 0.0500 }
  box { <-0.4500, -0.4500, -0.5000> <0.4500, 0.4500, 0.5000> }
  box { <-0.4500, -0.5000, -0.4500> <0.4500, 0.5000, 0.4500> }
  box { <-0.5000, -0.4500, -0.4500> <0.5000, 0.4500, 0.4500> }
  scale <2.015485, 2.032295, 1.992691>

}
#declare Zone_Soustraite = difference {
  object { RndCube001 }
  box { // Cube002
    <-1, -1, -1>, <1, 1, 1>
    scale <1.014323, 1.254271, 0.985935>
    rotate -44.4786*y
    translate  <1.534313, 0.0, 1.259379>
  }
  box { // Cube003
    <-1, -1, -1>, <1, 1, 1>
    scale <1.019097, 1.260962, 0.981247>
    rotate -44.4786*y
    translate  <-1.4811, 0.0, 1.268247>
  }
 pigment{White}
  scale <0.932718, 1.010931, 0.976772>
  translate  <-0.023344, -0.020797, 0.00486>
}
#declare Fiche_USB_Fem = difference {
  object { RndCube002 }
  object { Zone_Soustraite }
  pigment{White}
  scale <1.0, 0.913736, 0.878959>
  translate  <0.122599, 0.24676, 1.142296>
}
#declare RndCube003 = merge {
  sphere { <0.4800, 0.4800, 0.4800>, 0.0200 }
  sphere { <0.4800, -0.4800, 0.4800>, 0.0200 }
  sphere { <-0.4800, -0.4800, 0.4800>, 0.0200 }
  sphere { <-0.4800, 0.4800, 0.4800>, 0.0200 }
  sphere { <0.4800, 0.4800, -0.4800>, 0.0200 }
  sphere { <0.4800, -0.4800, -0.4800>, 0.0200 }
  sphere { <-0.4800, -0.4800, -0.4800>, 0.0200 }
  sphere { <-0.4800, 0.4800, -0.4800>, 0.0200 }
  cylinder { <0.4800, 0.4800, 0.4800>, <-0.4800, 0.4800, 0.4800>, 0.0200 }
  cylinder { <0.4800, -0.4800, 0.4800>, <-0.4800, -0.4800, 0.4800>, 0.0200 }
  cylinder { <0.4800, -0.4800, -0.4800>, <-0.4800, -0.4800, -0.4800>, 0.0200 }
  cylinder { <0.4800, 0.4800, -0.4800>, <-0.4800, 0.4800, -0.4800>, 0.0200 }
  cylinder { <0.4800, 0.4800, -0.4800>, <0.4800, 0.4800, 0.4800>, 0.0200 }
  cylinder { <0.4800, -0.4800, -0.4800>, <0.4800, -0.4800, 0.4800>, 0.0200 }
  cylinder { <-0.4800, -0.4800, -0.4800>, <-0.4800, -0.4800, 0.4800>, 0.0200 }
  cylinder { <-0.4800, 0.4800, -0.4800>, <-0.4800, 0.4800, 0.4800>, 0.0200 }
  cylinder { <0.4800, 0.4800, 0.4800>, <0.4800, -0.4800, 0.4800>, 0.0200 }
  cylinder { <0.4800, 0.4800, -0.4800>, <0.4800, -0.4800, -0.4800>, 0.0200 }
  cylinder { <-0.4800, 0.4800, -0.4800>, <-0.4800, -0.4800, -0.4800>, 0.0200 }
  cylinder { <-0.4800, 0.4800, 0.4800>, <-0.4800, -0.4800, 0.4800>, 0.0200 }
  box { <-0.4800, -0.4800, -0.5000> <0.4800, 0.4800, 0.5000> }
  box { <-0.4800, -0.5000, -0.4800> <0.4800, 0.5000, 0.4800> }
  box { <-0.5000, -0.4800, -0.4800> <0.5000, 0.4800, 0.4800> }
  texture{T_Silver_1A finish {phong 1.0}}
  scale <2.22642, 0.404995, 2.014602>
  translate  <0.092747, -1.142388, 1.149637>
}
#declare TetonInterieur = merge {
  sphere { <0.4700, 0.4700, 0.4700>, 0.0300 }
  sphere { <0.4700, -0.4700, 0.4700>, 0.0300 }
  sphere { <-0.4700, -0.4700, 0.4700>, 0.0300 }
  sphere { <-0.4700, 0.4700, 0.4700>, 0.0300 }
  sphere { <0.4700, 0.4700, -0.4700>, 0.0300 }
  sphere { <0.4700, -0.4700, -0.4700>, 0.0300 }
  sphere { <-0.4700, -0.4700, -0.4700>, 0.0300 }
  sphere { <-0.4700, 0.4700, -0.4700>, 0.0300 }
  cylinder { <0.4700, 0.4700, 0.4700>, <-0.4700, 0.4700, 0.4700>, 0.0300 }
  cylinder { <0.4700, -0.4700, 0.4700>, <-0.4700, -0.4700, 0.4700>, 0.0300 }
  cylinder { <0.4700, -0.4700, -0.4700>, <-0.4700, -0.4700, -0.4700>, 0.0300 }
  cylinder { <0.4700, 0.4700, -0.4700>, <-0.4700, 0.4700, -0.4700>, 0.0300 }
  cylinder { <0.4700, 0.4700, -0.4700>, <0.4700, 0.4700, 0.4700>, 0.0300 }
  cylinder { <0.4700, -0.4700, -0.4700>, <0.4700, -0.4700, 0.4700>, 0.0300 }
  cylinder { <-0.4700, -0.4700, -0.4700>, <-0.4700, -0.4700, 0.4700>, 0.0300 }
  cylinder { <-0.4700, 0.4700, -0.4700>, <-0.4700, 0.4700, 0.4700>, 0.0300 }
  cylinder { <0.4700, 0.4700, 0.4700>, <0.4700, -0.4700, 0.4700>, 0.0300 }
  cylinder { <0.4700, 0.4700, -0.4700>, <0.4700, -0.4700, -0.4700>, 0.0300 }
  cylinder { <-0.4700, 0.4700, -0.4700>, <-0.4700, -0.4700, -0.4700>, 0.0300 }
  cylinder { <-0.4700, 0.4700, 0.4700>, <-0.4700, -0.4700, 0.4700>, 0.0300 }
  box { <-0.4700, -0.4700, -0.5000> <0.4700, 0.4700, 0.5000> }
  box { <-0.4700, -0.5000, -0.4700> <0.4700, 0.5000, 0.4700> }
  box { <-0.5000, -0.4700, -0.4700> <0.5000, 0.4700, 0.4700> }
  pigment{White}
  scale <1.20, 1.961118, 0.708347>
  translate  <0.091114, 0.162214, 1.050937>
}
union { // Fiche_Femelle_USB_B
  object { Fiche_USB_Fem }
  object { RndCube003 }
  object { TetonInterieur }
  rotate  -90*x
  rotate -90*y
  //rotate 90*z
  scale <5,6,6>
}


#end

//***********************************************//
//     Fin de la fiche USB B femelle             //
//***********************************************//
// fin du code de mon composant



// ne rien toucher pour le reste, laisser tel que la suite

/**********************************************************************
Testing
**********************************************************************/
#ifndef(inc_testmode)

//Size of the Grid Plane (+/- span)
#local XYZ_span=20;

//Orientation axes
cylinder{<-XYZ_span,0,0><XYZ_span,0,0>0.1 pigment{Blue}}    //X
cylinder{<0,-XYZ_span,0><0,XYZ_span,0>0.1 pigment{Red}}        //Y
cylinder{<0,0,-XYZ_span><0,0,XYZ_span>0.1 pigment{Yellow}}    //Z

// Useful GRIDS:
#local XYZ_step= 1 ;          // axis increment
#local XYZ_cnt = 0;           //  loop counter
#local xyz_thick = 0.05;     // grid line thickness

// GRID PLANES: Remove comment begin/end to activate & select PLANES:
#while (XYZ_cnt <= XYZ_span)

    cylinder{<-XYZ_span,0,XYZ_cnt><XYZ_span,0,XYZ_cnt>xyz_thick pigment{Blue}}        // Positive Z-Lines
    cylinder{<-XYZ_span,0,-XYZ_cnt><XYZ_span,0,-XYZ_cnt>xyz_thick pigment{Blue}}    // Negative Z-Lines

    //cylinder{<0,XYZ_cnt,-XYZ_span><0,XYZ_cnt,XYZ_span>xyz_thick pigment{Red}}        // Positive Y-Z Plane Lines
    //cylinder{<0,-XYZ_cnt,-XYZ_span><0,-XYZ_cnt,XYZ_span>xyz_thick pigment{Red}}    // Negative Y-Z Plane Lines

    //cylinder{<-XYZ_span,XYZ_cnt,0><XYZ_span,XYZ_cnt,0>xyz_thick pigment{Red}}        // Positive Y-X Plane Lines
    //cylinder{<-XYZ_span,-XYZ_cnt,0><XYZ_span,-XYZ_cnt,0>xyz_thick pigment{Red}}    // Negative Y-X Plane Lines

    cylinder{<XYZ_cnt,0,-XYZ_span><XYZ_cnt,0,XYZ_span>xyz_thick pigment{Yellow}}    // Positive X-Lines
    cylinder{<-XYZ_cnt,0,-XYZ_span><-XYZ_cnt,0,XYZ_span>xyz_thick pigment{Yellow}}    // Negative X-Lines

    #local XYZ_cnt = XYZ_cnt+XYZ_step;
#end

camera
{
    #local tt = 40;                //let's you change the distance easily
    location <-tt,tt,-tt>
    //location<0,5,-50>            //alternate location
    look_at <0,0,0>                //best to select the approximate centre of the object
    angle 30
}

light_source { <100, 100, -100> White}
light_source { <-100, 100, -100> White }
light_source { <-100, 100, 100> White }
light_source { <100, 100, 100> White }
//light_source { <-tt,tt,-tt> White }
//light_source { <-tt,tt,-tt> White }
//light_source { <-tt,tt,-tt> White }
background{Grey}
      USB_FEM_B()
#end

#end
//End of Macros