EgtExecutor 2.1k6 :
- aggiunta gestione libreria di Nesting Automatico e relativa protezione - aggiunta funzione ExeSetLineAttribs per impostare spessore linee in grafica.
This commit is contained in:
+164
@@ -0,0 +1,164 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2019-2019
|
||||
//----------------------------------------------------------------------------
|
||||
// File : DllNesting.cpp Data : 28.11.19 Versione : 2.1k6
|
||||
// Contenuto : Funzioni di gestione della libreria opzionale EgtNesting.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 28.11.19 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "EXE.h"
|
||||
#include "DllNesting.h"
|
||||
#include "/EgtDev/Include/ENsDllMain.h"
|
||||
#define NOMINMAX
|
||||
#include <windows.h>
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Nome della libreria
|
||||
#if defined( _WIN64) && defined( _DEBUG)
|
||||
static const wchar_t* ENS_NAME = L"EgtNestingD64.dll" ;
|
||||
#elif defined( _WIN64)
|
||||
static const wchar_t* ENS_NAME = L"EgtNestingR64.dll" ;
|
||||
#elif defined( _WIN32) && defined( _DEBUG)
|
||||
static const wchar_t* ENS_NAME = L"EgtNestingD32.dll" ;
|
||||
#else
|
||||
static const wchar_t* ENS_NAME = L"EgtNestingR32.dll" ;
|
||||
#endif
|
||||
// Nome delle funzioni caricate
|
||||
static const char* ENS_SETENSLOGGER = "SetENsLogger" ;
|
||||
static const char* ENS_GETENSVERSION = "GetENsVersion" ;
|
||||
static const char* ENS_SETENSKEY = "SetENsKey" ;
|
||||
static const char* ENS_SETENSKEY2 = "SetENsKey2" ;
|
||||
static const char* ENS_CREATEAUTONESTER = "CreateAutoNester" ;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
HMODULE s_hENs = nullptr ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
LoadNestingDll( ILogger* pLogger, const string& sKey, const string& sKey2)
|
||||
{
|
||||
// verifico la chiave
|
||||
if ( ! TestKeyForENs( sKey, 0, pLogger)) {
|
||||
FreeNestingDll() ;
|
||||
return false ;
|
||||
}
|
||||
// se già caricata
|
||||
if ( s_hENs != nullptr)
|
||||
return true ;
|
||||
// carico la libreria EgtNesting
|
||||
s_hENs = LoadLibrary( ENS_NAME) ;
|
||||
if ( s_hENs == nullptr)
|
||||
return false ;
|
||||
// imposto logger
|
||||
MySetENsLogger( pLogger) ;
|
||||
// imposto i codici della chiave
|
||||
MySetENsKey( sKey) ;
|
||||
// imposto i codici della seconda chiave
|
||||
MySetENsKey2( sKey2) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
FreeNestingDll( void)
|
||||
{
|
||||
// se non è già caricata
|
||||
if ( s_hENs == nullptr)
|
||||
return true ;
|
||||
// libero la libreria EgtNesting
|
||||
FreeLibrary( s_hENs) ;
|
||||
s_hENs = nullptr ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
IsLoadedNestingDll( void)
|
||||
{
|
||||
return ( s_hENs != nullptr) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
MySetENsLogger( ILogger* pLogger)
|
||||
{
|
||||
// verifico caricamento libreria EgtNesting
|
||||
if ( s_hENs == nullptr)
|
||||
return ;
|
||||
// recupero funzione che imposta il logger
|
||||
typedef void (* PF_SetENsLogger) ( ILogger* pLogger) ;
|
||||
PF_SetENsLogger pFun = (PF_SetENsLogger)GetProcAddress( s_hENs, ENS_SETENSLOGGER) ;
|
||||
if ( pFun == nullptr)
|
||||
return ;
|
||||
pFun( pLogger) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
const char*
|
||||
MyGetENsVersion( void)
|
||||
{
|
||||
// verifico caricamento libreria EgtNesting
|
||||
if ( s_hENs == nullptr)
|
||||
return "" ;
|
||||
// recupero funzione che restituisce la versione della libreria
|
||||
typedef const char* (* PF_GetEMkVersion) ( void) ;
|
||||
PF_GetEMkVersion pFun = (PF_GetEMkVersion)GetProcAddress( s_hENs, ENS_GETENSVERSION) ;
|
||||
if ( pFun == nullptr)
|
||||
return "" ;
|
||||
return pFun() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
MySetENsKey( const string& sKey)
|
||||
{
|
||||
// verifico caricamento libreria EgtNesting
|
||||
if ( s_hENs == nullptr)
|
||||
return ;
|
||||
// recupero funzione che imposta i codici di protezione
|
||||
typedef void (* PF_SetENsKey) ( const string& sKey) ;
|
||||
PF_SetENsKey pFun = (PF_SetENsKey)GetProcAddress( s_hENs, ENS_SETENSKEY) ;
|
||||
if ( pFun == nullptr)
|
||||
return ;
|
||||
pFun( sKey) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
MySetENsKey2( const string& sKey2)
|
||||
{
|
||||
// verifico caricamento libreria EgtNesting
|
||||
if ( s_hENs == nullptr)
|
||||
return ;
|
||||
// recupero funzione che imposta i codici di protezione
|
||||
typedef void (* PF_SetENsKey2) ( const string& sKey2) ;
|
||||
PF_SetENsKey2 pFun = (PF_SetENsKey2)GetProcAddress( s_hENs, ENS_SETENSKEY2) ;
|
||||
if ( pFun == nullptr)
|
||||
return ;
|
||||
pFun( sKey2) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
IAutoNester*
|
||||
MyCreateAutoNester( void)
|
||||
{
|
||||
// verifico caricamento libreria EgtNesting
|
||||
if ( s_hENs == nullptr)
|
||||
return nullptr ;
|
||||
// recupero funzione creazione oggetto
|
||||
typedef IAutoNester* (* PF_CreateAutoNester) ( void) ;
|
||||
PF_CreateAutoNester pFun = (PF_CreateAutoNester)GetProcAddress( s_hENs, ENS_CREATEAUTONESTER) ;
|
||||
if ( pFun == nullptr)
|
||||
return nullptr ;
|
||||
return pFun() ;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : DllNesting.h Data : 28.11.19 Versione : 2.1k6
|
||||
// Contenuto : Dichiarazioni funzioni per libreria opzionale EgtNesting.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 28.11.19 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
class ILogger ;
|
||||
class IAutoNester ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool LoadNestingDll( ILogger* pLogger, const std::string& sKey, const std::string& sKey2) ;
|
||||
bool FreeNestingDll( void) ;
|
||||
bool IsLoadedNestingDll( void) ;
|
||||
void MySetENsLogger( ILogger* pLogger) ;
|
||||
void MySetENsKey( const std::string& sKey) ;
|
||||
void MySetENsKey2( const std::string& sKey2) ;
|
||||
const char* MyGetENsVersion( void) ;
|
||||
IAutoNester* MyCreateAutoNester( void) ;
|
||||
+1
-1
@@ -29,7 +29,7 @@
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
PtrOwner<ICAvToolSurfTm> s_pCAvTlStm( CreateCAvToolSurfTm()) ;
|
||||
static PtrOwner<ICAvToolSurfTm> s_pCAvTlStm( CreateCAvToolSurfTm()) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
|
||||
+15
-1
@@ -7,7 +7,7 @@
|
||||
//
|
||||
//
|
||||
// Modifiche : 01.09.14 DS Creazione modulo.
|
||||
//
|
||||
// 28.11.19 DS Aggiunto caricamento opzionale del Nesting.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "DllGraphics.h"
|
||||
#include "DllExchange.h"
|
||||
#include "DllMachKernel.h"
|
||||
#include "DllNesting.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EXeDllMain.h"
|
||||
#include "/EgtDev/Include/EGnDllMain.h"
|
||||
@@ -46,6 +47,7 @@ static string s_sKey ;
|
||||
static int s_nKeyType = KEY_LOCK_TYPE_ANY ;
|
||||
static int s_nKeyExpDays = 0 ;
|
||||
static int s_nKeyOptExpDays = 0 ;
|
||||
static string s_sNestKey ;
|
||||
static string s_sIniFile ;
|
||||
static bool s_bEnableUI = true ;
|
||||
static pfProcEvents s_pFunProcEvents = nullptr ;
|
||||
@@ -106,6 +108,10 @@ ExeInit( int nDebug, const string& sLogFile, const string& sLogMsg)
|
||||
if ( LoadMachKernelDll( s_pGenLog, s_sKey))
|
||||
LOG_INFO( s_pGenLog, MyGetEMkVersion())
|
||||
|
||||
// carico libreria neting opzionale
|
||||
if ( LoadNestingDll( s_pGenLog, s_sKey, s_sNestKey))
|
||||
LOG_INFO( s_pGenLog, MyGetENsVersion())
|
||||
|
||||
// Info sulla protezione e sul sistema
|
||||
string sTmp ;
|
||||
if ( ExeGetKeyInfo( sTmp))
|
||||
@@ -194,6 +200,14 @@ ExeSetKey( const string& sKey)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetNestKey( const string& sNestKey)
|
||||
{
|
||||
s_sNestKey = sNestKey ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetLockType( int nType)
|
||||
|
||||
@@ -0,0 +1,210 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2019-2019
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EXE_NstAutoNesting.cpp Data : 28.11.19 Versione : 2.1k6
|
||||
// Contenuto : Funzioni Automatic Nesting per EXE.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 28.11.19 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "EXE.h"
|
||||
#include "EXE_Macro.h"
|
||||
#include "EXE_Const.h"
|
||||
#include "DllNesting.h"
|
||||
#include "/EgtDev/Include/EGkCurve.h"
|
||||
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
||||
#include "/EgtDev/Include/ENsAutoNester.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include "/EgtDev/Include/SELkLockId.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static PtrOwner<IAutoNester> s_pAutoNester ;
|
||||
static int s_nTotParts ;
|
||||
static double s_dTotFillRatio ;
|
||||
static ANIVECT s_vANestInfo ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeAutoNestStart( void)
|
||||
{
|
||||
s_nTotParts = 0 ;
|
||||
s_dTotFillRatio = 0 ;
|
||||
if ( IsNull( s_pAutoNester)) {
|
||||
s_pAutoNester.Set( MyCreateAutoNester()) ;
|
||||
if ( IsNull( s_pAutoNester))
|
||||
return false ;
|
||||
}
|
||||
return s_pAutoNester->Start() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeAutoNestAddSheet( int nSheetId, int nOutlineId, int nPriority, int nCount)
|
||||
{
|
||||
if ( IsNull( s_pAutoNester))
|
||||
return false ;
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero riferimento dell'Outline
|
||||
Frame3d frOutl ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nOutlineId, frOutl))
|
||||
return false ;
|
||||
// recupero il tipo di oggetto
|
||||
int nType = pGeomDB->GetGeoType( nOutlineId) ;
|
||||
PolyArc Outline ;
|
||||
// recupero la curva di contorno
|
||||
if ( ( nType & GEO_CURVE) != 0) {
|
||||
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nOutlineId)) ;
|
||||
if ( pCrv == nullptr || ! pCrv->ApproxWithArcs( LIN_TOL_FINE, ANG_TOL_STD_DEG, Outline))
|
||||
return false ;
|
||||
}
|
||||
else if ( nType == SRF_FLATRGN) {
|
||||
const ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nOutlineId)) ;
|
||||
if ( pSfr == nullptr)
|
||||
return false ;
|
||||
PtrOwner<ICurve> pCrv( pSfr->GetLoop( 0, 0)) ;
|
||||
if ( IsNull( pCrv) || ! pCrv->ApproxWithArcs( LIN_TOL_FINE, ANG_TOL_STD_DEG, Outline))
|
||||
return false ;
|
||||
}
|
||||
// la porto in globale
|
||||
Outline.ToGlob( frOutl) ;
|
||||
// verifico direzione di estrusione
|
||||
Vector3d vtExtr = Outline.GetExtrusion() ;
|
||||
if ( vtExtr.IsZplus())
|
||||
;
|
||||
else if ( vtExtr.IsZminus())
|
||||
Outline.Mirror( ORIG, Z_AX) ;
|
||||
else
|
||||
return false ;
|
||||
// aggiungo il pezzo
|
||||
return s_pAutoNester->AddSheet( nSheetId, Outline, nPriority, nCount) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeAutoNestAddPart( int nPartId, int nOutlineId, int nCount)
|
||||
{
|
||||
if ( IsNull( s_pAutoNester))
|
||||
return false ;
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero riferimento dell'Outline
|
||||
Frame3d frOutl ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nOutlineId, frOutl))
|
||||
return false ;
|
||||
// recupero il tipo di oggetto
|
||||
int nType = pGeomDB->GetGeoType( nOutlineId) ;
|
||||
PolyArc Outline ;
|
||||
// recupero la curva di contorno
|
||||
if ( ( nType & GEO_CURVE) != 0) {
|
||||
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nOutlineId)) ;
|
||||
if ( pCrv == nullptr || ! pCrv->ApproxWithArcs( LIN_TOL_FINE, ANG_TOL_STD_DEG, Outline))
|
||||
return false ;
|
||||
}
|
||||
else if ( nType == SRF_FLATRGN) {
|
||||
const ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nOutlineId)) ;
|
||||
if ( pSfr == nullptr)
|
||||
return false ;
|
||||
PtrOwner<ICurve> pCrv( pSfr->GetLoop( 0, 0)) ;
|
||||
if ( IsNull( pCrv) || ! pCrv->ApproxWithArcs( LIN_TOL_FINE, ANG_TOL_STD_DEG, Outline))
|
||||
return false ;
|
||||
}
|
||||
// la porto in globale
|
||||
Outline.ToGlob( frOutl) ;
|
||||
// verifico direzione di estrusione
|
||||
Vector3d vtExtr = Outline.GetExtrusion() ;
|
||||
if ( vtExtr.IsZplus())
|
||||
;
|
||||
else if ( vtExtr.IsZminus())
|
||||
Outline.Mirror( ORIG, Z_AX) ;
|
||||
else
|
||||
return false ;
|
||||
// aggiungo il pezzo
|
||||
if ( ! s_pAutoNester->AddPart( nPartId, Outline, nCount))
|
||||
return false ;
|
||||
// incremento contatore pezzi
|
||||
s_nTotParts += nCount ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeAutoNestSetInterpartGap( double dGap)
|
||||
{
|
||||
if ( IsNull( s_pAutoNester))
|
||||
return false ;
|
||||
return s_pAutoNester->SetInterpartGap( dGap) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeAutoNestCompute( int nMaxTime)
|
||||
{
|
||||
if ( IsNull( s_pAutoNester))
|
||||
return false ;
|
||||
return s_pAutoNester->Compute( nMaxTime) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeAutoNestGetComputationStatus( int& nStatus)
|
||||
{
|
||||
if ( IsNull( s_pAutoNester))
|
||||
return false ;
|
||||
return s_pAutoNester->GetComputationStatus( nStatus) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeAutoNestPrintResults( const string& sHtmlFile)
|
||||
{
|
||||
if ( IsNull( s_pAutoNester))
|
||||
return false ;
|
||||
return s_pAutoNester->PrintResults( sHtmlFile) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeAutoNestGetResults( int& nNestedParts, int& nTotParts, int& nTotSheets, int& nDiffSheets, double& dTotFillRatio)
|
||||
{
|
||||
if ( IsNull( s_pAutoNester) || ! s_pAutoNester->GetResults( s_dTotFillRatio, s_vANestInfo))
|
||||
return false ;
|
||||
nNestedParts = 0 ;
|
||||
nTotParts = s_nTotParts ;
|
||||
nTotSheets = 0 ;
|
||||
nDiffSheets = 0 ;
|
||||
dTotFillRatio = s_dTotFillRatio ;
|
||||
for ( int i = 0 ; i < int( s_vANestInfo.size()) ; ++ i) {
|
||||
// se sheet
|
||||
if ( s_vANestInfo[i].nType > 0) {
|
||||
++ nDiffSheets ;
|
||||
nTotSheets += s_vANestInfo[i].nType ;
|
||||
nNestedParts += s_vANestInfo[i].nFlag * s_vANestInfo[i].nType ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeAutoNestGetOneResult( int nInd, int& nType, int& nId, int& nFlag, double& dX, double& dY, double& dAngRot)
|
||||
{
|
||||
if ( nInd < 0 || nInd >= int( s_vANestInfo.size()))
|
||||
return false ;
|
||||
nType = s_vANestInfo[nInd].nType ;
|
||||
nId = s_vANestInfo[nInd].nId ;
|
||||
nFlag = s_vANestInfo[nInd].nFlag ;
|
||||
dX = s_vANestInfo[nInd].dX ;
|
||||
dY = s_vANestInfo[nInd].dY ;
|
||||
dAngRot = s_vANestInfo[nInd].dAngRot ;
|
||||
return true ;
|
||||
}
|
||||
@@ -97,6 +97,16 @@ ExeGetBackground( Color& TopCol, Color& BottomCol)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetLineAttribs( int nWidth)
|
||||
{
|
||||
IEGrScene* pScene = GetCurrScene() ;
|
||||
VERIFY_SCENE( pScene, false)
|
||||
// imposto lo spessore delle linee
|
||||
return pScene->SetLineWidth( nWidth) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetMarkAttribs( Color MarkCol)
|
||||
|
||||
@@ -32,7 +32,7 @@ static PtrOwner< IShortestPath> s_pSP ;
|
||||
bool
|
||||
ExeSpInit( void)
|
||||
{
|
||||
// creo l'oggetto per il calolo del percorso minimo (ShortestPath)
|
||||
// creo l'oggetto per il calcolo del percorso minimo (ShortestPath)
|
||||
s_pSP.Set( CreateShortestPath()) ;
|
||||
return ( ! IsNull( s_pSP)) ;
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -222,6 +222,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="..\Include\EXeDllMain.h" />
|
||||
<ClInclude Include="..\Include\EXeExecutor.h" />
|
||||
<ClInclude Include="DllMain.h" />
|
||||
<ClInclude Include="DllNesting.h" />
|
||||
<ClInclude Include="EXE.h" />
|
||||
<ClInclude Include="EXE_Macro.h" />
|
||||
<ClInclude Include="AuxTools.h" />
|
||||
@@ -240,12 +241,14 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="stdafx.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="DllNesting.cpp" />
|
||||
<ClCompile Include="EXE_CAvTool.cpp" />
|
||||
<ClCompile Include="EXE_GdbCreateVol.cpp" />
|
||||
<ClCompile Include="EXE_GdbModifyVol.cpp" />
|
||||
<ClCompile Include="EXE_GeoDist.cpp" />
|
||||
<ClCompile Include="EXE_GeoInters.cpp" />
|
||||
<ClCompile Include="EXE_Image.cpp" />
|
||||
<ClCompile Include="EXE_NstAutoNesting.cpp" />
|
||||
<ClCompile Include="EXE_NstMachining.cpp" />
|
||||
<ClCompile Include="EXE_NstPartNesting.cpp" />
|
||||
<ClCompile Include="EXE_GdbCreateCurve.cpp" />
|
||||
|
||||
@@ -105,6 +105,9 @@
|
||||
<ClInclude Include="PictureObj.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DllNesting.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="LUA_Exchange.cpp">
|
||||
@@ -335,6 +338,12 @@
|
||||
<ClCompile Include="LUA_GeoDist.cpp">
|
||||
<Filter>File di origine\LUA</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DllNesting.cpp">
|
||||
<Filter>File di origine\Optional Dll</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EXE_NstAutoNesting.cpp">
|
||||
<Filter>File di origine\EXE</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="EgtExecutor.rc">
|
||||
|
||||
+173
@@ -91,6 +91,170 @@ LuaVerifyMachining( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaAutoNestStart( lua_State* L)
|
||||
{
|
||||
// nessu parametro
|
||||
LuaClearStack( L) ;
|
||||
// imposto inizio nuovo nesting
|
||||
bool bOk = ExeAutoNestStart() ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaAutoNestAddSheet( lua_State* L)
|
||||
{
|
||||
// 4 parametri : nSheetId, nOutlineId, nPriority, nCount
|
||||
int nSheetId ;
|
||||
LuaCheckParam( L, 1, nSheetId)
|
||||
int nOutlineId ;
|
||||
LuaCheckParam( L, 2, nOutlineId)
|
||||
int nPriority ;
|
||||
LuaCheckParam( L, 3, nPriority)
|
||||
int nCount ;
|
||||
LuaCheckParam( L, 4, nCount)
|
||||
LuaClearStack( L) ;
|
||||
// aggiungo un pannello al nesting corrente
|
||||
bool bOk = ExeAutoNestAddSheet( nSheetId, nOutlineId, nPriority, nCount) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaAutoNestAddPart( lua_State* L)
|
||||
{
|
||||
// 3 parametri : nPartId, nOutlineId, nCount
|
||||
int nPartId ;
|
||||
LuaCheckParam( L, 1, nPartId)
|
||||
int nOutlineId ;
|
||||
LuaCheckParam( L, 2, nOutlineId)
|
||||
int nCount ;
|
||||
LuaCheckParam( L, 3, nCount)
|
||||
LuaClearStack( L) ;
|
||||
// aggiungo un pezzo al nesting corrente
|
||||
bool bOk = ExeAutoNestAddPart( nPartId, nOutlineId, nCount) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaAutoNestSetInterpartGap( lua_State* L)
|
||||
{
|
||||
// 1 parametro : dGap
|
||||
double dGap ;
|
||||
LuaCheckParam( L, 1, dGap)
|
||||
LuaClearStack( L) ;
|
||||
// imposto la distanza minima tra i pezzi al nesting corrente
|
||||
bool bOk = ExeAutoNestSetInterpartGap( dGap) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaAutoNestCompute( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nMaxTime (ms)
|
||||
int nMaxTime ;
|
||||
LuaCheckParam( L, 1, nMaxTime)
|
||||
LuaClearStack( L) ;
|
||||
// lancio calcolo del nesting
|
||||
bool bOk = ExeAutoNestCompute( nMaxTime) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaAutoNestGetComputationStatus( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// lancio calcolo del nesting
|
||||
int nStatus ;
|
||||
bool bOk = ExeAutoNestGetComputationStatus( nStatus) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
LuaSetParam( L, nStatus) ;
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaAutoNestPrintResults( lua_State* L)
|
||||
{
|
||||
// 1 parametro : sHtmlFile
|
||||
string sHtmlFile ;
|
||||
LuaCheckParam( L, 1, sHtmlFile)
|
||||
LuaClearStack( L) ;
|
||||
// lancio stampa soluzione corrente
|
||||
bool bOk = ExeAutoNestPrintResults( sHtmlFile) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaAutoNestGetResults( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// recupero il risultato della soluzione
|
||||
int nNestedParts, nTotParts, nTotSheets, nDiffSheets ; double dTotFillRatio ;
|
||||
bool bOk = ExeAutoNestGetResults( nNestedParts, nTotParts, nTotSheets, nDiffSheets, dTotFillRatio) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk) {
|
||||
LuaSetParam( L, nNestedParts) ;
|
||||
LuaSetParam( L, nTotParts) ;
|
||||
LuaSetParam( L, nTotSheets) ;
|
||||
LuaSetParam( L, nDiffSheets) ;
|
||||
LuaSetParam( L, dTotFillRatio) ;
|
||||
return 5 ;
|
||||
}
|
||||
else {
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaAutoNestGetOneResult( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nInd
|
||||
int nInd ;
|
||||
LuaCheckParam( L, 1, nInd)
|
||||
LuaClearStack( L) ;
|
||||
// recupero i risultati del nesting
|
||||
int nType, nId, nFlag ; double dX, dY, dAngRot ;
|
||||
bool bOk = ExeAutoNestGetOneResult( nInd, nType, nId, nFlag, dX, dY, dAngRot) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk) {
|
||||
LuaSetParam( L, nType) ;
|
||||
LuaSetParam( L, nId) ;
|
||||
LuaSetParam( L, nFlag) ;
|
||||
LuaSetParam( L, dX) ;
|
||||
LuaSetParam( L, dY) ;
|
||||
LuaSetParam( L, dAngRot) ;
|
||||
return 6 ;
|
||||
}
|
||||
else {
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallNesting( LuaMgr& luaMgr)
|
||||
@@ -99,6 +263,15 @@ LuaInstallNesting( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPackBox", LuaPackBox) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPackBoxCluster", LuaPackBoxCluster) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVerifyMachining", LuaVerifyMachining) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestStart", LuaAutoNestStart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestAddSheet", LuaAutoNestAddSheet) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestAddPart", LuaAutoNestAddPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestSetInterpartGap", LuaAutoNestSetInterpartGap) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestCompute", LuaAutoNestCompute) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestGetComputationStatus", LuaAutoNestGetComputationStatus) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestPrintResults", LuaAutoNestPrintResults) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestGetResults", LuaAutoNestGetResults) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestGetOneResult", LuaAutoNestGetOneResult) ;
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user