Intermediate Tooling:IT Fixture Callbacks

From Macros Wiki
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

INT_TOOL Variables — Intermediate Tooling Fixture Callback

These variables are the interface between GibbsCAM and a fixture macro. The macro must reside in the same folder as the fixture and have the same name except with the .MAC extension. The macro is called once per solid in the fixture. GibbsCAM sets inputs before the macro runs; the macro writes outputs before it exits.

Inputs (set by GibbsCAM, read by the macro)

Variable Type Description
INT_TOOL_NODE_NAME$ string The name of the node (component/assembly node) this fixture belongs to
INT_TOOL_FIXTURE_NAME$ string The name of the fixture item
INT_TOOL_FIXTURE_TYPE$ string The type/category string of the fixture
INT_TOOL_SOLID_NUM int Which solid is currently being processed (1-based). The macro is invoked once per solid; use this to distinguish the first solid from subsequent ones
INT_TOOL_RETURNCODE int Pre-initialized to 999 by the system before the macro runs (acts as a sentinel — if the macro does not set it, the system knows something went wrong)

Outputs (set by the macro, read back by GibbsCAM)

Variable Type Description
INT_TOOL_NUM_COPIES int How many copies/instances of this solid to place. Set to 0 to skip the solid, -1 to explicitly exclude it, max 99
INT_TOOL_MATRIX double array Packed array of 4×3 transformation matrices (12 doubles each). Must be sized INT_TOOL_NUM_COPIES * 12. Each block of 12 doubles is the transform for one copy. Can be declared local or global
INT_TOOL_RETURNCODE int Set to 0 on success. Any non-zero value signals an error back to the engine

How the macro is structured

The typical example is:

degrees

NodeName$    = INT_TOOL_NODE_NAME$       ' read inputs
FixtureName$ = INT_TOOL_FIXTURE_NAME$
FixtureType$ = INT_TOOL_FIXTURE_TYPE$
iSolidNum    = INT_TOOL_SOLID_NUM

' Handle solid #1 specially — it is typically the "base" solid
' placed at the identity (no transform)
if iSolidNum = 1 then global INT_TOOL_MATRIX(12)
if iSolidNum = 1 then get_identity_matrix INT_TOOL_MATRIX
if iSolidNum = 1 then goto done

' For subsequent solids, compute N copies and fill the matrix array
global INT_TOOL_MATRIX(36)               ' 3 copies × 12 = 36
...build mat1, mat2, mat3...
INT_TOOL_MATRIX(i)    = mat1(i)
INT_TOOL_MATRIX(i+12) = mat2(i)
INT_TOOL_MATRIX(i+24) = mat3(i)
iNumCopies = 3

:done
INT_TOOL_NUM_COPIES = iNumCopies         ' write outputs
INT_TOOL_RETURNCODE = 0

Key rules

  • INT_TOOL_MATRIX must be declared (local or global) before the engine reads it back — undeclared or wrong-sized arrays produce error codes -31/-32/-33.
  • The array size must be exactly INT_TOOL_NUM_COPIES * 12 or larger.
  • INT_TOOL_RETURNCODE must be set to 0 for the system to accept the outputs. Leaving it at its initial value of 999 (or any non-zero value) signals failure.