diff --git a/EXE_CAvTool.cpp b/EXE_CAvTool.cpp
index 11cc447..7e335f5 100644
--- a/EXE_CAvTool.cpp
+++ b/EXE_CAvTool.cpp
@@ -2,7 +2,7 @@
// EgalTech 2018-2018
//----------------------------------------------------------------------------
// File : EXE_CAvTool.cpp Data : 28.04.18 Versione : 1.9e1
-// Contenuto : Funzioni per evitare coolisioni dell'utensile.
+// Contenuto : Funzioni per evitare collisioni dell'utensile.
//
//
//
diff --git a/EXE_CDeObjSolid.cpp b/EXE_CDeObjSolid.cpp
new file mode 100644
index 0000000..3efe721
--- /dev/null
+++ b/EXE_CDeObjSolid.cpp
@@ -0,0 +1,286 @@
+//----------------------------------------------------------------------------
+// EgalTech 2020-2020
+//----------------------------------------------------------------------------
+// File : EXE_CDeObjClosedSurfTm.cpp Data : 09.01.20 Versione : 2.2a2
+// Contenuto : Funzioni per verificare collisioni tra
+// Objects e Closed SurftriMesh.
+//
+//
+// Modifiche : 09.01.20 DS Creazione modulo.
+//
+//
+//----------------------------------------------------------------------------
+
+//--------------------------- Include ----------------------------------------
+#include "stdafx.h"
+#include "EXE.h"
+#include "EXE_Macro.h"
+#include "EXE_Const.h"
+#include "AuxTools.h"
+#include "GeoTools.h"
+#include "/EgtDev/Include/EXeExecutor.h"
+#include "/EgtDev/Include/EXeConst.h"
+#include "/EgtDev/Include/EGkCDeBoxClosedSurfTm.h"
+#include "/EgtDev/Include/EGkCDeCylClosedSurfTm.h"
+#include "/EgtDev/Include/EGkCDeSpheClosedSurfTm.h"
+#include "/EgtDev/Include/EGkVolZmap.h"
+#include "/EgtDev/Include/EGkStringUtils3d.h"
+
+using namespace std ;
+
+//----------------------------------------------------------------------------
+static int
+MyCDeBoxClosedSurfTm( const Frame3d& frBox, const Vector3d& vtDiag, int nSurfTmId, double dSafeDist, int nRefType)
+{
+ IGeomDB* pGeomDB = GetCurrGeomDB() ;
+ VERIFY_GEOMDB( pGeomDB, false)
+ // recupero la superficie TriMesh
+ const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTmId)) ;
+ if ( pStm == nullptr)
+ return -1 ;
+ // verifico sia chiusa
+ if ( ! pStm->IsClosed())
+ return -1 ;
+ // recupero il riferimento della superficie
+ Frame3d frSurf ;
+ if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frSurf))
+ return -1 ;
+ // porto in locale alla superficie il riferimento del box (il vettore è già in questo stesso riferimento)
+ Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frSurf) ;
+ // verifico la collisione
+ return ( CDeBoxClosedSurfTm( frBoxL, vtDiag, dSafeDist, *pStm) ? 1 : 0) ;
+}
+
+//----------------------------------------------------------------------------
+int
+ExeCDeBoxClosedSurfTm( const Frame3d& frBox, const Vector3d& vtDiag, int nSurfTmId, double dSafeDist, int nRefType)
+{
+ int nRes = MyCDeBoxClosedSurfTm( frBox, vtDiag, nSurfTmId, dSafeDist, nRefType) ;
+ // se richiesto, salvo il comando Lua equivalente
+ if ( IsCmdLog()) {
+ string sLua = "EgtCDeBoxClosedSurfTm({{" + ToString( frBox.Orig()) + "},{" +
+ ToString( frBox.VersX()) + "},{" +
+ ToString( frBox.VersY()) + "},{" +
+ ToString( frBox.VersZ()) + "}},{" +
+ ToString( vtDiag) + "}," +
+ IdToString( nSurfTmId) + "," +
+ ToString( dSafeDist) + "," +
+ RefTypeToString( nRefType) + ")" +
+ " -- Res=" + ToString( nRes) ;
+ LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
+ }
+ // restituisco risultato
+ return nRes ;
+}
+
+//----------------------------------------------------------------------------
+static int
+MyCDeCylClosedSurfTm( const Frame3d& frCyl, double dH, double dR, int nSurfTmId, double dSafeDist, int nRefType)
+{
+ IGeomDB* pGeomDB = GetCurrGeomDB() ;
+ VERIFY_GEOMDB( pGeomDB, false)
+ // recupero la superficie TriMesh
+ const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTmId)) ;
+ if ( pStm == nullptr)
+ return -1 ;
+ // verifico sia chiusa
+ if ( ! pStm->IsClosed())
+ return -1 ;
+ // recupero il riferimento della superficie
+ Frame3d frSurf ;
+ if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frSurf))
+ return -1 ;
+ // porto in locale alla superficie il riferimento del cilindro
+ Frame3d frCylL = GetFrameLocal( pGeomDB, frCyl, nRefType, frSurf) ;
+ // verifico la collisione
+ return ( CDeCylClosedSurfTm( frCylL, dH, dR, dSafeDist, *pStm) ? 1 : 0) ;
+}
+
+//----------------------------------------------------------------------------
+int
+ExeCDeCylClosedSurfTm( const Frame3d& frCyl, double dH, double dR, int nSurfTmId, double dSafeDist, int nRefType)
+{
+ int nRes = MyCDeCylClosedSurfTm( frCyl, dH, dR, nSurfTmId, dSafeDist, nRefType) ;
+ // se richiesto, salvo il comando Lua equivalente
+ if ( IsCmdLog()) {
+ string sLua = "EgtCDeCylClosedSurfTm({{" + ToString( frCyl.Orig()) + "},{" +
+ ToString( frCyl.VersX()) + "},{" +
+ ToString( frCyl.VersY()) + "},{" +
+ ToString( frCyl.VersZ()) + "}}," +
+ ToString( dH) + "," +
+ ToString( dR) + "," +
+ IdToString( nSurfTmId) + "," +
+ ToString( dSafeDist) + "," +
+ RefTypeToString( nRefType) + ")" +
+ " -- Res=" + ToString( nRes) ;
+ LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
+ }
+ // restituisco risultato
+ return nRes ;
+}
+
+//----------------------------------------------------------------------------
+static int
+MyCDeSpheClosedSurfTm( const Point3d& ptCen, double dR, int nSurfTmId, double dSafeDist, int nRefType)
+{
+ IGeomDB* pGeomDB = GetCurrGeomDB() ;
+ VERIFY_GEOMDB( pGeomDB, false)
+ // recupero la superficie TriMesh
+ const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTmId)) ;
+ if ( pStm == nullptr)
+ return -1 ;
+ // verifico sia chiusa
+ if ( ! pStm->IsClosed())
+ return -1 ;
+ // recupero il riferimento della superficie
+ Frame3d frSurf ;
+ if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frSurf))
+ return -1 ;
+ // porto in locale alla superficie il centro della sfera
+ Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frSurf) ;
+ // verifico la collisione
+ return ( CDeSpheClosedSurfTm( ptCenL, dR, dSafeDist, *pStm) ? 1 : 0) ;
+}
+
+//----------------------------------------------------------------------------
+int
+ExeCDeSpheClosedSurfTm( const Point3d& ptCen, double dR, int nSurfTmId, double dSafeDist, int nRefType)
+{
+ int nRes = MyCDeSpheClosedSurfTm( ptCen, dR, nSurfTmId, dSafeDist, nRefType) ;
+ // se richiesto, salvo il comando Lua equivalente
+ if ( IsCmdLog()) {
+ string sLua = "EgtCDeSpheClosedSurfTm({" + ToString( ptCen) + "}," +
+ ToString( dR) + "," +
+ IdToString( nSurfTmId) + "," +
+ ToString( dSafeDist) + "," +
+ RefTypeToString( nRefType) + ")" +
+ " -- Res=" + ToString( nRes) ;
+ LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
+ }
+ // restituisco risultato
+ return nRes ;
+}
+
+//----------------------------------------------------------------------------
+static int
+MyCDeBoxVolZmap( const Frame3d& frBox, const Vector3d& vtDiag, int nZmapId, double dSafeDist, int nRefType)
+{
+ IGeomDB* pGeomDB = GetCurrGeomDB() ;
+ VERIFY_GEOMDB( pGeomDB, false)
+ // recupero lo Zmap
+ const IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nZmapId)) ;
+ if ( pVZM == nullptr)
+ return -1 ;
+ // recupero il riferimento locale
+ Frame3d frLoc ;
+ if ( ! pGeomDB->GetGlobFrame( nZmapId, frLoc))
+ return -1 ;
+ // porto in locale il riferimento (il vettore è già in locale a questo stesso riferimento)
+ Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frLoc) ;
+ // verifico la collisione
+ return ( pVZM->AvoidBox( frBoxL, vtDiag, dSafeDist) ? 0 : 1) ;
+}
+
+//----------------------------------------------------------------------------
+int
+ExeCDeBoxVolZmap( const Frame3d& frBox, const Vector3d& vtDiag, int nZmapId, double dSafeDist, int nRefType)
+{
+ int nRes = MyCDeBoxVolZmap( frBox, vtDiag, nZmapId, dSafeDist, nRefType) ;
+ // se richiesto, salvo il comando Lua equivalente
+ if ( IsCmdLog()) {
+ string sLua = "EgtCDeBoxVolZmap({{" + ToString( frBox.Orig()) + "},{" +
+ ToString( frBox.VersX()) + "},{" +
+ ToString( frBox.VersY()) + "},{" +
+ ToString( frBox.VersZ()) + "}},{" +
+ ToString( vtDiag) + "}," +
+ IdToString( nZmapId) + "," +
+ ToString( dSafeDist) + "," +
+ RefTypeToString( nRefType) + ")" +
+ " -- Res=" + ToString( nRes) ;
+ LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
+ }
+ // restituisco risultato
+ return nRes ;
+}
+
+//----------------------------------------------------------------------------
+static int
+MyCDeCylVolZmap( const Frame3d& frCyl, double dL, double dR, int nZmapId, double dSafeDist, int nRefType)
+{
+ IGeomDB* pGeomDB = GetCurrGeomDB() ;
+ VERIFY_GEOMDB( pGeomDB, false)
+ // recupero lo Zmap
+ const IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nZmapId)) ;
+ if ( pVZM == nullptr)
+ return -1 ;
+ // recupero il riferimento locale
+ Frame3d frLoc ;
+ if ( ! pGeomDB->GetGlobFrame( nZmapId, frLoc))
+ return -1 ;
+ // porto in locale il riferimento
+ Frame3d frBoxL = GetFrameLocal( pGeomDB, frCyl, nRefType, frLoc) ;
+ // verifico la collisione
+ return ( pVZM->AvoidCylinder( frBoxL, dL, dR, dSafeDist) ? 0 : 1) ;
+}
+
+//----------------------------------------------------------------------------
+int
+ExeCDeCylVolZmap( const Frame3d& frCyl, double dL, double dR, int nZmapId, double dSafeDist, int nRefType)
+{
+ int nRes = MyCDeCylVolZmap( frCyl, dL, dR, nZmapId, dSafeDist, nRefType) ;
+ // se richiesto, salvo il comando Lua equivalente
+ if ( IsCmdLog()) {
+ string sLua = "EgtCDeCylVolZmap({{" + ToString( frCyl.Orig()) + "},{" +
+ ToString( frCyl.VersX()) + "},{" +
+ ToString( frCyl.VersY()) + "},{" +
+ ToString( frCyl.VersZ()) + "}}," +
+ ToString( dL) + "," +
+ ToString( dR) + "," +
+ IdToString( nZmapId) + "," +
+ ToString( dSafeDist) + "," +
+ RefTypeToString( nRefType) + ")" +
+ " -- Res=" + ToString( nRes) ;
+ LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
+ }
+ // restituisco risultato
+ return nRes ;
+}
+
+//----------------------------------------------------------------------------
+static int
+MyCDeSpheVolZmap( const Point3d& ptCen, double dRad, int nZmapId, double dSafeDist, int nRefType)
+{
+ IGeomDB* pGeomDB = GetCurrGeomDB() ;
+ VERIFY_GEOMDB( pGeomDB, false)
+ // recupero lo Zmap
+ const IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nZmapId)) ;
+ if ( pVZM == nullptr)
+ return -1 ;
+ // recupero il riferimento locale
+ Frame3d frLoc ;
+ if ( ! pGeomDB->GetGlobFrame( nZmapId, frLoc))
+ return -1 ;
+ // porto in locale il centro della sfera
+ Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ;
+ // verifico la collisione
+ return ( pVZM->AvoidSphere( ptCenL, dRad, dSafeDist) ? 0 : 1) ;
+}
+
+//----------------------------------------------------------------------------
+int
+ExeCDeSpheVolZmap( const Point3d& ptCen, double dRad, int nZmapId, double dSafeDist, int nRefType)
+{
+ int nRes = MyCDeSpheVolZmap( ptCen, dRad, nZmapId, dSafeDist, nRefType) ;
+ // se richiesto, salvo il comando Lua equivalente
+ if ( IsCmdLog()) {
+ string sLua = "EgtCDeSpheVolZmap({" + ToString( ptCen) + "}," +
+ ToString( dRad) + "," +
+ IdToString( nZmapId) + "," +
+ ToString( dSafeDist) + "," +
+ RefTypeToString( nRefType) + ")" +
+ " -- Res=" + ToString( nRes) ;
+ LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
+ }
+ // restituisco risultato
+ return nRes ;
+}
diff --git a/EXE_GdbModifyVol.cpp b/EXE_GdbModifyVol.cpp
index 299759b..833a212 100644
--- a/EXE_GdbModifyVol.cpp
+++ b/EXE_GdbModifyVol.cpp
@@ -579,97 +579,6 @@ ExeVolZmapGetEdges( int nId, int nDestGrpId, int* pnCount)
return nFirstId ;
}
-//----------------------------------------------------------------------------
-bool
-ExeVolZmapAvoidBox( int nId, const Frame3d& frBox, const Vector3d& vtDiag, 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 riferimento (il vettore è già in locale a questo stesso riferimento)
- Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frLoc) ;
- // recupero lo Zmap e calcolo collisione
- 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()) {
- string sLua = "EgtVolZmapAvoidBox(" + IdToString( nId) + ",{" +
- ToString( frBox.Orig()) + "},{" +
- ToString( frBox.VersX()) + "},{" +
- ToString( frBox.VersY()) + "},{" +
- ToString( frBox.VersZ()) + "}},{" +
- ToString( vtDiag) + "}," +
- 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)
-{
- IGeomDB* pGeomDB = GetCurrGeomDB() ;
- VERIFY_GEOMDB( pGeomDB, false)
- // recupero il riferimento locale
- Frame3d frLoc ;
- bool bOk = pGeomDB->GetGlobFrame( nId, frLoc) ;
- // porto in locale il riferimento
- Frame3d frBoxL = GetFrameLocal( pGeomDB, frCyl, nRefType, frLoc) ;
- // recupero lo Zmap e calcolo collisione
- 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()) {
- string sLua = "EgtVolZmapAvoidCylinder(" + IdToString( nId) + ",{" +
- ToString( frCyl.Orig()) + "},{" +
- ToString( frCyl.VersX()) + "},{" +
- ToString( frCyl.VersY()) + "},{" +
- ToString( frCyl.VersZ()) + "}}," +
- ToString( dL) + "," +
- ToString( dR) + "," +
- ToString( dSafeDist) + "," +
- RefTypeToString( nRefType) + ")" +
- " -- Ok=" + ToString( bOk) ;
- LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
- }
- // restituisco risultato
- 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)
diff --git a/EgtExecutor.vcxproj b/EgtExecutor.vcxproj
index 04857ed..04ad4a4 100644
--- a/EgtExecutor.vcxproj
+++ b/EgtExecutor.vcxproj
@@ -243,6 +243,7 @@ copy $(TargetPath) \EgtProg\Dll64
+
@@ -286,6 +287,7 @@ copy $(TargetPath) \EgtProg\Dll64
+
diff --git a/EgtExecutor.vcxproj.filters b/EgtExecutor.vcxproj.filters
index d0c7bf9..ca87b4b 100644
--- a/EgtExecutor.vcxproj.filters
+++ b/EgtExecutor.vcxproj.filters
@@ -344,6 +344,12 @@
File di origine\EXE
+
+ File di origine\EXE
+
+
+ File di origine\LUA
+
diff --git a/LUA.h b/LUA.h
index 3a47520..23f130d 100644
--- a/LUA.h
+++ b/LUA.h
@@ -75,6 +75,9 @@ bool LuaInstallGeoDist( LuaMgr& luaMgr) ;
//-------------------------- GeoInters ---------------------------------------
bool LuaInstallGeoInters( LuaMgr& luaMgr) ;
+//-------------------------- Collision Detection -----------------------------
+bool LuaInstallCDeObjSolid( LuaMgr& luaMgr) ;
+
//-------------------------- MachMgr -----------------------------------------
bool LuaInstallMachMgr( LuaMgr& luaMgr) ;
diff --git a/LUA_Base.cpp b/LUA_Base.cpp
index b2cf3cb..0e76d95 100644
--- a/LUA_Base.cpp
+++ b/LUA_Base.cpp
@@ -106,6 +106,10 @@ LuaInstallEgtFunctions( LuaMgr& LuaMgr)
LOG_ERROR( GetLogger(), "Error in LuaInstallGeoInters (" __FUNCTION__ ")")
return false ;
}
+ if ( ! LuaInstallCDeObjSolid( LuaMgr)) {
+ LOG_ERROR( GetLogger(), "Error in LuaInstallCDeObjSolid (" __FUNCTION__ ")")
+ return false ;
+ }
if ( ! LuaInstallMachMgr( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallMachMgr (" __FUNCTION__ ")")
return false ;
diff --git a/LUA_CDeObjSolid.cpp b/LUA_CDeObjSolid.cpp
new file mode 100644
index 0000000..9f0f80a
--- /dev/null
+++ b/LUA_CDeObjSolid.cpp
@@ -0,0 +1,196 @@
+//----------------------------------------------------------------------------
+// EgalTech 2020-2020
+//----------------------------------------------------------------------------
+// File : LUA_CDeObjSolid.cpp Data : 09.01.20 Versione : 2.2a2
+// Contenuto : Funzioni di verifica collisioni tra oggetti e solidi.
+// Oggetti = Box, Sfere, Cilindri
+// Solidi = SurfTriMesh, VolZMap
+//
+// Modifiche : 09.01.20 DS Creazione modulo.
+//
+//
+//----------------------------------------------------------------------------
+
+//--------------------------- Include ----------------------------------------
+#include "stdafx.h"
+#include "LUA.h"
+#include "/EgtDev/Include/EXeExecutor.h"
+#include "/EgtDev/Include/EXeConst.h"
+#include "/EgtDev/Include/EGkLuaAux.h"
+#include "/EgtDev/Include/EgnStringUtils.h"
+
+using namespace std ;
+
+//-------------------------------------------------------------------------------
+static int
+LuaCDeBoxClosedSurfTm( lua_State* L)
+{
+ // 4 o 5 parametri : frBox, vtDiag, nStmId, dSafeDist [, nRefType]
+ Frame3d frBox ;
+ LuaCheckParam( L, 1, frBox)
+ Vector3d vtDiag ;
+ LuaCheckParam( L, 2, vtDiag)
+ int nStmId ;
+ LuaCheckParam( L, 3, nStmId)
+ double dSafeDist ;
+ LuaCheckParam( L, 4, dSafeDist)
+ int nRefType = RTY_DEFAULT ;
+ LuaGetParam( L, 5, nRefType) ;
+ LuaClearStack( L) ;
+ // assegno dati utensile generico per Collision Avoidance
+ int nRes = ExeCDeBoxClosedSurfTm( frBox, vtDiag, nStmId, dSafeDist, nRefType) ;
+ // restituisco il risultato
+ if ( nRes >= 0)
+ LuaSetParam( L, ( nRes != 0)) ;
+ else
+ LuaSetParam( L) ;
+ return 1 ;
+}
+
+//-------------------------------------------------------------------------------
+static int
+LuaCDeCylClosedSurfTm( lua_State* L)
+{
+ // 5 o 6 parametri : frCyl, dH, dR, nStmId, dSafeDist [, nRefType]
+ Frame3d frCyl ;
+ LuaCheckParam( L, 1, frCyl)
+ double dH ;
+ LuaCheckParam( L, 2, dH)
+ double dR ;
+ LuaCheckParam( L, 3, dR)
+ int nStmId ;
+ LuaCheckParam( L, 4, nStmId)
+ double dSafeDist ;
+ LuaCheckParam( L, 5, dSafeDist)
+ int nRefType = RTY_DEFAULT ;
+ LuaGetParam( L, 6, nRefType) ;
+ LuaClearStack( L) ;
+ // assegno dati utensile generico per Collision Avoidance
+ int nRes = ExeCDeCylClosedSurfTm( frCyl, dH, dR, nStmId, dSafeDist, nRefType) ;
+ // restituisco il risultato
+ if ( nRes >= 0)
+ LuaSetParam( L, ( nRes != 0)) ;
+ else
+ LuaSetParam( L) ;
+ return 1 ;
+}
+
+//----------------------------------------------------------------------------
+static int
+LuaCDeSpheClosedSurfTm( lua_State* L)
+{
+ // 4 o 5 parametri : ptCen, dRad, nStmId, dSafeDist [, nRefType]
+ Point3d ptCen ;
+ LuaCheckParam( L, 1, ptCen)
+ double dR ;
+ LuaCheckParam( L, 2, dR)
+ int nStmId ;
+ LuaCheckParam( L, 3, nStmId)
+ double dSafeDist ;
+ LuaCheckParam( L, 4, dSafeDist)
+ int nRefType = RTY_DEFAULT ;
+ LuaGetParam( L, 5, nRefType) ;
+ LuaClearStack( L) ;
+ // assegno dati utensile generico per Collision Avoidance
+ int nRes = ExeCDeSpheClosedSurfTm( ptCen, dR, nStmId, dSafeDist, nRefType) ;
+ // restituisco il risultato
+ if ( nRes >= 0)
+ LuaSetParam( L, ( nRes != 0)) ;
+ else
+ LuaSetParam( L) ;
+ return 1 ;
+}
+
+//----------------------------------------------------------------------------
+static int
+LuaCDeBoxVolZmap( lua_State* L)
+{
+ // 4 o 5 parametri : frBox, vtDiag, nZmapId, dSafeDist [, nRefType]
+ Frame3d frBox ;
+ LuaCheckParam( L, 1, frBox)
+ Vector3d vtDiag ;
+ LuaCheckParam( L, 2, vtDiag)
+ int nZmapId ;
+ LuaCheckParam( L, 3, nZmapId)
+ double dSafeDist ;
+ LuaCheckParam( L, 4, dSafeDist)
+ int nRefType = RTY_DEFAULT ;
+ LuaGetParam( L, 5, nRefType) ;
+ LuaClearStack( L) ;
+ // verifico non interferenza
+ int nRes = ExeCDeBoxVolZmap( frBox, vtDiag, nZmapId, dSafeDist, nRefType) ;
+ // restituisco il risultato
+ if ( nRes >= 0)
+ LuaSetParam( L, ( nRes != 0)) ;
+ else
+ LuaSetParam( L) ;
+ return 1 ;
+}
+
+//----------------------------------------------------------------------------
+static int
+LuaCDeCylVolZmap( lua_State* L)
+{
+ // 5 o 6 parametri : frCyl, dL, dR, nZmapId, dSafeDist [, nRefType]
+ Frame3d frCyl ;
+ LuaCheckParam( L, 1, frCyl)
+ double dL ;
+ LuaCheckParam( L, 2, dL)
+ double dR ;
+ LuaCheckParam( L, 3, dR)
+ int nZmapId ;
+ LuaCheckParam( L, 4, nZmapId)
+ double dSafeDist ;
+ LuaCheckParam( L, 5, dSafeDist)
+ int nRefType = RTY_DEFAULT ;
+ LuaGetParam( L, 6, nRefType) ;
+ LuaClearStack( L) ;
+ // verifico non interferenza
+ int nRes = ExeCDeCylVolZmap( frCyl, dL, dR, nZmapId, dSafeDist, nRefType) ;
+ // restituisco il risultato
+ if ( nRes >= 0)
+ LuaSetParam( L, ( nRes != 0)) ;
+ else
+ LuaSetParam( L) ;
+ return 1 ;
+}
+
+//----------------------------------------------------------------------------
+static int
+LuaCDeSpheVolZmap( lua_State* L)
+{
+ // 4 o 5 parametri : ptCen, dRad, nZmapId, dSafeDist [, nRefType]
+ Point3d ptCen ;
+ LuaCheckParam( L, 1, ptCen)
+ double dRad ;
+ LuaCheckParam( L, 2, dRad)
+ int nZmapId ;
+ LuaCheckParam( L, 3, nZmapId)
+ double dSafeDist ;
+ LuaCheckParam( L, 4, dSafeDist)
+ int nRefType = RTY_DEFAULT ;
+ LuaGetParam( L, 5, nRefType) ;
+ LuaClearStack( L) ;
+ // verifico non interferenza
+ int nRes = ExeCDeSpheVolZmap( ptCen, dRad, nZmapId, dSafeDist, nRefType) ;
+ // restituisco il risultato
+ if ( nRes >= 0)
+ LuaSetParam( L, ( nRes != 0)) ;
+ else
+ LuaSetParam( L) ;
+ return 1 ;
+}
+
+//-------------------------------------------------------------------------------
+bool
+LuaInstallCDeObjSolid( LuaMgr& luaMgr)
+{
+ bool bOk = ( &luaMgr != nullptr) ;
+ bOk = bOk && luaMgr.RegisterFunction( "EgtCDeBoxClosedSurfTm", LuaCDeBoxClosedSurfTm) ;
+ bOk = bOk && luaMgr.RegisterFunction( "EgtCDeCylClosedSurfTm", LuaCDeCylClosedSurfTm) ;
+ bOk = bOk && luaMgr.RegisterFunction( "EgtCDeSpheClosedSurfTm", LuaCDeSpheClosedSurfTm) ;
+ bOk = bOk && luaMgr.RegisterFunction( "EgtCDeBoxVolZmap", LuaCDeBoxVolZmap) ;
+ bOk = bOk && luaMgr.RegisterFunction( "EgtCDeCylVolZmap", LuaCDeCylVolZmap) ;
+ bOk = bOk && luaMgr.RegisterFunction( "EgtCDeSpheVolZmap", LuaCDeSpheVolZmap) ;
+ return bOk ;
+}
diff --git a/LUA_GdbModifyVol.cpp b/LUA_GdbModifyVol.cpp
index fc9bbeb..4fea712 100644
--- a/LUA_GdbModifyVol.cpp
+++ b/LUA_GdbModifyVol.cpp
@@ -426,77 +426,6 @@ LuaVolZmapGetEdges( lua_State* L)
return 2 ;
}
-//----------------------------------------------------------------------------
-static int
-LuaVolZmapAvoidBox( lua_State* L)
-{
- // 4 o 5 parametri : nId, frBox, vtDiag, dSafeDist [, nRefType]
- int nId ;
- LuaCheckParam( L, 1, nId)
- Frame3d frBox ;
- LuaCheckParam( L, 2, frBox)
- Vector3d vtDiag ;
- LuaCheckParam( L, 3, vtDiag)
- double dSafeDist ;
- LuaCheckParam( L, 4, dSafeDist)
- int nRefType = RTY_DEFAULT ;
- LuaGetParam( L, 5, nRefType) ;
- LuaClearStack( L) ;
- // verifico non interferenza
- bool bOk = ExeVolZmapAvoidBox( nId, frBox, vtDiag, dSafeDist, nRefType) ;
- // restituisco il risultato
- LuaSetParam( L, bOk) ;
- return 1 ;
-}
-
-//----------------------------------------------------------------------------
-static int
-LuaVolZmapAvoidCylinder( lua_State* L)
-{
- // 5 o 6 parametri : nId, frCyl, dL, dR, dSafeDist [, nRefType]
- int nId ;
- LuaCheckParam( L, 1, nId)
- Frame3d frCyl ;
- LuaCheckParam( L, 2, frCyl)
- double dL ;
- LuaCheckParam( L, 3, dL)
- double dR ;
- LuaCheckParam( L, 4, dR)
- double dSafeDist ;
- LuaCheckParam( L, 5, dSafeDist)
- int nRefType = RTY_DEFAULT ;
- LuaGetParam( L, 6, nRefType) ;
- LuaClearStack( L) ;
- // verifico non interferenza
- bool bOk = ExeVolZmapAvoidCylinder( nId, frCyl, dL, dR, dSafeDist, nRefType) ;
- // restituisco il risultato
- LuaSetParam( L, bOk) ;
- 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)
@@ -539,9 +468,6 @@ LuaInstallGdbModifyVol( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapMillingStep", LuaVolZmapMillingStep) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapGetDepth", LuaVolZmapGetDepth) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapGetEdges", LuaVolZmapGetEdges) ;
- bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapAvoidBox", LuaVolZmapAvoidBox) ;
- bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapAvoidCylinder", LuaVolZmapAvoidCylinder) ;
- bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapAvoidSphere", LuaVolZmapAvoidSphere) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCutVolZmapPlane", LuaCutVolZmapPlane) ;
return bOk ;
}
\ No newline at end of file