EgtExecutor 2.1h2 :

- aggiunte funzioni ExeSetSelInfo, ExeGetLastSelInfo e ExeGetPrevSelInfo
- aggiunte funzioni lua EgtGetLastSelInfo, EgtGetPrevSelInfo e EgtSurfTmFacetFromTria.
This commit is contained in:
Dario Sassi
2019-08-29 08:59:52 +00:00
parent 93c77cb786
commit 1917a21a7c
6 changed files with 142 additions and 14 deletions
+37
View File
@@ -259,3 +259,40 @@ ExeGetPrevSelectedObj( void)
// recupero il precedente oggetto selezionato
return pGeomDB->GetPrevSelectedObj() ;
}
//-----------------------------------------------------------------------------
bool
ExeSetSelInfo( int nId, int nSub, const Point3d& ptSel)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX( pGseCtx, false)
// imposto le informazioni ausiliarie di selezione
pGseCtx->m_siSel.Set( nId, nSub, ptSel) ;
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeGetLastSelInfo( int& nLastId, int& nLastSub, Point3d& ptLastSel)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX( pGseCtx, false)
// recupero le informazioni ausiliarie di selezione dell'ultima entità
nLastId = pGseCtx->m_siSel.nLastId ;
nLastSub = pGseCtx->m_siSel.nLastSub ;
ptLastSel = pGseCtx->m_siSel.ptLastSel ;
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeGetPrevSelInfo( int& nPrevId, int& nPrevSub, Point3d& ptPrevSel)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX( pGseCtx, false)
// recupero le informazioni ausiliarie di selezione dell'ultima entità
nPrevId = pGseCtx->m_siSel.nPrevId ;
nPrevSub = pGseCtx->m_siSel.nPrevSub ;
ptPrevSel = pGseCtx->m_siSel.ptPrevSel ;
return true ;
}
+14 -14
View File
@@ -19,21 +19,21 @@
#include "GeoTools.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EgkGeoPoint3d.h"
#include "/EgtDev/Include/EgkGeoVector3d.h"
#include "/EgtDev/Include/EgkCurve.h"
#include "/EgtDev/Include/EgkCurveArc.h"
#include "/EgtDev/Include/EgkCurveComposite.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkGeoVector3d.h"
#include "/EgtDev/Include/EGkCurve.h"
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkCurveLocal.h"
#include "/EgtDev/Include/EgkSurf.h"
#include "/EgtDev/Include/EgkSurfFlatRegion.h"
#include "/EgtDev/Include/EgkSurfTriMesh.h"
#include "/EgtDev/Include/EGkSurf.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkSurfLocal.h"
#include "/EgtDev/Include/EgkVolZmap.h"
#include "/EgtDev/Include/EgkExtText.h"
#include "/EgtDev/Include/EgkDistPointCurve.h"
#include "/EgtDev/Include/EGkVolZmap.h"
#include "/EgtDev/Include/EGkExtText.h"
#include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkIntersLineSurfTm.h"
#include "/EgtDev/Include/EgkIntersCurves.h"
#include "/EgtDev/Include/EGkIntersCurves.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include <string>
@@ -1257,8 +1257,8 @@ ExeSurfTmFacetOppositeSideEx( int nId, int nFacet, const Vector3d& vtDir, int nR
pCrv = pCrvCompo->GetNextCurve() ;
}
// la curva gira in senso antiorario attorno al contorno faccia vista dalla normale uscente
// elimino i segmenti che hanno la direzione di riferimento a destra o quasi (45deg)
const double COS_ANG_MAX = cos( 45 * DEGTORAD) ;
// elimino i segmenti che hanno la direzione di riferimento a destra o quasi (46deg)
const double COS_ANG_MAX = cos( 46 * DEGTORAD) ;
const double MIN_DIR_LEN = 0.999 ;
// cerco primo elemento del contorno non valido e vi pongo inizio/fine della curva
int i = 0 ;
BIN
View File
Binary file not shown.
+16
View File
@@ -20,6 +20,21 @@
#define NOMINMAX
#include <windows.h>
//----------------------------------------------------------------------------
// Struttura per info aggiuntive di selezione
struct SelInfo {
int nLastId ;
int nLastSub ;
Point3d ptLastSel ;
int nPrevId ;
int nPrevSub ;
Point3d ptPrevSel ;
SelInfo( void)
: nLastId( GDB_ID_NULL), nLastSub( 0), ptLastSel(), nPrevId( GDB_ID_NULL), nPrevSub( 0), ptPrevSel() {}
void Set( int nI, int nS, const Point3d& ptP)
{ nPrevId = nLastId ; nPrevSub = nLastSub ; ptPrevSel = ptLastSel ; nLastId = nI ; nLastSub = nS ; ptLastSel = ptP ; }
} ;
//----------------------------------------------------------------------------
class GseContext
{
@@ -36,6 +51,7 @@ class GseContext
int m_nCurrPart ;
int m_nCurrLayer ;
int m_nObjFilterForSelect ;
SelInfo m_siSel ;
public :
GseContext( void)
+53
View File
@@ -223,6 +223,56 @@ LuaGetPrevSelectedObj( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetLastSelInfo( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// recupero le informazioni di selezione sull'ultimo oggetto selezionato
int nLastId ;
int nLastSub ;
Point3d ptLastSel ;
bool bOk = ExeGetLastSelInfo( nLastId, nLastSub, ptLastSel) ;
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, nLastId) ;
LuaSetParam( L, nLastSub) ;
LuaSetParam( L, ptLastSel) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 3 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetPrevSelInfo( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// recupero le informazioni di selezione sul penultimo oggetto selezionato
int nPrevId ;
int nPrevSub ;
Point3d ptPrevSel ;
bool bOk = ExeGetPrevSelInfo( nPrevId, nPrevSub, ptPrevSel) ;
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, nPrevId) ;
LuaSetParam( L, nPrevSub) ;
LuaSetParam( L, ptPrevSel) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 3 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbObjSelection( LuaMgr& luaMgr)
@@ -241,5 +291,8 @@ LuaInstallGdbObjSelection( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextSelectedObj", LuaGetNextSelectedObj) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLastSelectedObj", LuaGetLastSelectedObj) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPrevSelectedObj", LuaGetPrevSelectedObj) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLastSelInfo", LuaGetLastSelInfo) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPrevSelInfo", LuaGetPrevSelInfo) ;
return bOk ;
}
+22
View File
@@ -15,6 +15,7 @@
#include "stdafx.h"
#include "LUA.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkLuaAux.h"
using namespace std ;
@@ -718,6 +719,26 @@ LuaSurfTmFacetCount( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmFacetFromTria( lua_State* L)
{
// 2 parametri : nId, nTria
int nId ;
LuaCheckParam( L, 1, nId)
int nTria ;
LuaCheckParam( L, 2, nTria)
LuaClearStack( L) ;
// recupero l'indice della faccia cui appartiene il triangolo della superficie
int nFacet = ExeSurfTmFacetFromTria( nId, nTria) ;
// restituisco il risultato
if ( nFacet != SVT_NULL)
LuaSetParam( L, nFacet) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmFacetAdjacencies( lua_State* L)
@@ -1089,6 +1110,7 @@ LuaInstallGeoSnap( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrChunkSimpleClassify", LuaSurfFrChunkSimpleClassify) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrTestExternal", LuaSurfFrTestExternal) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetCount", LuaSurfTmFacetCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetFromTria", LuaSurfTmFacetFromTria) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetAdjacencies", LuaSurfTmFacetAdjacencies) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNearestEndPoint", LuaSurfTmFacetNearestEndPoint) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNearestMidPoint", LuaSurfTmFacetNearestMidPoint) ;