EgtExecutor :
- modifiche varie per OmagCut.
This commit is contained in:
@@ -340,11 +340,14 @@ ExeEraseEmptyParts( void)
|
||||
// passo al layer successivo
|
||||
nLayerId = ExeVerifyOrNext( pGeomDB, pGeomDB->GetNextGroup( nLayerId), false) ;
|
||||
}
|
||||
// verifico se gruppo sorgente di pezzo in gruppo di lavorazione
|
||||
if ( pGeomDB->ExistsInfo( nPartId, GDB_SI_SOURCE))
|
||||
bFound = true ;
|
||||
// salvo Id pezzo corrente
|
||||
int nOldId = nPartId ;
|
||||
// passo al pezzo successivo
|
||||
nPartId = ExeVerifyOrNext( pGeomDB, pGeomDB->GetNextGroup( nPartId), false) ;
|
||||
// se corrente da cancelare, procedo
|
||||
// se corrente da cancellare, procedo
|
||||
if ( ! bFound)
|
||||
pGeomDB->Erase( nOldId) ;
|
||||
}
|
||||
|
||||
+85
-3
@@ -236,18 +236,18 @@ ExeGetNextRawPart( int nRawId)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeAddRawPart( Point3d ptOrig, double dWidth, double dLength, double dHeight, Color cCol)
|
||||
ExeAddRawPart( Point3d ptOrig, double dLength, double dWidth, double dHeight, Color cCol)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, GDB_ID_NULL)
|
||||
// inserisco grezzo nella macchinata corrente
|
||||
int nId = pGseCtx->m_pMachMgr->AddRawPart( ptOrig, dWidth, dLength, dHeight, cCol) ;
|
||||
int nId = pGseCtx->m_pMachMgr->AddRawPart( ptOrig, dLength, dWidth, dHeight, cCol) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtAddRawPart({" + ToString( ptOrig) + "}," +
|
||||
ToString( dWidth) + "," +
|
||||
ToString( dLength) + "," +
|
||||
ToString( dWidth) + "," +
|
||||
ToString( dHeight) + ",{" +
|
||||
ToString( cCol) + "})" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
@@ -279,6 +279,28 @@ ExeAddRawPartWithPart( int nPartId, int nCrvId, double dOverMat, Color cCol)
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeModifyRawPartSize( int nRawId, double dLength, double dWidth, double dHeight)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, false)
|
||||
// modifico la lunghezza del grezzo
|
||||
bool bOk = pGseCtx->m_pMachMgr->ModifyRawPartSize( nRawId, dLength, dWidth, dHeight) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtModifyRawPartSize(" + ToString( nRawId) + "," +
|
||||
ToString( dLength) + "," +
|
||||
ToString( dWidth) + "," +
|
||||
ToString( dHeight) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeModifyRawPartHeight( int nRawId, double dHeight)
|
||||
@@ -522,6 +544,26 @@ ExeSetTable( const std::string& sTable)
|
||||
return pGseCtx->m_pMachMgr->SetTable( sTable) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetTableRef1( Point3d& ptPos)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, false)
|
||||
// recupero il riferimento della tavola corrente della macchinata corrente
|
||||
return pGseCtx->m_pMachMgr->GetTableRef1( ptPos) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeShowOnlyTable( bool bVal)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, false)
|
||||
// visualizzo solo la tavola corrente della macchinata corrente
|
||||
return pGseCtx->m_pMachMgr->ShowOnlyTable( bVal) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeAddSubPiece( const string& sName, const Point3d& ptPos, double dAngRotDeg)
|
||||
@@ -618,6 +660,16 @@ ExeSetCalcTool( const std::string& sTool, const std::string& sHead, int nExit)
|
||||
return pGseCtx->m_pMachMgr->SetCalcTool( sTool, sHead, nExit) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetCalcTool( std::string& sTool)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, false)
|
||||
// restituisco il nome dell'utensile corrente per il calcolo sulla macchina della macchinata corrente
|
||||
return pGseCtx->m_pMachMgr->GetCalcTool( sTool) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
@@ -650,6 +702,36 @@ ExeVerifyOutOfStroke( double dX, double dY, double dZ, double dAngA, double dAng
|
||||
return pGseCtx->m_pMachMgr->VerifyOutOfStroke( dX, dY, dZ, dAngA, dAngB, nStat) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetToolParam( const string& sName, int nType, int& nVal)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, false)
|
||||
// recupero il parametro dell'utensile
|
||||
return pGseCtx->m_pMachMgr->GetToolParam( sName, nType, nVal) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetToolParam( const string& sName, int nType, double& dVal)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, false)
|
||||
// recupero il parametro dell'utensile
|
||||
return pGseCtx->m_pMachMgr->GetToolParam( sName, nType, dVal) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetToolParam( const string& sName, int nType, string& sVal)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, false)
|
||||
// recupero il parametro dell'utensile
|
||||
return pGseCtx->m_pMachMgr->GetToolParam( sName, nType, sVal) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeAddMachining( const string& sName, const std::string& sMachining)
|
||||
|
||||
+7
-4
@@ -541,9 +541,12 @@ ExePackPart( int nId, double dXmin, double dYmin, double dXmax, double dYmax, do
|
||||
b3Part.Expand( dOffs - 2 * EPS_SMALL, dOffs - 2 * EPS_SMALL, 0) ;
|
||||
// Box della regione di interesse
|
||||
BBox3d b3Region( dXmin, dYmin, 0, dXmax, dYmax, 0) ;
|
||||
// Verifico se pezzo sotto la radice o pezzo in altro gruppo
|
||||
int nGroupId = pGeomDB->GetParentId( nId) ;
|
||||
bool bInRoot = ( nGroupId == GDB_ID_ROOT) ;
|
||||
// Determino il box di tutti gli altri pezzi compresi nella regione di interesse
|
||||
BOXVECTOR vBox ;
|
||||
int nId2 = ExeGetFirstPart( true) ;
|
||||
int nId2 = ( bInRoot ? ExeGetFirstPart( true) : ExeGetFirstGroupInGroup( nGroupId)) ;
|
||||
while ( nId2 != GDB_ID_NULL) {
|
||||
if ( nId2 != nId) {
|
||||
BBox3d b3Part2 ;
|
||||
@@ -551,7 +554,7 @@ ExePackPart( int nId, double dXmin, double dYmin, double dXmax, double dYmax, do
|
||||
b3Region.OverlapsXY( b3Part2))
|
||||
vBox.emplace_back( b3Part2) ;
|
||||
}
|
||||
nId2 = ExeGetNextPart( nId2, true) ;
|
||||
nId2 = ( bInRoot ? ExeGetNextPart( nId2, true) : ExeGetNextGroup( nId2)) ;
|
||||
}
|
||||
// Ordino i box dei pezzi secondo la X crescente
|
||||
sort( vBox.begin(), vBox.end(), []( const BBox3d& a, const BBox3d& b)
|
||||
@@ -598,7 +601,7 @@ ExePackPart( int nId, double dXmin, double dYmin, double dXmax, double dYmax, do
|
||||
else if ( ! bBottomUp && b3Part.GetMin().y - ptPart.y + dYok < dYmin - dOffs - EPS_SMALL)
|
||||
return false ;
|
||||
// Porto il pezzo nella giusta posizione
|
||||
if ( ! pGeomDB->TranslateGlob( nId, Point3d( dXok, dYok, 0) - ptPart))
|
||||
if ( ! pGeomDB->TranslateGlob( nId, Point3d( dXok, dYok, ptPart.z) - ptPart))
|
||||
return false ;
|
||||
ExeSetModified() ;
|
||||
return true ;
|
||||
@@ -702,7 +705,7 @@ ExePackCluster( const INTVECTOR& vIds, double dXmin, double dYmin, double dXmax,
|
||||
return false ;
|
||||
// Porto il cluster nella giusta posizione
|
||||
for ( auto nTrueId : vTrueIds) {
|
||||
pGeomDB->TranslateGlob( nTrueId, Point3d( dXok, dYok, 0) - ptCluster) ;
|
||||
pGeomDB->TranslateGlob( nTrueId, Point3d( dXok, dYok, ptCluster.z) - ptCluster) ;
|
||||
}
|
||||
ExeSetModified() ;
|
||||
return true ;
|
||||
|
||||
Binary file not shown.
+106
-6
@@ -15,6 +15,7 @@
|
||||
#include "stdafx.h"
|
||||
#include "LUA.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EMkToolConst.h"
|
||||
#include "/EgtDev/Include/EMkMachiningConst.h"
|
||||
#include "/EgtDev/Include/EGkGdbConst.h"
|
||||
#include "/EgtDev/Include/EGkLuaAux.h"
|
||||
@@ -234,20 +235,20 @@ LuaGetNextRawPart( lua_State* L)
|
||||
static int
|
||||
LuaAddRawPart( lua_State* L)
|
||||
{
|
||||
// 5 parametri : Pto origine, dWidth, dLen, dH, Color
|
||||
// 5 parametri : Pto origine, dLen, dWidth, dH, Color
|
||||
Point3d ptOrig ;
|
||||
LuaCheckParam( L, 1, ptOrig)
|
||||
double dWidth ;
|
||||
LuaCheckParam( L, 2, dWidth)
|
||||
double dLength ;
|
||||
LuaCheckParam( L, 3, dLength)
|
||||
LuaCheckParam( L, 2, dLength)
|
||||
double dWidth ;
|
||||
LuaCheckParam( L, 3, dWidth)
|
||||
double dHeight ;
|
||||
LuaCheckParam( L, 4, dHeight)
|
||||
Color cCol ;
|
||||
LuaCheckParam( L, 5, cCol)
|
||||
LuaClearStack( L) ;
|
||||
// inserisco il grezzo nella macchinata corrente
|
||||
int nInd = ExeAddRawPart( ptOrig, dWidth, dLength, dHeight, cCol) ;
|
||||
int nInd = ExeAddRawPart( ptOrig, dLength, dWidth, dHeight, cCol) ;
|
||||
// restituisco il risultato
|
||||
if ( nInd != GDB_ID_NULL)
|
||||
LuaSetParam( L, nInd) ;
|
||||
@@ -280,6 +281,27 @@ LuaAddRawPartWithPart( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaModifyRawPartSize( lua_State* L)
|
||||
{
|
||||
// 4 parametri : nRawId, dLength, dWidth, dHeight
|
||||
int nRawId ;
|
||||
LuaCheckParam( L, 1, nRawId)
|
||||
double dLength ;
|
||||
LuaCheckParam( L, 2, dLength)
|
||||
double dWidth ;
|
||||
LuaCheckParam( L, 3, dWidth)
|
||||
double dHeight ;
|
||||
LuaCheckParam( L, 4, dHeight)
|
||||
LuaClearStack( L) ;
|
||||
// modifico le dimensioni del grezzo
|
||||
bool bOk = ExeModifyRawPartSize( nRawId, dLength, dWidth, dHeight) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaModifyRawPartHeight( lua_State* L)
|
||||
@@ -522,6 +544,23 @@ LuaSetTable( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetTableRef1( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// imposto la tavola corrente
|
||||
Point3d ptPos ;
|
||||
bool bOk = ExeGetTableRef1( ptPos) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk)
|
||||
LuaSetParam( L, ptPos) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaAddSubPiece( lua_State* L)
|
||||
@@ -675,13 +714,30 @@ LuaSetCalcTool( lua_State* L)
|
||||
int nExit ;
|
||||
LuaCheckParam( L, 3, nExit)
|
||||
LuaClearStack( L) ;
|
||||
// imposto la tavola corrente per il calcolo
|
||||
// imposto l'utensile corrente per il calcolo
|
||||
bool bOk = ExeSetCalcTool( sTool, sHead, nExit) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetCalcTool( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// recupero l'utensile corrente
|
||||
string sTool ;
|
||||
bool bOk = ExeGetCalcTool( sTool) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk)
|
||||
LuaSetParam( L, sTool) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetCalcAngles( lua_State* L)
|
||||
@@ -772,6 +828,46 @@ LuaVerifyOutOfStroke( lua_State* L)
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetToolParam( lua_State* L)
|
||||
{
|
||||
// 2 parametri : sName, nType
|
||||
string sName ;
|
||||
LuaCheckParam( L, 1, sName)
|
||||
int nType ;
|
||||
LuaCheckParam( L, 2, nType)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il parametro dell'utensile voluto
|
||||
if ( ( nType & TPA_INT) != 0) {
|
||||
int nVal ;
|
||||
bool bOk = ExeGetToolParam( sName, nType, nVal) ;
|
||||
if ( bOk)
|
||||
LuaSetParam( L, nVal) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
}
|
||||
else if ( ( nType & TPA_DOU) != 0) {
|
||||
double dVal ;
|
||||
bool bOk = ExeGetToolParam( sName, nType, dVal) ;
|
||||
if ( bOk)
|
||||
LuaSetParam( L, dVal) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
}
|
||||
else if ( ( nType & TPA_STR) != 0) {
|
||||
string sVal ;
|
||||
bool bOk = ExeGetToolParam( sName, nType, sVal) ;
|
||||
if ( bOk)
|
||||
LuaSetParam( L, sVal) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
}
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaAddMachining( lua_State* L)
|
||||
@@ -878,6 +974,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextRawPart", LuaGetNextRawPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAddRawPart", LuaAddRawPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAddRawPartWithPart", LuaAddRawPartWithPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyRawPartSize", LuaModifyRawPartSize) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyRawPartHeight", LuaModifyRawPartHeight) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveRawPart", LuaRemoveRawPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRotateRawPart", LuaRotateRawPart) ;
|
||||
@@ -892,6 +989,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtMovePartInRawPart", LuaTranslatePartInRawPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRotatePartInRawPart", LuaRotatePartInRawPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetTable", LuaSetTable) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetTableRef1", LuaGetTableRef1) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAddSubPiece", LuaAddSubPiece) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetAxisPos", LuaSetAxisPos) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisPos", LuaGetAxisPos) ;
|
||||
@@ -901,9 +999,11 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtResetHeadSet", LuaResetHeadSet) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCalcTable", LuaSetCalcTable) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCalcTool", LuaSetCalcTool) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcTool", LuaGetCalcTool) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcAngles", LuaGetCalcAngles) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcPositions", LuaGetCalcPositions) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVerifyOutOfStroke", LuaVerifyOutOfStroke) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetToolParam", LuaGetToolParam) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAddMachining", LuaAddMachining) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetMachiningParam", LuaSetMachiningParam) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetMachiningGeometry", LuaSetMachiningGeometry) ;
|
||||
|
||||
Reference in New Issue
Block a user