Pip-Boy inspired phone holder built around the PINE64 PinePhone
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 regels
4.1 KiB

  1. // dependency: https://github.com/revarbat/BOSL
  2. include <BOSL/constants.scad>
  3. use <BOSL/transforms.scad>
  4. use <BOSL/shapes.scad>
  5. use <BOSL/masks.scad>
  6. use <BOSL/sliders.scad>
  7. // DEBUG:
  8. //validation = 1;
  9. //xray = 1;
  10. // EXPORT:
  11. MODEL_STRAP_PLATFORM_BASE=10;
  12. MODEL_STRAP_PLATFORM_RIB=11;
  13. MODEL_STRAP_PLATFORM_RIB_BRACE=12;
  14. MODEL_STRAP_SECONDARY=13;
  15. export=0; // [0:20]
  16. function is_not_export() = is_undef(export) || export == 0;
  17. function is_export() = !is_not_export();
  18. function is_model_strict(m) = is_export() && export == m;
  19. function is_model(m) = is_not_export() || export == m;
  20. function get_phone_size() = [160, 76.7, 10];
  21. module arm() {
  22. $fn=$preview ? 10 : 30;
  23. arm_size=[200, 55, 40];
  24. color("gray")
  25. down(arm_size.z/2) {
  26. cuboid(arm_size, fillet=16, edges=EDGES_X_ALL);
  27. left(arm_size.x*0.6) scale([1, 1, 0.8]) yrot(90) cylinder(d1=arm_size.y*1.4, d2=arm_size.y*0.95, h=arm_size.x/2);
  28. }
  29. }
  30. module strap_platform() {
  31. base_size=[40, 70, 2];
  32. rib_thickness=5;
  33. rib_height=20;
  34. rib_pos=[base_size.x/2 - rib_thickness, 0, -1.3];
  35. brace_size=[base_size.x, 3.6, 4.8];
  36. brace_pos=[0, base_size.y/2 - 4, -1.3];
  37. module platform_base() {
  38. cutout_size=[(base_size.x-rib_thickness*2 - 2*(base_size.x/2-rib_pos.x)), (base_size.y - 5), 2*base_size.z];
  39. difference() {
  40. down(base_size.z/2) cuboid(base_size, fillet=2, edges=EDGES_Z_ALL);
  41. down(base_size.z/2) cuboid(cutout_size, fillet=2, edges=EDGES_Z_ALL);
  42. model_rib_left(socket=true);
  43. model_rib_right(socket=true);
  44. }
  45. }
  46. module platform_rib(socket=false) {
  47. rib_size=[rib_thickness, base_size.y - 2, rib_height];
  48. difference() {
  49. union() {
  50. difference() {
  51. down(rib_size.z/2) scale(socket ? 1.01 : 1) sparse_strut(h=rib_size.z, l=rib_size.y, thick=rib_size.x, strut=1.2, maxang=40, max_bridge=4);
  52. arm();
  53. }
  54. difference() {
  55. intersection() {
  56. down(rib_size.z/2) cube(rib_size, center=true);
  57. scale(1.07) arm();
  58. }
  59. down(2) scale(1.0) arm();
  60. }
  61. }
  62. fwd(brace_pos.y) platform_rib_brace(socket=true);
  63. back(brace_pos.y) platform_rib_brace(socket=true);
  64. }
  65. }
  66. module platform_rib_brace(socket=false) {
  67. down(rib_height - 1.2 - brace_size.z/2) scale(socket ? 1.02 : 1) cuboid(brace_size, fillet=1, edges=EDGES_X_ALL);
  68. }
  69. module model_rib_left(socket=false) {
  70. left(rib_pos.x) up(rib_pos.z) platform_rib(socket=socket);
  71. }
  72. module model_rib_right(socket=false) {
  73. right(rib_pos.x) up(rib_pos.z) platform_rib(socket=socket);
  74. }
  75. module model_brace_front() {
  76. fwd(brace_pos.y) up(brace_pos.z) platform_rib_brace();
  77. }
  78. module model_brace_back() {
  79. back(brace_pos.y) up(brace_pos.z) platform_rib_brace();
  80. }
  81. if (is_model(MODEL_STRAP_PLATFORM_BASE)) platform_base();
  82. if (is_model(MODEL_STRAP_PLATFORM_RIB)) model_rib_left();
  83. if (is_model(MODEL_STRAP_PLATFORM_RIB_BRACE)) model_brace_front();
  84. if (is_not_export()) {
  85. model_rib_right();
  86. model_brace_back();
  87. }
  88. }
  89. module strap_secondary() {
  90. size=[40, 15, 10];
  91. size_base=[size.x, size.y];
  92. size_top=[size.x * 0.9, size.y * 0.4];
  93. cutout_size=[size.x - 10, size.y*10, size.z - 4];
  94. module anchor() {
  95. difference() {
  96. xrot(180) rounded_prismoid(size1=size_base, size2=size_top, h=size.z, r=5);
  97. down(size.z/2) cube(cutout_size, center=true);
  98. }
  99. }
  100. anchor_pos=[60, 30, 0];
  101. module anchor_front() {
  102. left(anchor_pos.x) fwd(anchor_pos.y) anchor();
  103. }
  104. module anchor_back() {
  105. left(anchor_pos.x) back(anchor_pos.y) anchor();
  106. }
  107. if (is_model(MODEL_STRAP_SECONDARY)) anchor_front();
  108. if (is_not_export()) anchor_back();
  109. }
  110. module model_strap_platform() {
  111. strap_platform();
  112. }
  113. module model_strap_secondary() {
  114. strap_secondary();
  115. }
  116. module model_arm() {
  117. if (is_not_export()) down(3) arm();
  118. }
  119. model_strap_platform();
  120. model_strap_secondary();
  121. model_arm();