Example
In aPriori’s starting point VPEs, the sheet metal process Material Stock uses a stock selection module to find stocks with a length, width, and thickness appropriate for the current part:
 
THICKNESS_SNAP = 0.05 // mm error between the actual measured sheet metal thickness and the closest actual stock size
 
validMaterialStocks = select from stocks as s where _
equalsEps(s.thickness, part.thickness, THICKNESS_SNAP) and _
((part.blankBoxLength <= s.length and part.blankBoxWidth <= s.width) or _
((part.blankBoxLength <= s.width and part.blankBoxWidth <= s.length)))
 
This query uses the following simple identifiers:
validMaterialStocks is the module’s output.
stocks is the CSL standard input containing each initially available stock.
s is, in effect, bound to each element of stocks in turn.
part is the CSL standard input designating the current part.
THICKNESS_SNAP is a constant, the maximum allowable difference between stock and part thickness.
The query assigns to validMaterialStocks a collection that contains the elements of stock that meet both the following conditions:
The stock’s thickness is within THICKNESS_SNAP of the part’s thickness.
The part’s blank fits on the stock, that is one of the following is true:
o The blank’s length and width are less than the stock’s length and width
o The blank’s length is less than the stock’s width and the blank’s width is less than the stock’s length.