//
include <library/box.scad>
include <MCAD-master/materials.scad>
include <MCAD-master/fonts.scad>
$fn = 50;

    va = 0.02; 
    van = -(va/2);
    vap = +(va/2);

    m3_hole = 3.2; 
    m3_thread = 2.5;
    m3_head_height = 3.5; 
    m3_head_dia = 6;

    radiator_base_lenght = 84; 
    radiator_base_width = 64; 
    radiator_base_height = 5;
    radiator_copper_lenght = 44; 
    radiator_copper_height = 6; 
    radiator_top_height = 31;
    radiator_full_height = 31 + radiator_base_height;
    radiator_full_width = 80;
    radiator_total_height = radiator_full_height + radiator_copper_height ;

    radiator_base_offset_x = 0;
    radiator_base_offset_y = (radiator_full_width - radiator_base_width)/2; 

    radiator_copper_offset_x = 19;
    radiator_copper_offset_y = 3 + radiator_base_offset_y; 

    nl2_frontResses = 2.55; 
    nl2_frontDia = 23.6; 
    nl2_mountThick = 6; 
    nl2_mountHeight = 31; 
    nl2_mountWidth = 26;
    nl2_screwDia = 3.2;
    nl2_screwX = 19;
    nl2_screwY = 24;  
    nl2_bladeLen = 8; 
    nl2_bladeWidth = 5; 
    nl2_bladeThick = 1.5;
    nl2_backIsolationDepth=1.95;
    nl2_tubeDia = 24; 
    nl2_tubeDepth = 25.75 - nl2_mountThick - nl2_backIsolationDepth;
    nl2_bladeOneY = 4.5; 
    nl2_bladeTwox = 5.5;
    n12_bladeZ = nl2_tubeDepth + nl2_bladeLen/2;
    n12_firstHoleDia = 19;
    n12_fisrtHoleDepth = 24; 


    neutrik_xlr_front_dia = 22; 
    neutrik_xlr_front_depth = 2.7 + 1; 
    neutrik_xlr_rear_depth = 19.5; 
    neutrik_xlr_srew_holder_dia = 5;
    neutrik_xlr_srew_holder_depth = 6.5; 
    neutrik_xlr_srew_holder_depth_offset =-neutrik_xlr_srew_holder_depth;
    neutrik_xlr_srew_sapcing = 19.8;
    neutrik_xlr_support_width = 10;
    neutrik_xlr_support_offset_y = 1.5;
    mounting_base_dia = 10;
    mounting_base_height = 2;
    mounting_base_lenght = 5;
    
    mounting_col_clearance = 0; 
    mounting_col_height = nl2_mountHeight + mounting_col_clearance ; 
    mounting_col_dia = 7;
    mounting_col_screw_depth = 6; 
    mounting_col_screw_offset = mounting_col_height - mounting_col_screw_depth;

    amplifier_pcb_cable_sapce = 15; 

    amplifier_base_height = 3; 
    amplifier_lid_height = 3; 

    lid_radiator_tollerance = 0.5;
    amplifier_side_wall_thickness = 3;


    amplifier_wall_mount_width = 6;
    amplifier_base_mounting_screw_offset = (amplifier_side_wall_thickness + amplifier_wall_mount_width/2);
   
    amplifier_wall_screw_offset = amplifier_wall_mount_width / 2;
    amplifier_wall_screw_separation = 2;
    amplifier_wall_srcew_1_z = mounting_col_screw_depth + amplifier_wall_screw_separation + m3_thread/2;
    amplifier_wall_srcew_2_z = amplifier_wall_srcew_1_z + amplifier_wall_screw_separation + m3_thread;
    amplifier_wall_height = 66;

    amplifier_base_foot_height = 10 ; 
    amplifier_base_foot_bot_width = amplifier_side_wall_thickness + amplifier_wall_mount_width;
    amplifier_base_foot_top_width = 8; 

    amplifier_pcb_lenght = 130;
    amplifier_pcb_width = 70;
    amplifier_pcb_height = 2;
    amplifier_pcb_srew_sapcing_x = 120;
    amplifier_pcb_srew_sapcing_y = 60;
    amplifier_pcb_srew_offset_x = 5;
    amplifier_pcb_srew_offset_y = 4;
    amplifier_mounting_srew_offset_x = amplifier_side_wall_thickness + amplifier_pcb_cable_sapce + amplifier_pcb_srew_offset_x;
    amplifier_mounting_srew_offset_y = amplifier_side_wall_thickness + radiator_total_height + amplifier_pcb_srew_offset_y - m3_hole;
    
    amplifier_base_lenght = 2*amplifier_side_wall_thickness + 2*amplifier_pcb_cable_sapce + amplifier_pcb_lenght; 
    amplifier_base_width = 2*amplifier_side_wall_thickness + amplifier_pcb_cable_sapce + amplifier_pcb_width + radiator_total_height;

    pos_opamp_from_frist_mounting_hole_x = 80 + amplifier_mounting_srew_offset_x + radiator_base_width / 2 ;
    pos_opamp_from_frist_mounting_hole_y = amplifier_mounting_srew_offset_y ;

    amplifier_base_radiator_mount_height = 15; 
    amplifier_base_raditor_base_offset_x = (pos_opamp_from_frist_mounting_hole_x - radiator_base_width) + (radiator_full_width-radiator_base_width)/2 ;
    amplifier_base_raditor_base_offset_y = radiator_full_height - radiator_base_height;
    amplifier_base_raditor_wall_hole_offset_x = amplifier_base_mounting_screw_offset + 60; 

    radiator_base_support_thread_offset = 5;
    radiator_base_support_hole_x = radiator_base_width/2;
    radiator_base_support_middle_width = radiator_base_height/2;
    radiator_base_support_thread_1_x = radiator_base_support_thread_offset;  
    radiator_base_support_thread_2_x = radiator_base_width - radiator_base_support_thread_offset;  

    connector_audio_in_pos_y = amplifier_base_height+neutrik_xlr_support_offset_y+neutrik_xlr_front_dia/2 + 1 ;
    connector_audio_in_pos_x = amplifier_base_width/2; 

    tilt_swicht_mount_dia = 4.9;
    tilt_swicht_mount_height = 6;
    tilt_swicht_mount_flat_offset = 4.5;

    writing_size = 6;
    writing_height = 0.6;


