BomApi

new BomApi(anarkCoreData)

BomApi object to create Bom Tables

Parameters:
Name Type Description
anarkCoreData ANARKCOREDATA

Methods

createNewBomTableFromCad(filter, cols) → {BomTable}

Create a new BomTable based on cad data

Parameters:
Name Type Description
filter filterFunction Function to filter cad data desired
cols Array.<bomColumn> The column definitions to populate each cell of the table
Returns:
BomTable A new BomTable based on above parameters
Example
// create BomTable with Bomcolumns name, quantity, and type with basic filter
var columns = [{name: 'name', func: getComponenetName}, {name: 'quantity', func: getOccurrenceCount}, {name: 'type', func: getType}];
var filterFunc = basicFilter;
var bomTable = bomApi.createNewBomTableFromCad(filterFunc, columns);

createNewBomTableFromWorkspaceTable(table, map, filter) → {BomTable}

Method to create a new BomTable based on workspace table Can map each row of outside table to cad data based on a mapping function argument (optional)

Parameters:
Name Type Argument Description
table Table The outside workspace table. See ANARKCOREDATA#getWorkspaceTableByName for getting this table
map map optional  Optional tuple that maps each cell in a given column to specific cad data
filter filterFunction optional  Optional filter function to use given a mapping function
Returns:
BomTable A new BomTable based on above parameters
Examples
// From table with no mapping
var table = anarkCoreData.getWorkSpaceTableByName('outsideBomTable');
var bomTable = bomApi.createNewBomTableFromWorkspaceTable(table, map, filter)
// From table with mapping
var table = anarkCoreData.getWorkSpaceTableByName('outsideBomTable');
// mapping with column 'name' in 'outsideBomTable' matching component name in cad data
var map = ['name', mapCompName];
var filter = basicFilter;
var bomTable = bomApi.createNewBomTableFromWorkspaceTable(table, map, filter);