diff --git a/apps/catalog/app/shared/fusion-library.test.ts b/apps/catalog/app/shared/fusion-library.test.ts index ae5607d..8cc3f0c 100644 --- a/apps/catalog/app/shared/fusion-library.test.ts +++ b/apps/catalog/app/shared/fusion-library.test.ts @@ -19,14 +19,16 @@ const tool = (over: Partial = {}): CatalogTool => const holder = { guid: '973eaa5d-4474-46c8-aaac-d89dcefcaa0f', brand: 'Kennametal', - catalogNumber: 'BT30ER16060M', - noseDiameter: 28, - noseLength: 20, - bodyDiameter: 34, - bodyLength: 15, + catalogNumber: 'BT 30 / PG 6 x 050', + // REGO-FIX's BT30 B4 gage length includes the 48.4 mm spindle-side taper. + // Fusion's holder gage is the sum of the below-spindle segments (B3). + gaugeLength: 98.4, + noseDiameter: 10, + noseLength: 10.55, + bodyDiameter: 12.02, + bodyLength: 9.6, flangeDiameter: 46, - projection: 60, - gaugeLength: 44, + projection: 50, } as unknown as Holder const ids = (): (() => string) => { @@ -49,17 +51,17 @@ describe('the order list as a Fusion library', () => { CSP: false, HAND: true, LB: 31, - assemblyGaugeLength: 75, + assemblyGaugeLength: 81, 'shoulder-length': 19, 'shoulder-diameter': 8, }) expect(first.holder).toMatchObject({ type: 'holder', - gaugeLength: 44, + gaugeLength: 50, segments: [ - { height: 20, 'lower-diameter': 28, 'upper-diameter': 28 }, - { height: 15, 'lower-diameter': 34, 'upper-diameter': 34 }, - { height: 25, 'lower-diameter': 46, 'upper-diameter': 46 }, + { height: 10.55, 'lower-diameter': 10, 'upper-diameter': 10 }, + { height: 9.6, 'lower-diameter': 12.02, 'upper-diameter': 12.02 }, + { height: 29.85, 'lower-diameter': 46, 'upper-diameter': 46 }, ], }) expect(first['start-values'].presets).toHaveLength(3) @@ -171,6 +173,7 @@ describe('the order list as a Fusion library', () => { expect(result.library.data).toHaveLength(1) expect(result.library.data[0]?.holder).toBeUndefined() + expect(result.library.data[0]?.geometry.assemblyGaugeLength).toBe(27) expect(result.holderWarnings[0]?.reason).toContain('no complete published Fusion shape') }) }) diff --git a/apps/catalog/app/shared/fusion-library.ts b/apps/catalog/app/shared/fusion-library.ts index daf5795..3728d58 100644 --- a/apps/catalog/app/shared/fusion-library.ts +++ b/apps/catalog/app/shared/fusion-library.ts @@ -131,7 +131,10 @@ const missingGeometry = (tool: CatalogTool): Array => { return codes.filter((code) => !validNumber(tool.geometry[code])) } -const geometryOf = (line: LibraryLine): Record => { +const geometryOf = ( + line: LibraryLine, + holderGaugeLength: number, +): Record => { const { tool } = line const setout = line.stickout ?? tool.geometry.LBH const geometry: Record = { @@ -145,7 +148,7 @@ const geometryOf = (line: LibraryLine): Record => { LB: setout!, 'shoulder-length': tool.geometry['shoulder-length'] ?? tool.geometry.LCF!, 'shoulder-diameter': tool.geometry['shoulder-diameter'] ?? tool.geometry.SFDM!, - assemblyGaugeLength: setout! + (line.holder?.gaugeLength ?? 0), + assemblyGaugeLength: setout! + holderGaugeLength, } for (const code of ['RE', 'SIG', 'TA', 'TP', 'TPX', 'TPN', 'NT', 'tip-diameter'] as const) { const value = tool.geometry[code] @@ -161,9 +164,13 @@ const geometryOf = (line: LibraryLine): Record => { const holderOf = (holder: Holder, nextGuid: () => string): FusionHolder | null => { const segments = segmentsOf(holder) - if (segments.length === 0 || !validNumber(holder.gaugeLength)) { + if (segments.length === 0) { return null } + // Fusion measures a holder from the sum of the geometry it receives. The + // catalog's gaugeLength can include the spindle-side taper (BT30 B4 does), + // which this deliberately below-spindle silhouette does not export. + const gaugeLength = segments.reduce((total, segment) => total + segment.height, 0) return { guid: nextGuid(), type: 'holder', @@ -171,7 +178,7 @@ const holderOf = (holder: Holder, nextGuid: () => string): FusionHolder | null = description: `${holder.brand} ${holder.catalogNumber}`, vendor: holder.brand, 'product-id': holder.catalogNumber, - gaugeLength: holder.gaugeLength, + gaugeLength, segments, } } @@ -249,7 +256,7 @@ export const fusionLibrary = ( 'product-id': line.tool.catalogNumber, ...(line.tool.productLink === null ? {} : { 'product-link': line.tool.productLink }), description: `${line.tool.brand} ${line.tool.catalogNumber}`, - geometry: geometryOf(line), + geometry: geometryOf(line, holder?.gaugeLength ?? 0), ...(holder === null ? {} : { holder }), 'post-process': { number: at,