diff --git a/EXE_Exchange.cpp b/EXE_Exchange.cpp index e24a741..905e188 100644 --- a/EXE_Exchange.cpp +++ b/EXE_Exchange.cpp @@ -19,6 +19,7 @@ #include "DllExchange.h" #include "/EgtDev/Include/EXeExecutor.h" #include "/EgtDev/Include/EXeConst.h" +#include "/EgtDev/Include/EXeCmdLogOff.h" #include "/EgtDev/Include/EExImportStl.h" #include "/EgtDev/Include/EExImportDxf.h" #include "/EgtDev/Include/EExImportCnc.h" @@ -302,7 +303,6 @@ ExeAdvancedImport( const string& sFilePath) { GseContext* pGseCtx = GetCurrGseContext() ; VERIFY_CTX_GEOMDB( pGseCtx, false) - bool bOk = true ; // verifico che il formato sia supportato int nFileType = ExeGetFileType( sFilePath) ; if ( nFileType != FT_IGES && @@ -320,7 +320,7 @@ ExeAdvancedImport( const string& sFilePath) return false ; // file intermedio stl string sTempDir ; ExeGetTempDir( sTempDir) ; - string sFileOut = sTempDir + "\\AdvImp.stl" ; + string sFileOut = sTempDir + "\\AdvImp.nge" ; EraseFile( sFileOut) ; // eseguo il programma esterno di conversione string sExec ; @@ -329,7 +329,8 @@ ExeAdvancedImport( const string& sFilePath) #elif defined( _WIN32) sExec = "EgtConverterR32.exe" ; #endif - string sCmdLine = "\"" + sExec + "\" \"" + sFilePath + "\" \"" + sFileOut + "\"" ; + string sCmdLine = "\"" + sExec + "\" \"" + sFilePath + "\" \"" + sFileOut + "\" \"" + + ExeGetKey() +"\" \"" + ToString( ExeGetDebugLevel()) + "\"" ; STARTUPINFO si ; PROCESS_INFORMATION pi ; ZeroMemory( &si, sizeof( si)) ; @@ -340,6 +341,7 @@ ExeAdvancedImport( const string& sFilePath) if ( CreateProcess( NULL, stringtoW( sCmdLine), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi) == FALSE) return false ; int nTime = 0 ; + bool bOk = true ; while ( bOk) { ++ nTime ; nTime = ( nTime % 200) ; @@ -348,24 +350,19 @@ ExeAdvancedImport( const string& sFilePath) if ( WaitForSingleObject( pi.hProcess, 100) != WAIT_TIMEOUT) break ; } + if ( ! bOk) + TerminateProcess( pi.hProcess, 98) ; DWORD nExitCode = 99 ; GetExitCodeProcess( pi.hProcess, &nExitCode) ; bOk = bOk && ( nExitCode == 0) ; CloseHandle( pi.hProcess) ; CloseHandle( pi.hThread) ; - // importo il file STL - // aggiungo un gruppo pezzo e un gruppo layer - int nPartId = ( bOk ? pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) : GDB_ID_NULL) ; - int nLayerId = ( bOk ? pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, nPartId, Frame3d()) : GDB_ID_NULL) ; - // preparo l'importatore - PtrOwner pImpStl( MyCreateImportStl()) ; - bOk = bOk && ! IsNull( pImpStl) ; - // eseguo l'importazione - bOk = bOk && pImpStl->Import( sFileOut, pGseCtx->m_pGeomDB, nLayerId, 1) ; - ExeProcessEvents( 100, 0) ; + // apro il file intermedio + CmdLogOff cmdLogOff ; + bOk = bOk && ExeOpenFile( sFileOut) ; + cmdLogOff.Reset() ; // aggiorno stato file corrente - if ( bOk && pGseCtx->m_sFilePath.empty()) - pGseCtx->m_sFilePath = sFilePath ; + pGseCtx->m_sFilePath = sFilePath ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { diff --git a/EgtExecutor.rc b/EgtExecutor.rc index dd902e2..866a90d 100644 Binary files a/EgtExecutor.rc and b/EgtExecutor.rc differ