๐Ÿ“š Macro API Reference

Call Parameters, Modes & Constants

๐Ÿ“‹ Table of Contents

๐Ÿ”ง Global Constants (fxGlobals.var)

Include with: include fxGlobals.var

Blade Profile Input Modes

Constant Value Description
i_BLADE_TWO_POINTS 1 Two XY points define blade line (vertical only)
i_BLADE_POINT_NORMAL_LENGTH 2 Center + normal + explicit length (compound angles)
i_BLADE_POINT_NORMAL_AUTO 3 Center + normal, auto-length (compound angles)

Contact Arc Offset Modes

Constant Value Description
i_FX_CONTACT_ARC_MODE 0 NONE: No offset on contact arcs
1 GRAVITY: Centre moves in gravity direction (default)
2 PERPENDICULAR: Centre moves in averaged normal direction

Gravity Approach Directions

Pass as strings to gravity-aware macros:

String Description
'NONE'No gravity, uniform offset on all faces
'TOP'Blade from above, contact on +Y faces
'BOTTOM'Blade from below, contact on -Y faces (typical fixture)
'LEFT'Blade from left, contact on -X faces
'RIGHT'Blade from right, contact on +X faces
'x y'Custom vector, e.g. '-0.707 -0.707' for 45ยฐ

Scratch Kurve Numbers

Constant Value
i_FX_KURVE_TEMP131900
i_FX_KURVE_TEMP231901
i_FX_KURVE_RESULT31902
i_FX_KURVE_TEST31800

๐Ÿ› Debug Levels (i_FX_DEBUG_LEVEL)

Set in fxGlobals.var to control debug output verbosity:

Level Name Output Use Case
0 OFF No debug messages Production
1 SUMMARY Key milestones, errors, results Default / Testing
2 VERBOSE Full debug output (face-by-face) Development / Debugging
โš ๏ธ Performance Note

Level 2 (VERBOSE) reduces performance significantly due to extensive print output. Use Level 1 for normal testing - it provides 92% reduction in output while maintaining key diagnostics.

โš”๏ธ fxBladeProfileVector

Purpose: Vector-based blade profile generation with compound angle support.

call fxBladeProfileVector i_mode w_p1 w_p2 w_p3 w_p4 w_p5 w_p6 w_p7 i_kurveOut

Mode 1: Two XY Points (Vertical Blade)

Mode 1 i_BLADE_TWO_POINTS

ParameterDescription
w_p1First point X
w_p2First point Y
w_p3First point Z (ignored - uses workspace center)
w_p4Second point X
w_p5Second point Y
w_p6Second point Z (ignored)
w_p7Unused
i_kurveOutStarting kurve number for output

Processing: Uses ORIGINAL rotation logic (proven working). Blade is always vertical.

Mode 2: Point + Normal + Length (Compound Angles)

Mode 2 i_BLADE_POINT_NORMAL_LENGTH

ParameterDescription
w_p1Center point X
w_p2Center point Y
w_p3Center point Z
w_p4Normal vector X (will be normalized)
w_p5Normal vector Y
w_p6Normal vector Z
w_p7Blade length (explicit)
i_kurveOutStarting kurve number for output

Processing: Uses COMPOUND rotation logic. Supports any 3D blade orientation.

Mode 3: Point + Normal + Auto-Length

Mode 3 i_BLADE_POINT_NORMAL_AUTO

ParameterDescription
w_p1-p6Same as Mode 2
w_p7Unused (length computed from workspace extents + overshoot)

Returns

VariableValue
i_returni_OK or i_ERROR
w_returnStarting kurve number
w_return2Total kurves created
$_returnStatus message
๐Ÿ’ก Performance Tip

Mode 2 (30ยฐ compound angle) is approximately 2.5x faster than Mode 1 and produces fewer kurves (19 vs 32).

โฌ‡๏ธ fxTestGravityOffset

Purpose: Test suite for gravity-aware offset using construction geometry approach.

call fxTestGravityOffset i_mode w_xPos
ParameterDescription
i_modeTest mode number (see below)
w_xPosX position offset for test shape (optional, default 0)

Test Modes

