11 changed files with 136 additions and 46 deletions
@ -0,0 +1,57 @@ |
|||||
|
from cadquery import exporters |
||||
|
from cq_warehouse.extensions import Workplane |
||||
|
import cadquery as cq |
||||
|
|
||||
|
result = Workplane() |
||||
|
|
||||
|
length = 27 |
||||
|
width = 10 |
||||
|
height = 30 |
||||
|
|
||||
|
rod_diameter = 11.0 |
||||
|
rod_height = 150 |
||||
|
rod_radius = rod_diameter / 2.0 |
||||
|
|
||||
|
female_hole_height = rod_height / 3.0 |
||||
|
|
||||
|
rod_female = Workplane() |
||||
|
rod_female = rod_female.cylinder(rod_height, rod_radius) |
||||
|
|
||||
|
rod_female = rod_female.workplane( |
||||
|
offset=(rod_height / 2.0) - female_hole_height / 2 |
||||
|
).cylinder(female_hole_height, (rod_radius / 2.0) + 0.15, combine="cut") |
||||
|
|
||||
|
rod_female = rod_female.workplane( |
||||
|
offset=-(rod_height / 2.0) - (female_hole_height / 2) + 20 |
||||
|
).cylinder(female_hole_height - 10, rod_radius / 2.0) |
||||
|
|
||||
|
rod_male = Workplane() |
||||
|
rod_male = rod_male.cylinder(rod_height, rod_radius) |
||||
|
rod_male = rod_male.workplane( |
||||
|
offset=(rod_height / 2.0) + (female_hole_height / 2) - 10 |
||||
|
).cylinder(female_hole_height - 10, rod_radius / 2.0) |
||||
|
|
||||
|
# l, w, h |
||||
|
result = result.box(length, width, height) |
||||
|
|
||||
|
result = ( |
||||
|
result.workplane(offset=-13) |
||||
|
.center(0, 0) |
||||
|
.box(length / 2, width, height + 7.73, combine="cut") |
||||
|
) |
||||
|
result = ( |
||||
|
result.workplane(offset=-30) |
||||
|
.center(10, 0) |
||||
|
.box(length / 2, width, height, combine="cut") |
||||
|
) |
||||
|
result = result.workplane(offset=-height / 2).center(-30, -2.5).box(20, 5, 5) |
||||
|
result = result.workplane(offset=-height / 2 + 10).center(-7.5, 0).box(5, 5, 20) |
||||
|
|
||||
|
cq.exporters.export(result, "/home/deck/model_files/curtain_holder.step") |
||||
|
cq.exporters.export(rod_female, "/home/deck/model_files/curtain_rod_female.step") |
||||
|
cq.exporters.export(rod_male, "/home/deck/model_files/curtain_rod_male.step") |
||||
|
|
||||
|
try: |
||||
|
show_object(result) |
||||
|
except NameError: |
||||
|
pass |
Loading…
Reference in new issue