Type Definitions
-
bomColumn
-
Object to encapsulate a column of data in a BomTable
Properties:
Name Type Description name string The name of the column in the bomTable func evalFunction The cell value evaluated based on cad data Example
// bomColumn that returns the name of the component {name: 'name', func: getComponentName} // Array of bomColumns [{name: 'name', func: getComponentName}, {name: 'count', func: getOccurrenceCount}, {name: 'type', func: getType}] -
columnIndex
-
A number or string representing a column by its name or index from 0 to number of columns - 1
Example
// get cell at column 'name' and row 0 bomTable.getCell('name', 0); // delete last column in table by number index bomTable.deleteColumn(-1); -
evalFunction(comp, occs) → {string/number}
-
Family of functions that take the component and occurrences of each row in the Bom Table and return a cell value
Parameters:
Name Type Description comp Component The component of a specific row in the Bom Table occs Array.<Occurrence> The occurrence(s) of a specific row in the Bom Table Returns:
string/number the evaluation of the cellExamples
function getComponentName(comp, occs) { // returns component name return comp.name; }function getOccurrenceCount(comp, occs) { // returns number of occurrences associated with the row return occs.length; } -
filterFunction(occ) → {boolean}
-
Parameters:
Name Type Description occ Occurrence a given occurrence of the cad data Returns:
boolean whether the occ passes the specified requirements and will be tied to rows of the Bom TableExample
function filter(occ) { // only looks at occurrences that are of type 'Part' return occ.typeOfEntity === "PartOccurrence"; } -
groupName
-
Name/number associated with a custom group
-
map
-
Tuple to hold map function and columnIndex. JSDoc lacks tuple type, so this is a placeholder
Example
// This is a valid tuple: var mapTuple = ['name', mapCompName]; var mapTuple2 = [0, mapCompName]; -
mapFunction(comp, cell) → {boolean}
-
Parameters:
Name Type Description comp Component A specific Component to test against a cell cell number/string The specific cell to which the cad component will be matched on Returns:
boolean True if matches, False if notExample
function mapCompEntityId(comp, cell) { // based on what the cell value is, if it matches this component will be tied to this row of the table return (comp.cadEntityId === cell); } -
search
-
Tuple to hold columnIndex and searchFunction. JSDoc lacks tuple type, so this is a placeholder
Example
// This is a valid tuple: var searchTuple = ['make', searchForMake]; var searchTuple2 = [0, searchQuantityOverOne]; -
searchFunction(cell) → {boolean}
-
Parameters:
Name Type Description cell number Specific cell to be tested in BomTable Returns:
boolean True if cell matches search, False if otherwiseExample
// search function to test if cell matches 'foo' function isFoo(cell) { return (cell == 'foo'); }