translate([0,0,amplifier_base_foot_height])amplifier_full();

//amplifer_base();
//radiator_base_support(amplifier_base_radiator_mount_height, m3_thread);
//amplifer_lid(); 
//amplifierWallMount(); 
//amplifier_base_foot(); 
//radiator(); 
//amplifierPcb(); 

module amplifierPcb()
{
    mkp_lenght = 17; 
    mkp_width = 40; 
    mkp_height = 32; 
    mkp_offset_x = 36; 
    mkp_offset_y = 4; 

    opamp_lenght = 20; 
    opamp_width = 3.5; 
    opamp_height = 21; 
    opamp_offset_x = 75; 
    opamp_offset_y = 0;
    opamp_mounting_hole_dia = 4; 
    opamp_mounting_hole_from_top = opamp_height- (2.5 + opamp_mounting_hole_dia/2) ;

    difference()
    {
        color("green")cube(size = [amplifier_pcb_lenght,amplifier_pcb_width,amplifier_pcb_height]);
        translate([amplifier_pcb_srew_offset_x,amplifier_pcb_srew_offset_y,van])
            cylinder(d=m3_hole,h=amplifier_pcb_height+va);
        translate([amplifier_pcb_srew_offset_x + amplifier_pcb_srew_sapcing_x ,amplifier_pcb_srew_offset_y,van])
            cylinder(d=m3_hole,h=amplifier_pcb_height+va);
        translate([amplifier_pcb_srew_offset_x,amplifier_pcb_srew_offset_y + amplifier_pcb_srew_sapcing_y,van])
            cylinder(d=m3_hole,h=amplifier_pcb_height+va);
        translate([amplifier_pcb_srew_offset_x + amplifier_pcb_srew_sapcing_x,amplifier_pcb_srew_offset_y + amplifier_pcb_srew_sapcing_y,van])
            cylinder(d=m3_hole,h=amplifier_pcb_height+va);
    }
    
    color("blue")
        translate([mkp_offset_x,mkp_offset_y,amplifier_pcb_height])
            cube(size = [mkp_lenght,mkp_width,mkp_height]);

    
    color(BlackPaint)
        translate([opamp_offset_x,opamp_offset_y,amplifier_pcb_height])
            difference()
            {
                cube(size = [opamp_lenght,opamp_width,opamp_height]);
                translate([opamp_lenght/2,opamp_width+vap,opamp_mounting_hole_from_top])
                    rotate([90,0,0])
                        cylinder(d=opamp_mounting_hole_dia,h=opamp_width+va);
            }
    
}
//amplifierWallMount(); 
module amplifierWallMount()
{
    difference()
    {
        cube(size = [amplifier_wall_mount_width,amplifier_wall_mount_width,amplifier_wall_height]); 

        translate([amplifier_wall_mount_width/2,amplifier_wall_mount_width/2,0])
            cylinder(d=m3_thread,h=mounting_col_screw_depth); 
                translate([amplifier_wall_screw_offset,amplifier_wall_screw_offset,van])
                    cylinder(d=m3_thread,h=va); 

        translate([amplifier_wall_screw_offset,amplifier_wall_screw_offset,amplifier_wall_height - mounting_col_screw_depth])
            cylinder(d=m3_thread,h=mounting_col_screw_depth);
                translate([amplifier_wall_screw_offset,amplifier_wall_screw_offset,amplifier_wall_height + van])
                    cylinder(d=m3_thread,h=va); 

        translate([amplifier_wall_screw_offset,amplifier_wall_mount_width+vap,amplifier_wall_srcew_1_z])
            rotate([90,0,0])
                cylinder(d=m3_thread,h=amplifier_wall_mount_width+va);

        translate([amplifier_wall_screw_offset,amplifier_wall_mount_width+vap,amplifier_wall_height - amplifier_wall_srcew_1_z])
            rotate([90,0,0])
                cylinder(d=m3_thread,h=amplifier_wall_mount_width+va);
        
        translate([van,amplifier_wall_screw_offset,amplifier_wall_srcew_2_z])
            rotate([0,90,0])
                cylinder(d=m3_thread,h=amplifier_wall_mount_width+va); 

        translate([van,amplifier_wall_screw_offset,amplifier_wall_height - amplifier_wall_srcew_2_z])
            rotate([0,90,0])
                cylinder(d=m3_thread,h=amplifier_wall_mount_width+va); 
    }
} 


