Template Pruning

As with feasibility modules (see Process and Operation Feasibility), you can use template pruning modules to eliminate routings from consideration by the cost engine. When the cost engine evaluates a feasibility module, it can identify a particular routing as infeasible (and eliminate it from consideration); in contrast, when the cost engine evaluates a pruning module, it can identify a large class of routings as infeasible.

A template pruning module eliminates a node (together with all its descendent nodes) from a routing template, saving the cost engine the trouble of expanding the pruned template portion and preventing consideration of the individual routings that expansion would have produced. For example, a pruning module might eliminate, for parts that have no turning axes, all routings with rotational processes (which are contained in a single subtree of the template).

When you navigate to the CSL modules for a node (see Navigating to the Data for a Given Node), if the node has a template pruning module, the module’s Type Name field is set templatePruningRule and the label templatePruningRule appears next to the folder icon.

This section includes the following subsections:

Context of Evaluation

During template expansion, the cost engine visits each template node, and evaluates the node’s associated template pruning module, if there is one. If a node’s template pruning module returns false, the node is removed from the template. All the node’s descendents in the template are removed as well. Note that, unlike feasibility modules, template pruning modules are not evaluated in the context of a candidate material stock. See Cost Engine Details.

Example

Consider, for example, the machining process group in aPriori starting point Digital Factories. The process routing template node Rotational has an associated pruning module. This module eliminates all turning routings for parts that have no valid turning axis.

Here is a simplified version of this file:

Copy
Rule HasTurningAxes: (countTurningAxes > 0)
Message HasTurningAxes: 'PRUNE: ' + _
    'Skip Turning Routings: this part has no turning axes and would not benefit.'
 
// Total count of turning axes extracted      
countTurningAxes = _
    select count(x) from part.childArtifacts x where isTurningAxis(x)

 

This module has one rule and one function definition.

The function uses a query to count the current part’s turning axes. The query effectively forms the set of child GCDs that are turning axes, and then returns the number of elements in that set. The query is composed of these expressions:

  • count(x): Query aggregate function (see Query Expressions in CSL chapter) that returns the number of elements in the collection formed by the query.

  • part.childArtifacts: Object access that uses the childArtifacts attribute of the current part  (designated by the standard CSL input part) to retrieve the collection of the current part’s child GCDs.

  • isTurningAxis(x): builtin CSL function that returns true if the specified GCD is a turning axis; returns false otherwise. This filters the child GCDs, so that only those that are turning axes are included in the collection formed by the query.

The rule tests whether the function result (the number of turning axes that are child GCDs of the current part) is greater than 0. If the rule evaluates to true, the Rotational node is retained in the template, and the cost engine generates the routing that it (and its descendents) represent. If the rule evaluates to false, the Rotation node (together with all its descendents) is pruned, and the cost engine never generates the individual routings that it represents.