EgtExecutor :
- aggiunte funzioni Exe e Lua VolZmapResolution e VolZmapChangeResolution.
This commit is contained in:
+8
-138
@@ -98,7 +98,7 @@ ExeExplodeVolume( int nId, int* pnCount)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeVolZmapGetPartBBox( int nId, int nPart, int nFlag, BBox3d& b3Box)
|
||||
ExeVolZmapChangeResolution( int nId, int nNewRes)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
@@ -106,68 +106,18 @@ ExeVolZmapGetPartBBox( int nId, int nPart, int nFlag, BBox3d& b3Box)
|
||||
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pVZM == nullptr)
|
||||
return false ;
|
||||
// recupero il bounding box della parte dell'oggetto in locale
|
||||
return pVZM->GetPartLocalBBox( nPart, b3Box, nFlag) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeVolZmapGetPartBBoxGlob( int nId, int nPart, int nFlag, BBox3d& b3Box)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero lo Zmap
|
||||
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pVZM == nullptr)
|
||||
return false ;
|
||||
// recupero il riferimento globale del gruppo cui appartiene
|
||||
Frame3d frGlob ;
|
||||
if ( nId != GDB_ID_ROOT && ! pGeomDB->GetGroupGlobFrame( pGeomDB->GetParentId( nId), frGlob))
|
||||
return false ;
|
||||
// recupero il bounding box della parte dell'oggetto in globale
|
||||
return pVZM->GetPartBBox( nPart, frGlob, b3Box, nFlag) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCopyVolZmapPart( int nId, int nPart, int nDestGrpId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero lo Zmap
|
||||
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pVZM == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
// recupero il suo riferimento globale
|
||||
Frame3d frVZM ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nId, frVZM))
|
||||
return GDB_ID_NULL ;
|
||||
// recupero il riferimento del gruppo di destinazione
|
||||
Frame3d frDest ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
|
||||
return GDB_ID_NULL ;
|
||||
// copio la parte connessa
|
||||
PtrOwner<IVolZmap> pPart( pVZM->ClonePart( nPart)) ;
|
||||
if ( IsNull( pPart))
|
||||
return GDB_ID_NULL ;
|
||||
pPart->LocToLoc( frVZM, frDest) ;
|
||||
// inserisco nel DB
|
||||
int nVZMId = pGeomDB->InsertGeoObj( GDB_ID_NULL, nDestGrpId, GDB_LAST_SON, Release( pPart)) ;
|
||||
if ( nVZMId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
// copio gli attributi
|
||||
if ( ! pGeomDB->CopyAttributes( nId, nVZMId))
|
||||
return GDB_ID_NULL ;
|
||||
// cambio la risoluzione (rapporto Voxel/Dexel, valori ammessi 1 e 2)
|
||||
bool bOk = pVZM->ChangeResolution( nNewRes) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "ExeCopyVolZmapPart(" + ToString( nId) + "," +
|
||||
ToString( nPart) + "," +
|
||||
ToString( nDestGrpId) + ")" +
|
||||
" -- Id=" + ToString( nVZMId) ;
|
||||
string sLua = "EgtVolZmapChangeResolution(" + ToString( nId) + "," +
|
||||
ToString( nNewRes) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
return nVZMId ;
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
@@ -502,86 +452,6 @@ ExeVolZmapMillingStep( int nId, const Point3d& ptPs, const Vector3d& vtDs, const
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeVolZmapGetDepth( int nId, const Point3d& ptP, const Vector3d& vtDir, int nRefType, bool bExact,
|
||||
double& dInLen, double& dOutLen)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bool bOk = pGeomDB->GetGlobFrame( nId, frLoc) ;
|
||||
// porto in locale il punto e il vettore
|
||||
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ;
|
||||
Vector3d vtVL = GetVectorLocal( pGeomDB, vtDir, nRefType, frLoc) ;
|
||||
// recupero lo Zmap e calcolo profondità
|
||||
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
|
||||
bOk = bOk && ( pVZM != nullptr && pVZM->GetDepth( ptP, vtDir, dInLen, dOutLen, bExact)) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtVolZmapGetDepth(" + IdToString( nId) + ",{" +
|
||||
ToString( ptP) + "},{" +
|
||||
ToString( vtDir) + "}," +
|
||||
( bExact ? "true" : "false") + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Ok=" + ToString( bOk) + "," + ToString( dInLen) + "," + ToString( dOutLen) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
ExeVolZmapGetEdges( int nId, int nDestGrpId, int* pnCount)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero lo Zmap
|
||||
const IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pVZM != nullptr) ;
|
||||
// recupero il riferimento del solido
|
||||
Frame3d frSurf ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( nId, frSurf) ;
|
||||
// recupero il riferimento di destinazione
|
||||
Frame3d frDest ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest) ;
|
||||
// ne determino gli spigoli
|
||||
ICURVEPOVECTOR vpCurve ;
|
||||
bOk = bOk && pVZM->GetEdges( vpCurve) ;
|
||||
// inserisco gli spigoli come curve nel DB
|
||||
int nFirstId = GDB_ID_NULL ;
|
||||
int nCount = 0 ;
|
||||
for ( int i = 0 ; i < int( vpCurve.size()) ; ++ i) {
|
||||
// lo porto nel riferimento destinazione
|
||||
bOk = bOk && vpCurve[i]->LocToLoc( frSurf, frDest) ;
|
||||
// lo inserisco nel DB geometrico
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vpCurve[i])) : GDB_ID_NULL) ;
|
||||
bOk = bOk && ( nNewId != GDB_ID_NULL) ;
|
||||
// copio il materiale
|
||||
bOk = bOk && pGeomDB->CopyMaterial( nId, nNewId) ;
|
||||
// aggiorno contatori
|
||||
if ( bOk && nFirstId == GDB_ID_NULL)
|
||||
nFirstId = nNewId ;
|
||||
if ( bOk)
|
||||
++ nCount ;
|
||||
}
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtGetSurfTmSilhouette(" + ToString( nId) + ",{" +
|
||||
ToString( nDestGrpId) + ")" +
|
||||
" -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultati
|
||||
if ( pnCount != nullptr)
|
||||
*pnCount = nCount ;
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeCutVolZmapPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, int nRefType)
|
||||
|
||||
Reference in New Issue
Block a user