hole_wizard
Drill ISO metric tapped or counterbore holes on a selected face. Accepts fastener size (M5–M12) and automatically computes thread and hole geometry using standard databases.
Instructions
Asistente de barrenos (Hole Wizard) — drill ONE standard ISO Metric hole on a face: tapped (con rosca) or counterbore (refrentado para tornillo socket).
Junior workflow: "agrega un barreno M8 con rosca en esta cara, profundidad 15mm". Tool replaces manual drill-diameter lookup (ISO 273 / ISO 2306) — pass the fastener size and SW reads geometry from its Toolbox database.
Args: hole_type: One of: - 'tap' (rosca): tapped (threaded) hole. Sizes M5–M12. - 'counterbore' (cilindro avellanado / refrentado): for socket-head cap screws (tornillo de cabeza cilíndrica con hueco hexagonal). Sizes M5–M10. size: ISO fastener nominal — 'M5','M6','M8','M10','M12' for tap; 'M5','M6','M8','M10' for counterbore. face_centroid_mm: Face to drill into. Pass a centroid from list_faces() (matched within 0.01mm tolerance). The hole is placed at the face's local origin (where SW positions it by default). end_condition: 'blind' (depth-controlled, depth_mm required) or 'through_all' (passes through the entire body, depth ignored). depth_mm: Hole depth for end_condition='blind'. Required if blind. For tapped holes, this is the FULL hole depth; SW computes thread depth from the toolbox. thread_class: ISO 965 thread tolerance class for tapped holes. Default '6H' (standard internal thread for steel/aluminum brackets). Ignored for counterbore.
Returns dict with name (e.g. 'Taladro roscado M81' or 'Refrentado para tornillo con cabeza hueca de M81' on Spanish-locale SW), type 'hole_wizard', and dimensions {'D1': diameter_mm, 'D2': depth_mm}.
Caveat (v1 limitations):
Requires SOLIDWORKS Toolbox add-in to be loaded. If not, raises a clean error pointing to Herramientas > Complementos.
Single hole per call at the face's centroid. For multi-hole patterns (e.g. 4 corner mounting holes), use add_bolt_circle (clearance) or call hole_wizard once per distinct face. Multi- position via sketch points is deferred to a later batch.
Clearance through-holes are NOT supported in v1 — SW's swWzdHole API path silently rejects all FTI/SSize combinations on this binding. Use add_bolt_circle (clearance, multi-position) or extrude_cut on a sketched circle for clearance holes.
End-face guard: rejects a centroid that isn't on the bbox extreme along the face normal (a stale
list_facescentroid), and a post-call bbox-shrink check auto-undos + raises if the hole consumed more than the requested depth — a known HoleWizard5 surprise on the end face of a multi-step shaft. Workaround there:add_drill_patternorextrude_cuton the end face.
Example — single M8 tap on a 50×50 mounting face: faces = list_faces() top = max((f for f in faces if f['normal'][2] > 0.9), key=lambda f: f['centroid_mm'][2]) hole_wizard('tap', 'M8', face_centroid_mm=top['centroid_mm'], end_condition='blind', depth_mm=15.0)
Example — M6 counterbore for a socket-head cap screw: hole_wizard('counterbore', 'M6', face_centroid_mm=top['centroid_mm'], end_condition='blind', depth_mm=8.0)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| size | Yes | ||
| depth_mm | No | ||
| hole_type | Yes | ||
| thread_class | No | 6H | |
| end_condition | No | blind | |
| face_centroid_mm | Yes |