diff --git a/EXE_MachMgr.cpp b/EXE_MachMgr.cpp index 77748fe..73de9a4 100644 --- a/EXE_MachMgr.cpp +++ b/EXE_MachMgr.cpp @@ -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) diff --git a/EXE_Nesting.cpp b/EXE_Nesting.cpp index 2d17bd6..1887e7a 100644 --- a/EXE_Nesting.cpp +++ b/EXE_Nesting.cpp @@ -415,6 +415,36 @@ VerifyAndAdjustFlatParts( void) pGeomDB->SetMaterial( nTextId, BLACK) ; } } + // creo un nuovo layer in cui copiare il contorno esterno + PtrOwner 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 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])) ; diff --git a/EgtExecutor.rc b/EgtExecutor.rc index 563aaa9..f97e00c 100644 Binary files a/EgtExecutor.rc and b/EgtExecutor.rc differ diff --git a/LUA_MachMgr.cpp b/LUA_MachMgr.cpp index fceb9d8..8f1b616 100644 --- a/LUA_MachMgr.cpp +++ b/LUA_MachMgr.cpp @@ -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) ;