module amplifer_base()
{
    difference()
    {
        cube(size = [amplifier_base_lenght,amplifier_base_width,amplifier_base_height]);
        translate([amplifier_mounting_srew_offset_x, amplifier_mounting_srew_offset_y, van])
            cylinder(d= m3_hole ,h=amplifier_base_height+ va);
        translate([amplifier_mounting_srew_offset_x + amplifier_pcb_srew_sapcing_x , amplifier_mounting_srew_offset_y, van])
            cylinder(d= m3_hole ,h=amplifier_base_height+ va);
        translate([amplifier_mounting_srew_offset_x, amplifier_mounting_srew_offset_y + amplifier_pcb_srew_sapcing_y , van])
            cylinder(d= m3_hole ,h=amplifier_base_height+ va);
        translate([amplifier_mounting_srew_offset_x + amplifier_pcb_srew_sapcing_x, amplifier_mounting_srew_offset_y + amplifier_pcb_srew_sapcing_y, van])
            cylinder(d= m3_hole ,h=amplifier_base_height+ va);

        translate([amplifier_base_mounting_screw_offset, amplifier_base_mounting_screw_offset, van])
            cylinder(d= m3_hole ,h=amplifier_base_height+ va);
        translate([amplifier_base_mounting_screw_offset, amplifier_base_width - amplifier_base_mounting_screw_offset, van])
            cylinder(d= m3_hole ,h=amplifier_base_height+ va);
        translate([amplifier_base_lenght - amplifier_base_mounting_screw_offset, amplifier_base_mounting_screw_offset, van])
            cylinder(d= m3_hole ,h=amplifier_base_height+ va);
        translate([amplifier_base_lenght - amplifier_base_mounting_screw_offset, amplifier_base_width - amplifier_base_mounting_screw_offset, van])
            cylinder(d= m3_hole ,h=amplifier_base_height+ va);

        translate([amplifier_base_raditor_wall_hole_offset_x, amplifier_base_mounting_screw_offset, van])
            cylinder(d= m3_hole ,h=amplifier_base_height+va);

        
        translate([pos_opamp_from_frist_mounting_hole_x - radiator_base_width ,radiator_total_height ,amplifier_base_height + va])
            rotate([90,90,0])
                radiator();
    }
    
    translate([amplifier_side_wall_thickness,amplifier_mounting_srew_offset_y,amplifier_base_height])
           cube(size = [2,5,2]);

    translate([amplifier_base_lenght - 2 - amplifier_side_wall_thickness,amplifier_mounting_srew_offset_y,amplifier_base_height])
           cube(size = [2,5,2]);
  
    translate([amplifier_base_raditor_base_offset_x,amplifier_base_raditor_base_offset_y,0])
           radiator_base_support(amplifier_base_height,m3_hole); 
    
}


//translate([amplifier_base_raditor_base_offset_x,amplifier_base_raditor_base_offset_y,amplifier_base_height])
//radiator_base_support();
module radiator_base_support(height = 1, srew_hole_size = 1)
{
    difference()
    {
        cube(size = [radiator_base_width,radiator_base_height,height]);
        
        translate([radiator_base_support_hole_x,radiator_base_support_middle_width,van])
            cylinder(d=3.2 ,h=height + va);

        translate([radiator_base_support_thread_1_x,radiator_base_support_middle_width,van])
            cylinder(d= srew_hole_size ,h=height + va);

        translate([radiator_base_support_thread_2_x,radiator_base_support_middle_width,van])
            cylinder(d= srew_hole_size ,h=height + va);
    }
}

module amplifer_lid()
{

