EgtExecutor 1.8k3 :

- aggiunta funzione Exe e Lua VolZmapIntersPlane
- aggiunta funzione Exe e Lua CopyAttributes.
This commit is contained in:
Dario Sassi
2017-11-20 08:24:02 +00:00
parent 225e9689dd
commit af4a364975
7 changed files with 145 additions and 0 deletions
+68
View File
@@ -367,6 +367,74 @@ ExeVolZmapGetDepth( int nId, const Point3d& ptP, const Vector3d& vtDir, int nRef
return bOk ;
}
//----------------------------------------------------------------------------
int
MyVolZmapIntersPlane( int nId, const Plane3d& plPlane, int nDestGrpId, int nRefType, int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero il riferimento locale
Frame3d frLoc ;
if ( ! pGeomDB->GetGlobFrame( nId, frLoc))
return GDB_ID_NULL ;
// recupero il riferimento destinazione
Frame3d frDest ;
if ( ! pGeomDB->GetGlobFrame( nDestGrpId, frDest))
return GDB_ID_NULL ;
// porto in locale il piano
Plane3d plPlaneL = GetPlaneLocal( pGeomDB, plPlane, nRefType, frLoc) ;
// recupero lo Zmap e calcolo l'intersezione
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
POCRVVECTOR vpLoop ;
if ( pVZM == nullptr || ! pVZM->GetPlaneIntersection( plPlaneL, vpLoop))
return GDB_ID_NULL ;
// inserisco le curve nel gruppo destinazione
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
for ( size_t i = 0 ; i < vpLoop.size() ; ++ i) {
PtrOwner<ICurve> pCrv( Release( vpLoop[i])) ;
if ( IsNull( pCrv))
continue ;
pCrv->ToLoc( frDest) ;
// inserisco la curva composita nel gruppo destinazione
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, ::Release( pCrv)) ;
if ( nNewId == GDB_ID_NULL)
return GDB_ID_NULL ;
if ( nFirstId == GDB_ID_NULL)
nFirstId = nNewId ;
++ nCount ;
}
// aggiorno contatore
if ( pnCount != nullptr)
*pnCount = nCount ;
// restituisco l'identificativo della prima nuova entità
return nFirstId ;
}
//----------------------------------------------------------------------------
int
ExeVolZmapIntersPlane( int nId, const Plane3d& plPlane, int nDestGrpId, int nRefType, int* pnCount)
{
// eseguo
int nCount = 0 ;
int nFirstId = MyVolZmapIntersPlane( nId, plPlane, nDestGrpId, nRefType, &nCount) ;
if ( pnCount != nullptr)
*pnCount = nCount ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZmapIntersPlane(" + IdToString( nId) + ",{" +
ToString( ORIG + plPlane.GetVersN() * plPlane.GetDist()) + "},{" +
ToString( plPlane.GetVersN()) + "},{" +
ToString( nDestGrpId) + "}," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della prima nuova entità
return nFirstId ;
}
//----------------------------------------------------------------------------
bool
ExeVolZmapAvoidBox( int nId, const Frame3d& frBox, const Vector3d& vtDiag, int nRefType)