EgtExecutor 1.6k3 :
- aggiornamenti
This commit is contained in:
+4
-3
@@ -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<IImportBtl> 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()) ;
|
||||
}
|
||||
|
||||
@@ -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<ICurveComposite> 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)
|
||||
|
||||
Binary file not shown.
+4
-2
@@ -89,14 +89,16 @@ LuaImportCsf( lua_State* L)
|
||||
static int
|
||||
LuaImportBtl( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : path del file da importare, falg per mettere di piatto
|
||||
// 1,2 o 3 parametri : path del file da importare, flag per mettere di piatto, flag per trim speciale pareti
|
||||
string sFilePath ;
|
||||
LuaCheckParam( L, 1, sFilePath)
|
||||
bool bFlatPos = false ;
|
||||
LuaGetParam( L, 2, bFlatPos) ;
|
||||
bool bSpecialTrim = false ;
|
||||
LuaGetParam( L, 3, bSpecialTrim) ;
|
||||
LuaClearStack( L) ;
|
||||
// apro il file
|
||||
bool bOk = ExeImportBtl( sFilePath, bFlatPos) ;
|
||||
bool bOk = ExeImportBtl( sFilePath, bFlatPos, bSpecialTrim) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
|
||||
+24
-1
@@ -147,6 +147,28 @@ LuaExtractSurfFrChunkLoops( lua_State* L)
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaExtractSurfTmLoops( lua_State* L)
|
||||
{
|
||||
// 2 parametri : nId2, nDestGrpId
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nDestGrpId ;
|
||||
LuaCheckParam( L, 2, nDestGrpId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero i contorni della superficie
|
||||
int nCount ;
|
||||
int nNewId = ExeExtractSurfTmLoops( nId, nDestGrpId, &nCount) ;
|
||||
// restituisco il risultato
|
||||
if ( nNewId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nNewId) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
LuaSetParam( L, nCount) ;
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaExtractSurfTmFacetLoops( lua_State* L)
|
||||
@@ -159,7 +181,7 @@ LuaExtractSurfTmFacetLoops( lua_State* L)
|
||||
int nDestGrpId ;
|
||||
LuaCheckParam( L, 3, nDestGrpId)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo inversione superfici
|
||||
// recupero i contorni della faccetta della superficie
|
||||
int nCount ;
|
||||
int nNewId = ExeExtractSurfTmFacetLoops( nId, nFacet, nDestGrpId, &nCount) ;
|
||||
// restituisco il risultato
|
||||
@@ -183,6 +205,7 @@ LuaInstallGdbModifySurf( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrIntersect", LuaSurfFrIntersect) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrOffset", LuaSurfFrOffset) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfFrChunkLoops", LuaExtractSurfFrChunkLoops) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfTmLoops", LuaExtractSurfTmLoops) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfTmFacetLoops", LuaExtractSurfTmFacetLoops) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user