    difference()
    {
        cube(size = [amplifier_base_lenght,amplifier_base_width,amplifier_lid_height]);
        
        translate([amplifier_base_mounting_screw_offset, amplifier_base_mounting_screw_offset, van])
            cylinder(d= m3_hole ,h=amplifier_lid_height + va);
        translate([amplifier_base_mounting_screw_offset, amplifier_base_width - amplifier_base_mounting_screw_offset, van])
            cylinder(d= m3_hole ,h=amplifier_lid_height + va);
        translate([amplifier_base_lenght - amplifier_base_mounting_screw_offset, amplifier_base_mounting_screw_offset, van])
            cylinder(d= m3_hole ,h=amplifier_lid_height + va);
        translate([amplifier_base_lenght - amplifier_base_mounting_screw_offset, amplifier_base_width - amplifier_base_mounting_screw_offset, van])
            cylinder(d= m3_hole ,h=amplifier_lid_height + va);

        translate([amplifier_base_raditor_wall_hole_offset_x, amplifier_base_mounting_screw_offset, van])
            cylinder(d= m3_hole ,h=amplifier_lid_height + va);
        
        translate([pos_opamp_from_frist_mounting_hole_x - radiator_base_width, radiator_total_height + lid_radiator_tollerance,radiator_base_lenght/2])
            rotate([90,90,0])
                radiator();
        
        translate([pos_opamp_from_frist_mounting_hole_x - radiator_base_width - lid_radiator_tollerance, radiator_total_height + lid_radiator_tollerance,radiator_base_lenght/2])
            rotate([90,90,0])
                radiator();

        translate([pos_opamp_from_frist_mounting_hole_x - radiator_base_width + lid_radiator_tollerance, radiator_total_height + lid_radiator_tollerance,radiator_base_lenght/2])
            rotate([90,90,0])
                radiator();

        translate([pos_opamp_from_frist_mounting_hole_x - radiator_base_width -lid_radiator_tollerance ,radiator_total_height,radiator_base_lenght/2])
            rotate([90,90,0])
                radiator();

        translate([pos_opamp_from_frist_mounting_hole_x - radiator_base_width +lid_radiator_tollerance ,radiator_total_height,radiator_base_lenght/2])
            rotate([90,90,0])
                radiator();

        translate([pos_opamp_from_frist_mounting_hole_x - radiator_base_width,radiator_total_height,radiator_base_lenght/2])
            rotate([90,90,0])
                radiator();
    }


    translate([amplifier_side_wall_thickness,amplifier_mounting_srew_offset_y,-2])
        cube(size = [2,5,2]);

    translate([amplifier_base_lenght - 2 - amplifier_side_wall_thickness,amplifier_mounting_srew_offset_y,-2])
        cube(size = [2,5,2]);


}


module srewHolder()
{
    difference()
    {
        hull()
        {
            cylinder(d=mounting_base_dia,h=mounting_base_height);
            translate([0,0,mounting_base_lenght])
                cylinder(d=mounting_col_dia,h=0.1);
        }
        
        cylinder(d=m3_thread,h=mounting_col_screw_depth);
            translate([0,0,van])
                cylinder(d=m3_thread,h=va);
             
    }

    difference()
    {
        cylinder(d=mounting_col_dia,h=mounting_col_height);
        
        translate([0,0,mounting_col_screw_offset])
            cylinder(d=m3_thread,h=mounting_col_screw_depth);
                translate([0,0,mounting_col_height+van])
                    cylinder(d=m3_thread,h=va);


        cylinder(d=m3_thread,h=mounting_col_screw_depth);
            translate([0,0,van])
                cylinder(d=m3_thread,h=va);

        translate([0,0,mounting_col_screw_depth+(m3_thread-1.5)/2])
            cylinder(h=m3_thread-1.5, d1=m3_thread, d2=0, center = true);
    }
}

module radiator()
{
    color(Brass)
        translate([radiator_copper_offset_x,radiator_copper_offset_y,0])
            cube(size = [radiator_copper_lenght,radiator_copper_lenght,radiator_copper_height]);
    
    color(Aluminum)translate([radiator_base_offset_x,radiator_base_offset_y,radiator_copper_height])
            cube(size = [radiator_base_lenght,radiator_base_width,radiator_base_height]);

    color(Aluminum)hull()
    {
        translate([radiator_base_offset_x,radiator_base_offset_y,radiator_copper_height+radiator_base_height])
            cube(size = [radiator_base_lenght,radiator_base_width,0.5]);
        translate([0,0,radiator_copper_height+radiator_full_height-1])
            cube(size = [radiator_base_lenght,radiator_full_width,1]);
    }
}



module amplifier_base_foot()
{
    difference()
    {
        hull()
        {
            translate([0,0,0.5])
            cube(size = [amplifier_base_foot_bot_width,amplifier_base_foot_bot_width,1], center = true);

            translate([0,0,amplifier_base_foot_height-1+0.5])
                cube(size = [amplifier_base_foot_top_width,amplifier_base_foot_top_width,1], center = true);
        }
        translate([0,0,van])
            cylinder(d=m3_hole,h=amplifier_base_foot_height+va);

        translate([0,0,amplifier_base_foot_height - m3_head_height+van])
            cylinder(d=m3_head_dia,h=m3_head_height+va);
    }
}

//

//neutrik_xlr();
module neutrik_xlr()
{
  
    color("grey")cylinder(d=neutrik_xlr_front_dia,h=neutrik_xlr_front_depth);

    difference()
    {
        color(BlackPaint)hull()
        {
            translate([neutrik_xlr_srew_sapcing/2,neutrik_xlr_srew_sapcing/2,neutrik_xlr_srew_holder_depth_offset])
                cylinder(d=neutrik_xlr_srew_holder_dia,h=neutrik_xlr_srew_holder_depth);

            translate([-neutrik_xlr_srew_sapcing/2,-neutrik_xlr_srew_sapcing/2,neutrik_xlr_srew_holder_depth_offset])
                cylinder(d=neutrik_xlr_srew_holder_dia,h=neutrik_xlr_srew_holder_depth);

            translate([0,0,neutrik_xlr_srew_holder_depth_offset])
                cylinder(d=neutrik_xlr_front_dia,h=neutrik_xlr_srew_holder_depth);

            translate([neutrik_xlr_front_dia/2,-neutrik_xlr_support_width/2,-neutrik_xlr_srew_holder_depth])
                cube(size = [neutrik_xlr_support_offset_y,neutrik_xlr_support_width,neutrik_xlr_srew_holder_depth]);
        }

        translate([neutrik_xlr_srew_sapcing/2,neutrik_xlr_srew_sapcing/2,neutrik_xlr_srew_holder_depth_offset+van])
                cylinder(d=m3_thread,h=neutrik_xlr_srew_holder_depth+va);

            translate([-neutrik_xlr_srew_sapcing/2,-neutrik_xlr_srew_sapcing/2,neutrik_xlr_srew_holder_depth_offset+van])
                cylinder(d=m3_thread,h=neutrik_xlr_srew_holder_depth+va);
    }

