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 lines
3.6 KiB

  1. include <export.scad>
  2. //export=MODEL_PLATFORM_HARNESS;
  3. //export=MODEL_PLATFORM_STRAP;
  4. // dependency: https://github.com/revarbat/BOSL
  5. include <BOSL/constants.scad>
  6. use <BOSL/transforms.scad>
  7. use <BOSL/shapes.scad>
  8. use <BOSL/masks.scad>
  9. use <BOSL/sliders.scad>
  10. use <specs_platform.scad>
  11. use <specs_strap.scad>
  12. use <common.scad>
  13. use <strap_common.scad>
  14. use <platform_common.scad>
  15. // DEBUG:
  16. //validation = 1;
  17. //xray = 1;
  18. // PROP >>
  19. module prop_arm() {
  20. $fn=$preview ? 10 : 30;
  21. arm_size=[200, 55, 40];
  22. color("gray")
  23. down(arm_size.z/2) {
  24. cuboid(arm_size, fillet=16, edges=EDGES_X_ALL);
  25. 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);
  26. }
  27. }
  28. module model_prop_arm() {
  29. if (is_not_export()) down(3) prop_arm();
  30. }
  31. // <<<
  32. // Blocks:
  33. module platform(base) {
  34. size=get_platform_size();
  35. base_size=size;
  36. wall=get_platform_wall();
  37. top_size=get_platform_top_size();
  38. top=!base;
  39. module platform_screwholes() {
  40. module screwhole_one() {
  41. fwd(base_size.y/2) xrot(90) down(get_platform_screwhole_h()) screwhole(d=get_platform_screwhole_d(), h=get_platform_screwhole_h());
  42. }
  43. module screwhole_sided() {
  44. offset=16;
  45. left(offset) screwhole_one();
  46. right(offset) screwhole_one();
  47. }
  48. up(top_size.z/5) {
  49. screwhole_sided();
  50. scale([1,-1,1]) screwhole_sided();
  51. }
  52. }
  53. module base_platform_cutout_for_top() {
  54. base_top_diff=[base_size.x-top_size.x, base_size.y-top_size.y];
  55. guiding=1;
  56. top_slack=[0.2, 0.2, 0];
  57. translate(get_platform_top_pos()) {
  58. cube(vec_sum(top_size, top_slack), center=true);
  59. down(top_size.z/2 - 2)
  60. prismoid(size1=[top_size.x,top_size.y], size2=[top_size.x+base_top_diff.x*guiding,top_size.y+base_top_diff.y*guiding], h=top_size.z);
  61. }
  62. }
  63. module base_platform() {
  64. module base_platform_core() {
  65. braced_thinning_wall(h=size.y, l=size.x, thick=size.z, wall=0, strut=wall, orient=ORIENT_X_90);
  66. }
  67. difference() {
  68. base_platform_core();
  69. base_platform_cutout_for_top();
  70. platform_screwholes();
  71. }
  72. }
  73. module top_platform() {
  74. difference() {
  75. up((base_size.z-top_size.z)/2)
  76. up(top_size.z/2) intersection() {
  77. scale([1,1,4]) braced_thinning_wall(h=top_size.y, l=top_size.x, thick=top_size.z, wall=0, strut=wall/4, orient=ORIENT_X_90);
  78. down(top_size.z/2) scale([2,2,1]) cube(top_size, center=true);
  79. }
  80. platform_screwholes();
  81. }
  82. }
  83. module strap_connectors() {
  84. //down(size.z/2)
  85. difference() {
  86. foreach_platform_strap_connector() {
  87. link_connector_pin();
  88. }
  89. base_platform_cutout_for_top();
  90. }
  91. }
  92. color(top?"Olive":"YellowGreen")
  93. if (base) {
  94. base_platform();
  95. strap_connectors();
  96. } else {
  97. top_platform();
  98. }
  99. }
  100. // Models:
  101. module model_platform_harness() {
  102. platform(base=false);
  103. }
  104. module model_platform_strap() {
  105. platform(base=true);
  106. }
  107. // Validation:
  108. /*intersection() {
  109. model_platform_harness();
  110. model_platform_strap();
  111. }*/
  112. // Export:
  113. difference() {
  114. union() {
  115. if (is_model(MODEL_PLATFORM_HARNESS)) model_platform_harness();
  116. if (is_model(MODEL_PLATFORM_STRAP)) model_platform_strap();
  117. //if (is_model(MODEL_DEMO)) model_prop_arm();
  118. }
  119. // xray:
  120. //left(500+5) cube([1000, 1000, 1000], center=true);
  121. }