by Nadesj 3 years, 3 months ago
6 times 2.18s avg. build time

Funnel experiment

Click to change title and description

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

Log in to download models or make your own copy!

Auto Apply Changes

  1. # Lofty Cup
  2. # By Spencer Bliven
  3. #
  4. # A simple flared cup with a sturdy base.
  5. # Change the aspect ratio for different degrees of flare!
  6. #
  7. # Important MetaData
  8. #
  9. UOM = "mm"
  10. #
  11. # PARAMETERS and PRESETS
  12. # These parameters can be manipulated by end users
  13. #
  14. height = FloatParam(min=10.0,max=500.0,presets={'default':60.0},group="Basics", desc="Total height of cup")
  15. topWidth = FloatParam(min=10.0,max=500.0,presets={'default':50.0},group="Basics", desc="diameter of the cup at the top")
  16. baseHeight = FloatParam(min=.1,max=500.0,presets={'default':8.0},group="Advanced", desc="Thickness of the base")
  17. wallThickness = FloatParam(min=.1,max=500.0,presets={'default':2.0},group="Advanced", desc="Thickness of cup edges")
  18. #
  19. # Your build method. It must return a solid object
  20. #
  21. def build():
  22. topRadius = topWidth.value/2.
  23. baseRadius = 50
  24. cupHeight = height.value
  25. cup = Workplane("front").circle(baseRadius)
  26. cup = cup.workplane(offset=baseHeight.value).circle( baseRadius )
  27. cup = cup.workplane(offset=cupHeight).circle(topRadius)
  28. cup = cup.loft(combine=True)
  29. ##tried to do this with intersections to preserve curvature, but they're not implemented
  30. #base = cup.faces("<Z").box(baseRadius*2.+1.0,baseRadius*2.+1.0,baseHeight.value*2.,combine=False)
  31. #base = base.common(cup)
  32. cup = cup.faces(">Z").shell(wallThickness.value)
  33. base = cup.faces("<Z").circle(baseRadius).extrude(baseHeight.value)
  34. #result = cup.add(base).combineSolids()
  35. result = base
  36. return result