from cadquery import exporters from cq_warehouse.extensions import Workplane from cq_warehouse.fastener import * from cq_warehouse.thread import * from svg_path import addSvgPath from svgpathtools import svg2paths from cqmore.polygon import regularPolygon import cadquery as cq import cqmore Workplane = cqmore.extend(Workplane) Workplane.addSvgPath = addSvgPath probe_diameter = 22.15 # OD of the main probe housing probe_radius = probe_diameter / 2.0 probe_length = 100.0 # length of the probe housing coax_diameter = 7.5 # OD diameter of the coax with insulation coax_radius = coax_diameter / 2.0 ground_cable_diameter = 3.0 ground_cable_radius = ground_cable_diameter / 2.0 wall_width = 2.0 gland_od = 22.0 gland_or = gland_od / 2.0 gland_id = 16 gland_ir = gland_id / 2.0 full_probe = Workplane() full_probe = full_probe.cylinder( probe_length + wall_width * 2, probe_radius + wall_width ) # probe end cap must be 8.8mm longer for the switch probe_end_cap = full_probe.workplane(offset=-4).split(keepTop=True) probe_end_cap = probe_end_cap.workplane(offset=2).cylinder( (probe_length / 2.0) + 6, probe_radius, combine="cut" ) probe_end_cap = probe_end_cap.workplane(offset=-(probe_length / 4.0)).cylinder( 4, coax_radius, combine="cut" ) probe_end_cap = ( probe_end_cap.workplane(offset=-(probe_length / 4.0)) .move(3, 8) .cylinder(4, ground_cable_radius, combine="cut") ) probe_end_cap = ( probe_end_cap.workplane(offset=(probe_length / 2.0) - 24.53) .move(probe_radius, 0) .box(5.6, 5, 9.0, combine="cut") ) # 8.85 and 5.6 are the switch dimensions # Need to add 4.9 mm to this to account for the cable gland, it's 4.9 / 2.0 though cable_end_cap = full_probe.workplane(offset=-4 + 7.4).split(keepBottom=True) cable_end_cap = cable_end_cap.workplane(offset=2 + (2.9 / 2.0)).cylinder( (probe_length / 2.0) - 2.0 + 4.68, probe_radius, combine="cut" ) cable_end_cap = cable_end_cap.workplane(offset=-(probe_length / 5.0)).cylinder( 11, gland_ir, combine="cut" ) # led hole should be 11.0 mm from end + width of the end ring cable_end_cap = ( cable_end_cap.workplane(offset=-(probe_length / 6.0) + 12.74) .move(12, 0) .sphere(2.5, combine="cut") ) cq.exporters.export( cable_end_cap, "/home/deck/model_files/carlson_probe_cable_end_cap.stl" ) cq.exporters.export( probe_end_cap, "/home/deck/model_files/carlson_probe_probe_end_cap.stl" ) try: # show_object(probe_end_cap) show_object(cable_end_cap) except NameError: pass