1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  | Quintiq file version 2.0 
 |  #parent: #root 
 |  Method SetHorizontalNodeIndex ( 
 |    Nodes nodes 
 |  ) 
 |  { 
 |    Description: 'Move nodes to prefered position' 
 |    TextBody: 
 |    [* 
 |      // set all grid x to max 
 |      traverse( nodes, Elements, n ) 
 |      { 
 |        n.GridX( Number::MaxNumber() ); 
 |      } 
 |      // set relevent nodes grid to 0 
 |      traverse( nodes, 
 |                Elements, 
 |                n, 
 |                ( n.istype( UnitNode ) and counter( n.astype( UnitNode ).Unit(), InputStockingPoint.StockingPoint_MP, sp, true, true  ) = 0  ) 
 |                or ( n.istype( StockingPointNode ) and n.astype( StockingPointNode ).StockingPoint_MP().InputUnit( relsize ) = 0 ) 
 |                ) 
 |      { 
 |        n.GridX( 0 ); 
 |        n.SetPreferredHorizontalPosition(); 
 |      } 
 |       
 |      // Set the offset 
 |      traverse( nodes, Elements, n, n.GridX() = Number::MaxNumber() ) 
 |      { 
 |        n.GridX( this.OffsetX() ); 
 |        n.SetPreferredHorizontalPosition(); 
 |      } 
 |    *] 
 |  } 
 |  
  |