From 51bd358642838d002307f23e8b11e241f4a342d1 Mon Sep 17 00:00:00 2001 From: James Bremner Date: Tue, 30 Jun 2020 10:43:43 -0400 Subject: [PATCH] Update citlist interface to pack2 --- src/TimberAllocation.h | 12 ++++++++++++ src/taCutter.cpp | 19 +++++++++++++++---- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/TimberAllocation.h b/src/TimberAllocation.h index b7d3a7c..c659f64 100644 --- a/src/TimberAllocation.h +++ b/src/TimberAllocation.h @@ -250,12 +250,24 @@ bool CS2Pack2( cInstance& I, cLevel& level, int h ); +/** Record a cut for an order in the instance + @param[in] I the instance + @param[in] stock order is cut from + @param[in] order being cut + @param[[in] length position + @param[[in] width position + @param[[in] height position +*/ void CutOrder( cInstance& I, timber_t& stock, timber_t& order, int length, int width, int height ); +/** Record the V cut for a level in the instance + @param[in] I the instance + @param[in] level +*/ void CutLevel( cInstance& I, cLevel& level ); diff --git a/src/taCutter.cpp b/src/taCutter.cpp index 5fe8ac4..d9ee0b2 100644 --- a/src/taCutter.cpp +++ b/src/taCutter.cpp @@ -310,26 +310,37 @@ bool CS2Pack2( return false; } - auto binList = RawCutList( E )[0]; - for( auto& c : binList ) + // output the cuts + + /* Loop over cuts in level + + The pack2 engine returns a vector of vectors, one for each bin + There is only one bin, the level, + so we need only look at the first vector of cuts + */ + for( auto& c : CutList( E )[0] ) { - // add to cutting list + char LW; if( c.myIsVertical ) { + // vertical cuts in pack2 ( which is 2d ) are orthogonasl to the length dimension in 3D LW = 'L'; } else { + // horizontal cuts in pack2 ( which is 2d ) are orthogonasl to the width dimension in 3D LW = 'W'; } - + // construct a 3D cut cCut cut( level.myStock, LW, c.myIntercept, h ); //std::cout << cut.text() << "\n\n"; + + // add it to the instance cut list I.myCut.push_back( cut ); }