Advertisement
Guest User

vars

a guest
Feb 17th, 2022
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 4.83 KB | None | 0 0
  1. use <_lib_/scad-utils/transformations.scad>
  2. use <_lib_/scad-utils/linalg.scad>
  3. include <_lib_/dict.scad>
  4.  
  5. use<_parts_/motor_N20.scad>
  6. use <_parts_/gears.scad>
  7.  
  8. tt=0; // assembled
  9. //tt=1; // exploded
  10.  
  11.  
  12. //////////////////////////////////////////////////////////////////
  13.  
  14. gap=0.3;
  15.  
  16. rearaxle_gear_AA_n = 14;
  17. clutch_gear_AA_n = 10;
  18.  
  19. clutch_gear_BB_n = 24;
  20. motor_A_gear_BB_n = 24;
  21.  
  22. motor_A_gear_AA_n = 32;
  23. motor_B_gear_AA_n = 20;
  24.  
  25. rearaxle_x = 0;
  26. rearaxle_z = 0;
  27.  
  28. rearaxle_clutch_angle=45;
  29. clutch_x = (rearaxle_gear_AA_n+clutch_gear_AA_n+gap)/4*cos(rearaxle_clutch_angle);
  30. clutch_z = (rearaxle_gear_AA_n+clutch_gear_AA_n+gap)/4*sin(rearaxle_clutch_angle);
  31.  
  32. clutch_motor_A_angle=45;
  33. motor_A_x = clutch_x + (clutch_gear_BB_n+motor_A_gear_BB_n+gap)/4*cos(clutch_motor_A_angle);
  34. motor_A_z = clutch_z + (clutch_gear_BB_n+motor_A_gear_BB_n+gap)/4*sin(clutch_motor_A_angle);
  35.  
  36. motor_A_motor_B_angle=0;
  37. motor_B_x = motor_A_x + (motor_A_gear_AA_n+motor_B_gear_AA_n+gap)/4*cos(motor_A_motor_B_angle);
  38. motor_B_z = motor_A_z + (motor_A_gear_AA_n+motor_B_gear_AA_n+gap)/4*sin(motor_A_motor_B_angle);
  39.  
  40. //////////////////////////////////////////////////////////////////
  41.  
  42. function twin_vars(key) = dict([
  43.  
  44.   ["clutch_x", clutch_x],
  45.   ["clutch_z", clutch_z],
  46.  
  47.   ["clutch_gear_AA_n",   clutch_gear_AA_n],
  48.   ["clutch_gear_AA_h",   5],
  49.   ["clutch_gear_BB_n",   clutch_gear_BB_n],
  50.   ["clutch_gear_BB_h",   1],
  51.  
  52.   ["motor_A_x", motor_A_x],
  53.   ["motor_A_y", 2],
  54.   ["motor_A_z", motor_A_z],
  55.   ["motor_A_rotation_x", 90],
  56.   ["motor_A_rotation_y", 90],
  57.   ["motor_A_rotation_z", 0],
  58.  
  59.   ["motor_B_x", motor_B_x],
  60.   ["motor_B_y", 5],
  61.   ["motor_B_z", motor_B_z],
  62.   ["motor_B_rotation_x", 90],
  63.   ["motor_B_rotation_y", 90],
  64.   ["motor_B_rotation_z", 0],
  65.  
  66.   ["motor_A_gear_AA_n",   motor_A_gear_AA_n], // 32
  67.   ["motor_A_gear_AA_h",   1],
  68.  
  69.   ["motor_A_gear_BB_n",   motor_A_gear_BB_n], // 20
  70.   ["motor_A_gear_BB_h",   5],
  71.  
  72.   ["motor_B_gear_AA_n",   motor_B_gear_AA_n],
  73.   ["motor_B_gear_AA_h",   3],
  74.  
  75.   ["align_A_x", (motor_A_x+motor_B_x)/2+3],
  76.   ["align_A_z", (motor_A_z+motor_B_z)/2+8],
  77.   ["align_B_x", (motor_A_x+motor_B_x)/2+3],
  78.   ["align_B_z", (motor_A_z+motor_B_z)/2-8],
  79.   ["align_C_x", motor_A_x/2-10],
  80.   ["align_C_z", motor_A_z],
  81.  
  82.   ["mount_A_x", clutch_x-5],
  83.   ["mount_A_z", clutch_x+5],
  84.   ["mount_B_x", clutch_x-5],
  85.   ["mount_B_z", clutch_x+10],
  86.  
  87.   ],key);
  88.  
  89. //////////////////////////////////////////////////////////////////
  90.  
  91. twin_csg_colors = [
  92.  
  93.   ["motor_A_gear_AA",           ["white"]],
  94.   ["motor_A_gear_BB",           ["gold"]],
  95.   ["motor_A_gearbox_shell",     ["orange"]],
  96.   ["motor_A_gearbox_gears",     ["white"]],
  97.   ["motor_A_motor",             ["lightgrey"]],
  98.  
  99.   ["motor_B_gear_AA",           ["silver"]],
  100.   ["motor_B_gearbox_shell",     ["orange"]],
  101.   ["motor_B_gearbox_gears",     ["white"]],
  102.   ["motor_B_motor",             ["lightgrey"]],
  103.  
  104.   ["clutch_axle",               ["khaki"]],
  105.   ["clutch_gear_AA",            ["darkseagreen"]],
  106.   ["clutch_gear_BB",            ["darkseagreen"]],
  107.  
  108.   ["p1",                        ["slategrey"]],
  109.   ["p2",                        ["slategrey"]],
  110.  
  111.  
  112. ];
  113.  
  114. //////////////////////////////////////////////////////////////////
  115.  
  116. twin_csg_transforms = [
  117.   ["motor_A_gearbox_shell",[
  118.     ["motor_A_motor",
  119.      translation([
  120.        0,0,-motor_N20_vars("gearbox_z")-8*tt])] ]],
  121.   ["motor_A_gearbox_gears",[
  122.     ["motor_A_gear_BB",
  123.       translation([
  124.         0,0,20*tt+4+motor_N20_vars("gearbox_axle_step_h")])] ]],
  125.   ["motor_B_gearbox_shell",[
  126.     ["motor_B_motor",
  127.      translation([
  128.        0,0,-motor_N20_vars("gearbox_z")])] ]],
  129.   ["motor_B_gearbox_gears",[
  130.     ["motor_B_gear_AA",
  131.       translation([
  132.         0,0,0.5+motor_N20_vars("gearbox_axle_step_h")+tt*15])] ]],
  133.   ["p2",[
  134.     ["p1", translation([0,tt*-40,0])],
  135.     ["motor_A_gearbox_shell",
  136.       translation([
  137.         twin_vars("motor_A_x"),
  138.         twin_vars("motor_A_y")+tt*-25,
  139.         twin_vars("motor_A_z")]) *
  140.         rotation([
  141.           twin_vars("motor_A_rotation_x"),
  142.           twin_vars("motor_A_rotation_y"),
  143.           twin_vars("motor_A_rotation_z")])],
  144.     ["motor_B_gearbox_shell",
  145.       translation([
  146.         twin_vars("motor_B_x"),
  147.         twin_vars("motor_B_y")+tt*-15,
  148.         twin_vars("motor_B_z")]) *
  149.         rotation([
  150.           twin_vars("motor_B_rotation_x"),
  151.           twin_vars("motor_B_rotation_y"),
  152.           twin_vars("motor_B_rotation_z")])],
  153.     ["clutch_axle",
  154.       translation([0,-20*tt,0])] ]],
  155.   ["clutch_axle",[
  156.     ["clutch_gear_BB",
  157.       translation([0,-25*tt,0])] ]],
  158.  
  159.   /////////////////////////////////////////
  160.  
  161.   ["CAM",[
  162.     ["p1",
  163.       rotation([90,0,0])*
  164.       translation([-twin_vars("motor_A_x"),2,-twin_vars("motor_A_z")])],
  165.     ["p2",
  166.       rotation([-90,0,0])*
  167.       translation([-twin_vars("motor_A_x"),-20,-twin_vars("motor_A_z")])] ]]
  168.  
  169. ];
  170.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement