EgtExecutor 2.2h3 :

- aggiunta funzione Exe e Lua CreateSurfTmBySurfBezier.
This commit is contained in:
Dario Sassi
2020-08-12 15:21:56 +00:00
parent d71d932772
commit 8dbf0057f0
4 changed files with 61 additions and 0 deletions
+36
View File
@@ -1384,6 +1384,42 @@ ExeCreateSurfTmBySewing( int nParentId, const INTVECTOR& vIds, bool bErase)
return nNewId ;
}
//----------------------------------------------------------------------------
int
ExeCreateSurfTmBySurfBezier( int nParentId, int nSbezId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero la superficie di Bezier
const ISurfBezier* pSbez = GetSurfBezier( pGeomDB->GetGeoObj( nSbezId)) ;
bool bOk = ( pSbez != nullptr) ;
// recupero il riferimento della superficie sorgente
Frame3d frSou ;
bOk = bOk && pGeomDB->GetGlobFrame( nSbezId, frSou) ;
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// copio la superficie ausiliaria della Bezier
const ISurfTriMesh* pAuxSurf = ( bOk ? pSbez->GetAuxSurf() : nullptr) ;
PtrOwner<ISurfTriMesh> pStm( pAuxSurf != nullptr ? pAuxSurf->Clone() : nullptr) ;
bOk = bOk && ! IsNull( pStm) ;
// la porto nel riferimento destinazione
pStm->LocToLoc( frSou, frLoc) ;
// inserisco la superficie trimesh nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStm)) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmBySurfBezier(" + IdToString( nParentId) + "," +
IdToString( nSbezId) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return nNewId ;
}
//----------------------------------------------------------------------------
int
ExeCreateSurfTmByVolZmap( int nParentId, int nZmapId, int nPart)
+4
View File
@@ -914,6 +914,8 @@ ExeSurfBezierGetPointD1( int nSurfId, double dU, double dV, int nUsd, int nVsd,
string sLua = "EgtSurfBezierGetPointD1(" + ToString( nSurfId) + "," +
ToString( dU) + "," +
ToString( dV) + "," +
ToString( nUsd) + "," +
ToString( nVsd) + "," +
ToString( nRefId) + ")" +
" -- Pnt=" + ( bOk ? "{" + ToString( ptP) + "}" : "nil") +
" DerU=" + ( bOk ? "{" + ToString( vtDerU) + "}" : "nil") +
@@ -949,6 +951,8 @@ ExeSurfBezierGetPointNrmD1( int nSurfId, double dU, double dV, int nUsd, int nVs
string sLua = "EgtSurfBezierGetPointNrmD1(" + ToString( nSurfId) + "," +
ToString( dU) + "," +
ToString( dV) + "," +
ToString( nUsd) + "," +
ToString( nVsd) + "," +
ToString( nRefId) + ")" +
" -- Pnt=" + ( bOk ? "{" + ToString( ptP) + "}" : "nil") +
" Nrm=" + ( bOk ? "{" + ToString( vtN) + "}" : "nil") +
BIN
View File
Binary file not shown.
+21
View File
@@ -673,6 +673,26 @@ LuaCreateSurfTmBySewing( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmBySurfBezier( lua_State* L)
{
// 2 parametri : ParentId, nSbezId
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nZmapId ;
LuaCheckParam( L, 2, nZmapId)
LuaClearStack( L) ;
// creo STM partendo da superficie di Bezier
int nId = ExeCreateSurfTmBySurfBezier( nParentId, nZmapId) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmByVolZmap( lua_State* L)
@@ -793,6 +813,7 @@ LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRuled", LuaCreateSurfTmRuled) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByTriangles", LuaCreateSurfTmByTriangles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmBySewing", LuaCreateSurfTmBySewing) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmBySurfBezier", LuaCreateSurfTmBySurfBezier) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByVolZmap", LuaCreateSurfTmByVolZmap) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezier", LuaCreateSurfBezier) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierRat", LuaCreateSurfBezierRational) ;