feat(isogrid): Add DRAW_HOLES flag to skip bolt holes in NX import

Default: DRAW_HOLES = False (holes already exist in the solid body).

Config block in import_profile.py is now:
  DRAW_OUTER_BOUNDARY = False  (sandbox perimeter — not needed for subtract)
  DRAW_HOLES          = False  (bolt holes — already in existing body)

Sketch now imports ONLY the rib pocket profiles, ready for Subtract extrude.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-18 09:49:08 -05:00
parent 98774453b3
commit a9c40368d3

View File

@@ -44,6 +44,9 @@ DEFAULT_RIB_THICKNESS = 10.0 # mm, fallback if not in profile JSON
# Set to True only for standalone plate creation (no existing body).
DRAW_OUTER_BOUNDARY = False
# Set to False to skip bolt hole circles (they already exist in the solid body).
DRAW_HOLES = False
# ---------------------------------------------------------------------------
# Geometry helpers
@@ -878,29 +881,32 @@ def main():
lister.WriteLine(f"[import] Pockets done: {total_lines} lines + {total_arcs} arcs")
# Holes (bolt circles) — drawn as two semicircular arcs each
holes = profile.get("holes", [])
if holes:
holes_drawn = 0
for hole in holes:
try:
cx, cy = hole["center"]
r = hole.get("radius", hole.get("diameter", 0) / 2.0)
p1 = [cx + r, cy]
p2 = [cx, cy + r]
p3 = [cx - r, cy]
p4 = [cx, cy - r]
p1_3d = unproject_point_to_3d(p1, transform)
p2_3d = unproject_point_to_3d(p2, transform)
p3_3d = unproject_point_to_3d(p3, transform)
p4_3d = unproject_point_to_3d(p4, transform)
_draw_arc_3pt(work_part, p1_3d, p2_3d, p3_3d)
_draw_arc_3pt(work_part, p3_3d, p4_3d, p1_3d)
holes_drawn += 1
total_arcs += 2
except Exception as exc:
lister.WriteLine(f"[import] WARN: hole failed: {exc}")
lister.WriteLine(f"[import] Holes: {holes_drawn}/{len(holes)} drawn ({holes_drawn*2} arcs)")
# Holes (bolt circles)
if DRAW_HOLES:
holes = profile.get("holes", [])
if holes:
holes_drawn = 0
for hole in holes:
try:
cx, cy = hole["center"]
r = hole.get("radius", hole.get("diameter", 0) / 2.0)
p1 = [cx + r, cy]
p2 = [cx, cy + r]
p3 = [cx - r, cy]
p4 = [cx, cy - r]
p1_3d = unproject_point_to_3d(p1, transform)
p2_3d = unproject_point_to_3d(p2, transform)
p3_3d = unproject_point_to_3d(p3, transform)
p4_3d = unproject_point_to_3d(p4, transform)
_draw_arc_3pt(work_part, p1_3d, p2_3d, p3_3d)
_draw_arc_3pt(work_part, p3_3d, p4_3d, p1_3d)
holes_drawn += 1
total_arcs += 2
except Exception as exc:
lister.WriteLine(f"[import] WARN: hole failed: {exc}")
lister.WriteLine(f"[import] Holes: {holes_drawn}/{len(holes)} drawn ({holes_drawn*2} arcs)")
else:
lister.WriteLine(f"[import] Holes skipped (DRAW_HOLES=False)")
lister.WriteLine(f"[import] Total: {total_lines} lines + {total_arcs} arcs")
@@ -928,28 +934,29 @@ def main():
lister.WriteLine(f"[import] Done: {total_lines} lines in sketch")
# Holes for legacy fallback
holes = profile.get("holes", [])
if holes:
holes_drawn = 0
for hole in holes:
try:
cx, cy = hole["center"]
r = hole["diameter"] / 2.0
p1 = [cx + r, cy]
p2 = [cx, cy + r]
p3 = [cx - r, cy]
p1_3d = unproject_point_to_3d(p1, transform)
p2_3d = unproject_point_to_3d(p2, transform)
p3_3d = unproject_point_to_3d(p3, transform)
_draw_arc_3pt(work_part, p1_3d, p2_3d, p3_3d)
p4 = [cx, cy - r]
p4_3d = unproject_point_to_3d(p4, transform)
_draw_arc_3pt(work_part, p3_3d, p4_3d, p1_3d)
holes_drawn += 1
total_lines += 2 # counting as arcs but reusing counter
except Exception as exc:
lister.WriteLine(f"[import] WARN: hole {hole.get('index','?')} failed: {exc}")
lister.WriteLine(f"[import] Holes: {holes_drawn}/{len(holes)} drawn")
if DRAW_HOLES:
holes = profile.get("holes", [])
if holes:
holes_drawn = 0
for hole in holes:
try:
cx, cy = hole["center"]
r = hole["diameter"] / 2.0
p1 = [cx + r, cy]
p2 = [cx, cy + r]
p3 = [cx - r, cy]
p1_3d = unproject_point_to_3d(p1, transform)
p2_3d = unproject_point_to_3d(p2, transform)
p3_3d = unproject_point_to_3d(p3, transform)
_draw_arc_3pt(work_part, p1_3d, p2_3d, p3_3d)
p4 = [cx, cy - r]
p4_3d = unproject_point_to_3d(p4, transform)
_draw_arc_3pt(work_part, p3_3d, p4_3d, p1_3d)
holes_drawn += 1
total_lines += 2
except Exception as exc:
lister.WriteLine(f"[import] WARN: hole {hole.get('index','?')} failed: {exc}")
lister.WriteLine(f"[import] Holes: {holes_drawn}/{len(holes)} drawn")
# Deactivate sketch
try: