EgtExecutor :

- a funzioni Exe e Lua CreateCurveCompoByChain e CreateCurveCompoByReorder aggiunto parametro Tolleranza (opzionale per Lua).
This commit is contained in:
DarioS
2022-04-13 14:53:16 +02:00
parent 5ba4240755
commit cb2082a033
2 changed files with 41 additions and 14 deletions
+23 -6
View File
@@ -1632,7 +1632,7 @@ ExeCreateCurveCompo( int nParentId, const INTVECTOR& vIds, bool bErase)
//-------------------------------------------------------------------------------
static int
MyCreateCurveCompoByChain( int nParentId, const INTVECTOR& vIds,
const Point3d& ptNear, bool bAllowInvert, bool bErase, int nRefType, int* pnCount)
const Point3d& ptNear, bool bAllowInvert, bool bErase, int nRefType, double dToler, int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
@@ -1642,7 +1642,6 @@ MyCreateCurveCompoByChain( int nParentId, const INTVECTOR& vIds,
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frDest))
return GDB_ID_NULL ;
// preparo i dati per il concatenamento
double dToler = 10 * EPS_SMALL ;
ChainCurves chainC ;
chainC.Init( bAllowInvert, dToler, int( vIds.size())) ;
INTVECTOR vMyIds ;
@@ -1801,10 +1800,18 @@ MyCreateCurveCompoByChain( int nParentId, const INTVECTOR& vIds,
int
ExeCreateCurveCompoByChain( int nParentId, const INTVECTOR& vIds,
const Point3d& ptNear, bool bErase, int nRefType, int* pnCount)
{
return ExeCreateCurveCompoByChainEx( nParentId, vIds, ptNear, bErase, nRefType, 10 * EPS_SMALL, pnCount) ;
}
//-------------------------------------------------------------------------------
int
ExeCreateCurveCompoByChainEx( int nParentId, const INTVECTOR& vIds,
const Point3d& ptNear, bool bErase, int nRefType, double dToler, int* pnCount)
{
// eseguo
int nCount = 0 ;
int nFirstId = MyCreateCurveCompoByChain( nParentId, vIds, ptNear, true, bErase, nRefType, &nCount) ;
int nFirstId = MyCreateCurveCompoByChain( nParentId, vIds, ptNear, true, bErase, nRefType, dToler, &nCount) ;
if ( pnCount != nullptr)
*pnCount = nCount ;
ExeSetModified() ;
@@ -1814,7 +1821,8 @@ ExeCreateCurveCompoByChain( int nParentId, const INTVECTOR& vIds,
IdListToString( vIds) + "},{" +
ToString( ptNear) + "}," +
( bErase ? "true" : "false") + "," +
RefTypeToString( nRefType) + ")" +
RefTypeToString( nRefType) + "," +
ToString( dToler) + ")" +
" -- Id=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
@@ -1826,10 +1834,18 @@ ExeCreateCurveCompoByChain( int nParentId, const INTVECTOR& vIds,
int
ExeCreateCurveCompoByReorder( int nParentId, const INTVECTOR& vIds,
const Point3d& ptNear, bool bErase, int nRefType, int* pnCount)
{
return ExeCreateCurveCompoByReorderEx( nParentId, vIds, ptNear, bErase, nRefType, 10 * EPS_SMALL, pnCount) ;
}
//-------------------------------------------------------------------------------
int
ExeCreateCurveCompoByReorderEx( int nParentId, const INTVECTOR& vIds,
const Point3d& ptNear, bool bErase, int nRefType, double dToler, int* pnCount)
{
// eseguo
int nCount = 0 ;
int nFirstId = MyCreateCurveCompoByChain( nParentId, vIds, ptNear, false, bErase, nRefType, &nCount) ;
int nFirstId = MyCreateCurveCompoByChain( nParentId, vIds, ptNear, false, bErase, nRefType, dToler, &nCount) ;
if ( pnCount != nullptr)
*pnCount = nCount ;
ExeSetModified() ;
@@ -1839,7 +1855,8 @@ ExeCreateCurveCompoByReorder( int nParentId, const INTVECTOR& vIds,
IdListToString( vIds) + "},{" +
ToString( ptNear) + "}," +
( bErase ? "true" : "false") + "," +
RefTypeToString( nRefType) + ")" +
RefTypeToString( nRefType) + "," +
ToString( dToler) + ")" +
" -- Id=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
+18 -8
View File
@@ -676,7 +676,7 @@ LuaCreateCurveCompo( lua_State* L)
static int
LuaCreateCurveCompoByChain( lua_State* L)
{
// 3 o 4 o 5 parametri : ParentId, nIds, PtNear [, Erase] [, nRefType]
// 3 o 4 o 5 o 6 parametri : ParentId, nIds, PtNear [, Erase] [, nRefType] [, dToler]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
INTVECTOR vIds ;
@@ -685,14 +685,19 @@ LuaCreateCurveCompoByChain( lua_State* L)
LuaCheckParam( L, 3, ptNear)
bool bErase = true ;
int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, 4, bErase))
double dToler = 10 * EPS_SMALL ;
if ( LuaGetParam( L, 4, bErase)) {
LuaGetParam( L, 5, nRefType) ;
LuaGetParam( L, 6, dToler) ;
}
else if ( LuaGetParam( L, 4, nRefType))
LuaGetParam( L, 5, dToler) ;
else
LuaGetParam( L, 4, nRefType) ;
LuaGetParam( L, 4, dToler) ;
LuaClearStack( L) ;
// creo la curva composita
int nCount = 0 ;
int nId = ExeCreateCurveCompoByChain( nParentId, vIds, ptNear, bErase, nRefType, &nCount) ;
int nId = ExeCreateCurveCompoByChainEx( nParentId, vIds, ptNear, bErase, nRefType, dToler, &nCount) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
@@ -706,7 +711,7 @@ LuaCreateCurveCompoByChain( lua_State* L)
static int
LuaCreateCurveCompoByReorder( lua_State* L)
{
// 3 o 4 o 5 parametri : ParentId, nIds, PtNear [, Erase] [, nRefType]
// 3 o 4 o 5 o 6 parametri : ParentId, nIds, PtNear [, Erase] [, nRefType] [, dToler]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
INTVECTOR vIds ;
@@ -715,14 +720,19 @@ LuaCreateCurveCompoByReorder( lua_State* L)
LuaCheckParam( L, 3, ptNear)
bool bErase = true ;
int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, 4, bErase))
double dToler = 10 * EPS_SMALL ;
if ( LuaGetParam( L, 4, bErase)) {
LuaGetParam( L, 5, nRefType) ;
LuaGetParam( L, 6, dToler) ;
}
else if ( LuaGetParam( L, 4, nRefType))
LuaGetParam( L, 5, dToler) ;
else
LuaGetParam( L, 4, nRefType) ;
LuaGetParam( L, 4, dToler) ;
LuaClearStack( L) ;
// creo la curva composita
int nCount = 0 ;
int nId = ExeCreateCurveCompoByReorder( nParentId, vIds, ptNear, bErase, nRefType, &nCount) ;
int nId = ExeCreateCurveCompoByReorderEx( nParentId, vIds, ptNear, bErase, nRefType, dToler, &nCount) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;