    translate([neutrik_xlr_srew_sapcing/2,neutrik_xlr_srew_sapcing/2,0])
        cylinder(d=m3_hole,h=neutrik_xlr_srew_holder_depth+va);

    translate([-neutrik_xlr_srew_sapcing/2,-neutrik_xlr_srew_sapcing/2,0])
        cylinder(d=m3_hole,h=neutrik_xlr_srew_holder_depth+va);

    translate([0,0,-neutrik_xlr_rear_depth])
        cylinder(d=neutrik_xlr_front_dia,h=neutrik_xlr_rear_depth);    

   color(BlackPaint) translate([neutrik_xlr_front_dia/2,-neutrik_xlr_support_width/2,-neutrik_xlr_rear_depth])
            cube(size = [neutrik_xlr_support_offset_y,neutrik_xlr_support_width,neutrik_xlr_rear_depth]);

}

//tlit_switch_mounting();
module tilt_switch_mounting()
{
    


    difference()
    {
        cylinder(d=tilt_swicht_mount_dia,h=tilt_swicht_mount_height);
        
        translate([-tilt_swicht_mount_dia/2,tilt_swicht_mount_dia/2 - (tilt_swicht_mount_dia-tilt_swicht_mount_flat_offset),van])
            cube(size = [tilt_swicht_mount_dia,tilt_swicht_mount_dia,tilt_swicht_mount_height+va]);
    }

}

//neutrik_nl2(); 
module neutrik_nl2()
{
    color(BlackPaint)
        neutric_nl2_mount();
    color(Steel)
        translate([-nl2_bladeTwox,0,-n12_bladeZ])
            neutrik_nl2_blade();
    color(Steel)
        translate([0,nl2_bladeOneY,-n12_bladeZ])
            rotate([0,0,90])
                neutrik_nl2_blade();
}

module neutric_nl2_mount()
{
    difference()
    {
        translate([0,0,nl2_mountThick/2])
            keyCubeRounded(nl2_mountWidth,nl2_mountHeight,nl2_mountThick,3,true);
        translate([-(nl2_screwX/2),(nl2_screwY/2),van])
            cylinder(d=nl2_screwDia, h=nl2_mountThick+va);
        translate([(nl2_screwX/2),-(nl2_screwY/2),van])
            cylinder(d=nl2_screwDia, h=nl2_mountThick+va);
    }
    translate([-(nl2_screwX/2),(nl2_screwY/2),-nl2_mountThick])
            cylinder(d=m3_thread, h=nl2_mountThick);
        translate([(nl2_screwX/2),-(nl2_screwY/2),-nl2_mountThick])
            cylinder(d=m3_thread, h=nl2_mountThick);
    difference() 
    {
        union()
        {
            translate([0,0,nl2_mountThick])
                cylinder(d=nl2_frontDia,h=nl2_frontResses);
            translate([0,0,-nl2_tubeDepth])
                cylinder(d=nl2_tubeDia,h=nl2_tubeDepth);
        }
        translate([0,0,nl2_mountThick])
            cylinder(d=n12_firstHoleDia,h=n12_fisrtHoleDepth);
    }
}

module neutrik_nl2_tube()
{   
    difference() 
    {
        union()
        {
            translate([0,0,nl2_mountThick])
                cylinder(d=nl2_frontDia,h=nl2_frontResses);
            translate([0,0,-nl2_tubeDepth])
                cylinder(d=nl2_tubeDia,h=nl2_tubeDepth);
        }
        translate([0,0,nl2_mountThick])
            cylinder(d=n12_firstHoleDia,h=n12_fisrtHoleDepth);
    }
}


module neutrik_nl2_blade()
{
    cube(size = [nl2_bladeThick,nl2_bladeWidth,nl2_bladeLen], center = true);
}

//wall_00();
module wall_00()
{
    difference()
    {
        cube(size = [amplifier_base_width - 2*amplifier_side_wall_thickness,amplifier_wall_height,amplifier_side_wall_thickness]);
        
        translate([amplifier_wall_mount_width/2,amplifier_wall_srcew_2_z,van])
            cylinder(d=m3_hole,h=amplifier_side_wall_thickness+va);

        translate([amplifier_wall_mount_width/2,amplifier_wall_height-amplifier_wall_srcew_2_z,van])
            cylinder(d=m3_hole,h=amplifier_side_wall_thickness+va);

       translate([amplifier_base_width-amplifier_wall_mount_width/2- 2*amplifier_side_wall_thickness,amplifier_wall_srcew_2_z,van])
            cylinder(d=m3_hole,h=amplifier_side_wall_thickness+va);

        translate([amplifier_base_width-amplifier_wall_mount_width/2 - 2*amplifier_side_wall_thickness,amplifier_wall_height-amplifier_wall_srcew_2_z,van])
            cylinder(d=m3_hole,h=amplifier_side_wall_thickness+va);
    }
}


