Merge commit '2f7a8a8f9c8083d4c4152b96dc7114f9aeebf990' into ThreeJS
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#include "/EgtDev/Include/EGkCurveLocal.h"
|
||||
#include "/EgtDev/Include/EGkCurveAux.h"
|
||||
#include "/EgtDev/Include/EGkOffsetCurve.h"
|
||||
#include "/EgtDev/Include/EGkMedialAxis.h"
|
||||
#include "/EgtDev/Include/EGkChainCurves.h"
|
||||
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
||||
#include "/EgtDev/Include/EGkExtTExt.h"
|
||||
@@ -145,6 +146,39 @@ ExeOffsetCurveAdv( int nId, double dDist, int nType, int* pnCount)
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
ExeCurveMedialAxis( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero la curva
|
||||
const ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
// eseguo il calcolo
|
||||
PolyLine PL ;
|
||||
if ( ! CurveSimpleMedialAxis( pCurve, PL))
|
||||
return GDB_ID_NULL ;
|
||||
// creo la curva
|
||||
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCompo) || ! pCompo->FromPolyLine( PL))
|
||||
return GDB_ID_NULL ;
|
||||
// la inserisco nel DB geometrico
|
||||
int nNewId = pGeomDB->InsertGeoObj( GDB_ID_NULL, nId, GDB_AFTER, Release( pCompo)) ;
|
||||
// copio gli attributi
|
||||
pGeomDB->CopyAttributes( nId, nNewId) ;
|
||||
// notifico la modifica
|
||||
if ( nNewId != GDB_ID_NULL)
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua ;
|
||||
sLua = "EgtCurveMedialAxis(" + ToString( nId) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeApproxCurve( int nId, int nApprType, double dLinTol)
|
||||
|
||||
@@ -202,6 +202,14 @@ ExeLuaResetGlobVar( const string& sVar)
|
||||
return LuaResetGlobVar( sVar) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeLuaExistsFunction( const string& sFun)
|
||||
{
|
||||
// verifica esistenza funzione
|
||||
return LuaExistsFunction( sFun) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeLuaCallFunction( const string& sFun)
|
||||
|
||||
Binary file not shown.
+5
-3
@@ -1,13 +1,13 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
// EgalTech 2015-2022
|
||||
//----------------------------------------------------------------------------
|
||||
// File : LUA_Base.h Data : 21.03.15 Versione : 1.6c6
|
||||
// File : LUA_Base.h Data : 26.08.22 Versione : 2.4h4
|
||||
// Contenuto : Dichiarazioni per funzioni di base gestione LUA.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 21.03.15 DS Creazione modulo.
|
||||
//
|
||||
// 26.08.22 DS Aggiunta funzione LuaExistsFunction.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -29,6 +29,8 @@ bool LuaGetGlobVar( const std::string& sVar, T& Val)
|
||||
{ return LuaGetGlobVar( LuaGetLuaMgr().GetLuaState(), sVar, Val) ; }
|
||||
bool LuaResetGlobVar( const std::string& sVar) ;
|
||||
bool LuaCreateGlobTable( const std::string& sVar) ;
|
||||
inline bool LuaExistsFunction( const std::string& sFunName)
|
||||
{ return LuaGetLuaMgr().ExistsFunction( sFunName) ; }
|
||||
template<typename... Args>
|
||||
bool LuaCallFunction( const std::string& sFunName, int nRets, const Args&... params)
|
||||
{ return LuaGetLuaMgr().CallFunction( sFunName, nRets, params...) ; }
|
||||
|
||||
@@ -81,6 +81,23 @@ LuaOffsetCurveAdv( lua_State* L)
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCurveMedialAxis( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// calcolo del Medial Axis della curva
|
||||
int nNewId = ExeCurveMedialAxis( nId) ;
|
||||
if ( nNewId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nNewId) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaApproxCurve( lua_State* L)
|
||||
@@ -901,6 +918,7 @@ LuaInstallGdbModifyCurve( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtInvertCurve", LuaInvertCurve) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtOffsetCurve", LuaOffsetCurve) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtOffsetCurveAdv", LuaOffsetCurveAdv) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveMedialAxis", LuaCurveMedialAxis) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtApproxCurve", LuaApproxCurve) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtProjectCurveOnPlane", LuaProjectCurveOnPlane) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtChangeClosedCurveStart", LuaChangeClosedCurveStart) ;
|
||||
|
||||
@@ -949,6 +949,20 @@ LuaGetLanguage( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetMsg( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nMsg
|
||||
int nMsg ;
|
||||
LuaCheckParam( L, 1, nMsg)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il nome della lingua corrente
|
||||
string sMsg = ExeGetMsg( nMsg) ;
|
||||
LuaSetParam( L, sMsg) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaWinExec( lua_State* L)
|
||||
@@ -1202,6 +1216,7 @@ LuaInstallGeneral( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetVersion", LuaGetVersion) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtIs64bit", LuaIs64bit) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLanguage", LuaGetLanguage) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtMsg", LuaGetMsg) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtDialogBox", LuaDialogBox) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtWinExec", LuaWinExec) ;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user