EgtExecutor :

- aggiunte funzioni per Vmill additivo.
This commit is contained in:
Riccardo Elitropi
2024-04-22 13:23:59 +02:00
parent a3c905c33a
commit 22774303af
4 changed files with 139 additions and 4 deletions
+47 -4
View File
@@ -1,4 +1,4 @@
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// EgalTech 2016-2016
//----------------------------------------------------------------------------
// File : EXE_GdbCreateVol.cpp Data : 27.10.16 Versione : 1.6v7
@@ -64,7 +64,50 @@ ExeCreateVolZmap( int nParentId, const Point3d& ptIni, double dDimX, double dDim
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
//-------------------------------------------------------------------------------
int ExeCreateVolZmapEmpty( int nParentId, const Point3d& ptIni, double dDimX, double dDimY, double dDimZ,
double dPrec, bool bTriDex, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento locale
Frame3d frLoc ;
bool bOk = pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// porto in locale i punti
Point3d ptIniL = GetPointLocal( pGeomDB, ptIni, nRefType, frLoc) ;
Point3d ptOnXL = GetPointLocal( pGeomDB, ptIni + X_AX, nRefType, frLoc) ;
Point3d ptOnYL = GetPointLocal( pGeomDB, ptIni + Y_AX, nRefType, frLoc) ;
// ne ricavo un riferimento intrinseco
Frame3d frBox ;
bOk = bOk && frBox.Set( ptIniL, ptOnXL, ptOnYL) ;
// creo lo Zmap nel suo riferimento intrinseco
PtrOwner<IVolZmap> pVZM( CreateVolZmap()) ;
bOk = bOk && ! IsNull( pVZM) ;
bOk = bOk && pVZM->CreateEmptyMap( ORIG, dDimX, dDimY, dDimZ, dPrec, bTriDex) ;
// lo porto nel riferimento locale
bOk = bOk && pVZM->ToGlob( frBox) ;
// inserisco lo Zmap nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pVZM)) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZmapEmpty(" + IdToString( nParentId) + ",{" +
ToString( ptIni) + "}," +
ToString( dDimX) + "," +
ToString( dDimY) + "," +
ToString( dDimZ) + "," +
ToString( dPrec) + "," +
( bTriDex ? "true" : "false") + "," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -103,7 +146,7 @@ ExeCreateVolZmapByRegionExtrusion( int nParentId, int nSfrId, double dDimZ, doub
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -141,6 +184,6 @@ ExeCreateVolZmapFromSurfTm( int nParentId, int nStmId, double dPrec, bool bTriDe
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
+28
View File
@@ -337,6 +337,34 @@ ExeVolZmapSetChiselTool( const INTVECTOR& vIds, const string& sToolName,
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeVolZmapSetAdditiveTool( const INTVECTOR& vIds, const string& sToolName,
double dLen, double dDiam, double dCornR, int nFlag, bool bFirst)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero gli Zmap e assegno i dati dell'utensile
bool bOk = true ;
for ( int i = 0 ; i < int( vIds.size()) ; ++ i) {
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( vIds[i])) ;
bOk = ( bOk && pVZM != nullptr && pVZM->SetAdditiveTool( sToolName, dLen, dDiam / 2, dCornR, nFlag, bFirst)) ;
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZmapSetAdditiveTool({" + IdListToString( vIds) + "}," +
sToolName + "," +
ToString( dLen) + "," +
ToString( dDiam) + "," +
ToString( dCornR) + "," +
ToString( nFlag) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeVolZmapResetTools( const INTVECTOR& vIds)
+37
View File
@@ -54,6 +54,42 @@ LuaCreateVolZmapBox( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateVolZmapEmpty( lua_State* L)
{
// 6 o 7 o 8 parametri : ParentId, PtIni, dDimX, dDimY, dDimZ, dPrec [, bTriDex] [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptIni ;
LuaCheckParam( L, 2, ptIni)
double dDimX ;
LuaCheckParam( L, 3, dDimX)
double dDimY ;
LuaCheckParam( L, 4, dDimY)
double dDimZ ;
LuaCheckParam( L, 5, dDimZ)
double dPrec ;
LuaCheckParam( L, 6, dPrec)
bool bTriDex = true ;
int nRefType = RTY_DEFAULT ;
if ( ! LuaGetParam( L, 7, bTriDex))
LuaGetParam( L, 7, nRefType) ;
else
LuaGetParam( L, 8, nRefType) ;
LuaClearStack( L) ;
// creo VZM parallelepipedo
int nId = ExeCreateVolZmapEmpty( nParentId, ptIni, dDimX, dDimY, dDimZ, dPrec, bTriDex, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateVolZmapByRegionExtrusion( lua_State* L)
@@ -110,6 +146,7 @@ LuaInstallGdbCreateVol( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapBox", LuaCreateVolZmapBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapEmpty", LuaCreateVolZmapEmpty) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapByRegionExtrusion", LuaCreateVolZmapByRegionExtrusion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapFromSurfTm", LuaCreateVolZmapFromSurfTm) ;
return bOk ;
+27
View File
@@ -250,6 +250,32 @@ LuaVolZmapSetChiselTool( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaVolZmapSetAdditiveTool( lua_State* L)
{
// 5 o 6 parametri : vIds, sToolName, dLen, dWidth, dThick, nFlag
INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds)
string sToolName ;
LuaCheckParam( L, 2, sToolName)
double dLen ;
LuaCheckParam( L, 3, dLen)
double dDiam ;
LuaCheckParam( L, 4, dDiam)
double dCornR ;
LuaCheckParam( L, 5, dCornR)
int nFlag = 1 ;
LuaGetParam( L, 6, nFlag) ;
LuaClearStack( L) ;
// imposto scalpello a Zmap indicati
bool bOk = ExeVolZmapSetAdditiveTool( vIds, sToolName, dLen, dDiam, dCornR, nFlag, true) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaVolZmapResetTool( lua_State* L)
@@ -375,6 +401,7 @@ LuaInstallGdbModifyVol( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetGenTool", LuaVolZmapSetGenTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetMortiserTool", LuaVolZmapSetMortiserTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetChiselTool", LuaVolZmapSetChiselTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetAdditiveTool", LuaVolZmapSetAdditiveTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapResetTool", LuaVolZmapResetTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapGetToolOutline", LuaVolZmapGetToolOutline) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapMillingStep", LuaVolZmapMillingStep) ;