diff --git a/EXE_GdbCreateSurf.cpp b/EXE_GdbCreateSurf.cpp index a2e351a..33a3a0a 100644 --- a/EXE_GdbCreateSurf.cpp +++ b/EXE_GdbCreateSurf.cpp @@ -1373,7 +1373,7 @@ ExeCreateSurfTmByVolZmap( int nParentId, int nZmapId, int nPart) INTVECTOR vnModif ; TRIA3DEXLISTVECTOR vlTria ; int nCount = ( bOk ? pVZM->GetBlockCount() : 0) ; - ( bOk ? pVZM->GetTriangles( false, vnModif, vlTria) : false) ; + ( bOk ? pVZM->GetTriangles( true, vnModif, vlTria) : false) ; for ( int i = 0 ; i < nCount && bOk ; ++ i) { // se blocco non modificato, vado oltre if ( vnModif[i] < 0) diff --git a/EXE_GdbModifyVol.cpp b/EXE_GdbModifyVol.cpp index 6763100..97c1c19 100644 --- a/EXE_GdbModifyVol.cpp +++ b/EXE_GdbModifyVol.cpp @@ -521,3 +521,37 @@ ExeVolZmapAvoidSphere( int nId, const Point3d& ptCen, double dRad, int nRefType) // restituisco risultato return bOk ; } + +//------------------------------------------------------------------------------- +bool +ExeCutVolZmapPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, int nRefType) +{ + IGeomDB* pGeomDB = GetCurrGeomDB() ; + VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + // recupero lo Zmap + IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ; + bool bOk = ( pVZM != nullptr) ; + // recupero il riferimento locale + Frame3d frLoc ; + bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ; + // porto in locale il punto e la normale del piano + Point3d ptOnL = GetPointLocal( pGeomDB, ptOn, nRefType, frLoc) ; + Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frLoc) ; + // calcolo il piano di taglio + Plane3d plPlane ; + bOk = bOk && plPlane.Set( ptOnL, vtNL) ; + // eseguo il taglio + bOk = bOk && pVZM->Cut( plPlane) ; + ExeSetModified() ; + // se richiesto, salvo il comando Lua equivalente + if ( IsCmdLog()) { + string sLua = "EgtCutVolZmapPlane(" + ToString( nId) + ",{" + + ToString( ptOn) + "},{" + + ToString( vtN) + "}," + + RefTypeToString( nRefType) + ")" + + " -- Ok=" + ToString( bOk) ; + LOG_INFO( GetCmdLogger(), sLua.c_str()) ; + } + // restituisco risultato + return bOk ; +} diff --git a/EgtExecutor.rc b/EgtExecutor.rc index 5998d27..30d97d4 100644 Binary files a/EgtExecutor.rc and b/EgtExecutor.rc differ diff --git a/LUA_GdbModifyVol.cpp b/LUA_GdbModifyVol.cpp index f8508dd..bb3c72f 100644 --- a/LUA_GdbModifyVol.cpp +++ b/LUA_GdbModifyVol.cpp @@ -383,6 +383,27 @@ LuaVolZmapAvoidSphere( lua_State* L) return 1 ; } +//---------------------------------------------------------------------------- +static int +LuaCutVolZmapPlane( lua_State* L) +{ + // 3 o 4 parametri : Id, ptOn, vtN [, nRefType] + int nId ; + LuaCheckParam( L, 1, nId) + Point3d ptOn ; + LuaCheckParam( L, 2, ptOn) + Vector3d vtN ; + LuaCheckParam( L, 3, vtN) + int nRefType = RTY_DEFAULT ; + LuaGetParam( L, 4, nRefType) ; + LuaClearStack( L) ; + // taglio la superficie con ilpiano + bool bOk = ExeCutVolZmapPlane( nId, ptOn, vtN, nRefType) ; + // restituisco il risultato + LuaSetParam( L, bOk) ; + return 1 ; +} + //------------------------------------------------------------------------------- bool LuaInstallGdbModifyVol( LuaMgr& luaMgr) @@ -402,5 +423,6 @@ LuaInstallGdbModifyVol( LuaMgr& luaMgr) bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapGetDepth", LuaVolZmapGetDepth) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapAvoidBox", LuaVolZmapAvoidBox) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapAvoidSphere", LuaVolZmapAvoidSphere) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtCutVolZmapPlane", LuaCutVolZmapPlane) ; return bOk ; } \ No newline at end of file