Join Diameter Check  (Check-Mate checker for NX Join fasteners)
==============================================================

What it checks
--------------
For every NX Join fastener (FAS object, Join > Fastener with the "Fastener" option) in the work part
and its components, the diameter of each head-side and tail-side hardware part is compared with the
fastener diameter according to the hardware type:

    BLOCK   greater than the fastener, or no diameter listed       -> PASS
    NUT     equal to the fastener                                   -> PASS
    RING    greater than the fastener                               -> PASS
    SPACER  greater than the fastener, or no diameter listed       -> PASS
    WASHER  greater than the fastener, or no diameter listed       -> PASS
    anything else                                                   -> FAIL

Two diameters within the equality tolerance (default 0.0001 in) are equal. A hardware type outside
the five is NOT APPLICABLE. A missing number the rule needs (a nut or ring with no diameter, a
fastener whose diameter cannot be found, hardware not in any library) is COULD NOT CHECK, logged as a
Check-Mate warning: it is never reported as a pass.

Where the diameters come from
-----------------------------
NX Join stores only the names of a fastener's hardware, not its diameters. The checker reads them
from the hardware library the Join dialog uses:
  * the Hardware.xlsx beside each hardware part (Reuse Library Excel). Columns 'Diameter<...:in|mm>'
    and 'Type' or 'Hardware Type'. 'mapsTo:<column>' cells are read from the part family table.
  * Join hardware XML databases (hardware.xml + specifications\), if you list them in the
    "Hardware XML Databases" parameter.
The library NX recorded on each hardware part decides which is read first.

Install as a Check-Mate checker
-------------------------------
1. Put the "application" folder of this zip in a folder of your choice, e.g. D:\nx_custom\diacheck\application
2. Either set UGII_USER_DIR=D:\nx_custom\diacheck before starting NX, or add D:\nx_custom\diacheck
   to the custom_dirs.dat your site already uses (the checker is found in its "application" folder).
3. Start NX, open the assembly, Analysis > Check-Mate > Set Up Tests. The test is under
   Join > Point Join > "Fastener Hardware Diameter". Customize the parameters if needed and run it.

Run without Check-Mate
----------------------
With the assembly open: File > Execute > NX Open (Alt+F8) and choose run_diacheck.py. The result
goes to the listing window and to <part>_diacheck.json next to the part.

Batch:
    run_journal.exe run_diacheck.py -args D:\path\asm.prt D:\path\report.json
    run_journal.exe ExecuteChecker.py -args D:\path\asm.prt D:\logs [hardware.xml]   (through Check-Mate,
                                                                                    UGII_USER_DIR set as above)

Parameters (Check-Mate customize, or Params() in diacheck_nx.py)
----------------------------------------------------------------
  Equality Tolerance (in)          0.0001   diameters closer than this are equal
  Washer Must Have a Diameter      false    true = description text: a diameterless washer cannot pass
  Type Aliases                     ""       e.g. "Collar=NUT; Lock Washer=WASHER"
  Hardware XML Databases           ""       ;-separated hardware.xml paths
  Extra Hardware Library Folders   ""       ;-separated folders searched for Hardware.xlsx
  Join Subtypes to Check           Fastener ;-separated Join subtype labels
  JSON Report File                 ""       optional full report
  Log Option                       LOG_ERROR

Verified on NX (Designcenter) 2606.5001. Evidence and source: https://diacheck.xcelerator.us
