πŸ”„ The Rotation Technique

Proven Method for 3D Blade Positioning

πŸ’‘ The Key Insight

✨
The breakthrough: The rotation axis is simply the blade line endpoints at Z=0. Not the face normal, not complex centroid tracking - just the two XY points that define where the blade sits.

This technique, discovered in the working 2019 codebase (fxComputeBladeEdge2019.ovm), provides reliable blade positioning that works for both simple and zigzag blade paths.

πŸ“ The Technique

Core Code Pattern

'*** Blade line defined by two points: (xStart, yStart) to (xEnd, yEnd)
'*** These define WHERE the blade sits along the part

'*** STEP 1: LAY BLADE FLAT
'*** Rotate 90Β° around blade line (Z=0 for both points)
sld rotate 1 i_bladeBody w_xStart w_yStart 0 w_xEnd w_yEnd 0 90

'*** STEP 2: SCULPTING ZONE
'*** Do all modification work while blade is flat:
'***   - Edge treatments
'***   - Grippers
'***   - Weight reduction cutouts
'***   - etc.

'*** STEP 3: STAND BLADE BACK UP  
'*** Rotate -90Β° around the SAME axis
sld rotate 1 i_bladeBody w_xStart w_yStart 0 w_xEnd w_yEnd 0 -90

Visual Explanation

SIDE VIEW (Looking along blade line from start to end) Rotation Axis β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ β”‚ β”‚BLADE β”‚ ◄──────────┼──── Blade attached to axis like a door β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ ═════════╧═══════════════╧═══════════════════ Part Surface AFTER ROTATE +90Β°: AFTER ROTATE -90Β° (back): Blade β”Œβ”€β”€β”€β”€β”€β”€β” ═══════════ β”‚ β”‚ ═══════════════════════ ═════│BLADE │═════════════ Part β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”˜ (Blade is FLAT) (Blade VERTICAL)

❌ vs βœ… Approaches Compared

❌ WRONG: Complex Centroid Math

  • Calculate face normal vector
  • Find face centroid in 3D
  • Track centroid through transforms
  • Calculate inverse rotation
  • Apply complex matrix math

Result: Blade ends up in wrong position, complex debugging required.

βœ… RIGHT: Blade Line Rotation

  • Define blade position with two XY points
  • Rotate 90Β° around that line
  • Do work while flat
  • Rotate -90Β° around same line
  • Done!

Result: Blade positions correctly every time, simple and reliable.

πŸ”§ Implementation Details

SLD ROTATE Syntax

sld rotate <copies> <body> <x1> <y1> <z1> <x2> <y2> <z2> <angle_degrees>

Parameters:
  copies  - Number of copies (1 = transform in place)
  body    - Body ID to rotate
  x1,y1,z1 - First point of rotation axis
  x2,y2,z2 - Second point of rotation axis
  angle   - Rotation angle in DEGREES (PEPS uses degrees, not radians)

Critical Points

Point Explanation
Z coordinates = 0 Both axis points use Z=0, keeping the axis in the XY plane
Same axis for both rotations Must use identical endpoints for +90Β° and -90Β° rotations
Degrees not radians PEPS uses degrees for all angle parameters
Store endpoints before extending If extending for overlap mode, save original endpoints first

From Working 2019 Code

'*** From _4fxComputeBladeEdge2019.ovm, line 173:

'*** Lay blade flat:
sld rotate 1 i_bladeBodyMaster w_xStartOfGroup w_yStartOfGroup 0 w_xEndOfGroup w_yEndOfGroup 0 90

'*** The blade line is defined by:
'***   Start: (w_xStartOfGroup, w_yStartOfGroup)
'***   End:   (w_xEndOfGroup, w_yEndOfGroup)

🎯 Why This Works

The blade line represents the physical edge where the blade contacts or aligns with the part. By rotating around this line:

  • The blade pivots like a door on hinges
  • The blade-to-part relationship is preserved
  • No complex coordinate transformations needed
  • The technique is self-reversing (-90Β° undoes +90Β°)
3D VIEW - Blade Pivoting Around Its Line Before (Vertical) During (Rotating) After (Flat) β”‚ β•² ═══════ β”‚ β•² β”‚ Blade β•² Blade Blade β”‚ β•² β”‚ β•² ═══════ ──────┴────── ────────────── ────────────── Part Part Part The blade line (the "hinge") stays fixed; the blade swings around it.

πŸ“‹ Checklist

βœ“ Item
☐ Define blade position with two XY points (start, end)
☐ Store original endpoints before any extension
☐ Build blade solid (vertical, along the line)
☐ Rotate +90° around line (Z=0 for both points)
☐ Perform all modifications while flat
☐ Rotate -90° around SAME line endpoints
☐ Verify blade position visually