EgtExecutor 1.6k9 :

- aggiunta GetCalcTipFromPositions a EXE e LUA
- modificata CreatrFlatParts (copia contorni in layer di nome opportuno).
This commit is contained in:
Dario Sassi
2015-11-26 16:50:35 +00:00
parent 5490da8f1e
commit eb47c09568
4 changed files with 71 additions and 0 deletions
+11
View File
@@ -1298,6 +1298,17 @@ ExeGetCalcPositions( const Point3d& ptP, double dAngA, double dAngB,
return pGseCtx->m_pMachMgr->GetCalcPositions( ptP, dAngA, dAngB, nStat, dX, dY, dZ) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetCalcTipFromPositions( double dX, double dY, double dZ, double dAngA, double dAngB,
bool bBottom, Point3d& ptTip)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_MACHMGR( pGseCtx, false)
// calcolo il tip utensile dagli assi macchina
return pGseCtx->m_pMachMgr->GetCalcTipFromPositions( dX, dY, dZ, dAngA, dAngB, bBottom, ptTip) ;
}
//-----------------------------------------------------------------------------
bool
ExeVerifyOutOfStroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat)
+30
View File
@@ -415,6 +415,36 @@ VerifyAndAdjustFlatParts( void)
pGeomDB->SetMaterial( nTextId, BLACK) ;
}
}
// creo un nuovo layer in cui copiare il contorno esterno
PtrOwner<ICurve> pOutCrv( bOk ? pSfr->GetLoop( 0, 0) : nullptr) ;
if ( ! IsNull( pOutCrv)) {
int nOutLoopId = ExeCreateGroup( pPar->GetId(), Frame3d(), RTY_GLOB) ;
bOk = bOk && nOutLoopId != GDB_ID_NULL ;
bOk = bOk && pGeomDB->SetName( nOutLoopId, "OutLoop") ;
pGeomDB->AddGeoObj( GDB_ID_NULL, nOutLoopId, Release( pOutCrv)) ;
}
// creo nuovi layer in cui copiare gli eventuali contorni interni
if ( bOk && pSfr->GetLoopCount( 0) > 1) {
int i = 1 ;
PtrOwner<ICurve> pInCrv( bOk ? pSfr->GetLoop( 0, i) : nullptr) ;
while ( ! IsNull( pInCrv)) {
int nInLoopId = ExeCreateGroup( pPar->GetId(), Frame3d(), RTY_GLOB) ;
bOk = bOk && nInLoopId != GDB_ID_NULL ;
bOk = bOk && pGeomDB->SetName( nInLoopId, "InLoop") ;
pGeomDB->AddGeoObj( GDB_ID_NULL, nInLoopId, Release( pInCrv)) ;
++ i ;
pInCrv.Set( bOk ? pSfr->GetLoop( 0, i) : nullptr) ;
}
}
// creo nuovi layer in cui mettere le curve aperte
if ( bOk && vOpenIds.size() > 0) {
for ( int i = 0 ; bOk && i < int( vOpenIds.size()) ; ++i) {
int nOnPathId = ExeCreateGroup( pPar->GetId(), Frame3d(), RTY_GLOB) ;
bOk = bOk && nOnPathId != GDB_ID_NULL ;
bOk = bOk && pGeomDB->SetName( nOnPathId, "OnPath") ;
pGeomDB->RelocateGlob( vOpenIds[i], nOnPathId) ;
}
}
// taglio le curve aperte con la regione
for ( int i = 0 ; bOk && i < int( vOpenIds.size()) ; ++i) {
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( vOpenIds[i])) ;
BIN
View File
Binary file not shown.
+30
View File
@@ -1573,6 +1573,35 @@ LuaGetCalcPositions( lua_State* L)
}
}
//-------------------------------------------------------------------------------
static int
LuaGetCalcTipFromPositions( lua_State* L)
{
// 6 parametri : dX, dY, dZ, dAngA, dAngB, bBottom
double dX ;
LuaCheckParam( L, 1, dX)
double dY ;
LuaCheckParam( L, 2, dY)
double dZ ;
LuaCheckParam( L, 3, dZ)
double dAngA ;
LuaCheckParam( L, 4, dAngA)
double dAngB ;
LuaCheckParam( L, 5, dAngB)
bool bBottom ;
LuaCheckParam( L, 6, bBottom)
LuaClearStack( L) ;
// calcolo il tip utensile dagli assi macchina
Point3d ptTip ;
bool bOk = ExeGetCalcTipFromPositions( dX, dY, dZ, dAngA, dAngB, bBottom, ptTip) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, ptTip) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaVerifyOutOfStroke( lua_State* L)
@@ -1807,6 +1836,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcTool", LuaGetCalcTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcAngles", LuaGetCalcAngles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcPositions", LuaGetCalcPositions) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcTipFromPositions", LuaGetCalcTipFromPositions) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVerifyOutOfStroke", LuaVerifyOutOfStroke) ;
// Machine Move
bOk = bOk && luaMgr.RegisterFunction( "EgtSetAxisPos", LuaSetAxisPos) ;