EgtInterface 1.6c10 :
- gestione macchinate (gruppi di lavorazione).
This commit is contained in:
@@ -135,7 +135,11 @@ bool EgtShear( INTVECTOR& vIds, const Point3d& ptP, const Vector3d& vtN,
|
||||
const Vector3d& vtDir, double dCoeff, int nRefType) ;
|
||||
|
||||
//--------------------------- Machining --------------------------------------
|
||||
bool EgtUpdateMachMgr( void) ;
|
||||
bool EgtInsertMachMgr( int nInsGrp) ;
|
||||
int EgtAddMachGroup( const std::string& sName, const std::string& sMachineName) ;
|
||||
bool EgtGetMachGroupName( int nMGroupInd, std::string& sName) ;
|
||||
bool EgtGetMachGroupInd( const std::string& sName, int& nInd) ;
|
||||
|
||||
//--------------------------- Scene ------------------------------------------
|
||||
bool EgtSetBackground( Color TopCol, Color BottomCol, bool bRedraw) ;
|
||||
|
||||
+27
-2
@@ -285,6 +285,8 @@ __stdcall EgtNewFile( void)
|
||||
// aggiorno stato file corrente
|
||||
pGseCtx->m_sFilePath.clear() ;
|
||||
pGseCtx->m_bModified = false ;
|
||||
// aggiornamento gestore lavorazioni
|
||||
EgtUpdateMachMgr() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtNewFile()"
|
||||
@@ -313,10 +315,12 @@ EgtOpenFile( const string& sFilePath)
|
||||
bOk = bOk && pGseCtx->m_pGeomDB->Init() ;
|
||||
bOk = bOk && pGseCtx->m_pGeomDB->SetDefaultMaterial( pGseCtx->m_colDef) ;
|
||||
// carico il file
|
||||
bOk = bOk && GetCurrGeomDB()->Load( sFilePath) ;
|
||||
bOk = bOk && pGseCtx->m_pGeomDB->Load( sFilePath) ;
|
||||
// aggiorno stato file corrente
|
||||
pGseCtx->m_sFilePath = sFilePath ;
|
||||
pGseCtx->m_bModified = false ;
|
||||
// aggiornamento gestore lavorazioni
|
||||
EgtUpdateMachMgr() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLuaPath = sFilePath ;
|
||||
@@ -342,8 +346,29 @@ EgtInsertFile( const string& sFilePath)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
||||
IGeomDB* pGeomDB = pGseCtx->m_pGeomDB ;
|
||||
// creo gruppo temporaneo di parcheggio
|
||||
int nGrp = pGeomDB->InsertGroup( GDB_ID_NULL, GDB_ID_ROOT, GDB_FIRST_SON, GLOB_FRM) ;
|
||||
bool bOk = ( nGrp != GDB_ID_NULL) ;
|
||||
bOk = bOk && pGeomDB->SetLevel( nGrp, GDB_LV_TEMP) ;
|
||||
// carico il file
|
||||
bool bOk = pGseCtx->m_pGeomDB->Load( sFilePath) ;
|
||||
bOk = bOk && pGeomDB->Load( sFilePath, nGrp) ;
|
||||
// sposto i pezzi sotto la radice
|
||||
int nId = pGeomDB->GetFirstGroupInGroup( nGrp) ;
|
||||
while ( bOk && nId != GDB_ID_NULL) {
|
||||
// prossimo gruppo
|
||||
int nNextId = pGeomDB->GetNextGroup( nId) ;
|
||||
// se il gruppo corrente è un pezzo, lo sposto
|
||||
int nLevel ;
|
||||
if ( ! pGeomDB->GetLevel( nId, nLevel) || nLevel == GDB_LV_USER)
|
||||
bOk = pGeomDB->Relocate( nId, GDB_ID_ROOT, GDB_LAST_SON) ;
|
||||
// passo al prossimo
|
||||
nId = nNextId ;
|
||||
}
|
||||
// sistemo le lavorazioni
|
||||
bOk = bOk && EgtInsertMachMgr( nGrp) ;
|
||||
// cancello il gruppo temporaneo
|
||||
pGeomDB->Erase( nGrp) ;
|
||||
// aggiorno stato file corrente
|
||||
pGseCtx->m_bModified = true ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
|
||||
+111
-1
@@ -40,6 +40,36 @@ __stdcall EgtInitMachMgr( void)
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
EgtUpdateMachMgr( void)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, FALSE)
|
||||
// aggiornamento gestore lavorazioni
|
||||
return pMachMgr->Update() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
EgtInsertMachMgr( int nInsGrp)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, 0)
|
||||
// sposto le macchinate dal gruppo di inserimento alla base macchinate
|
||||
return pMachMgr->Insert( nInsGrp) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtGetMachGroupNbr( void)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, 0)
|
||||
// recupero il numero di macchinate
|
||||
return pMachMgr->GetMachGroupNbr() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtAddMachGroup( const wchar_t* wsName, const wchar_t* wsMachineName)
|
||||
@@ -52,7 +82,87 @@ int
|
||||
EgtAddMachGroup( const string& sName, const string& sMachineName)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
|
||||
VERIFY_MACHMGR( pMachMgr, 0)
|
||||
// aggiungo la macchinata (gruppo di lavorazione)
|
||||
return pMachMgr->AddMachGroup( sName, sMachineName) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtRemoveMachGroup( int nMGroupInd)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, FALSE)
|
||||
// rimuovo la macchinata (gruppo di lavorazione)
|
||||
return ( pMachMgr->RemoveMachGroup( nMGroupInd) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtGetMachGroupName( int nMGroupInd, wchar_t*& wsName)
|
||||
{
|
||||
if ( &wsName == nullptr)
|
||||
return FALSE ;
|
||||
string sName ;
|
||||
if ( ! EgtGetMachGroupName( nMGroupInd, sName))
|
||||
return FALSE ;
|
||||
wsName = _wcsdup( stringtoW( sName)) ;
|
||||
return (( wsName == nullptr) ? FALSE : TRUE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
EgtGetMachGroupName( int nMGroupInd, string& sName)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, false)
|
||||
// recupero il nome della macchinata
|
||||
return pMachMgr->GetMachGroupName( nMGroupInd, sName) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtGetMachGroupInd( const wchar_t* wsName, int* pnInd)
|
||||
{
|
||||
return ( EgtGetMachGroupInd( wstrztoA( wsName), *pnInd) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
EgtGetMachGroupInd( const string& sName, int& nInd)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, false)
|
||||
// recupero l'indice della macchinata
|
||||
return pMachMgr->GetMachGroupInd( sName, nInd) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtSetCurrMachGroup( int nMGroupInd)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, FALSE)
|
||||
// imposto la macchinata corrente
|
||||
return ( pMachMgr->SetCurrMachGroup( nMGroupInd) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtResetCurrMachGroup( void)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, FALSE)
|
||||
// reset macchinata corrente
|
||||
return ( pMachMgr->ResetCurrMachGroup() ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtGetCurrMachGroup( int* pnInd)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, FALSE)
|
||||
// reset macchinata corrente
|
||||
return ( pMachMgr->GetCurrMachGroup( *pnInd) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
Binary file not shown.
+117
@@ -22,6 +22,18 @@
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetMachGroupNbr( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// recupero il numero di macchinate
|
||||
int nTot = EgtGetMachGroupNbr() ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, nTot) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
@@ -40,11 +52,116 @@ LuaAddMachGroup( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaRemoveMachGroup( lua_State* L)
|
||||
{
|
||||
// 1 parametro : indice del gruppo
|
||||
int nMGroupInd ;
|
||||
LuaCheckParam( L, 1, nMGroupInd)
|
||||
LuaClearStack( L) ;
|
||||
// rimuovo la macchinata
|
||||
bool bOk = ( EgtRemoveMachGroup( nMGroupInd) != FALSE) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetMachGroupName( lua_State* L)
|
||||
{
|
||||
// 1 parametro : indice del gruppo
|
||||
int nMGroupInd ;
|
||||
LuaCheckParam( L, 1, nMGroupInd)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il nome della macchinata
|
||||
string sName ;
|
||||
bool bOk = EgtGetMachGroupName( nMGroupInd, sName) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk)
|
||||
LuaSetReturn( L, sName) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetMachGroupInd( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nome del gruppo
|
||||
string sGroupName ;
|
||||
LuaCheckParam( L, 1, sGroupName)
|
||||
LuaClearStack( L) ;
|
||||
// recupero l'indice della macchinata
|
||||
int nInd ;
|
||||
bool bOk = EgtGetMachGroupInd( sGroupName, nInd) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk)
|
||||
LuaSetReturn( L, nInd) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetCurrMachGroup( lua_State* L)
|
||||
{
|
||||
// 1 parametro : indice del gruppo
|
||||
int nMGroupInd ;
|
||||
LuaCheckParam( L, 1, nMGroupInd)
|
||||
LuaClearStack( L) ;
|
||||
// imposto il gruppo corrente
|
||||
bool bOk = ( EgtSetCurrMachGroup( nMGroupInd) != FALSE) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaResetCurrMachGroup( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// imposto il gruppo corrente
|
||||
bool bOk = ( EgtResetCurrMachGroup() != FALSE) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetCurrMachGroup( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// recupero il gruppo corrente
|
||||
int nInd ;
|
||||
bool bOk = ( EgtGetCurrMachGroup( &nInd) != FALSE) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk)
|
||||
LuaSetReturn( L, nInd) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallMachMgr( void)
|
||||
{
|
||||
bool bOk = true ;
|
||||
bOk = bOk && LuaRegisterFunction( "EgtGetMachGroupNbr", LuaGetMachGroupNbr) ;
|
||||
bOk = bOk && LuaRegisterFunction( "EgtAddMachGroup", LuaAddMachGroup) ;
|
||||
bOk = bOk && LuaRegisterFunction( "EgtRemoveMachGroup", LuaRemoveMachGroup) ;
|
||||
bOk = bOk && LuaRegisterFunction( "EgtGetMachGroupName", LuaGetMachGroupName) ;
|
||||
bOk = bOk && LuaRegisterFunction( "EgtGetMachGroupInd", LuaGetMachGroupInd) ;
|
||||
bOk = bOk && LuaRegisterFunction( "EgtSetCurrMachGroup", LuaSetCurrMachGroup) ;
|
||||
bOk = bOk && LuaRegisterFunction( "EgtResetCurrMachGroup", LuaResetCurrMachGroup) ;
|
||||
bOk = bOk && LuaRegisterFunction( "EgtGetCurrMachGroup", LuaGetCurrMachGroup) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user