|
|
@ -13,23 +13,25 @@ import cqmore |
|
|
|
base_diameter = 100 |
|
|
|
base_radius = base_diameter / 2 |
|
|
|
|
|
|
|
band_diameter = 50 |
|
|
|
band_radius = band_diameter / 2 |
|
|
|
stand_diameter = 38 |
|
|
|
stand_radius = stand_diameter / 1.5 |
|
|
|
|
|
|
|
clock_diameter = 35 |
|
|
|
clock_radius = clock_diameter / 2 |
|
|
|
|
|
|
|
winding_knob_dist = clock_radius |
|
|
|
band_width = 18.13 |
|
|
|
band_width = 21 |
|
|
|
|
|
|
|
band_diameter = 55 |
|
|
|
band_radius = band_diameter / 2 |
|
|
|
|
|
|
|
first_circle_height = 120 # how tall the horizontal circle part will be |
|
|
|
first_circle_height = 175 # how tall the horizontal circle part will be |
|
|
|
|
|
|
|
Workplane = cqmore.extend(Workplane) |
|
|
|
Workplane.addSvgPath = addSvgPath |
|
|
|
|
|
|
|
stand_base = Workplane() |
|
|
|
|
|
|
|
stand_base = stand_base.cylinder(first_circle_height, band_radius) |
|
|
|
stand_base = Workplane("ZY") |
|
|
|
holder_part = Workplane("XY") |
|
|
|
|
|
|
|
simple = False |
|
|
|
|
|
|
@ -37,32 +39,82 @@ screw = ButtonHeadScrew( |
|
|
|
size="M16-2", fastener_type="iso7380_1", length=20 * MM, simple=simple |
|
|
|
) |
|
|
|
|
|
|
|
scaled_screw = screw.scale(0.90) |
|
|
|
thread_scaled_screw = screw.scale(0.5) |
|
|
|
scaled_screw = screw.scale(1.00) |
|
|
|
small_scaled_screw = scaled_screw.scale(0.5) |
|
|
|
|
|
|
|
screw_thread = Workplane("YZ").workplane(offset=60).move(0, 40).cylinder(100, 10).threadedHole( |
|
|
|
screw, 30, simple=simple, fit="Loose" |
|
|
|
) |
|
|
|
|
|
|
|
screw_thread = screw_thread.workplane(offset=45).center(0, 50).sphere(55, combine="cut") |
|
|
|
stand_base = stand_base.cylinder(first_circle_height, stand_radius) |
|
|
|
|
|
|
|
stand_base = stand_base.union(screw_thread) |
|
|
|
stand_base = ( |
|
|
|
stand_base.workplane(offset=-70) |
|
|
|
.move(0, 21) |
|
|
|
.box(20, 25, 20) |
|
|
|
.workplane(offset=-69) |
|
|
|
.transformed((90, 0, 0), (0, 0, 0)) |
|
|
|
.threadedHole(screw, 34, simple=simple, fit="Loose") |
|
|
|
) |
|
|
|
|
|
|
|
stand_base = stand_base.faces(">Z[0]").sphere(base_radius) |
|
|
|
stand_base = stand_base.workplane(offset=base_radius).box( |
|
|
|
base_diameter, base_radius * 2, base_radius * 2, combine="cut" |
|
|
|
stand_base = stand_base.faces(">X[0]").sphere(base_radius*1.5) |
|
|
|
stand_base = stand_base.workplane(offset=base_radius*2).box( |
|
|
|
base_diameter * 2, base_radius * 3, base_radius * 3, combine="cut" |
|
|
|
) |
|
|
|
|
|
|
|
stand_base = ( |
|
|
|
stand_base.workplane(offset=base_radius - 10) |
|
|
|
.rect(base_radius, base_radius, forConstruction=True) |
|
|
|
stand_base.workplane(offset=base_radius - 5) |
|
|
|
.rect(base_radius*1.5, base_radius*1.5, forConstruction=True) |
|
|
|
.vertices() |
|
|
|
.cylinder(5, 5, combine="cut") |
|
|
|
.cylinder(9, 6, combine="cut") |
|
|
|
) |
|
|
|
|
|
|
|
holder_angle_offset = 67 |
|
|
|
|
|
|
|
clock_paths, clock_attributes = svg2paths("/home/deck/cad_files/svgs/clock.svg") |
|
|
|
|
|
|
|
svgs_to_render = [(clock_paths, (-50, -125, 46), "cut", "XY")] |
|
|
|
|
|
|
|
holder_part = ( |
|
|
|
holder_part.workplane(offset=2) |
|
|
|
.makePolygon( |
|
|
|
regularPolygon( |
|
|
|
nSides=12, |
|
|
|
radius=band_radius, |
|
|
|
thetaStart=holder_angle_offset, |
|
|
|
thetaEnd=360 + holder_angle_offset, |
|
|
|
) |
|
|
|
) |
|
|
|
.extrude(band_width) |
|
|
|
) |
|
|
|
|
|
|
|
holder_part = holder_part.faces(">Z[0]").cylinder(5, 8).union(small_scaled_screw) |
|
|
|
|
|
|
|
if True: |
|
|
|
image_objects = [] |
|
|
|
for svg_paths, translate_offsets, combine, planes in svgs_to_render: |
|
|
|
image_objects.append( |
|
|
|
Workplane(planes) |
|
|
|
.center(0, 75) |
|
|
|
.addSvgPath(svg_paths[0]) |
|
|
|
.extrude(-2.0) |
|
|
|
.translate(translate_offsets) |
|
|
|
) |
|
|
|
|
|
|
|
for image_object in image_objects: |
|
|
|
image_object = image_object.val().scale(0.5) |
|
|
|
if combine == "cut": |
|
|
|
holder_part = holder_part.cut(image_object, clean=False) |
|
|
|
if combine == "union": |
|
|
|
holder_part = holder_part.union(image_object, clean=False) |
|
|
|
|
|
|
|
cq.exporters.export(stand_base, "/home/deck/model_files/watch_stand_base.step") |
|
|
|
cq.exporters.export(scaled_screw, "/home/deck/model_files/watch_stand_screw.step") |
|
|
|
cq.exporters.export( |
|
|
|
small_scaled_screw, "/home/deck/model_files/watch_stand_screw_small.step" |
|
|
|
) |
|
|
|
cq.exporters.export(holder_part, "/home/deck/model_files/watch_stand_holder.step") |
|
|
|
|
|
|
|
try: |
|
|
|
show_object(stand_base) |
|
|
|
# show_object(cut_polygon) |
|
|
|
#show_object(holder_part) |
|
|
|
except NameError: |
|
|
|
pass |
|
|
|