ModeShapeApproach
0Simple rectangleBOTTOM
1StaircaseBOTTOM
2Simple rectangleTOP
3StaircaseTOP
4Simple rectangleLEFT
5Simple rectangleRIGHT
6Simple rectangle45ยฐ custom vector
7Diamond shape45ยฐ custom vector
8Simple rectangleNONE (uniform)
9StaircaseNONE (uniform)
10Rounded rectangleBOTTOM
11CircleBOTTOM (fallback)
12Mixed lines/arcsBOTTOM
13Zigzag angled profileBOTTOM
14Scalloped bottomBOTTOM
15Arc-to-Arc tangent waveBOTTOM
16Arc-to-Arc non-tangentBOTTOM (fallback test)
17Asymmetric scallopBOTTOM
18Offset-offset-back blendCorner radii technique
19Contact Arc Mode testNONE
20Contact Arc Mode testGRAVITY
21Contact Arc Mode testPERPENDICULAR

Special Modes

99 Run ALL tests - Executes modes 0-21 sequentially with spacing
100 Multi-direction grid - Tests key shapes in all approach directions

๐Ÿ“ fxProfileToKurve3D

Purpose: Converts a blade profile solid to kurves by extracting cut face edges.

call fxProfileToKurve3D i_profileBody w_centerX w_centerY w_centerZ w_normX w_normY w_normZ i_kurveOut
ParameterDescription
i_profileBodyBody ID of the blade profile solid
w_centerX/Y/ZBlade center position (for rotation origin)
w_normX/Y/ZBlade normal vector
i_kurveOutKurve number for output

Processing Steps

  1. Get slice body center for rotation origin
  2. Rotate slice to XY plane using matrix transform
  3. Find cut faces (planar with Z-aligned normal)
  4. Convert faces to wire bodies (sld cnv ent 6 7)
  5. Convert wire bodies to kurves
  6. Union kurves via mosaic to get outer envelope

Returns

i_returni_OK or i_ERROR
w_returnOutput kurve number
w_return2Number of kurves created
๐Ÿ“ Compound Variant

For compound angles (Modes 2/3), use fxxProfileToKurve3D_Compound instead. Same parameters, different rotation logic.

๐Ÿงช fxRealBladeTest

Purpose: Full blade test harness with hole detection and capping.

call fxRealBladeTest i_partBody
ParameterDescription
i_partBodyPart solid body to generate blades for

Internal Parameters (hardcoded in macro)

VariableValueDescription
w_bladeThick3mmBlade material thickness
w_taperAngle-2.0ยฐTaper angle on pocket faces
w_margin0.5"Overshoot margin
i_pocketMode00=intersection, 1=bbox
i_holeMode10=off, 1=detect and cap

๐Ÿ•ณ๏ธ fxDetectHolesAndCaps

Purpose: Detect holes on gravity-facing side and create caps.

call fxDetectHolesAndCaps i_bladeBody i_partBody i_thinAxis w_capDepth
ParameterDescription
i_bladeBodyBlade solid body
i_partBodyPart solid body (for hole detection)
i_thinAxis0=thin in X, 1=thin in Y
w_capDepthCap thickness (e.g. 6mm)

Cap Mode (Internal)

i_capModeDescription
0CLOSURE SHEET - Single flat slab seals entire bottom
1INDIVIDUAL CAPS - Separate cap per detected hole

Configuration Switches (Internal)

VariableDefaultDescription
w_minRadius0.125"Min radius to qualify as hole (vs fillet)
w_zFilterPct0.5Z height filter (50% from bottom)
w_zCapOffset6mmTotal height of cap above part bottom
w_wallThick3mmWall thickness for hollow caps
w_negativeExtrusion3mmExtension below part bottom
i_skipNonZAxis00=process all axes, 1=skip X/Y holes

๐Ÿ’ง fxMakeWatertight

Purpose: Make a solid body watertight by capping holes.

call fxMakeWatertight i_body i_replaceInput
ParameterDescription
i_bodyBody ID to process
i_replaceInput0=preserve original, 1=delete original after

Variants

MacroDescription
fxMakeWatertightCaps ALL holes
fxMakeWatertightSkipGravityCaps holes except gravity-facing side
โš ๏ธ Critical Note

sld fac rem must process ONE face at a time. Batch mode fails silently. Uses two-pass approach: cylinders (4002) first, then planes (4001).

๐Ÿ“Š VDM Settings Slots

Settings stored in i_VDM_FIXTURE_SETTINGS:

SlotVariableDescription
313i_debugModeDebug mode flag (0/1)
326w_bladeThicknessBlade material thickness
'*** Read setting vdm get i_VDM_FIXTURE_SETTINGS 313 i_debugMode 1 '*** Write setting vdm add i_VDM_FIXTURE_SETTINGS 313 i_debugMode 1