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>
Add DRAW_OUTER_BOUNDARY flag (default: False) to import_profile.py.
When False (default): only pocket profiles + holes are imported into the
sketch. This is the correct mode when subtracting rib pockets from an
existing solid body — the sandbox perimeter is not needed and would create
unwanted edges in the part.
When True: full profile including sandbox perimeter (original behavior,
for standalone plate creation only).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Root cause: typed segment offsetting created self-intersecting geometry at
concave corners (notches). Triangle's PSLG boundary didn't match the plotted
inset contour, allowing vertices 7+ mm outside.
Changes:
- _build_inner_plate: always use Shapely buffer(-w_frame) (robust at concavities)
- _sample_ring: use simplified polygon vertices + interpolated points on long edges
(preserves tight features without vertex clustering)
- Plot uses same inner_plate from triangulation (no mismatch)
- Post-process: snap any residual outside vertices to boundary
- Result: 0 vertices outside inner plate (was 10, up to 7.45mm)
The clockwise flag from NX extractor can be inverted depending on face
normal orientation. The sampled mid-point is always reliable. Now
_arc_angles checks which direction (CW vs CCW) passes through the
mid-point and uses that.
Detects pairs of consecutive 135° vertices (characteristic of filleted
90° corners) and reconstructs circular arcs from tangent-perpendicular
intersection. Verified on sandbox 2: 2 arcs detected at R=7.5mm with
correct centers. Chain continuity validated.
When arcs are detected, v1 boundaries get promoted to v2 typed segments
and the polyline is re-densified with proper arc interpolation.
- Add explicit corner vertices of the inset boundary (w_frame offset) to Delaunay point set
- This guarantees no triangle can cross a boundary corner
- Updated test_data geometry files to v2.0 format with typed segments
- Sandbox 2 now has proper arc curves (4 arc segments) from extract_sandbox
- Preserved holes from v1.0 geometry
- Boundary vertices also enforced on keepout boundaries
profile_assembly.py now checks each pocket's polyline against the plate
boundary using Shapely contains(). Pockets extending outside are dropped.
Sandbox 1: 1 pocket removed (was crossing corner near x=150, y=-20).
Reverts to drawing outer boundary + pocket outlines (3 lines + 3 arcs
per pocket) + bolt hole circles. These are the red curves from the
Brain plot. NX sketch regions between outer boundary and pocket/hole
outlines define the rib web material for extrusion.
The rib_web Shapely approach was wrong: it approximated arcs as dense
polylines, losing the clean geometry.
Brain: profile_assembly.py now exports 'rib_web' — the actual material
geometry from Shapely boolean (exterior + interior rings). This is the
rib shape, not the pocket cutouts.
import_profile.py: prefers rib_web when available, drawing exterior +
interior polyline rings directly. Falls back to pocket-based drawing
for older rib JSONs without rib_web.
Cross product of (start-center) × (end-center) is zero for 180° arcs,
causing random clockwise assignment. Now samples actual midpoint via
UF Eval at t_mid, stores as 'mid' in JSON. Import prefers 'mid' over
computed clockwise direction.
0.1mm was generating thousands of unnecessary points on straight
edges. Now: 1mm default, 0.5mm minimum, 500 max per edge.
Curves still get proper sampling, straight edges stay lean.
NXOpen Python wraps UF methods with version-specific names.
Now dumps available methods on UF.Modl, UF.Eval, UF.Curve
and tries them in order. Detailed logging shows which method
was found and used, plus raw result format on parse failures.
UF_EVAL.Evaluate() doesn't exist in NXOpen Python.
UF_MODL.AskCurveProps(tag, param) uses normalized 0-1
parameter and returns (point, tangent, normal, binormal,
torsion, radius). Works on all edge types.
- Uses ISOGRID_RIB_sandbox_N_thk expression for thickness
- Creates expression if missing, uses existing if present
- Symmetric extrude: ±thk/2 from sketch plane
- Fallback to literal value if expression fails
- Create section explicitly if builder.Section returns None
- Try 3 approaches for adding curves: CreateRuleCurveFeature,
CreateRuleCurveDumb with options, CreateRuleCurveDumb without
- Detailed step-by-step logging for debugging
- Get help point from first sketch curve for section seeding
Full cycle now automated:
1. Delete old extrude (if exists)
2. Delete old sketch (try ReplaceFeatureBuilder first, fallback to delete)
3. Create new sketch with rib geometry
4. Extrude new sketch by rib thickness along face normal
5. Name both features for identification on next iteration
Rib thickness read from profile JSON (parameters_used.thickness)
with fallback to geometry JSON or default 10mm.
No more manual extrude step needed between iterations.
Replaces naive ReplaceEntity approach with NX's proper
ReplaceFeatureBuilder API. This mirrors the interactive
right-click → Replace Feature workflow:
- SelectFeature: old sketch to replace
- ReplacementFeature: new sketch taking over
- DoAutomaticGeomMatch: auto-maps curves
- DeleteOriginalFeature: removes old after remap
- Fallback: manual delete if builder fails
All downstream features (extrude, trim) automatically
re-reference the new sketch.