by spencer 3 years, 11 months ago
15 times 2.58s avg. build time

Endstop Holder

A basic endstop holder. Based off the Prusa endstop holder.

License: CreativeCommons-ShareAlike Publicly Listed: True Tags: None

Log in to download models or make your own copy!

Auto Apply Changes

  1. # A basic endstop holder by Spencer Bliven
  2. # Based off the Prusa endstop holder (Josef Prusa, GPL, https://github.com/prusajr/PrusaMendel/)
  3. #
  4. # This version is licensed under either the GPL or the Creative Commons Share-Alike (CC-BY-SA)
  5. #
  6. # Changelog
  7. # 1.1 - Made nut trap hexagonal for easier printing.
  8. # 1.0 - basic endstop
  9. #
  10. # Important MetaData
  11. #
  12. UOM = "mm"
  13. #
  14. # PARAMETERS and PRESETS
  15. # These parameters can be manipulated by end users
  16. #
  17. screwSpacing = FloatParam(min=1,max=40,presets={'default':20},group=" Basic", desc="Distance between screw holes on the endstop")
  18. smoothBarDiameter = FloatParam(min=1,max=20,presets={'default':9},group="Advanced", desc="Diameter of bar channel (9mm for M8)")
  19. outerDiameter = FloatParam(min=1,max=20,presets={'default':9+3.3*2},group="Advanced", desc="Outer diameter of bar channel")
  20. thickness = FloatParam(min=0,max=1,presets={'default':4},group="Advanced", desc="Thickness of streight sections")
  21. openingSize = FloatParam(min=0,max=1,presets={'default':9-1.5},group="Advanced", desc="Width of the opening to slide the bar in")
  22. partHeight = FloatParam(min=1,max=20,presets={'default':10.0},group="Advanced", desc="Height of the part")
  23. screwDiameter = FloatParam(min=1,max=10,presets={'default':3.6},group="Advanced", desc="Width of the screw (M3 default)")
  24. nutDiameter = FloatParam(min=1,max=10,presets={'default':6.1},group="Advanced", desc="Corner-corner Width of the nut (M3 default)")
  25. nutDepth = FloatParam(min=1,max=10,presets={'default':3},group="Advanced", desc="Depth of the nut (M3 default)")
  26. #
  27. # Other Variables.
  28. # These are used in the script but not exposed to users to change with the GUI
  29. #
  30. # Your build method. It must return a solid object
  31. #
  32. def build():
  33. #return Workplane("XY").box(5,5,10).add(Workplane("XY",Vector(7.5,7.5)).box(10,10,10)).add(Workplane("XY",Vector(-7.5,7.5,0)).box(10,10,5)).combine()
  34. #return Workplane("XY",Vector(5,5,5)).box(10,10,10)
  35. outerR = outerDiameter.value/2
  36. innerR = smoothBarDiameter.value/2
  37. screwR = screwDiameter.value/2
  38. nutR = nutDiameter.value/2
  39. height = partHeight.value
  40. handleLength = screwSpacing.value + 2*nutDiameter.value
  41. square = Workplane("XY",Vector(outerR,outerR,0)).rect(outerR*2,outerR*2).extrude(height)
  42. circ = Workplane("XY",Vector(0,outerR,0)).circle(outerR).extrude(height)#.circle(innerR)
  43. handle = Workplane("XY",Vector(-(handleLength+outerR)/2,thickness.value/2,height/2)).box(handleLength+outerR,thickness.value,height)
  44. #OpenSCAD-style cuts
  45. #hole1 = Workplane("XZ", Vector(-outerR-nutDiameter.value,0,height/2)).circle(screwR).extrude(-thickness.value)
  46. #hole2 = Workplane("XZ", Vector(-outerR-nutDiameter.value-screwSpacing.value,0,height/2)).circle(screwR).extrude(-thickness.value)
  47. #handle = handle.cut(hole1).cut(hole2)
  48. #ModelCAD holes
  49. handle = handle.faces(">Y").workplane().transformed(offset=cad.Vector((outerR+handleLength)/2-nutDiameter.value,0,0))
  50. handle = handle.hole(screwDiameter.value)
  51. handle = handle.transformed(offset=cad.Vector(-screwSpacing.value,0,0)).hole(screwDiameter.value)
  52. #ModelCAD holes with local reference points. Broken
  53. #handle = handle.faces(">Y").vertices().workplane().transformed(offset=cad.Vector(0,0,0),rotate=Base.Vector(90,0,0)).hole(screwDiameter.value)
  54. #handle = handle.faces("+Y").workplane().edges("|Y").circle(screwDiameter.value).extrude(15)#hole(screwDiameter.value)
  55. #broken translate?
  56. #screwCollar = square.faces(">Y").workplane()#.transformed(Vector(0,0,0),Vector(2,0,0))
  57. hexWidth = height*2/math.sqrt(3) #with of hex with height 'height'
  58. screwCollar = Workplane("XZ", Vector(2*outerR-hexWidth/2,2*outerR+nutDepth.value,height/2))
  59. screwCollar = screwCollar.polygon(6,hexWidth).polygon(6,nutDiameter.value).extrude(nutDepth.value)
  60. innerCirc = Workplane("XY",Vector(0,outerR,0)).circle(innerR).extrude(height)
  61. opening = Workplane("XY",Vector(outerR,outerR,height/2)).box(2*outerR,openingSize.value,height)
  62. hole3 = Workplane("XZ", Vector(2*outerR-hexWidth/2,2*outerR,height/2))
  63. hole3 = hole3.circle(screwR).extrude(2*outerR)
  64. innerCirc = innerCirc.add(opening).add(hole3).combine()
  65. result = square.add(circ).add(handle).add(screwCollar).combine()
  66. result = result.cut(innerCirc)#.add(hole3).combine()
  67. return result