EgtExecutor:

- aggiunte funzioni Exe e Lua CDeBoxClosedSurfTm, ExeCDeCylClosedSurfTm e ExeCDeSpheClosedSurfTm
- modificate funzioni Exe e Lua VolZmapAvoid* in CDe*VolZmap.
This commit is contained in:
Dario Sassi
2020-01-10 10:37:49 +00:00
parent bcdcc46deb
commit fb6bb48d14
9 changed files with 498 additions and 166 deletions
+1 -1
View File
@@ -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.
//
//
//
+286
View File
@@ -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 ;
}
-91
View File
@@ -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)
+2
View File
@@ -243,6 +243,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ItemGroup>
<ClCompile Include="DllNesting.cpp" />
<ClCompile Include="EXE_CAvTool.cpp" />
<ClCompile Include="EXE_CDeObjSolid.cpp" />
<ClCompile Include="EXE_GdbCreateVol.cpp" />
<ClCompile Include="EXE_GdbModifyVol.cpp" />
<ClCompile Include="EXE_GeoDist.cpp" />
@@ -286,6 +287,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="GeoTools.cpp" />
<ClCompile Include="GseContext.cpp" />
<ClCompile Include="LUA_CAvTool.cpp" />
<ClCompile Include="LUA_CDeObjSolid.cpp" />
<ClCompile Include="LUA_GeoDist.cpp" />
<ClCompile Include="LUA_GeoInters.cpp" />
<ClCompile Include="LUA_Picture.cpp" />
+6
View File
@@ -344,6 +344,12 @@
<ClCompile Include="EXE_NstAutoNesting.cpp">
<Filter>File di origine\EXE</Filter>
</ClCompile>
<ClCompile Include="EXE_CDeObjSolid.cpp">
<Filter>File di origine\EXE</Filter>
</ClCompile>
<ClCompile Include="LUA_CDeObjSolid.cpp">
<Filter>File di origine\LUA</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="EgtExecutor.rc">
+3
View File
@@ -75,6 +75,9 @@ bool LuaInstallGeoDist( LuaMgr& luaMgr) ;
//-------------------------- GeoInters ---------------------------------------
bool LuaInstallGeoInters( LuaMgr& luaMgr) ;
//-------------------------- Collision Detection -----------------------------
bool LuaInstallCDeObjSolid( LuaMgr& luaMgr) ;
//-------------------------- MachMgr -----------------------------------------
bool LuaInstallMachMgr( LuaMgr& luaMgr) ;
+4
View File
@@ -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 ;
+196
View File
@@ -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 ;
}
-74
View File
@@ -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 ;
}