//wall_01(); 
module wall_01()
{
    difference()
    {
        cube(size = [amplifier_base_lenght - radiator_base_width ,amplifier_wall_height,amplifier_side_wall_thickness]);

        translate([amplifier_wall_mount_width/2+amplifier_side_wall_thickness,amplifier_wall_srcew_1_z,van])
            cylinder(d=m3_hole,h=amplifier_side_wall_thickness+va);

        translate([amplifier_wall_mount_width/2+amplifier_side_wall_thickness,amplifier_wall_height-amplifier_wall_srcew_1_z,van])
            cylinder(d=m3_hole,h=amplifier_side_wall_thickness+va);


        translate([amplifier_base_raditor_wall_hole_offset_x, amplifier_wall_srcew_1_z, van])
            cylinder(d=m3_hole,h=amplifier_side_wall_thickness+va);

        translate([amplifier_base_raditor_wall_hole_offset_x, amplifier_wall_height- amplifier_wall_srcew_1_z, van])
            cylinder(d=m3_hole,h=amplifier_side_wall_thickness+va);


        translate([pos_opamp_from_frist_mounting_hole_x - radiator_base_width - lid_radiator_tollerance,radiator_full_width-2,radiator_total_height-0.01])
            rotate([180,0,0])
                radiator();
    }
}

//wall_02();
module wall_02()
{
    difference()
    {
            translate([amplifier_base_lenght - amplifier_base_lenght /4 ,0,0])
            cube(size = [amplifier_base_lenght /4,amplifier_wall_height,amplifier_side_wall_thickness]);

        translate([ amplifier_base_lenght - (amplifier_wall_mount_width/2+amplifier_side_wall_thickness), amplifier_wall_srcew_1_z, van])
            cylinder(d=m3_hole,h=amplifier_side_wall_thickness+va);

        translate([ amplifier_base_lenght - (amplifier_wall_mount_width/2+amplifier_side_wall_thickness), amplifier_wall_height- amplifier_wall_srcew_1_z, van])
            cylinder(d=m3_hole,h=amplifier_side_wall_thickness+va);


        translate([pos_opamp_from_frist_mounting_hole_x - radiator_base_width + lid_radiator_tollerance - 4,radiator_full_width-2,radiator_total_height-0.01])
            rotate([180,0,0])
                radiator();  
    }
}

module wall_03()
{
    difference()
    {
        cube(size = [amplifier_base_lenght, amplifier_wall_height,amplifier_side_wall_thickness]);

        translate([(amplifier_wall_mount_width/2+amplifier_side_wall_thickness), amplifier_wall_srcew_1_z, van])
            cylinder(d=m3_hole,h=amplifier_side_wall_thickness+va);

        translate([(amplifier_wall_mount_width/2+amplifier_side_wall_thickness), amplifier_wall_height- amplifier_wall_srcew_1_z, van])
            cylinder(d=m3_hole,h=amplifier_side_wall_thickness+va);

        translate([ amplifier_base_lenght - (amplifier_wall_mount_width/2+amplifier_side_wall_thickness), amplifier_wall_srcew_1_z, van])
            cylinder(d=m3_hole,h=amplifier_side_wall_thickness+va);

        translate([ amplifier_base_lenght - (amplifier_wall_mount_width/2+amplifier_side_wall_thickness), amplifier_wall_height- amplifier_wall_srcew_1_z, van])
            cylinder(d=m3_hole,h=amplifier_side_wall_thickness+va);
    }
}

module amplifier_full()
{
    amplifer_base();

    translate([amplifier_mounting_srew_offset_x, amplifier_mounting_srew_offset_y, amplifier_base_height])
        srewHolder();
    translate([amplifier_mounting_srew_offset_x + amplifier_pcb_srew_sapcing_x , amplifier_mounting_srew_offset_y, amplifier_base_height])
        srewHolder();
    translate([amplifier_mounting_srew_offset_x, amplifier_mounting_srew_offset_y + amplifier_pcb_srew_sapcing_y , amplifier_base_height])
        srewHolder();
    translate([amplifier_mounting_srew_offset_x + amplifier_pcb_srew_sapcing_x, amplifier_mounting_srew_offset_y + amplifier_pcb_srew_sapcing_y, amplifier_base_height])
        srewHolder();

    color("blue")
        translate([amplifier_base_raditor_base_offset_x,amplifier_base_raditor_base_offset_y,amplifier_base_height])
            radiator_base_support(amplifier_base_radiator_mount_height, m3_thread);

    translate([amplifier_mounting_srew_offset_x-amplifier_pcb_srew_offset_x,amplifier_mounting_srew_offset_y-amplifier_pcb_srew_offset_y,amplifier_base_height+mounting_col_height])
        amplifierPcb();

