<commit_before>// Battery packs
// battery_pack_linear - all batteries in a row
// battery_pack_double - 2 rows of batteries (can't cope with odd numbers!)

// Point of origin is the centre of the end of the end battery.

include <../config/colors.scad>

// AAs - http://en.wikipedia.org/wiki/AA_battery

//                    Battery len, Battery dia, Pack width, Pack depth, Pack height, Linear?, Name 
BatteryPack_AA = [ 50.5,       14.5,        31.4,       27.5,       57.4,        0,       "AA" ];

// Constants for access:
BatteryPack_Const_BLen = 0;
BatteryPack_Const_BDia = 1;
BatteryPack_Const_PWidth = 2;
BatteryPack_Const_PDepth = 3;
BatteryPack_Const_PHeight = 4;
BatteryPack_Const_Linear = 5;
BatteryPack_Const_Name = 6;

// We have the total battery length, assume the positive terminal is 1/20th of the length
module battery(BP) {

  Battery_len = BP[BatteryPack_Const_BLen];
  Battery_dia = BP[BatteryPack_Const_BDia];

  button_h = (1/20)*Battery_len;
  top_h = (1/3)*Battery_len;
  bottom_h = Battery_len-(top_h+button_h);

  color("black")
  linear_extrude(height=bottom_h)
    circle(r=Battery_dia/2);<commit_msg>Add connector (currently centre of whole thing!)<commit_after>// Battery packs
// battery_pack_linear - all batteries in a row
// battery_pack_double - 2 rows of batteries (can't cope with odd numbers!)

// Point of origin is the centre of the end of the end battery.

include <../config/colors.scad>

// AAs - http://en.wikipedia.org/wiki/AA_battery

//                    Battery len, Battery dia, Pack width, Pack depth, Pack height, Linear?, Batteries, Name 
BatteryPack_AA_4_SQ = [ 50.5,       14.5,        31.4,       27.5,       57.4,        0,      , 4,       "AA" ];

// Default:
BatteryPack_AA = BatteryPack_AA_4_SQ;

// Constants for access:
BatteryPack_Const_BLen = 0;
BatteryPack_Const_BDia = 1;
BatteryPack_Const_PWidth = 2;
BatteryPack_Const_PDepth = 3;
BatteryPack_Const_PHeight = 4;
BatteryPack_Const_Linear = 5;
BatteryPack_Const_Count = 6;
BatteryPack_Const_Name = 7;

// Connectors:
function BatteryPack_Con_Centre(BP) = [
  [
    BP[BatteryPack_Const_PWidth]/2 + BP[BatteryPack_Const_BDia]/2,
    BP[BatteryPack_Const_PDepth]/2 + BP[BatteryPack_Const_BDia]/2,
    BP[BatteryPack_Const_PHeight]/2,    
  ],
  [ 0,0,0 ],
  0, 0, 0
];

// We have the total battery length, assume the positive terminal is 1/20th of the length
module battery(BP) {

  Battery_len = BP[BatteryPack_Const_BLen];
  Battery_dia = BP[BatteryPack_Const_BDia];

  button_h = (1/20)*Battery_len;
  top_h = (1/3)*Battery_len;
  bottom_h = Battery_len-(top_h+button_h);

  color("black")
  linear_extrude(height=bottom_h)
    circle(r=Battery_dia/2);
{'fraction_non_alphanumeric': 0.11148522259633371, 'fraction_numerical': 0.030303030303030304, 'mean_word_length': 3.5476190476190474, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3932904', 'n_tokens_mistral': 1035, 'n_tokens_neox': 961, 'n_words': 230}