Compare commits
38 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 408a49c099 | |||
| d9497aae35 | |||
| 770d436664 | |||
| d996ff2b81 | |||
| 1b280e8fa0 | |||
| 6637b590f2 | |||
| ba38cd3c47 | |||
| 43c7e5c0b5 | |||
| 2a1a0d2521 | |||
| 44d3aa5eae | |||
| 89d2797d53 | |||
| 918481ee67 | |||
| c7f9eb871c | |||
| c4561c2033 | |||
| 4428536b16 | |||
| b1a7e2e497 | |||
| 38f2ef696c | |||
| 4c86f86900 | |||
| 4295e0114c | |||
| e851f46c83 | |||
| e045ad9bd7 | |||
| 96833a29e6 | |||
| cb01161e49 | |||
| 634d3285cd | |||
| 567f6f0c89 | |||
| 9b94cc255b | |||
| 00060cfc3e | |||
| 55744af21a | |||
| a60a77808b | |||
| ca66a7d69d | |||
| d7b9247b8e | |||
| 5d03fae5fc | |||
| 58bb9d1234 | |||
| 39f673fdcc | |||
| d38072d208 | |||
| b379dec480 | |||
| 3d361016ce | |||
| 1464915d42 |
+82
-6
@@ -21,6 +21,7 @@
|
||||
#include "/EgtDev/Extern/Optalog/Include/cns_tooling.h"
|
||||
#include "/EgtDev/Extern/Optalog/Include/cns_restricted_zone.h"
|
||||
#include "/EgtDev/Extern/Optalog/Include/cns_textile.h"
|
||||
#include "/EgtDev/Extern/Optalog/Include/cns_shear_sequence.h"
|
||||
#include "/EgtDev/Extern/Optalog/Include/cns_egaltech.h"
|
||||
#include "/EgtDev/Include/SELkLockId.h"
|
||||
|
||||
@@ -59,7 +60,7 @@ GetCNSPath( const PolyArc& Outline, double dOffsX, double dOffsY, vector<CNS_Ele
|
||||
// AutoNester
|
||||
//----------------------------------------------------------------------------
|
||||
AutoNester::AutoNester( void)
|
||||
: m_pOrder( nullptr), m_pComp( nullptr), m_dInterpartGap( 0)
|
||||
: m_pOrder( nullptr), m_pComp( nullptr), m_dInterpartGap( 0), m_dShearGap( 0), m_bGuillotine( false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -87,6 +88,8 @@ AutoNester::Clear( void)
|
||||
m_IdRzCstrPtr.clear() ;
|
||||
m_IdPartPtr.clear() ;
|
||||
m_dInterpartGap = 0 ;
|
||||
m_dShearGap = 0 ;
|
||||
m_bGuillotine = false ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -106,6 +109,7 @@ AutoNester::SetGuillotineMode( void)
|
||||
if ( m_pOrder == nullptr)
|
||||
return false ;
|
||||
CNS_SetShearMode( m_pOrder, 1) ;
|
||||
m_bGuillotine = true ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -153,7 +157,7 @@ AutoNester::AddSheet( int nSheetId, const PolyArc& Outline, double dKerf, int nP
|
||||
dOffsY = ptMin.y ;
|
||||
// imposto altri dati
|
||||
CNS_SetSheetGaps( pSheet, dKerf, dKerf, dKerf, dKerf) ;
|
||||
// se richiesto, ritorno che è un rettangolo
|
||||
// se richiesto, ritorno che è un rettangolo
|
||||
if ( pbIsRect != nullptr)
|
||||
*pbIsRect = true ;
|
||||
}
|
||||
@@ -167,7 +171,7 @@ AutoNester::AddSheet( int nSheetId, const PolyArc& Outline, double dKerf, int nP
|
||||
return false ;
|
||||
// imposto altri dati
|
||||
CNS_SetNonRectangularSheetGaps( pSheet, dKerf, dKerf, dKerf, dKerf, dKerf) ;
|
||||
// se richiesto, ritorno che non è un rettangolo
|
||||
// se richiesto, ritorno che non è un rettangolo
|
||||
if ( pbIsRect != nullptr)
|
||||
*pbIsRect = false ;
|
||||
}
|
||||
@@ -175,7 +179,7 @@ AutoNester::AddSheet( int nSheetId, const PolyArc& Outline, double dKerf, int nP
|
||||
CNS_SetSheetUserString( pSheet, ToString( nSheetId).c_str()) ;
|
||||
CNS_SetSheetPriority( pSheet, nPriority) ;
|
||||
// lo inserisco nel map
|
||||
m_IdSheetInfo.emplace( nSheetId, SheetInfo( pSheet, dOffsX, dOffsY)) ;
|
||||
m_IdSheetInfo.emplace( nSheetId, SheetInfo( pSheet, dOffsX, dOffsY, dKerf)) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -416,6 +420,16 @@ AutoNester::SetInterpartGap( double dGap)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
AutoNester::SetShearGap( double dShearGap)
|
||||
{
|
||||
if ( m_pOrder == nullptr)
|
||||
return false ;
|
||||
m_dShearGap = max( 0., dShearGap) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
AutoNester::SetReportFile( const string& sReportFile)
|
||||
@@ -438,6 +452,10 @@ AutoNester::Compute( bool bMinimizeOnXvsY, int nMaxTime)
|
||||
for ( auto Iter = m_IdSheetInfo.begin() ; Iter != m_IdSheetInfo.end() ; ++ Iter)
|
||||
CNS_SetDefectGap( Iter->second.pSheet, m_dInterpartGap) ;
|
||||
}
|
||||
// shear gap
|
||||
if ( m_dShearGap > 10 * EPS_SMALL)
|
||||
CNS_SetShearGap( m_pOrder, m_dShearGap) ;
|
||||
|
||||
// per evitare pezzi posti inutilmente di sghembo su ultimo pannello
|
||||
CNS_SetObjective( m_pOrder, ( bMinimizeOnXvsY ? CNS_IntelligentMinimizeX : CNS_IntelligentMinimizeY)) ;
|
||||
// recupero i codici di sblocco del nesting
|
||||
@@ -491,7 +509,7 @@ AutoNester::GetComputationStatus( int& nStatus)
|
||||
bool
|
||||
AutoNester::GetResults( double& dTotFillRatio, ANIVECT& vANI)
|
||||
{
|
||||
// verifico validità calcolo
|
||||
// verifico validità calcolo
|
||||
if ( m_pComp == nullptr)
|
||||
return false ;
|
||||
// recupero la soluzione
|
||||
@@ -537,11 +555,69 @@ AutoNester::GetResults( double& dTotFillRatio, ANIVECT& vANI)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
AutoNester::CalcShearSequence( int nNesting, PNTVECTOR& vPtStart, PNTVECTOR& vPtEnd)
|
||||
{
|
||||
vPtStart.clear() ;
|
||||
vPtEnd.clear() ;
|
||||
|
||||
// verifico se impostata modalità ghigliottina
|
||||
if ( ! m_bGuillotine)
|
||||
return false ;
|
||||
// verifico vincolo con intergap tra i pezzi
|
||||
if ( m_dShearGap < m_dInterpartGap - EPS_SMALL)
|
||||
return false ;
|
||||
// verifico validità calcolo
|
||||
if ( m_pComp == nullptr)
|
||||
return false ;
|
||||
// recupero la soluzione
|
||||
CNS_SolutionPtr pSol = CNS_GetSolution( m_pComp) ;
|
||||
if ( pSol == nullptr)
|
||||
return false ;
|
||||
// recupero il nesting richiesto
|
||||
int nNestCount = CNS_GetNumberOfNestings( pSol) ;
|
||||
if ( nNesting < 0 || nNesting > nNestCount - 1)
|
||||
return false ;
|
||||
CNS_NestingPtr pNest = CNS_GetNesting( pSol, nNesting) ;
|
||||
// recupero pannello
|
||||
CNS_SheetPtr pSheet = CNS_GetSheet( pNest) ;
|
||||
const char* szSheetId = CNS_GetSheetUserString( pSheet) ;
|
||||
int nSheetId = 999 ;
|
||||
if ( szSheetId != nullptr)
|
||||
FromString( szSheetId, nSheetId) ;
|
||||
const auto Iter = m_IdSheetInfo.find( nSheetId) ;
|
||||
|
||||
// verifico vincolo con kerf del pannello
|
||||
double dSheetKerf = ( Iter != m_IdSheetInfo.end() ? Iter->second.dKerf : 0) ;
|
||||
if ( dSheetKerf > EPS_SMALL && m_dShearGap > dSheetKerf + EPS_SMALL)
|
||||
return false ;
|
||||
|
||||
// offset per origine pannello
|
||||
double dOffsX = ( Iter != m_IdSheetInfo.end() ? Iter->second.dOffsX : 0) ;
|
||||
double dOffsY = ( Iter != m_IdSheetInfo.end() ? Iter->second.dOffsY : 0) ;
|
||||
|
||||
// calcolo shear sequence
|
||||
CNS_ShearSequencePtr pShearSeq = CNS_ComputeShearSequence( pNest) ;
|
||||
int nCnt = CNS_GetNumberOfElementsInShearSequence( pShearSeq) ;
|
||||
vPtStart.reserve( nCnt) ;
|
||||
vPtEnd.reserve( nCnt) ;
|
||||
for ( int j = 0 ; j < nCnt ; j ++) {
|
||||
double dStartX, dEndX, dStartY, dEndY ;
|
||||
CNS_GetElementInShearSequence( pShearSeq, j, &dStartX, &dStartY, &dEndX, &dEndY) ;
|
||||
vPtStart.emplace_back( dStartX + dOffsX, dStartY + dOffsY, 0) ;
|
||||
vPtEnd.emplace_back( dEndX + dOffsX, dEndY + dOffsY, 0) ;
|
||||
}
|
||||
CNS_DeleteShearSequence( pShearSeq) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
AutoNester::PrintResults( const string& sHtmlFile)
|
||||
{
|
||||
// verifico validità calcolo
|
||||
// verifico validità calcolo
|
||||
if ( m_pComp == nullptr)
|
||||
return false ;
|
||||
// recupero la soluzione
|
||||
|
||||
+6
-1
@@ -41,11 +41,13 @@ class AutoNester : public IAutoNester
|
||||
bool SetStripYconstraintToPart( int nPartId, const Point3d& ptRef, double dStripStart, double dStripRepeat) override ;
|
||||
bool SetStripXconstraintToPart( int nPartId, const Point3d& ptRef, double dStripStart, double dStripRepeat) override ;
|
||||
bool SetInterpartGap( double dGap) override ;
|
||||
bool SetShearGap( double dShearGap) override ;
|
||||
bool SetReportFile( const std::string& sReportFile) override ;
|
||||
bool Compute( bool bMinimizeOnXvsY, int nMaxTime) override ;
|
||||
bool CancelComputation( void) override ;
|
||||
bool GetComputationStatus( int& nStatus) override ;
|
||||
bool GetResults( double& dTotFillRatio, ANIVECT& vANI) override ;
|
||||
bool CalcShearSequence( int nNesting, std::vector<Point3d>& vPtStart, std::vector<Point3d>& vPtEnd) override ;
|
||||
bool PrintResults( const std::string& sHtmlFile) override ;
|
||||
|
||||
public :
|
||||
@@ -59,7 +61,8 @@ class AutoNester : public IAutoNester
|
||||
CNS_Sheet* pSheet ;
|
||||
double dOffsX ;
|
||||
double dOffsY ;
|
||||
SheetInfo( CNS_Sheet* pS, double dX, double dY) : pSheet( pS), dOffsX( dX), dOffsY( dY) {}
|
||||
double dKerf ;
|
||||
SheetInfo( CNS_Sheet* pS, double dX, double dY, double dKerf) : pSheet( pS), dOffsX( dX), dOffsY( dY), dKerf( dKerf) {}
|
||||
} ;
|
||||
typedef std::unordered_map< int, SheetInfo> IDSHEETINFO_UMAP ;
|
||||
typedef std::unordered_map< int, CNS_RestrictedZoneConstraint*> IDRZCSTRPTR_UMAP ;
|
||||
@@ -72,5 +75,7 @@ class AutoNester : public IAutoNester
|
||||
IDRZCSTRPTR_UMAP m_IdRzCstrPtr ; // map dei vincoli di zone ristrette basato su identificativi
|
||||
IDPARTPTR_UMAP m_IdPartPtr ; // map dei pezzi basato su identificativi
|
||||
double m_dInterpartGap ; // distanza minima tra i pezzi
|
||||
double m_dShearGap ;
|
||||
bool m_bGuillotine ; // flag per indicare se è impostata modalità a ghigliottina
|
||||
std::string m_sReportFile ; // file di report dei dati da inviare a Optalog in caso di problemi
|
||||
} ;
|
||||
|
||||
Binary file not shown.
+7
-7
@@ -22,14 +22,14 @@
|
||||
<ProjectGuid>{29956D5C-1F3C-4AF4-81C6-53E144808B78}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>EgtNesting</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.20348.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v141_xp</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
@@ -42,7 +42,7 @@
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v141_xp</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
@@ -103,7 +103,7 @@
|
||||
<PreprocessorDefinitions>WIN32;I_AM_ENS;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@@ -126,7 +126,7 @@ copy $(TargetPath) \EgtProg\DllD32</Command>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;I_AM_ENS;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<OpenMPSupport>true</OpenMPSupport>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
@@ -159,7 +159,7 @@ copy $(TargetPath) \EgtProg\DllD64</Command>
|
||||
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
|
||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@@ -192,7 +192,7 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
|
||||
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
|
||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
|
||||
Reference in New Issue
Block a user