Compare commits

...

5 Commits

Author SHA1 Message Date
Riccardo Elitropi 824e6e3ba1 EgtExecutor :
- correzione codice.
2024-03-18 13:21:21 +01:00
Riccardo Elitropi 88fa7ef54c EgtExecutor :
- rimozione codici di test.
- modifiche parametri LuaCreateSurfTmSwept.
2024-03-15 13:18:48 +01:00
Riccardo Elitropi 82633bf725 EgtExecutor :
- migliorie al codice.
2024-03-11 13:21:29 +01:00
Riccardo Elitropi a27dfd2b54 EgtExecutor :
- Codice di test per RMF aggiornato.
2024-03-07 10:52:39 +01:00
Riccardo Elitropi 2a106c4263 EgtExecutor :
- Codice di test per RMF.
2024-03-06 16:28:48 +01:00
2 changed files with 74 additions and 46 deletions
+67 -43
View File
@@ -1,4 +1,4 @@
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// EgalTech 2014-2015
//----------------------------------------------------------------------------
// File : EXE_GdbCreateSurf.cpp Data : 04.05.15 Versione : 1.6e1
@@ -33,6 +33,7 @@
#include "/EgtDev/Include/EGkCurveLocal.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/EGkExtText.h"
using namespace std ;
//-------------------------------------------------------------------------------
@@ -79,7 +80,7 @@ ExeCreateSurfFrRectangle( int nParentId, const Point3d& ptIni, const Point3d& pt
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -130,7 +131,7 @@ ExeCreateSurfFrRectangle3P( int nParentId, const Point3d& ptIni,
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -179,7 +180,7 @@ ExeCreateSurfFrStadium( int nParentId, const Point3d& ptIni, const Point3d& ptCr
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -196,7 +197,7 @@ ExeCreateSurfFrDisk( int nParentId, const Point3d& ptOrig, double dRad, int nRef
// porto in locale il punto e calcolo la normale in locale
Point3d ptOrigL = GetPointLocal( pGeomDB, ptOrig, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
// calcolo riferimento per l'entità
// calcolo riferimento per l'entità
Frame3d frEnt ;
bOk = bOk && frEnt.Set( ptOrigL, vtNL) ;
// creo il disco nel suo riferimento intrinseco
@@ -216,7 +217,7 @@ ExeCreateSurfFrDisk( int nParentId, const Point3d& ptOrig, double dRad, int nRef
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -260,7 +261,7 @@ ExeCreateSurfFrFatCurve( int nParentId, int nCrvId, double dRad, bool bSquaredEn
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -316,7 +317,7 @@ MyCreateSurfFlatRegion( int nParentId, const INTVECTOR& vCrvIds, int* pnCount)
// recupero la prossima superficie
pSfr = SfrCntr.GetSurf() ;
}
// restituisco l'identificativo della prima nuova entità
// restituisco l'identificativo della prima nuova entità
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
@@ -339,7 +340,7 @@ ExeCreateSurfFlatRegion( int nParentId, const INTVECTOR& vCrvIds, int* pnCount)
" -- Id=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nFirstId ;
}
@@ -388,7 +389,7 @@ ExeCreateSurfTmPlaneInBBox( int nParentId, const Point3d& ptP, const Vector3d& v
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -449,7 +450,7 @@ MyCreateSewPolygon( ISurfTriMesh* pStm, const Polygon3d& Polyg)
// verifico esistenza superficie
if ( pStm == nullptr)
return false ;
// se poligono vuoto, non devo fare alcunché
// se poligono vuoto, non devo fare alcunché
if ( Polyg.GetSideCount() == 0)
return true ;
// creo la superficie trimesh del poligono
@@ -579,7 +580,7 @@ ExeCreateSurfTmConvexHullInBBox( int nParentId, int nId, const BBox3d& b3Box, in
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -627,7 +628,7 @@ ExeCreateSurfTmBBox( int nParentId, const BBox3d& b3Box, bool bRegular, int nRef
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -682,7 +683,7 @@ ExeCreateSurfTmBox( int nParentId, const Point3d& ptIni, const Point3d& ptCross,
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -739,7 +740,7 @@ ExeCreateSurfTmPyramid( int nParentId, const Point3d& ptIni, const Point3d& ptCr
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -781,7 +782,7 @@ ExeCreateSurfTmCylinder( int nParentId, const Point3d& ptOrig, const Vector3d& v
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -823,7 +824,7 @@ ExeCreateSurfTmCone( int nParentId, const Point3d& ptOrig, const Vector3d& vtN,
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -859,7 +860,7 @@ ExeCreateSurfTmSphere( int nParentId, const Point3d& ptOrig,
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -901,7 +902,7 @@ ExeCreateSurfTmTriangle( int nParentId, const Point3d& ptP1, const Point3d& ptP2
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -950,7 +951,7 @@ ExeCreateSurfTmRectangle( int nParentId, const Point3d& ptO, const Point3d& ptL,
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -981,7 +982,7 @@ ExeCreateSurfTmByFlatContour( int nParentId, int nCrvId, double dLinTol)
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -1027,7 +1028,7 @@ ExeCreateSurfTmByRegion( int nParentId, const INTVECTOR& vCrvIds, double dLinTol
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -1082,7 +1083,7 @@ ExeCreateSurfTmByExtrusion( int nParentId, const INTVECTOR& vCrvIds, const Vecto
" -- Id=" + ToString( nFirstId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nFirstId ;
}
@@ -1126,7 +1127,7 @@ ExeCreateSurfTmByRegionExtrusion( int nParentId, const INTVECTOR& vCrvIds, const
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -1166,7 +1167,7 @@ ExeCreateSurfTmByRevolve( int nParentId, int nCrvId,
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -1208,7 +1209,7 @@ ExeCreateSurfTmByScrewing( int nParentId, int nCrvId,
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -1245,13 +1246,13 @@ ExeCreateSurfTmRectSwept( int nParentId, double dDimH, double dDimV, double dBev
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfTmSwept( int nParentId, int nSectId, int nGuideId, bool bCapEnds, double dLinTol)
ExeCreateSurfTmSwept( int nParentId, int nSectId, int nGuideId, bool bCapEnds, double dLinTol, Vector3d* vtStatic)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
@@ -1260,17 +1261,40 @@ ExeCreateSurfTmSwept( int nParentId, int nSectId, int nGuideId, bool bCapEnds, d
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// recupero la sezione in locale
CurveLocal CrvSect( pGeomDB, nSectId, frLoc) ;
bOk = bOk && ( CrvSect.Get() != nullptr) ;
// recupero la guida in locale
CurveLocal CrvGuide( pGeomDB, nGuideId, frLoc) ;
bOk = bOk && ( CrvGuide.Get() != nullptr) ;
// creo la superficie trimesh
// inizializzazione superficie e suo Id
ISurfTriMesh* pSTM = nullptr ;
pSTM = ( bOk ? GetSurfTriMeshSwept( CrvSect, CrvGuide, bCapEnds, dLinTol) : nullptr) ;
// inserisco la superficie trimesh nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ;
int nNewId = GDB_ID_NULL ;
// recupero il tipo di entità della sezione
int nSecType = pGeomDB->GetGeoType( nSectId) ;
// controllo se la sezione è definita da una curva
if ( nSecType == CRV_LINE || nSecType == CRV_ARC ||
nSecType == CRV_BEZIER || nSecType == CRV_COMPO) {
// recupero la sezione in locale
CurveLocal CrvSect( pGeomDB, nSectId, frLoc) ;
bOk = bOk && ( CrvSect.Get() != nullptr) ;
// calcolo la Swept
pSTM = ( bOk ? GetSurfTriMeshSwept( CrvSect, CrvGuide, bCapEnds, dLinTol, vtStatic) : nullptr) ;
// inserisco la superficie trimesh nel DB
nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ;
}
// controllo se la sezione è definita da una regione piana
else if ( nSecType == SRF_FLATRGN) {
// recupero la sezione e la porto nel frame corrente
PtrOwner<ISurfFlatRegion> pSfrSec( CloneSurfFlatRegion( pGeomDB->GetGeoObj( nSectId))) ;
Frame3d frSec ;
if ( ! IsNull( pSfrSec) && pGeomDB->GetGlobFrame( nSectId, frSec) &&
pSfrSec->LocToLoc( frSec, frLoc)) {
// calcolo la Swept
pSTM = ( bOk ? GetSurfTriMeshSwept( pSfrSec, CrvGuide, bCapEnds, dLinTol, vtStatic) : nullptr) ;
// inserisco la superficie trimesh nel DB
nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ;
}
}
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -1282,7 +1306,7 @@ ExeCreateSurfTmSwept( int nParentId, int nSectId, int nGuideId, bool bCapEnds, d
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -1319,7 +1343,7 @@ ExeCreateSurfTmTransSwept( int nParentId, int nSectId, int nGuideId, bool bCapEn
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -1336,7 +1360,7 @@ ExeCreateSurfTmRuled( int nParentId, int nPtOrCrvId1, int nPtOrCrvId2, int nType
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// creo la superficie trimesh
ISurfTriMesh* pSTM = nullptr ;
// se la prima entità è un punto e la seconda una curva
// se la prima entità è un punto e la seconda una curva
if ( pGeomDB->GetGeoType( nPtOrCrvId1) == GEO_PNT3D &&
( pGeomDB->GetGeoType( nPtOrCrvId2) & GEO_CURVE) != 0) {
// recupero il punto in locale
@@ -1352,7 +1376,7 @@ ExeCreateSurfTmRuled( int nParentId, int nPtOrCrvId1, int nPtOrCrvId2, int nType
// calcolo la superficie
pSTM = ( bOk ? GetSurfTriMeshRuled( ptP, CrvLoc, dLinTol) : nullptr) ;
}
// se la prima entità è una curva e la seconda un punto
// se la prima entità è una curva e la seconda un punto
else if ( ( pGeomDB->GetGeoType( nPtOrCrvId1) & GEO_CURVE) != 0 &&
pGeomDB->GetGeoType( nPtOrCrvId2) == GEO_PNT3D) {
// recupero la curva in locale
@@ -1396,7 +1420,7 @@ ExeCreateSurfTmRuled( int nParentId, int nPtOrCrvId1, int nPtOrCrvId2, int nType
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -1507,7 +1531,7 @@ ExeCreateSurfTmBySewing( int nParentId, const INTVECTOR& vIds, bool bErase)
bOk = bOk && pGeomDB->GetGlobFrame( nId, frStmS) ;
// lo esprimo rispetto a quello della prima superficie
frStmS.ToLoc( frLoc) ;
// se è la prima, copio
// se è la prima, copio
if ( bFirst) {
bOk = bOk && pStm->CopyFrom( pStmS) ;
bOk = bOk && pStm->ToGlob( frStmS) ;
@@ -1696,7 +1720,7 @@ ExeCreateSurfBezier( int nParentId, int nDegU, int nDegV, int nSpanU, int nSpanV
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nId ;
}
@@ -1748,7 +1772,7 @@ ExeCreateSurfBezierRational( int nParentId, int nDegU, int nDegV, int nSpanU, in
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nId ;
}
+7 -3
View File
@@ -660,7 +660,7 @@ LuaCreateSurfTmRectSwept( lua_State* L)
static int
LuaCreateSurfTmSwept( lua_State* L)
{
// 4 o 5 parametri : ParentId, SectId, GuideId, bCapEnds [, dTol]
// 4, 5 o 6 parametri : ParentId, SectId, GuideId, bCapEnds [, dTol] [, vtStatic]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nSectId ;
@@ -670,10 +670,14 @@ LuaCreateSurfTmSwept( lua_State* L)
bool bCapEnds ;
LuaCheckParam( L, 4, bCapEnds)
double dLinTol = LIN_TOL_SRF ;
LuaGetParam( L, 5, dLinTol) ;
Vector3d vtStatic = V_INVALID ;
if ( LuaGetParam( L, 5, dLinTol)) {
LuaGetParam( L, 6, vtStatic) ;
}
LuaClearStack( L) ;
// creo STM swept
int nId = ExeCreateSurfTmSwept( nParentId, nSectId, nGuideId, bCapEnds, dLinTol) ;
int nId = ExeCreateSurfTmSwept( nParentId, nSectId, nGuideId, bCapEnds, dLinTol,
vtStatic.IsValid() ? &vtStatic : nullptr) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;