EgtExecutor :
- piccole migliorie stilistiche.
This commit is contained in:
+30
-30
@@ -510,7 +510,7 @@ ExeVolZmapAvoidBox( int nId, const Frame3d& frBox, const Vector3d& vtDiag, doubl
|
||||
// porto in locale il riferimento (il vettore è già in locale a questo stesso riferimento)
|
||||
Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frLoc) ;
|
||||
// recupero lo Zmap e calcolo collisione
|
||||
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
|
||||
const IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
|
||||
bOk = bOk && ( pVZM != nullptr && pVZM->AvoidBox( frBoxL, vtDiag, dSafeDist)) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
@@ -529,34 +529,6 @@ ExeVolZmapAvoidBox( int nId, const Frame3d& frBox, const Vector3d& vtDiag, doubl
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeVolZmapAvoidSphere( int nId, const Point3d& ptCen, double dRad, double dSafeDist, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bool bOk = pGeomDB->GetGlobFrame( nId, frLoc) ;
|
||||
// porto in locale il centro della sfera
|
||||
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ;
|
||||
// recupero lo Zmap e calcolo collisione
|
||||
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
|
||||
bOk = bOk && ( pVZM != nullptr && pVZM->AvoidSphere( ptCenL, dRad, dSafeDist)) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtVolZmapAvoidSphere(" + IdToString( nId) + ",{" +
|
||||
ToString( ptCen) + "}," +
|
||||
ToString( dRad) + "," +
|
||||
ToString( dSafeDist) + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeVolZmapAvoidCylinder( int nId, const Frame3d& frCyl, double dL, double dR, double dSafeDist, int nRefType)
|
||||
@@ -569,7 +541,7 @@ ExeVolZmapAvoidCylinder( int nId, const Frame3d& frCyl, double dL, double dR, do
|
||||
// porto in locale il riferimento
|
||||
Frame3d frBoxL = GetFrameLocal( pGeomDB, frCyl, nRefType, frLoc) ;
|
||||
// recupero lo Zmap e calcolo collisione
|
||||
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
|
||||
const IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
|
||||
bOk = bOk && ( pVZM != nullptr && pVZM->AvoidCylinder( frBoxL, dL, dR, dSafeDist)) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
@@ -589,6 +561,34 @@ ExeVolZmapAvoidCylinder( int nId, const Frame3d& frCyl, double dL, double dR, do
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeVolZmapAvoidSphere( int nId, const Point3d& ptCen, double dRad, double dSafeDist, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bool bOk = pGeomDB->GetGlobFrame( nId, frLoc) ;
|
||||
// porto in locale il centro della sfera
|
||||
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ;
|
||||
// recupero lo Zmap e calcolo collisione
|
||||
const IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
|
||||
bOk = bOk && ( pVZM != nullptr && pVZM->AvoidSphere( ptCenL, dRad, dSafeDist)) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtVolZmapAvoidSphere(" + IdToString( nId) + ",{" +
|
||||
ToString( ptCen) + "}," +
|
||||
ToString( dRad) + "," +
|
||||
ToString( dSafeDist) + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeCutVolZmapPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, int nRefType)
|
||||
|
||||
+24
-24
@@ -379,29 +379,6 @@ LuaVolZmapAvoidBox( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaVolZmapAvoidSphere( lua_State* L)
|
||||
{
|
||||
// 4 o 5 parametri : nId, ptCen, dRad, dSafeDist [, nRefType]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
Point3d ptCen ;
|
||||
LuaCheckParam( L, 2, ptCen)
|
||||
double dRad ;
|
||||
LuaCheckParam( L, 3, dRad)
|
||||
double dSafeDist ;
|
||||
LuaCheckParam( L, 4, dSafeDist)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 5, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico non interferenza
|
||||
bool bOk = ExeVolZmapAvoidSphere( nId, ptCen, dRad, dSafeDist, nRefType) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaVolZmapAvoidCylinder( lua_State* L)
|
||||
@@ -427,6 +404,29 @@ LuaVolZmapAvoidCylinder( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaVolZmapAvoidSphere( lua_State* L)
|
||||
{
|
||||
// 4 o 5 parametri : nId, ptCen, dRad, dSafeDist [, nRefType]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
Point3d ptCen ;
|
||||
LuaCheckParam( L, 2, ptCen)
|
||||
double dRad ;
|
||||
LuaCheckParam( L, 3, dRad)
|
||||
double dSafeDist ;
|
||||
LuaCheckParam( L, 4, dSafeDist)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 5, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico non interferenza
|
||||
bool bOk = ExeVolZmapAvoidSphere( nId, ptCen, dRad, dSafeDist, nRefType) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCutVolZmapPlane( lua_State* L)
|
||||
@@ -467,8 +467,8 @@ LuaInstallGdbModifyVol( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapMillingStep", LuaVolZmapMillingStep) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapGetDepth", LuaVolZmapGetDepth) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapAvoidBox", LuaVolZmapAvoidBox) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapAvoidSphere", LuaVolZmapAvoidSphere) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapAvoidCylinder", LuaVolZmapAvoidCylinder) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapAvoidSphere", LuaVolZmapAvoidSphere) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCutVolZmapPlane", LuaCutVolZmapPlane) ;
|
||||
return bOk ;
|
||||
}
|
||||
Reference in New Issue
Block a user