|
|
@@ -0,0 +1,107 @@
|
|
|
+
|
|
|
+import cadquery as cq
|
|
|
+from cq_warehouse.thread import (
|
|
|
+ IsoThread
|
|
|
+)
|
|
|
+from ocp_vscode import show, show_object
|
|
|
+from cadquery.occ_impl.exporters import ExportTypes
|
|
|
+
|
|
|
+MM = 1
|
|
|
+IN = 25.4 * MM
|
|
|
+
|
|
|
+distance = 10 * MM
|
|
|
+
|
|
|
+seal_diam = 8.2 * MM
|
|
|
+seal_depth = 5.4 * MM
|
|
|
+seal_torus_diam = 1.5 * MM
|
|
|
+cartridge_small_diam = 7.7 * MM
|
|
|
+cartridge_small_depth = 7 * MM
|
|
|
+cartridge_large_diam = 8.9 * MM
|
|
|
+cartridge_large_depth = 3.7 * MM
|
|
|
+
|
|
|
+eps = 0.1 * MM
|
|
|
+
|
|
|
+iso_external_thread = IsoThread(
|
|
|
+ major_diameter=7 * MM,
|
|
|
+ pitch=1 * MM,
|
|
|
+ length=8 * MM,
|
|
|
+ external=True,
|
|
|
+ end_finishes=("chamfer", "chamfer"),
|
|
|
+)
|
|
|
+
|
|
|
+iso_external_core = (
|
|
|
+ cq.Workplane("XY")
|
|
|
+ .circle(iso_external_thread.min_radius)
|
|
|
+ .extrude(iso_external_thread.length)
|
|
|
+)
|
|
|
+iso_external = iso_external_thread.cq_object.fuse(iso_external_core.val())
|
|
|
+
|
|
|
+housing_diameter = cartridge_large_diam * 1.5
|
|
|
+housing = (
|
|
|
+ cq.Workplane("XY")
|
|
|
+ .rect(housing_diameter, housing_diameter)
|
|
|
+ .workplane(offset=iso_external_thread.length + distance)
|
|
|
+ .center(0, housing_diameter/2)
|
|
|
+ .rect(housing_diameter, housing_diameter * 2)
|
|
|
+ .workplane(offset=iso_external_thread.length)
|
|
|
+ .rect(housing_diameter, housing_diameter * 2)
|
|
|
+ .loft()
|
|
|
+)
|
|
|
+# Side A
|
|
|
+housing = housing.cut(iso_external)
|
|
|
+# Side B
|
|
|
+housing = housing.cut(iso_external.translate((0, 0, iso_external_thread.length + distance)))
|
|
|
+# Cartidge hole
|
|
|
+housing = (
|
|
|
+ housing.faces(">Z")
|
|
|
+ .workplane(centerOption="CenterOfBoundBox")
|
|
|
+ .center(0, housing_diameter/2)
|
|
|
+ .circle(cartridge_large_diam / 2)
|
|
|
+ .cutBlind(-cartridge_large_depth)
|
|
|
+)
|
|
|
+housing = (
|
|
|
+ housing.faces(">Z")
|
|
|
+ .workplane(centerOption="CenterOfBoundBox")
|
|
|
+ .center(0, housing_diameter/2)
|
|
|
+ .circle(cartridge_small_diam / 2)
|
|
|
+ .cutBlind(-cartridge_small_depth)
|
|
|
+)
|
|
|
+# seal as torus
|
|
|
+seal = (
|
|
|
+ cq.Workplane('XZ', origin = (seal_diam/2, 0, 0))
|
|
|
+ .circle(seal_torus_diam/2)
|
|
|
+ .revolve(360, (-seal_diam/2, 0, 0), (-seal_diam/2, 1, 0))
|
|
|
+)
|
|
|
+seal_position = iso_external_thread.length*2 + distance - seal_depth
|
|
|
+seal_moved = seal.translate((0, housing_diameter, seal_position))
|
|
|
+housing = housing.cut(seal_moved)
|
|
|
+
|
|
|
+# straight channel
|
|
|
+housing = (
|
|
|
+ housing.faces("<Z")
|
|
|
+ .circle(iso_external_thread.min_radius)
|
|
|
+ .cutThruAll()
|
|
|
+)
|
|
|
+
|
|
|
+sweep = (
|
|
|
+ housing.faces(">Z")
|
|
|
+ .workplane(centerOption="CenterOfBoundBox", offset=-cartridge_small_depth)
|
|
|
+ .center(0, housing_diameter/2)
|
|
|
+ .circle(cartridge_small_diam / 2)
|
|
|
+ .workplane(offset=cartridge_small_diam/2-(iso_external_thread.length + distance/2))
|
|
|
+ .center(0, -housing_diameter)
|
|
|
+ .transformed(rotate=(-90, 0, 0))
|
|
|
+ .circle(seal_diam / 2)
|
|
|
+ .loft(combine=False)
|
|
|
+)
|
|
|
+housing = housing.cut(sweep)
|
|
|
+
|
|
|
+
|
|
|
+# show_object(iso_external_thread.cq_object, name="iso_external_thread")
|
|
|
+# show_object(iso_external_core, name="iso_external_core")
|
|
|
+# show_object(iso_external, name="iso_external")
|
|
|
+show_object(housing, name="housing")
|
|
|
+
|
|
|
+
|
|
|
+with open(r"t_connector.step", "w") as fp:
|
|
|
+ cq.exporters.exportShape(housing, ExportTypes.STEP, fp)
|