    translate([pos_opamp_from_frist_mounting_hole_x - radiator_base_width ,radiator_total_height,radiator_base_lenght+amplifier_base_height + amplifier_base_radiator_mount_height])
        rotate([90,90,0])
            radiator();

    color("gray")
        translate([amplifier_side_wall_thickness, amplifier_side_wall_thickness, amplifier_base_height])
            amplifierWallMount();

    color("gray")
        translate([amplifier_base_lenght - amplifier_wall_screw_offset - amplifier_wall_mount_width , amplifier_wall_screw_offset, amplifier_base_height])
            amplifierWallMount();

    color("gray")
        translate([amplifier_base_raditor_wall_hole_offset_x-amplifier_wall_screw_offset, amplifier_wall_screw_offset, amplifier_base_height])
            amplifierWallMount();

    color("gray")
        translate([amplifier_wall_screw_offset, amplifier_base_width - amplifier_wall_screw_offset - amplifier_wall_mount_width , amplifier_base_height])
            amplifierWallMount();

    color("gray")
        translate([amplifier_base_lenght - amplifier_wall_screw_offset - amplifier_wall_mount_width , amplifier_base_width - amplifier_wall_screw_offset - amplifier_wall_mount_width, amplifier_base_height])
            amplifierWallMount();

    color("black")
        translate([amplifier_base_mounting_screw_offset, amplifier_base_mounting_screw_offset, 0])
            rotate([180,0,0])
                amplifier_base_foot();

    color("black")
        translate([amplifier_base_mounting_screw_offset, amplifier_base_width - amplifier_base_mounting_screw_offset, 0])
            rotate([180,0,0])
                amplifier_base_foot();

    color("black")
        translate([amplifier_base_lenght - amplifier_base_mounting_screw_offset, amplifier_base_mounting_screw_offset, 0])
            rotate([180,0,0])
                amplifier_base_foot();

    color("black")
        translate([amplifier_base_lenght - amplifier_base_mounting_screw_offset, amplifier_base_width - amplifier_base_mounting_screw_offset, 0])
            rotate([180,0,0])
                amplifier_base_foot();

    


    difference()
    {
           color("cyan") translate([0,amplifier_side_wall_thickness,amplifier_base_height])
            rotate([90,0,90])
                wall_00(); 

        translate([-0.1,amplifier_mounting_srew_offset_y + amplifier_pcb_srew_sapcing_y, amplifier_wall_height - radiator_top_height/2])
            rotate([90,0,270])
                neutrik_nl2();
            
        translate([amplifier_base_height +0.1, connector_audio_in_pos_x, connector_audio_in_pos_y ])
            rotate([90,90,270])
                neutrik_xlr();
        
        color("pink")translate([writing_height,amplifier_mounting_srew_offset_y + amplifier_pcb_srew_sapcing_y + 18, amplifier_wall_height - radiator_top_height/2-22])
            rotate([90,0,270])
                linear_extrude(writing_height+va)
                    text("Power In", size=writing_size,font="Liberation Sans:style=Bold");

        color("pink")translate([writing_height, connector_audio_in_pos_x+14, connector_audio_in_pos_y +15])
            rotate([90,0,270])
                linear_extrude(writing_height+va)
                    text("Audio In", size=writing_size,font="Liberation Sans:style=Bold");

    }

        translate([0,amplifier_mounting_srew_offset_y + amplifier_pcb_srew_sapcing_y, amplifier_wall_height - radiator_top_height/2])
            rotate([90,0,270])
                neutrik_nl2();
            
        translate([amplifier_base_height, connector_audio_in_pos_x, connector_audio_in_pos_y ])
            rotate([90,90,270])
                neutrik_xlr();


    difference()
    {
        color("cyan") translate([amplifier_base_lenght - amplifier_side_wall_thickness ,amplifier_side_wall_thickness,amplifier_base_height])
                rotate([90,0,90])
                    wall_00();

        translate([amplifier_base_lenght + vap ,amplifier_mounting_srew_offset_y + amplifier_pcb_srew_sapcing_y, amplifier_wall_height - radiator_top_height/2])
            rotate([90,0,90])
                neutrik_nl2();
        
        color("pink")translate([amplifier_base_lenght - writing_height,amplifier_mounting_srew_offset_y + amplifier_pcb_srew_sapcing_y-16, amplifier_wall_height - radiator_top_height/2 - 25])
            rotate([90,0,90])
                linear_extrude(writing_height+va)
                    text("Speaker", size=writing_size,font="Liberation Sans:style=Bold");

        color("pink")translate([amplifier_base_lenght - writing_height,amplifier_mounting_srew_offset_y + amplifier_pcb_srew_sapcing_y-8, amplifier_wall_height - radiator_top_height/2 - 33])
            rotate([90,0,90])
                linear_extrude(writing_height+va)
                    text("Out", size=writing_size,font="Liberation Sans:style=Bold");
    }


    translate([amplifier_base_lenght ,amplifier_mounting_srew_offset_y + amplifier_pcb_srew_sapcing_y, amplifier_wall_height - radiator_top_height/2])
            rotate([90,0,90])
                neutrik_nl2();

