EgtExecutor 2.2b2 :
- aggiunta funzione Lua ExistsDirectory - aggiunte funzioni Exe e Lua CurveWithRegionClassify.
This commit is contained in:
@@ -773,6 +773,71 @@ ExeClosedCurveClassify( int nId1, int nId2)
|
||||
return ccInt.GetRegionCurveClassification() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
ExeCurveWithRegionClassify( int nCurveId, int nRegionId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, 0)
|
||||
// recupero la curva e il suo riferimento
|
||||
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nCurveId)) ;
|
||||
if ( pCrv == nullptr)
|
||||
return CRC_NULL ;
|
||||
// recupero il riferimento della curva
|
||||
Frame3d frCrv ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nCurveId, frCrv))
|
||||
return CRC_NULL ;
|
||||
// recupero la superficie FlatRegion e il suo riferimento
|
||||
ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nRegionId)) ;
|
||||
if ( pSfr == nullptr)
|
||||
return CRC_NULL ;
|
||||
// recupero il riferimento della superficie
|
||||
Frame3d frSurf ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nRegionId, frSurf))
|
||||
return CRC_NULL ;
|
||||
// se riferimenti diversi, porto una copia della curva nel riferimento della superficie
|
||||
const ICurve* pCrvL = pCrv ;
|
||||
PtrOwner<ICurve> pTmp ;
|
||||
if ( ! AreSameFrame( frCrv, frSurf)) {
|
||||
pTmp.Set( pCrv->Clone()) ;
|
||||
if ( IsNull( pTmp))
|
||||
return CRC_NULL ;
|
||||
pTmp->LocToLoc( frCrv, frSurf) ;
|
||||
pCrvL = pTmp ;
|
||||
}
|
||||
// classifico la curva rispetto alla regione
|
||||
CRVCVECTOR vcClass ;
|
||||
if ( ! pSfr->GetCurveClassification( *pCrvL, vcClass))
|
||||
return CRC_NULL ;
|
||||
int nRes = CRC_NULL ;
|
||||
for ( auto& cClass : vcClass) {
|
||||
switch ( cClass.nClass) {
|
||||
case CRVC_NULL :
|
||||
return CRC_NULL ;
|
||||
break ;
|
||||
case CRVC_IN :
|
||||
if ( nRes == CRC_NULL || nRes == CRC_IN || nRes == CRC_ON)
|
||||
nRes = CRC_IN ;
|
||||
else
|
||||
nRes = CRC_INTERS ;
|
||||
break ;
|
||||
case CRVC_OUT :
|
||||
if ( nRes == CRC_NULL || nRes == CRC_OUT || nRes == CRC_ON)
|
||||
nRes = CRC_OUT ;
|
||||
else
|
||||
nRes = CRC_INTERS ;
|
||||
break ;
|
||||
case CRVC_ON_P :
|
||||
case CRVC_ON_M :
|
||||
if ( nRes == CRC_NULL)
|
||||
nRes = CRC_ON ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
return nRes ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeArcRadius( int nId, double* pdRad)
|
||||
|
||||
Binary file not shown.
+18
-2
@@ -590,11 +590,26 @@ LuaEraseFile( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaExistsDirectory( lua_State* L)
|
||||
{
|
||||
// 1 parametro : sDir
|
||||
string sDir ;
|
||||
LuaCheckParam( L, 1, sDir)
|
||||
LuaClearStack( L) ;
|
||||
// verifico esistenza direttorio
|
||||
bool bOk = ExistsDirectory( sDir) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaEmptyDirectory( lua_State* L)
|
||||
{
|
||||
// 1 parametro : dir
|
||||
// 1 parametro : sDir
|
||||
string sDir ;
|
||||
LuaCheckParam( L, 1, sDir)
|
||||
LuaClearStack( L) ;
|
||||
@@ -883,7 +898,7 @@ LuaDialogBox( lua_State* L)
|
||||
s_nCtrls = 0 ;
|
||||
for ( int i = 0 ; i < MAX_CTRLS ; ++ i) {
|
||||
STRVECTOR vData ;
|
||||
if ( LuaGetParam( L, 2 + i, vData)) {
|
||||
if ( LuaGetParam( L, 2 + i, vData) && vData.size() >= 2) {
|
||||
s_sText[i] = Trim( vData[0]) ;
|
||||
s_sEdit[i] = Trim( vData[1]) ;
|
||||
++ s_nCtrls ;
|
||||
@@ -937,6 +952,7 @@ LuaInstallGeneral( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyFile", LuaCopyFile) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRenameFile", LuaRenameFile) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtEraseFile", LuaEraseFile) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExistsDirectory", LuaExistsDirectory) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtEmptyDirectory", LuaEmptyDirectory) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTextFileCompare", LuaTextFileCompare) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtBinaryFileCompare", LuaBinaryFileCompare) ;
|
||||
|
||||
+23
-2
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
// EgalTech 2014-2020
|
||||
//----------------------------------------------------------------------------
|
||||
// File : LUA_GeoSnap.cpp Data : 02.10.14 Versione : 1.5i5
|
||||
// File : LUA_GeoSnap.cpp Data : 06.02.20 Versione : 2.2b2
|
||||
// Contenuto : Funzioni di snap ad oggetti del DB geometrico per LUA.
|
||||
//
|
||||
//
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "stdafx.h"
|
||||
#include "LUA.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EGkLuaAux.h"
|
||||
|
||||
@@ -492,6 +493,25 @@ LuaCurveMinAreaRectangleXY( lua_State* L)
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCurveWithRegionClassify( lua_State* L)
|
||||
{
|
||||
// 2 parametri : nCurveId, nRegionId
|
||||
int nCurveId ;
|
||||
LuaCheckParam( L, 1, nCurveId)
|
||||
int nRegionId ;
|
||||
LuaCheckParam( L, 2, nRegionId) ;
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la classificazione
|
||||
int nRes = ExeCurveWithRegionClassify( nCurveId, nRegionId) ;
|
||||
if ( nRes != CRC_NULL)
|
||||
LuaSetParam( L, nRes) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaArcRadius( lua_State* L)
|
||||
@@ -1097,6 +1117,7 @@ LuaInstallGeoSnap( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveThickness", LuaCurveThickness) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveSelfIntersCount", LuaCurveSelfIntersCount) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveMinAreaRectangleXY", LuaCurveMinAreaRectangleXY) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveWithRegionClassify", LuaCurveWithRegionClassify) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtArcRadius", LuaArcRadius) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtArcAngCenter", LuaArcAngCenter) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtArcDeltaN", LuaArcDeltaN) ;
|
||||
|
||||
Reference in New Issue
Block a user