From bb73946e1888af84aa1207ebc234beb8eec1e7fd Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 9 Nov 2015 10:29:45 +0000 Subject: [PATCH] EgtExecutor 1.6k3 : - aggiornamenti --- EXE_Exchange.cpp | 7 +++--- EXE_GdbModifySurf.cpp | 53 ++++++++++++++++++++++++++++++++++++++++++ EgtExecutor.rc | Bin 11694 -> 11694 bytes LUA_Exchange.cpp | 6 +++-- LUA_GdbModifySurf.cpp | 25 +++++++++++++++++++- 5 files changed, 85 insertions(+), 6 deletions(-) diff --git a/EXE_Exchange.cpp b/EXE_Exchange.cpp index eb3f15f..41ca0f9 100644 --- a/EXE_Exchange.cpp +++ b/EXE_Exchange.cpp @@ -186,7 +186,7 @@ ExeImportCsf( const string& sFilePath) //----------------------------------------------------------------------------- bool -ExeImportBtl( const string& sFilePath, bool bFlatPos) +ExeImportBtl( const string& sFilePath, bool bFlatPos, bool bSpecialTrim) { GseContext* pGseCtx = GetCurrGseContext() ; VERIFY_CTX_GEOMDB( pGseCtx, false) @@ -196,14 +196,15 @@ ExeImportBtl( const string& sFilePath, bool bFlatPos) PtrOwner pImpBtl( MyCreateImportBtl()) ; bOk = bOk && ! IsNull( pImpBtl) ; // eseguo l'importazione (direttamente nella radice) - bOk = bOk && pImpBtl->Import( sFilePath, pGseCtx->m_pGeomDB, bFlatPos) ; + bOk = bOk && pImpBtl->Import( sFilePath, pGseCtx->m_pGeomDB, bFlatPos, bSpecialTrim) ; // aggiorno stato file corrente pGseCtx->m_sFilePath = sFilePath ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtImportBtl('" + StringToLuaString( sFilePath) + "'," + - ( bFlatPos ? "true" : "false") + ")" + + ( bFlatPos ? "true" : "false") + "," + + ( bSpecialTrim ? "true" : "false") + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } diff --git a/EXE_GdbModifySurf.cpp b/EXE_GdbModifySurf.cpp index 9ea5d52..d84cda1 100644 --- a/EXE_GdbModifySurf.cpp +++ b/EXE_GdbModifySurf.cpp @@ -367,6 +367,59 @@ ExeExtractSurfFrChunkLoops( int nId, int nChunk, int nDestGrpId, int* pnCount) return nFirstId ; } +//---------------------------------------------------------------------------- +int +ExeExtractSurfTmLoops( int nId, int nDestGrpId, int* pnCount) +{ + IGeomDB* pGeomDB = GetCurrGeomDB() ; + VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + // recupero la superficie TriMesh + const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ; + bool bOk = ( pStm != nullptr) ; + // recupero il riferimento della superficie + Frame3d frSurf ; + bOk = bOk && pGeomDB->GetGlobFrame( nId, frSurf) ; + // recupero il riferimento di destinazione + Frame3d frDest ; + bOk = bOk && pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest) ; + // recupero i loop come polilinee + POLYLINEVECTOR vPL ; + bOk = bOk && pStm->GetLoops( vPL) ; + // dalle polilinee creo le curve e le inserisco nel DB + int nFirstId = GDB_ID_NULL ; + int nCount = 0 ; + for ( size_t i = 0 ; i < vPL.size() ; ++ i) { + // creo la curva + PtrOwner pCrvCompo( CreateCurveComposite()) ; + bOk = bOk && pCrvCompo->FromPolyLine( vPL[i]) ; + // la porto nel riferimento destinazione + bOk = bOk && pCrvCompo->LocToLoc( frSurf, frDest) ; + // la inserisco nel DB geometrico + int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pCrvCompo)) : GDB_ID_NULL) ; + bOk = bOk && ( nNewId != GDB_ID_NULL) ; + // copio il materiale + if ( ! pGeomDB->CopyMaterial( nId, nNewId)) + return GDB_ID_NULL ; + // aggiorno contatori + if ( bOk && nFirstId == GDB_ID_NULL) + nFirstId = nNewId ; + if ( bOk) + ++ nCount ; + } + ExeSetModified() ; + // se richiesto, salvo il comando Lua equivalente + if ( IsCmdLog()) { + string sLua = "EgtExtractSurfTmLoops(" + ToString( nId) + "," + + ToString( nDestGrpId) + ")" + + " -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ; + LOG_INFO( GetCmdLogger(), sLua.c_str()) ; + } + // restituisco risultati + if ( pnCount != nullptr) + *pnCount = nCount ; + return nFirstId ; +} + //---------------------------------------------------------------------------- int ExeExtractSurfTmFacetLoops( int nId, int nFacet, int nDestGrpId, int* pnCount) diff --git a/EgtExecutor.rc b/EgtExecutor.rc index 02b2b029733ea5aadec1c1c6d29dd833763fd9de..421fb0b1f86357989ee13824b0b7511c624b9c4b 100644 GIT binary patch delta 97 zcmZ1%y)JsgA2vqg%@@V4Gflq2na5~6Ignd-a{*Tk3sCf++-0W82LxfF21;&>n->Y| cF@rU@0x76sKgP|Iq`|@mn->Y| cF@rU@0x76sKgP|Iq`|@m