Include :

- aggiornamento prototipi
- aggiunto tipo DBLMATRIX
- aggiunte per Nesting Automatico.
This commit is contained in:
Dario Sassi
2019-12-02 07:33:04 +00:00
parent fbd52ae401
commit 9b483fb336
9 changed files with 180 additions and 3 deletions
+29
View File
@@ -388,6 +388,35 @@ LuaSetParam( lua_State* L, const DBLVECTOR& vPar)
return true ;
}
//-------------------------------------------------------------------------------
inline bool
LuaSetParam( lua_State* L, const DBLMATRIX& vPar)
{
try {
// recupero prima dimensione
int nDim1 = int( vPar.size()) ;
// creo tavola principale
lua_createtable( L, nDim1, 0) ;
// creo e inserisco tavola per ogni componente
for ( int i = 1 ; i <= nDim1 ; ++ i) {
// recupero seconda dimensione
int nDim2 = int( vPar[i-1].size()) ;
// creo tavola componente
lua_createtable( L, nDim2, 0) ;
for ( int j = 1 ; j <= nDim2 ; ++ j) {
lua_pushnumber( L, vPar[i-1][j-1]) ;
lua_rawseti( L, -2, j) ;
}
// la metto nel vettore
lua_rawseti( L, -2, i) ;
}
}
catch( ...) {
return false ;
}
return true ;
}
//----------------------------------------------------------------------------
inline bool
LuaSetParam( lua_State* L, const STRVECTOR& vPar)
+1
View File
@@ -86,6 +86,7 @@ class IEGrScene
virtual bool UpdateExtension( void) = 0 ;
virtual bool SetMark( Color colMark) = 0 ;
virtual bool SetSelSurf( Color colSelSurf) = 0 ;
virtual bool SetLineWidth( int nW) = 0 ;
// Grid
virtual bool SetGridShow( bool bShowGrid, bool bShowFrame) = 0 ;
virtual bool SetGridGeo( double dSnapStep, int nMinLineSstep, int nMajLineSstep, int nExtSstep) = 0 ;
+2
View File
@@ -35,6 +35,7 @@ extern "C" {
EIN_EXPORT BOOL __stdcall EgtInit( int nDebug, const wchar_t* wsLogFile, const wchar_t* wsLogMsg) ;
EIN_EXPORT BOOL __stdcall EgtExit( void) ;
EIN_EXPORT BOOL __stdcall EgtSetKey( const wchar_t* wsKey) ;
EIN_EXPORT BOOL __stdcall EgtSetNestKey( const wchar_t* wsNestKey) ;
EIN_EXPORT BOOL __stdcall EgtSetFont( const wchar_t* wsNfeFontDir, const wchar_t* wsDefaultFont) ;
EIN_EXPORT BOOL __stdcall EgtGetNfeFontDir( wchar_t*& wsNfeFontDir) ;
EIN_EXPORT BOOL __stdcall EgtGetDefaultFont( wchar_t*& wsDefaultFont) ;
@@ -814,6 +815,7 @@ EIN_EXPORT BOOL __stdcall EgtSetMachineLook( int nFlag) ;
EIN_EXPORT BOOL __stdcall EgtInitScene( HWND hWnd, int nDriver, BOOL b2Buff, int nColorBits, int nDepthBits) ;
EIN_EXPORT BOOL __stdcall EgtGetSceneInfo( wchar_t*& wsInfo) ;
EIN_EXPORT BOOL __stdcall EgtSetBackground( const int nTopCol[4], const int nBottomCol[4], BOOL bRedraw) ;
EIN_EXPORT BOOL __stdcall EgtSetLineAttribs( int nWidth) ;
EIN_EXPORT BOOL __stdcall EgtSetMarkAttribs( const int MarkCol[4]) ;
EIN_EXPORT BOOL __stdcall EgtSetSelSurfAttribs( const int SelSurfCol[4]) ;
EIN_EXPORT BOOL __stdcall EgtSetGeoLineAttribs( const int GlCol[4]) ;
+58
View File
@@ -0,0 +1,58 @@
//----------------------------------------------------------------------------
// EgalTech 2019-2019
//----------------------------------------------------------------------------
// File : ENsAutoNester.h Data : 28.11.19 Versione : 2.1k6
// Contenuto : Dichiarazione della interfaccia IAutoNester.
//
//
//
// Modifiche : 28.11.19 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include <string>
#include <vector>
//----------------------- Macro per import/export ----------------------------
#undef ENS_EXPORT
#if defined( I_AM_ENS) // da definirsi solo nella DLL
#define ENS_EXPORT __declspec( dllexport)
#else
#define ENS_EXPORT __declspec( dllimport)
#endif
class PolyArc ;
//-----------------------------------------------------------------------------
struct ANestInfo {
int nType ; // se > 0 allora pannello e quindi molteplicità, se == 0 è pezzo
int nId ; // identificativo
int nFlag ; // per pannello numero di pezzi contenuti, per pezzo flip (0=no/1=si)
double dX ; // per pannello fill ratio, per pezzo traslazione in X dell'origine pezzo
double dY ; // solo per pezzo, traslazione in Y dell'origine pezzo
double dAngRot ; // solo per pezzo, rotazione del pezzo attorno all'origine
} ;
typedef std::vector<ANestInfo> ANIVECT ;
//-----------------------------------------------------------------------------
class __declspec( novtable) IAutoNester
{
public :
virtual ~IAutoNester( void) {}
virtual bool Start( void) = 0 ;
virtual bool AddSheet( int nSheetId, const PolyArc& Outline, int nPriority, int nCount) = 0 ;
virtual bool AddPart( int nPartId, const PolyArc& Outline, int nCount) = 0 ;
virtual bool SetInterpartGap( double dGap) = 0 ;
virtual bool Compute( int nMaxTime) = 0 ;
virtual bool GetComputationStatus( int& nStatus) = 0 ;
virtual bool GetResults( double& dTotFillRatio, ANIVECT& vANI) = 0 ;
virtual bool PrintResults( const std::string& sHtmlFile) = 0 ;
} ;
//-----------------------------------------------------------------------------
extern "C" {
ENS_EXPORT IAutoNester* CreateAutoNester(void) ;
}
+72
View File
@@ -0,0 +1,72 @@
//----------------------------------------------------------------------------
// EgalTech 2019-2019
//----------------------------------------------------------------------------
// File : ENsDllMain.h Data : 28.11.19 Versione : 2.1k6
// Contenuto : Prototipi funzioni generali della DLL.
//
//
//
// Modifiche : 28.11.19 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include <string>
class ILogger ;
//----------------------- Macro per import/export ----------------------------
#undef ENS_EXPORT
#if defined( I_AM_ENS) // da definirsi solo nella DLL
#define ENS_EXPORT __declspec( dllexport)
#else
#define ENS_EXPORT __declspec( dllimport)
#endif
//-----------------------------------------------------------------------------
// E' necessaria l'interfaccia in C per caricare queste funzioni dinamicamente
extern "C" {
// restituisce la versione della Dll
ENS_EXPORT const char* GetENsVersion( void) ;
// permette di impostare il logger per la Dll
ENS_EXPORT void SetENsLogger( ILogger* pLogger) ;
// imposta la chiave di protezione
ENS_EXPORT void SetENsKey( const std::string& sKey) ;
// imposta la seconda chiave di protezione
ENS_EXPORT void SetENsKey2( const std::string& sKey2) ;
}
//-----------------------------------------------------------------------------
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EgtILogger.h"
#include "/EgtDev/Include/EgtKeyCodes.h"
#include "/EgtDev/Include/SELkKeyProc.h"
//-----------------------------------------------------------------------------
// Test della chiave per caricare la DLL
inline bool
TestKeyForENs( const std::string& sKey, int nKeyOpt, ILogger* pLogger)
{
// verifico la chiave e le opzioni
unsigned int nOpt1, nOpt2 ;
int nOptExpDays ;
int nRet = GetKeyOptions( sKey, KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
if ( nRet != KEY_OK) {
std::string sErr = "Error on Key (ENS/" + ToString( nRet) + ")" ;
LOG_ERROR( pLogger, sErr.c_str()) ;
return false ;
}
if ( ( nOpt1 & ( KEYOPT_ENS_BASE)) == 0 ||
( nKeyOpt != 0 && ( nOpt1 & nKeyOpt) == 0) ||
nOptExpDays < GetCurrDay()) {
std::string sErr = "Error on Key (ENS/OPT)" ;
LOG_ERROR( pLogger, sErr.c_str()) ;
return false ;
}
return true ;
}
+12
View File
@@ -39,6 +39,7 @@ EXE_EXPORT bool ExeInit( int nDebug, const std::string& sLogFile, const std::str
EXE_EXPORT bool ExeExit( void) ;
EXE_EXPORT int ExeGetDebugLevel( void) ;
EXE_EXPORT bool ExeSetKey( const std::string& sKey) ;
EXE_EXPORT bool ExeSetNestKey( const std::string& sNestKey) ;
EXE_EXPORT bool ExeSetFont( const std::string& sNfeFontDir, const std::string& sDefaultFont) ;
EXE_EXPORT bool ExeGetNfeFontDir( std::string& sNfeFontDir) ;
EXE_EXPORT bool ExeGetDefaultFont( std::string& sDefaultFont) ;
@@ -673,6 +674,16 @@ EXE_EXPORT bool ExeGetPartClusterCenterGlob( const INTVECTOR& vIds, Point3d& ptC
// Machining Nest
EXE_EXPORT bool ExeVerifyMachining( int nMchId, int& nResult) ;
EXE_EXPORT int ExeVerifyCutAsSplitting( int nMchId) ;
// AutoNesting
EXE_EXPORT bool ExeAutoNestStart( void) ;
EXE_EXPORT bool ExeAutoNestAddSheet( int nSheetId, int nOutlineId, int nPriority, int nCount) ;
EXE_EXPORT bool ExeAutoNestAddPart( int nPartId, int nOutlineId, int nCount) ;
EXE_EXPORT bool ExeAutoNestSetInterpartGap( double dGap) ;
EXE_EXPORT bool ExeAutoNestCompute( int nMaxTime) ;
EXE_EXPORT bool ExeAutoNestGetComputationStatus( int& nStatus) ;
EXE_EXPORT bool ExeAutoNestPrintResults( const std::string& sHtmlFile) ;
EXE_EXPORT bool ExeAutoNestGetResults( int& nNestedParts, int& nTotParts, int& nTotSheets, int& nDiffSheets, double& dTotFillRatio) ;
EXE_EXPORT bool ExeAutoNestGetOneResult( int nInd, int& nType, int& nId, int& nFlag, double& dX, double& dY, double& dAngRot) ;
// Collision Avoidance Tool SurfaceTriMesh
EXE_EXPORT bool ExeCAvSetStdTool( double dToolLen, double dToolDiam, double dToolCornR) ;
@@ -947,6 +958,7 @@ EXE_EXPORT bool ExeInitScene( HWND hWnd, int nDriver, bool b2Buff, int nColorBit
EXE_EXPORT bool ExeGetSceneInfo( std::string& sInfo) ;
EXE_EXPORT bool ExeSetBackground( Color TopCol, Color BottomCol, bool bRedraw) ;
EXE_EXPORT bool ExeGetBackground( Color& TopCol, Color& BottomCol) ;
EXE_EXPORT bool ExeSetLineAttribs( int nWidth) ;
EXE_EXPORT bool ExeSetMarkAttribs( Color MarkCol) ;
EXE_EXPORT bool ExeSetSelSurfAttribs( Color SelSurfCol) ;
EXE_EXPORT bool ExeSetGeoLineAttribs( Color GlCol) ;
+2
View File
@@ -31,3 +31,5 @@ const int KEYOPT_EEX_INPADV = 0x00010 ; // EgtExchange import avanzato
const int KEYOPT_EEX_EXPBASE = 0x00020 ; // EgtExchange export base
const int KEYOPT_EEX_EXPADV = 0x00040 ; // EgtExchange export avanzato
const int KEYOPT_EMK_BASE = 0x00080 ; // EgtMachKernel lavorazioni base
const int KEYOPT_EMK_ADV = 0x00100 ; // EgtMachKernel lavorazioni avanzate
const int KEYOPT_ENS_BASE = 0x00200 ; // EgtNesting automatico base
+1 -1
View File
@@ -32,4 +32,4 @@
#endif
// Direttorio librerie esterne
#define EGTEXTDIR "/EgtDev/EXTERN/"
#define EGTEXTDIR "/EgtDev/Extern/"
+3 -2
View File
@@ -35,8 +35,9 @@ typedef std::list<unsigned int> UINT_LIST ; // lista di interi senza seg
//----------------------------------------------------------------------------
// Raccolte di double
typedef std::vector<double> DBLVECTOR ; // vettore di double
typedef std::list<double> DBLLIST ; // lista di double
typedef std::vector<double> DBLVECTOR ; // vettore di double
typedef std::list<double> DBLLIST ; // lista di double
typedef std::vector<std::vector<double>> DBLMATRIX ; // matrice di double
//----------------------------------------------------------------------------
// Raccolte di coppie integer, integer