    difference()
    {   

        color("blue")translate([0,amplifier_side_wall_thickness,amplifier_base_height])
            rotate([90,0,0])
                wall_01();

        color("black")translate([amplifier_base_raditor_wall_hole_offset_x/2,amplifier_side_wall_thickness/2+tilt_swicht_mount_height/2,amplifier_wall_height - amplifier_wall_height/4])
            rotate([90,0,0])
                tilt_switch_mounting(); 

        color("pink")translate([amplifier_base_raditor_wall_hole_offset_x/2 -9,writing_height,amplifier_wall_height - amplifier_wall_height/4-11])
            rotate([90,0,0])
                linear_extrude(writing_height+va)
                    text("Mute", size=writing_size,font="Liberation Sans:style=Bold");

        color("pink")translate([amplifier_base_raditor_wall_hole_offset_x/2 -13,writing_height,amplifier_wall_height - amplifier_wall_height/4+6])
            rotate([90,0,0])
                linear_extrude(writing_height+va)
                    text("Unmute", size=writing_size,font="Liberation Sans:style=Bold");
    }
     
    color("blue")translate([0,amplifier_side_wall_thickness,amplifier_base_height])
        rotate([90,0,0])
            wall_02();

    color("red")translate([0,amplifier_base_width,amplifier_base_height])
        rotate([90,0,0])
            wall_03(); 

    translate([0,0,amplifier_base_height + amplifier_wall_height])
        amplifer_lid(); 
}


psu_base_thickness = 3; 
psu_wall_thickness = 3;

tdk_lenght = 128;
tdk_width = 95; 
tdk_height = 41;  

tdk_sideScrew_dia = 5;
tdk_sideScrew_height = 3;
tdk_sideScrew_offset_x = 3;
tdk_sideScrew_offset_z = 33;

tdk_terminal_lenght = 17; 
tdk_terminal_width = 51; 
tdk_terminal_height = 17; 

tdk_terminal_offset_y = 25;
tdk_terminal_offset_z = 7; 

tdk_botSrewRela_offset_y = 69; 
tdk_botSrewRela_offset_x = 118;

tdk_botSrew2_offset_x = 5;  
tdk_botSrew1_offset_x = tdk_botSrewRela_offset_x + tdk_botSrew2_offset_x; 

tdk_botSrew1_offset_y = 18; 
tdk_botSrew2_offset_y = tdk_botSrewRela_offset_y + tdk_botSrew1_offset_y;

tdk_sideSrewRela_offset_x = 109;
tdk_sideSrewRela_offset_z = 26.5;
tdk_sideSrew1_offset_x = 14;

tdk_wall_space = 5; 
tdk_roof_space = 3;
tdk_cable_space = 20;

psu_power_base_lenght = tdk_lenght + tdk_cable_space + tdk_wall_space + 2*psu_wall_thickness; 
psu_power_base_width = tdk_width + 2*tdk_wall_space + 2*psu_wall_thickness;  




module tdk_psu()
{
    color(Aluminum)cube(size=[tdk_lenght,tdk_width, tdk_height]);
    
    color("gray")translate([tdk_lenght- tdk_sideScrew_dia/2 -tdk_sideScrew_offset_x ,0,tdk_sideScrew_offset_z+tdk_sideScrew_dia/2])
        rotate([90,0,0])
            cylinder(d=tdk_sideScrew_dia,h=tdk_sideScrew_height);

    color(BlackPaint)translate([tdk_lenght,tdk_terminal_offset_y,tdk_terminal_offset_z])
        cube(size=[tdk_terminal_lenght,tdk_terminal_width,tdk_terminal_height]);

    color("black")translate([tdk_lenght- tdk_botSrew2_offset_x ,tdk_width-tdk_botSrew2_offset_y,-(psu_base_thickness+va)])
            cylinder(d=m3_hole,h=psu_base_thickness+va);
 
    color("black")translate([tdk_lenght- tdk_botSrew1_offset_x ,tdk_width-tdk_botSrew1_offset_y,-(psu_base_thickness+va)])
            cylinder(d=m3_hole,h=psu_base_thickness+va);

    color("black")translate([tdk_lenght - tdk_sideSrew1_offset_x,tdk_width + psu_wall_thickness +va,tdk_sideSrewRela_offset_z])
        rotate([90,0,0])
            cylinder(d=m3_hole,h=psu_wall_thickness+va);

    color("black")translate([tdk_lenght - tdk_sideSrew1_offset_x-tdk_sideSrewRela_offset_x,tdk_width + psu_wall_thickness +va,tdk_sideSrewRela_offset_z])
        rotate([90,0,0])
            cylinder(d=m3_hole,h=psu_wall_thickness+va);
}

module psu_power_base()
{
    difference()
    {
        cube(size=[psu_power_base_lenght,psu_power_base_width,psu_base_thickness]);
        translate([tdk_wall_space + psu_wall_thickness,tdk_wall_space + psu_wall_thickness,psu_base_thickness+vap])
            tdk_psu();
    }
}

module psu()
{
    translate([0,0,0])psu_power_base(); 
}