by jharkes 3 years, 7 months ago
11 times 1.09s avg. build time

Wooden train connector

Click to change title and description

License: ParametricParts-Free Publicly Listed: True Tags: Repair,Toys
  1. #
  2. # Important MetaData
  3. #
  4. UOM = "mm"
  5. #
  6. # PARAMETERS and PRESETS
  7. # These parameters can be manipulated by end users
  8. #
  9. ball = FloatParam(min=1.0,max=20.0,presets={'default':12.0},group="Basics", desc="Ball Diameter")
  10. neckDiameter = FloatParam(min=1,max=25.0,presets={'default':6.0},group="Basics", desc="Neck Diameter")
  11. neckLenght = FloatParam(min=1.0,max=25.0,presets={'default':10.0},group="Basics", desc="Neck Lenght (to the center af the ball)")
  12. insertDiameter = FloatParam(min=1.0,max=25.0,presets={'default':4.0},group="Basics", desc="Insert Diameter")
  13. insertLenght = FloatParam(min=0.0,max=25.0,presets={'default':11.0},group="Basics", desc="Insert Lenght")
  14. #
  15. # Other Variables.
  16. # These are used in the script but not exposed to users to change with the GUI
  17. #
  18. # Your build method. It must return a solid object
  19. #
  20. def build():
  21. br = ball.value/2
  22. nr = neckDiameter.value/2
  23. nl = neckLenght.value
  24. ir = insertDiameter.value/2
  25. il = insertLenght.value
  26. result = Workplane("top")
  27. #ball
  28. result = result.circle(br).extrude(br*2,True).edges().fillet((br)-0.01)
  29. #neckball.value/2
  30. result = result.faces(">Y").workplane(offset=-br).circle(nr).extrude(nl,True)
  31. #insert
  32. result = result.faces(">Y").workplane().circle(ir).extrude(il,True)
  33. return result