EgtExecutor 1.6n4 :

- correzione a ChainCurves
- aggiunte RemoveLastPhase, VerifyRawPartPhase, SplitFlatRawPartWithMachinings, GetOperationPhase, RemoveAllPhaseOperations, ChangeOperationPhase, GetPhaseDisposition
- estesa VerifyCutAsSplitting
- aggiunti nei messaggi gestione "???" per traduzioni da fare.
This commit is contained in:
Dario Sassi
2016-02-15 07:44:15 +00:00
parent 285da9d4e8
commit af4f4633e0
7 changed files with 274 additions and 36 deletions
+10 -10
View File
@@ -1134,16 +1134,16 @@ MyChainCurvesInGroup( int nGroupId, const Point3d& ptNear, bool bAllowInvert, in
while ( nId != GDB_ID_NULL) {
// recupero la curva
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nId)) ;
if ( pCrv == nullptr)
continue ;
// recupero i dati della curva necessari al concatenamento e li assegno
Point3d ptStart, ptEnd ;
Vector3d vtStart, vtEnd ;
if ( ! pCrv->GetStartPoint( ptStart) || ! pCrv->GetStartDir( vtStart) ||
! pCrv->GetEndPoint( ptEnd) || ! pCrv->GetEndDir( vtEnd))
return false ;
if ( ! chainC.AddCurve( nId, ptStart, vtStart, ptEnd, vtEnd))
return false ;
if ( pCrv != nullptr) {
// recupero i dati della curva necessari al concatenamento e li assegno
Point3d ptStart, ptEnd ;
Vector3d vtStart, vtEnd ;
if ( ! pCrv->GetStartPoint( ptStart) || ! pCrv->GetStartDir( vtStart) ||
! pCrv->GetEndPoint( ptEnd) || ! pCrv->GetEndDir( vtEnd))
return false ;
if ( ! chainC.AddCurve( nId, ptStart, vtStart, ptEnd, vtEnd))
return false ;
}
// passo al successivo
nId = pGeomDB->GetNext( nId) ;
}
+86 -4
View File
@@ -260,6 +260,16 @@ ExeGetCurrPhase( void)
return pMachMgr->GetCurrPhase() ;
}
//-----------------------------------------------------------------------------
bool
ExeRemoveLastPhase( void)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// elimina l'ultima fase di lavorazione dalla macchinata corrente
return pMachMgr->RemoveLastPhase() ;
}
//-----------------------------------------------------------------------------
int
ExeGetPhaseCount( void)
@@ -421,6 +431,18 @@ ExeKeepRawPart( int nRawId)
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeVerifyRawPartPhase( int nRawId, int nPhase)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_MACHMGR( pGseCtx, false)
// verifico che il grezzo sia valido ed appartenga alla fase di lavorazione indicata
bool bOk = pGseCtx->m_pMachMgr->VerifyRawPartPhase( nRawId, nPhase) ;
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeRemoveRawPart( int nRawId)
@@ -523,6 +545,26 @@ ExeMoveRawPart( int nRawId, const Vector3d& vtMove)
return bOk ;
}
//-----------------------------------------------------------------------------
int
ExeSplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_MACHMGR( pGseCtx, false)
// divido il grezzo in nuove parti in base alle lavorazioni
int nId = pGseCtx->m_pMachMgr->SplitFlatRawPartWithMachinings( nRawId, vMchId) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSplitFlatRawPartWithMachinings(" + ToString( nRawId) + ",{" +
IdListToString( vMchId) + "})" +
" -- FirstId=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return nId ;
}
//-----------------------------------------------------------------------------
int
ExeGetPartInRawPartCount( int nRawId)
@@ -1128,10 +1170,20 @@ ExeGetOperationType( int nId)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_MACHMGR( pGseCtx, false)
// recupero il tipo di operazione della macchinata corrente
// recupero il tipo della operazione della macchinata corrente
return pGseCtx->m_pMachMgr->GetOperationType( nId) ;
}
//-----------------------------------------------------------------------------
int
ExeGetOperationPhase( int nId)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_MACHMGR( pGseCtx, false)
// recupero la fase di appartenenza della operazione della macchinata corrente
return pGseCtx->m_pMachMgr->GetOperationPhase( nId) ;
}
//-----------------------------------------------------------------------------
bool
ExeRemoveOperation( int nId)
@@ -1142,14 +1194,24 @@ ExeRemoveOperation( int nId)
return pGseCtx->m_pMachMgr->RemoveOperation( nId) ;
}
//-----------------------------------------------------------------------------
bool
ExeRemoveAllPhaseOperations( int nPhase)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_MACHMGR( pGseCtx, false)
// elimino tutte le operazioni (tranne la disposizione) della fase indicata della macchinata corrente
return pGseCtx->m_pMachMgr->RemoveAllPhaseOperations( nPhase) ;
}
//-----------------------------------------------------------------------------
bool
ExeRemoveAllOperations( void)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_MACHMGR( pGseCtx, false)
// elimino tutte le operazioni della macchinata corrente tranne il primo posizionamento
return pGseCtx->m_pMachMgr->RemoveAllOperations( true) ;
// elimino tutte le operazioni e le fasi della macchinata corrente tranne la prima disposizione
return pGseCtx->m_pMachMgr->RemoveAllOperations() ;
}
//-----------------------------------------------------------------------------
@@ -1212,6 +1274,26 @@ ExeSetAllOperationsStatus( bool bShow)
return pGseCtx->m_pMachMgr->SetAllOperationsStatus( true, bShow) ;
}
//-----------------------------------------------------------------------------
bool
ExeChangeOperationPhase( int nId, int nNewPhase)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_MACHMGR( pGseCtx, false)
// cambio la fase dell'operazione e la sposto in fondo alle lavorazioni della stessa fase
return pGseCtx->m_pMachMgr->ChangeOperationPhase( nId, nNewPhase) ;
}
//-----------------------------------------------------------------------------
int
ExeGetPhaseDisposition( int nPhase)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_MACHMGR( pGseCtx, false)
// recupero la disposizione della fase indicata
return pGseCtx->m_pMachMgr->GetPhaseDisposition( nPhase) ;
}
//-----------------------------------------------------------------------------
// Lavorazioni
//-----------------------------------------------------------------------------
@@ -1361,7 +1443,7 @@ ExeIsMachiningEmpty( void)
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_MACHMGR( pGseCtx, false)
// restituisco lo stato della lavorazione corrente
return pGseCtx->m_pMachMgr->IsEmpty() ;
return pGseCtx->m_pMachMgr->IsMachiningEmpty() ;
}
//-----------------------------------------------------------------------------
+2 -1
View File
@@ -71,7 +71,8 @@ ExeLoadMessages( const string& sMsgFilePath)
}
nCurrNum = nNum ;
// converto i caratteri speciali
ReplaceString( sMsg, "<br/>", "\n") ;
ReplaceString( sMsg, "<br/>", "\n") ; // a capo
ReplaceString( sMsg, "???", "") ; // da tradurre
// inserisco il messaggio in tabella
if ( ! s_IdStringMap.emplace( nNum, sMsg).second)
return false ;
+13 -2
View File
@@ -605,8 +605,19 @@ ExeAdjustFlatPartLayer( int nLayerId)
// Disabilito registrazione comandi
CmdLogOff cmdLogOff ;
bool bOk = true ;
// Compatto e poi esplodo le curve composite
// Elimino dal gruppo gli oggetti che non sono curve
int nId = pGeomDB->GetFirstInGroup( nLayerId) ;
while ( nId != GDB_ID_NULL && bOk) {
// Recupero successiva
int nNextId = pGeomDB->GetNext( nId) ;
// Se non è una curva, la cancello
if ( ( pGeomDB->GetGeoType( nId) & GEO_CURVE) == 0)
pGeomDB->Erase( nId) ;
// Passo all'entità successiva
nId = nNextId ;
}
// Compatto e poi esplodo le curve composite
nId = pGeomDB->GetFirstInGroup( nLayerId) ;
while ( nId != GDB_ID_NULL && bOk) {
// Recupero successiva
int nNextId = pGeomDB->GetNext( nId) ;
@@ -635,7 +646,7 @@ ExeAdjustFlatPartLayer( int nLayerId)
// Inserisco in ogni curva info su angoli con precedente e successiva
int nFirstId = pGeomDB->GetFirstInGroup( nLayerId) ;
nId = nFirstId ;
while ( nId != GDB_ID_NULL) {
while ( bOk && nId != GDB_ID_NULL) {
// Recupero successiva
int nNextId = pGeomDB->GetNext( nId) ;
// Successiva geometrica (si considera il layer formato da curve contigue che si chiudono)
+40 -18
View File
@@ -45,7 +45,7 @@ ExeVerifyMachining( int nMchId, int& nResult)
return false ;
// se vuoto, cerco il rimando al preview nel pezzo
if ( pGeomDB->GetGroupObjs( nPVGrp) == 0 &&
! pGeomDB->GetInfo( nPVGrp, "PvId", nPVGrp))
! pGeomDB->GetInfo( nPVGrp, MCH_PV_KEY_RELOCATE, nPVGrp))
return false ;
// ciclo sui percorsi utensile (CL)
int nClId = pGeomDB->GetFirstGroupInGroup( nPVGrp) ;
@@ -141,7 +141,7 @@ ExeVerifyMachining( int nMchId, int& nResult)
}
//----------------------------------------------------------------------------
bool
int
ExeVerifyCutAsSplitting( int nMchId)
{
GseContext* pGseCtx = GetCurrGseContext() ;
@@ -155,32 +155,54 @@ ExeVerifyCutAsSplitting( int nMchId)
int nCurrMch = pGseCtx->m_pMachMgr->GetCurrMachining() ;
// imposto la nuova lavorazione corrente
pGseCtx->m_pMachMgr->SetCurrMachining( nMchId) ;
// risultato
int nResult = CAR_INTERF ;
// recupero attacco e uscita correnti della lavorazione
int nLiType ;
pGseCtx->m_pMachMgr->GetMachiningParam( MPA_LEADINTYPE, nLiType) ;
int nLoType ;
pGseCtx->m_pMachMgr->GetMachiningParam( MPA_LEADOUTTYPE, nLoType) ;
// se diversi da attacco/uscita al bordo grezzo, li cambio
bool bToModif = ( ( nLiType != SAW_LI_EXT_CENT && nLiType != SAW_LI_EXT_OUT) || nLoType != SAW_LO_EXT) ;
if ( bToModif) {
// verifico se posso portare attacco al bordo grezzo
bool bLiToModif = ( nLiType != SAW_LI_EXT_CENT && nLiType != SAW_LI_EXT_OUT) ;
if ( bLiToModif) {
// cambio attacco
pGseCtx->m_pMachMgr->SetMachiningParam( MPA_LEADINTYPE, SAW_LI_EXT_CENT) ;
pGseCtx->m_pMachMgr->SetMachiningParam( MPA_LEADOUTTYPE, SAW_LO_EXT) ;
}
// aggiorno preview
pGseCtx->m_pMachMgr->MachiningPreview( true) ;
// verifico interferenza
bool bOk ;
int nResult ;
bOk = ( ExeVerifyMachining( nMchId, nResult) && nResult == FMI_NONE) ;
// se attacco/uscita modificati, li ripristino e riaggiorno preview
if ( bToModif) {
pGseCtx->m_pMachMgr->SetMachiningParam( MPA_LEADINTYPE, nLiType) ;
pGseCtx->m_pMachMgr->SetMachiningParam( MPA_LEADOUTTYPE, nLoType) ;
// aggiorno preview
pGseCtx->m_pMachMgr->MachiningPreview( true) ;
// verifico interferenza
int nRes ;
if ( ExeVerifyMachining( nMchId, nRes) && nRes == FMI_NONE)
nResult += CAR_LI_OK ;
// ripristino attacco originale
pGseCtx->m_pMachMgr->SetMachiningParam( MPA_LEADINTYPE, nLiType) ;
}
// verifico se posso portare uscita al bordo grezzo
bool bLoToModif = ( nLoType != SAW_LO_EXT) ;
if ( bLoToModif) {
pGseCtx->m_pMachMgr->SetMachiningParam( MPA_LEADOUTTYPE, SAW_LO_EXT) ;
// aggiorno preview
pGseCtx->m_pMachMgr->MachiningPreview( true) ;
// verifico interferenza
int nRes ;
if ( ExeVerifyMachining( nMchId, nRes) && nRes == FMI_NONE)
nResult += CAR_LO_OK ;
// ripristino uscita originale
pGseCtx->m_pMachMgr->SetMachiningParam( MPA_LEADOUTTYPE, nLoType) ;
}
// aggiorno preview con attacco/uscita originali
pGseCtx->m_pMachMgr->MachiningPreview( true) ;
// se già al bordo grezzo, faccio verifica
if ( ! bLiToModif && ! bLoToModif) {
// aggiorno preview
pGseCtx->m_pMachMgr->MachiningPreview( true) ;
// verifico interferenza
int nRes ;
if ( ExeVerifyMachining( nMchId, nRes) && nRes == FMI_NONE)
nResult = CAR_LI_LO_OK ;
}
// ripristino lavorazione corrente
pGseCtx->m_pMachMgr->SetCurrMachining( nCurrMch) ;
// restituisco il risultato
return bOk ;
return nResult ;
}
BIN
View File
Binary file not shown.
+123 -1
View File
@@ -268,6 +268,19 @@ LuaGetCurrPhase( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRemoveLastPhase( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// elimina l'ultima fase di lavorazione dalla macchinata corrente
bool bOk = ExeRemoveLastPhase() ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetPhaseCount( lua_State* L)
@@ -432,6 +445,23 @@ LuaKeepRawPart( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaVerifyRawPartPhase( lua_State* L)
{
// 2 parametri : nRawId, nPhase
int nRawId ;
LuaCheckParam( L, 1, nRawId)
int nPhase ;
LuaCheckParam( L, 2, nPhase)
LuaClearStack( L) ;
// verifico che il grezzo sia valido ed appartenga alla fase di lavorazione indicata
bool bOk = ExeVerifyRawPartPhase( nRawId, nPhase) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRemoveRawPart( lua_State* L)
@@ -464,6 +494,26 @@ LuaMoveRawPart( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSplitFlatRawPartWithMachinings( lua_State* L)
{
// 2 parametri : nRawId, vMchId
int nRawId ;
LuaCheckParam( L, 1, nRawId)
INTVECTOR vMchId ;
LuaCheckParam( L, 2, vMchId)
LuaClearStack( L) ;
// divido il grezzo in parti in base ai tagli delle lavorazioni
int nId = ExeSplitFlatRawPartWithMachinings( nRawId, vMchId) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRotateRawPart( lua_State* L)
@@ -1290,6 +1340,21 @@ LuaGetOperationType( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetOperationPhase( lua_State* L)
{
// 1 parametro : nId
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// restituisco la fase di appartenenza dell'operazione indicata della macchinata corrente
int nType = ExeGetOperationPhase( nId) ;
// restituisco il risultato
LuaSetParam( L, nType) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRemoveOperation( lua_State* L)
@@ -1305,6 +1370,21 @@ LuaRemoveOperation( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRemoveAllPhaseOperations( lua_State* L)
{
// 1 parametro : nPhase
int nPhase ;
LuaCheckParam( L, 1, nPhase)
LuaClearStack( L) ;
// elimino tutte le operazioni (tranne la disposizione) della fase indicata della macchinata corrente
bool bOk = ExeRemoveAllPhaseOperations( nPhase) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRemoveAllOperations( lua_State* L)
@@ -1382,6 +1462,41 @@ LuaSetAllOperationsStatus( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaChangeOperationPhase( lua_State* L)
{
// 2 parametri : nId, nNewPhase
int nId ;
LuaCheckParam( L, 1, nId)
int nNewPhase ;
LuaCheckParam( L, 2, nNewPhase)
LuaClearStack( L) ;
// imposto lo stato di visualizzazione di tutte le operazioni
bool bOk = ExeChangeOperationPhase( nId, nNewPhase) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetPhaseDisposition( lua_State* L)
{
// 1 parametro : nPhase
int nPhase ;
LuaCheckParam( L, 1, nPhase)
LuaClearStack( L) ;
// recupero la disposizione della fase indicata
int nId = ExeGetPhaseDisposition( nPhase) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
// Machinings
//-------------------------------------------------------------------------------
@@ -2056,6 +2171,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtAddPhase", LuaAddPhase) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCurrPhase", LuaSetCurrPhase) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCurrPhase", LuaGetCurrPhase) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveLastPhase", LuaRemoveLastPhase) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPhaseCount", LuaGetPhaseCount) ;
// Raw Parts & Parts
bOk = bOk && luaMgr.RegisterFunction( "EgtGetRawPartCount", LuaGetRawPartCount) ;
@@ -2066,11 +2182,13 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyRawPartSize", LuaModifyRawPartSize) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyRawPartHeight", LuaModifyRawPartHeight) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtKeepRawPart", LuaKeepRawPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVerifyRawPartPhase", LuaVerifyRawPartPhase) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveRawPart", LuaRemoveRawPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRotateRawPart", LuaRotateRawPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtMoveToCornerRawPart", LuaMoveToCornerRawPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtMoveToCenterRawPart", LuaMoveToCenterRawPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtMoveRawPart", LuaMoveRawPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSplitFlatRawPartWithMachinings", LuaSplitFlatRawPartWithMachinings) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPartInRawPartCount", LuaGetPartInRawPartCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstPartInRawPart", LuaGetFirstPartInRawPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextPartInRawPart", LuaGetNextPartInRawPart) ;
@@ -2115,12 +2233,16 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstOperation", LuaGetFirstOperation) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextOperation", LuaGetNextOperation) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetOperationType", LuaGetOperationType) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetOperationPhase", LuaGetOperationPhase) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveOperation", LuaRemoveOperation) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveAllPhaseOperations", LuaRemoveAllPhaseOperations) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveAllOperations", LuaRemoveAllOperations) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetOperationMode", LuaSetOperationMode) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetAllOperationsMode", LuaSetAllOperationsMode) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetOperationStatus", LuaSetOperationStatus) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetAllOperationsStatus", LuaSetAllOperationsStatus) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetAllOperationsStatus", LuaSetAllOperationsStatus) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtChangeOperationPhase", LuaChangeOperationPhase) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPhaseDisposition", LuaGetPhaseDisposition) ;
// Machinings
bOk = bOk && luaMgr.RegisterFunction( "EgtAddMachining", LuaAddMachining) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCurrMachining", LuaSetCurrMachining) ;