EgtMachKernel :
- in Sgrossature e Finiture aggiunta gestione superfici di Bezier.
This commit is contained in:
+205
-31
@@ -25,6 +25,7 @@
|
||||
#include "/EgtDev/Include/EGkArcSpecial.h"
|
||||
#include "/EgtDev/Include/EGkChainCurves.h"
|
||||
#include "/EgtDev/Include/EGkOffsetCurve.h"
|
||||
#include "/EgtDev/Include/EGkSurfBezier.h"
|
||||
#include "/EgtDev/Include/EGkIntersCurves.h"
|
||||
#include "/EgtDev/Include/EGkCurveAux.h"
|
||||
#include "/EgtDev/Include/EGkSfrCreate.h"
|
||||
@@ -1031,7 +1032,7 @@ SurfFinishing::VerifyGeometry( SelData Id, int& nSubs)
|
||||
bool
|
||||
SurfFinishing::GetCurves( SelData Id, ICURVEPLIST& lstPC)
|
||||
{
|
||||
// ammessi : curve
|
||||
// ammessi : curve, superfici TriMesh e superfici Bezier
|
||||
const IGeoObj* pGObj = m_pGeomDB->GetGeoObj( Id.nId) ;
|
||||
if ( pGObj == nullptr)
|
||||
return false ;
|
||||
@@ -1039,8 +1040,10 @@ SurfFinishing::GetCurves( SelData Id, ICURVEPLIST& lstPC)
|
||||
Frame3d frGlob ;
|
||||
if ( ! m_pGeomDB->GetGlobFrame( Id.nId, frGlob))
|
||||
return false ;
|
||||
// recupero il tipo
|
||||
int nType = pGObj->GetType() ;
|
||||
// se curva
|
||||
if ( ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
if ( ( nType & GEO_CURVE) != 0) {
|
||||
PtrOwner<ICurve> pCurve ;
|
||||
// se direttamente curva
|
||||
if ( Id.nSub == SEL_SUB_ALL) {
|
||||
@@ -1084,8 +1087,11 @@ SurfFinishing::GetCurves( SelData Id, ICURVEPLIST& lstPC)
|
||||
lstPC.emplace_back( Release( pCurve)) ;
|
||||
return true ;
|
||||
}
|
||||
// se altrimenti superficie
|
||||
else if ( pGObj->GetType() == SRF_TRIMESH)
|
||||
// se superficie TriMesh
|
||||
else if ( nType == SRF_TRIMESH)
|
||||
return true ;
|
||||
// se superficie Bezier
|
||||
else if ( nType == SRF_BEZIER)
|
||||
return true ;
|
||||
// altrimenti errore
|
||||
else
|
||||
@@ -1456,9 +1462,39 @@ SurfFinishing::SetCAvTlStmForSurfaces( ICAvToolSurfTm* pCAvTlStm, const ISurfFla
|
||||
}
|
||||
|
||||
// aggiungo tutte le superfici di lavoro
|
||||
pCAvTlStm->SetSurfTm( *GetSurfTriMesh( vSurfLoc[0].Get())) ;
|
||||
for ( int i = 1 ; i < int( vSurfLoc.size()) ; ++ i)
|
||||
pCAvTlStm->AddSurfTm( *GetSurfTriMesh( vSurfLoc[i].Get())) ;
|
||||
for ( int i = 0 ; i < int( vSurfLoc.size()) ; ++ i) {
|
||||
// superfici ammesse : TriMesh, Bezier
|
||||
const ISurf* pSurf = GetSurf( vSurfLoc[i].Get()) ;
|
||||
if ( pSurf != nullptr && pSurf->IsValid()) {
|
||||
int nType = pSurf->GetType() ;
|
||||
// se TriMesh
|
||||
if ( nType == SRF_TRIMESH) {
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pSurf) ;
|
||||
if ( pStm != nullptr && pStm->IsValid() && pStm->GetTriangleCount() > 0) {
|
||||
if ( i == 0)
|
||||
pCAvTlStm->SetSurfTm( *pStm) ;
|
||||
else
|
||||
pCAvTlStm->AddSurfTm( *pStm) ;
|
||||
}
|
||||
}
|
||||
// se Bezier
|
||||
else if ( nType == SRF_BEZIER) {
|
||||
const ISurfBezier* pSBz = GetSurfBezier( pSurf) ;
|
||||
if ( pSBz != nullptr && pSBz->IsValid()) {
|
||||
double dOldTol = GetSurfBezierAuxSurfRefinedTol() ;
|
||||
SetSurfBezierAuxSurfRefinedTol( 5. * EPS_SMALL) ;
|
||||
const ISurfTriMesh* pStm = pSBz->GetAuxSurfRefined() ;
|
||||
SetSurfBezierAuxSurfRefinedTol( dOldTol) ;
|
||||
if ( pStm != nullptr && pStm->IsValid() && pStm->GetTriangleCount() > 0) {
|
||||
if ( i == 0)
|
||||
pCAvTlStm->SetSurfTm( *pStm) ;
|
||||
else
|
||||
pCAvTlStm->AddSurfTm( *pStm) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// aggiungo le superfici di supporto
|
||||
if ( ! vSurfSuppLoc.empty()) {
|
||||
@@ -1494,12 +1530,34 @@ SurfFinishing::SetCAvTlStmForSurfaces( ICAvToolSurfTm* pCAvTlStm, const ISurfFla
|
||||
// recupero le superfici singole ( più veloce che calcolare Offset complessivo)
|
||||
for ( const SurfLocal& SurfSupp : vSurfSuppLoc) {
|
||||
// le superfici di supporto devono essere ben definite ed avere un volume chiuso
|
||||
const ISurfTriMesh* pStmSupp = GetSurfTriMesh( SurfSupp.Get()) ;
|
||||
if ( pStmSupp == nullptr || ! pStmSupp->IsValid() || pStmSupp->GetTriangleCount() == 0 ||
|
||||
! pStmSupp->IsClosed())
|
||||
const ISurf* pSurfSupp = GetSurf( SurfSupp.Get()) ;
|
||||
if ( pSurfSupp == nullptr || ! pSurfSupp->IsValid())
|
||||
continue ;
|
||||
int nType = pSurfSupp->GetType() ;
|
||||
PtrOwner<ISurfTriMesh> pTruncStm ;
|
||||
// se TriMesh
|
||||
if ( nType == SRF_TRIMESH) {
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pSurfSupp) ;
|
||||
if ( pStm != nullptr && pStm->IsValid() && pStm->GetTriangleCount() > 0) {
|
||||
if ( ! pTruncStm.Set( CloneSurfTriMesh( pStm)))
|
||||
continue ;
|
||||
}
|
||||
}
|
||||
// se Bezier
|
||||
else if ( nType == SRF_BEZIER) {
|
||||
const ISurfBezier* pSBz = GetSurfBezier( pSurfSupp) ;
|
||||
if ( pSBz != nullptr && pSBz->IsValid()) {
|
||||
double dOldTol = GetSurfBezierAuxSurfRefinedTol() ;
|
||||
SetSurfBezierAuxSurfRefinedTol( 5. * EPS_SMALL) ;
|
||||
const ISurfTriMesh* pStm = pSBz->GetAuxSurfRefined() ;
|
||||
SetSurfBezierAuxSurfRefinedTol( dOldTol) ;
|
||||
if ( pStm != nullptr && pStm->IsValid() && pStm->GetTriangleCount() > 0) {
|
||||
if ( ! pTruncStm.Set( CloneSurfTriMesh( pStm)))
|
||||
continue ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// tengo la la tengo la parte di superficie
|
||||
PtrOwner<ISurfTriMesh> pTruncStm( CloneSurfTriMesh( pStmSupp)) ;
|
||||
if ( IsNull( pTruncStm) || ! pTruncStm->IsValid())
|
||||
return false ;
|
||||
if ( ! IsNull( pStmContainment) && pStmContainment->IsValid() &&
|
||||
@@ -1533,8 +1591,31 @@ SurfFinishing::EraseMaxDownSurf( const SURFLOCALVECTOR& vSurfLoc, const Frame3d&
|
||||
|
||||
// calcolo silhouette dell'insieme di superfici
|
||||
CISURFTMPVECTOR vpStm ; vpStm.reserve( vSurfLoc.size()) ;
|
||||
for ( int i = 0 ; i < int( vSurfLoc.size()) ; ++ i)
|
||||
vpStm.emplace_back( GetSurfTriMesh( vSurfLoc[i].Get())) ;
|
||||
for ( int i = 0 ; i < int( vSurfLoc.size()) ; ++ i) {
|
||||
// recupero la superficie
|
||||
const ISurf* pSurf = GetSurf( vSurfLoc[i].Get()) ;
|
||||
if ( pSurf == nullptr || ! pSurf->IsValid())
|
||||
continue ;
|
||||
int nType = pSurf->GetType() ;
|
||||
// se TriMesh
|
||||
if ( nType == SRF_TRIMESH) {
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pSurf) ;
|
||||
if ( pStm != nullptr && pStm->IsValid() && pStm->GetTriangleCount() > 0)
|
||||
vpStm.emplace_back( pStm) ;
|
||||
}
|
||||
// se Bezier
|
||||
else if ( nType == SRF_BEZIER) {
|
||||
const ISurfBezier* pSBz = GetSurfBezier( pSurf) ;
|
||||
if ( pSBz != nullptr && pSBz->IsValid()) {
|
||||
double dOldTol = GetSurfBezierAuxSurfRefinedTol() ;
|
||||
SetSurfBezierAuxSurfRefinedTol( 5. * EPS_SMALL) ;
|
||||
const ISurfTriMesh* pStm = pSBz->GetAuxSurfRefined() ;
|
||||
SetSurfBezierAuxSurfRefinedTol( dOldTol) ;
|
||||
if ( pStm != nullptr && pStm->IsValid() && pStm->GetTriangleCount() > 0)
|
||||
vpStm.emplace_back( pStm) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// determino il frame locale delle superfici analizzando la prima
|
||||
Frame3d frPocket ;
|
||||
Point3d ptCen ; pSfrCnt->GetCentroid( ptCen) ;
|
||||
@@ -2044,7 +2125,7 @@ SurfFinishing::GetActiveSurfaces( INTVECTOR& vSurfId, INTVECTOR& vSurfSuppId) co
|
||||
{
|
||||
// NB.
|
||||
// - vSrufInd contiene gli Id delle superfici selezionate ( nel caso non ci siano superfici
|
||||
// seleionate, allora vengono considerate tutte le superfici presenti nei grezzi attivi della fase
|
||||
// selezionate, allora vengono considerate tutte le superfici presenti nei grezzi attivi della fase)
|
||||
// - vSurfSupp contiene gli Id delle superfici di supporto, quindi quelle superici da cui si vuole
|
||||
// mantenere una certa distanza con l'utensile ( senza che siano selezionate)
|
||||
|
||||
@@ -2057,7 +2138,8 @@ SurfFinishing::GetActiveSurfaces( INTVECTOR& vSurfId, INTVECTOR& vSurfSuppId) co
|
||||
// cerco tra gli oggetti selezionati
|
||||
for ( const auto& Id : m_vId) {
|
||||
int nEntId = Id.nId ;
|
||||
if ( m_pGeomDB->GetGeoType( nEntId) == SRF_TRIMESH)
|
||||
int nType = m_pGeomDB->GetGeoType( nEntId) ;
|
||||
if ( nType == SRF_TRIMESH || nType == SRF_BEZIER)
|
||||
vSurfId.emplace_back( nEntId) ;
|
||||
}
|
||||
// controllo se sono state trovate delle superfici
|
||||
@@ -2077,8 +2159,9 @@ SurfFinishing::GetActiveSurfaces( INTVECTOR& vSurfId, INTVECTOR& vSurfSuppId) co
|
||||
while ( nEntId != GDB_ID_NULL) {
|
||||
// se entità superficie e visibile, la aggiungo
|
||||
int nStat ;
|
||||
if ( m_pGeomDB->GetGeoType( nEntId) == SRF_TRIMESH &&
|
||||
m_pGeomDB->GetCalcStatus( nEntId, nStat) && nStat != GDB_ST_OFF) {
|
||||
if ( ( m_pGeomDB->GetGeoType( nEntId) == SRF_TRIMESH ||
|
||||
m_pGeomDB->GetGeoType( nEntId) == SRF_BEZIER) &&
|
||||
m_pGeomDB->GetCalcStatus( nEntId, nStat) && nStat != GDB_ST_OFF) {
|
||||
// se non sono state selezionate superfici precedentemente, memorizzo tale id
|
||||
if ( bNoSurfId)
|
||||
vSurfId.emplace_back( nEntId) ;
|
||||
@@ -2267,9 +2350,33 @@ SurfFinishing::GetZConstQuotesInsideSfrParallelToTool( const SURFLOCALVECTOR& vS
|
||||
// scorro le superfici trimesh selezionate
|
||||
for ( int nS = 0 ; nS < int( vSrfLoc.size()) ; ++ nS) {
|
||||
// recupero la superficie
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( vSrfLoc[nS].Get()) ;
|
||||
if ( pStm == nullptr || ! pStm->IsValid())
|
||||
const ISurf* pSurf = GetSurf( vSrfLoc[nS].Get()) ;
|
||||
if ( pSurf == nullptr || ! pSurf->IsValid())
|
||||
continue ;
|
||||
int nType = pSurf->GetType() ;
|
||||
PtrOwner<ISurfTriMesh> pStm ;
|
||||
// se TriMesh
|
||||
if ( nType == SRF_TRIMESH) {
|
||||
const ISurfTriMesh* pSurftm = GetSurfTriMesh( pSurf) ;
|
||||
if ( pSurftm != nullptr && pSurftm->IsValid() && pSurftm->GetTriangleCount() > 0) {
|
||||
if ( ! pStm.Set( CloneSurfTriMesh( pStm)))
|
||||
continue ;
|
||||
}
|
||||
}
|
||||
// se Bezier
|
||||
else if ( nType == SRF_BEZIER) {
|
||||
const ISurfBezier* pSBz = GetSurfBezier( pSurf) ;
|
||||
if ( pSBz != nullptr && pSBz->IsValid()) {
|
||||
double dOldTol = GetSurfBezierAuxSurfRefinedTol() ;
|
||||
SetSurfBezierAuxSurfRefinedTol( 5. * EPS_SMALL) ;
|
||||
const ISurfTriMesh* pSurftm = pSBz->GetAuxSurfRefined() ;
|
||||
SetSurfBezierAuxSurfRefinedTol( dOldTol) ;
|
||||
if ( pSurftm != nullptr && pSurftm->IsValid() && pSurftm->GetTriangleCount() > 0) {
|
||||
if ( ! pStm.Set( CloneSurfTriMesh( pSurftm)))
|
||||
continue ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// scorro le facce
|
||||
for ( int nF = 0 ; nF < pStm->GetFacetCount() ; ++ nF) {
|
||||
// recupero il centro e la normale della faccia
|
||||
@@ -3091,10 +3198,31 @@ SurfFinishing::AddZConst( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrf
|
||||
CISURFTMPVECTOR vpStm ; vpStm.reserve( vSrfLoc.size()) ;
|
||||
// scorro le superfici
|
||||
for ( int i = 0 ; i < int( vSrfLoc.size()) ; ++ i) {
|
||||
// recupero la superficie TriMesh e se valida, la memorizzo
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( vSrfLoc[i].Get()) ;
|
||||
if ( pStm != nullptr && pStm->IsValid() && pStm->GetTriangleCount() > 0)
|
||||
vpStm.emplace_back( pStm) ;
|
||||
// recupero la superficie
|
||||
const ISurf* pSurf = GetSurf( vSrfLoc[i].Get()) ;
|
||||
if ( pSurf == nullptr || ! pSurf->IsValid())
|
||||
continue ;
|
||||
int nType = pSurf->GetType() ;
|
||||
// se TriMesh
|
||||
if ( nType == SRF_TRIMESH) {
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pSurf) ;
|
||||
// se valida, memorizzo
|
||||
if ( pStm != nullptr && pStm->IsValid() && pStm->GetTriangleCount() > 0)
|
||||
vpStm.emplace_back( pStm) ;
|
||||
}
|
||||
// se Bezier
|
||||
if ( nType == SRF_BEZIER) {
|
||||
const ISurfBezier* pSBz = GetSurfBezier( pSurf) ;
|
||||
if ( pSBz != nullptr && pSBz->IsValid()) {
|
||||
double dOldTol = GetSurfBezierAuxSurfRefinedTol() ;
|
||||
SetSurfBezierAuxSurfRefinedTol( 5. * EPS_SMALL) ;
|
||||
const ISurfTriMesh* pStm = pSBz->GetAuxSurfRefined() ;
|
||||
SetSurfBezierAuxSurfRefinedTol( dOldTol) ;
|
||||
// se valida, memorizzo
|
||||
if ( pStm != nullptr && pStm->IsValid() && pStm->GetTriangleCount() > 0)
|
||||
vpStm.emplace_back( pStm) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
const double TOL_SAMPLING = 1. ;
|
||||
PtrOwner<ICAvParSilhouettesSurfTm> pCavParSilh( CreateCAvParSilhouettesSurfTm()) ;
|
||||
@@ -5414,10 +5542,29 @@ SurfFinishing::CalcOptimalZConstCurves( const ISurfFlatRegion* pSfrLoc, const SU
|
||||
CISURFTMPVECTOR vpStm ; vpStm.reserve( vSrfLoc.size()) ;
|
||||
// scorro le superfici
|
||||
for ( int i = 0 ; i < int( vSrfLoc.size()) ; ++ i) {
|
||||
// recupero la superficie TriMesh e, se valida, la memorizzo
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( vSrfLoc[i].Get()) ;
|
||||
if ( pStm != nullptr && pStm->IsValid() && pStm->GetTriangleCount() > 0)
|
||||
vpStm.emplace_back( pStm) ;
|
||||
// recupero la superficie
|
||||
const ISurf* pSurf = GetSurf( vSrfLoc[i].Get()) ;
|
||||
if ( pSurf == nullptr || ! pSurf->IsValid())
|
||||
continue ;
|
||||
int nType = pSurf->GetType() ;
|
||||
// se TriMesh
|
||||
if ( nType == SRF_TRIMESH) {
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pSurf) ;
|
||||
if ( pStm != nullptr && pStm->IsValid() && pStm->GetTriangleCount() > 0)
|
||||
vpStm.emplace_back( pStm) ;
|
||||
}
|
||||
// se Bezier
|
||||
else if ( nType == SRF_BEZIER) {
|
||||
const ISurfBezier* pSBz = GetSurfBezier( pSurf) ;
|
||||
if ( pSBz != nullptr && pSBz->IsValid()) {
|
||||
double dOldTol = GetSurfBezierAuxSurfRefinedTol() ;
|
||||
SetSurfBezierAuxSurfRefinedTol( 5. * EPS_SMALL) ;
|
||||
const ISurfTriMesh* pStm = pSBz->GetAuxSurfRefined() ;
|
||||
SetSurfBezierAuxSurfRefinedTol( dOldTol) ;
|
||||
if ( pStm != nullptr && pStm->IsValid() && pStm->GetTriangleCount() > 0)
|
||||
vpStm.emplace_back( pStm) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// definisco il frame della regione piana
|
||||
@@ -5863,17 +6010,44 @@ SurfFinishing::AddProjection( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR&
|
||||
|
||||
// scorro il vettore di superfici selezionate
|
||||
for ( int i = 0 ; i < int( vSrfLoc.size()) ; ++ i) {
|
||||
// recupero la superficie ( TriMesh o Bezier)
|
||||
const ISurf* pSurf = GetSurf( vSrfLoc[i].Get()) ;
|
||||
if ( pSurf == nullptr || ! pSurf->IsValid())
|
||||
continue ;
|
||||
int nType = pSurf->GetType() ;
|
||||
PtrOwner<ISurfTriMesh> pSurfTm ;
|
||||
// se TriMesh
|
||||
if ( nType == SRF_TRIMESH) {
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pSurf) ;
|
||||
if ( pStm != nullptr && pStm->IsValid() && pStm->GetTriangleCount() > 0) {
|
||||
if ( ! pSurfTm.Set( CloneSurfTriMesh( pStm)))
|
||||
continue ;
|
||||
}
|
||||
}
|
||||
// se Bezier
|
||||
else if ( nType == SRF_BEZIER) {
|
||||
const ISurfBezier* pSBz = GetSurfBezier( pSurf) ;
|
||||
if ( pSBz != nullptr && pSBz->IsValid()) {
|
||||
double dOldTol = GetSurfBezierAuxSurfRefinedTol() ;
|
||||
SetSurfBezierAuxSurfRefinedTol( 5. * EPS_SMALL) ;
|
||||
const ISurfTriMesh* pStm = pSBz->GetAuxSurfRefined() ;
|
||||
SetSurfBezierAuxSurfRefinedTol( dOldTol) ;
|
||||
if ( pStm != nullptr && pStm->IsValid() && pStm->GetTriangleCount() > 0) {
|
||||
if ( ! pSurfTm.Set( CloneSurfTriMesh( pStm)))
|
||||
continue ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// porto la supercicie nel riferimento globale come TriMesh
|
||||
PtrOwner<ISurfTriMesh> pStm( CloneSurfTriMesh( GetSurfTriMesh( vSrfLoc[i].Get()))) ;
|
||||
if ( IsNull( pStm) || ! pStm->IsValid() || ! pStm->ToGlob( frSurf))
|
||||
if ( IsNull( pSurfTm) || ! pSurfTm->IsValid() || ! pSurfTm->ToGlob( frSurf))
|
||||
return false ;
|
||||
// calcolo il box rispetto a frLoc e sommo i contributi
|
||||
BBox3d BBox ;
|
||||
if ( ! pStm->GetBBox( frLocInv, BBox))
|
||||
if ( ! pSurfTm->GetBBox( frLocInv, BBox))
|
||||
return false ;
|
||||
BBox3Loc.Add( BBox) ;
|
||||
// memorizzo la superficie nel vettore
|
||||
vpStm.emplace_back( Release( pStm)) ;
|
||||
vpStm.emplace_back( Release( pSurfTm)) ;
|
||||
}
|
||||
|
||||
// recupero flag per saltare parti a massimo affondamento
|
||||
|
||||
+61
-14
@@ -27,6 +27,7 @@
|
||||
#include "/EgtDev/Include/EGkChainCurves.h"
|
||||
#include "/EgtDev/Include/EGkOffsetCurve.h"
|
||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EGkSurfBezier.h"
|
||||
#include "/EgtDev/Include/EGkSfrCreate.h"
|
||||
#include "/EgtDev/Include/EGkCalcPocketing.h"
|
||||
#include "/EgtDev/Include/EGkSurfLocal.h"
|
||||
@@ -1007,7 +1008,7 @@ SurfRoughing::VerifyGeometry( SelData Id, int& nSubs)
|
||||
bool
|
||||
SurfRoughing::GetCurves( SelData Id, ICURVEPLIST& lstPC)
|
||||
{
|
||||
// ammessi : curve
|
||||
// ammessi : curve, superfici TriMesh e superfici Bezier
|
||||
const IGeoObj* pGObj = m_pGeomDB->GetGeoObj( Id.nId) ;
|
||||
if ( pGObj == nullptr)
|
||||
return false ;
|
||||
@@ -1015,8 +1016,10 @@ SurfRoughing::GetCurves( SelData Id, ICURVEPLIST& lstPC)
|
||||
Frame3d frGlob ;
|
||||
if ( ! m_pGeomDB->GetGlobFrame( Id.nId, frGlob))
|
||||
return false ;
|
||||
// recupero il tipo
|
||||
int nType = pGObj->GetType() ;
|
||||
// se curva
|
||||
if ( ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
if ( ( nType & GEO_CURVE) != 0) {
|
||||
PtrOwner<ICurve> pCurve ;
|
||||
// se direttamente curva
|
||||
if ( Id.nSub == SEL_SUB_ALL) {
|
||||
@@ -1060,8 +1063,11 @@ SurfRoughing::GetCurves( SelData Id, ICURVEPLIST& lstPC)
|
||||
lstPC.emplace_back( Release( pCurve)) ;
|
||||
return true ;
|
||||
}
|
||||
// se altrimenti superficie
|
||||
else if ( pGObj->GetType() == SRF_TRIMESH)
|
||||
// se superficie TriMesh
|
||||
else if ( nType == SRF_TRIMESH)
|
||||
return true ;
|
||||
// se superficie Bezier
|
||||
else if ( nType == SRF_BEZIER)
|
||||
return true ;
|
||||
// altrimenti errore
|
||||
else
|
||||
@@ -1506,12 +1512,31 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
SURFLOCALVECTOR vSurfL ; vSurfL.reserve( vSurfId.size()) ;
|
||||
CISURFTMPVECTOR vpStm ; vpStm.reserve( vSurfId.size()) ;
|
||||
for ( int i = 0 ; i < int( vSurfId.size()) ; ++ i) {
|
||||
// superfici ammesse : TriMesh, Bezier
|
||||
vSurfL.emplace_back( m_pGeomDB, vSurfId[i], GLOB_FRM) ;
|
||||
if ( vSurfL[i].Get() == nullptr)
|
||||
return false ;
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( vSurfL[i].Get()) ;
|
||||
if ( pStm != nullptr && pStm->IsValid() && pStm->GetTriangleCount() > 0) {
|
||||
vpStm.emplace_back( pStm) ;
|
||||
const ISurf* pSurf = GetSurf( vSurfL[i].Get()) ;
|
||||
if ( pSurf != nullptr && pSurf->IsValid()) {
|
||||
int nType = pSurf->GetType() ;
|
||||
// se TriMesh
|
||||
if ( nType == SRF_TRIMESH) {
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pSurf) ;
|
||||
if ( pStm != nullptr && pStm->IsValid() && pStm->GetTriangleCount() > 0)
|
||||
vpStm.emplace_back( pStm) ;
|
||||
}
|
||||
// se Bezier
|
||||
else if ( nType == SRF_BEZIER) {
|
||||
const ISurfBezier* pSBz = GetSurfBezier( pSurf) ;
|
||||
if ( pSBz != nullptr && pSBz->IsValid()) {
|
||||
double dOldTol = GetSurfBezierAuxSurfRefinedTol() ;
|
||||
SetSurfBezierAuxSurfRefinedTol( 5. * EPS_SMALL) ;
|
||||
const ISurfTriMesh* pStm = pSBz->GetAuxSurfRefined() ;
|
||||
SetSurfBezierAuxSurfRefinedTol( dOldTol) ;
|
||||
if ( pStm != nullptr && pStm->IsValid() && pStm->GetTriangleCount() > 0)
|
||||
vpStm.emplace_back( pStm) ;
|
||||
}
|
||||
}
|
||||
#if ENABLE_DEBUG_STM_NORMAL_SHADER
|
||||
DrawNormalShaderSurfTm( vpStm.back(), ToString( i)) ;
|
||||
#endif
|
||||
@@ -1532,12 +1557,32 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
vSurfL_supp.reserve( vSurfSuppId.size()) ;
|
||||
vpStm.reserve( vSurfSuppId.size()) ;
|
||||
for ( int i = 0 ; i < int( vSurfSuppId.size()) ; ++ i) {
|
||||
// superfici ammesse : TriMesh, Bezier
|
||||
vSurfL_supp.emplace_back( m_pGeomDB, vSurfSuppId[i], GLOB_FRM) ;
|
||||
if ( vSurfL_supp[i].Get() == nullptr)
|
||||
return false ;
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( vSurfL_supp[i].Get()) ;
|
||||
if ( pStm != nullptr && pStm->IsValid() && pStm->GetTriangleCount() > 0)
|
||||
vpStm_supp.emplace_back( pStm) ;
|
||||
const ISurf* pSurf = GetSurf( vSurfL[i].Get()) ;
|
||||
if ( pSurf != nullptr && pSurf->IsValid()) {
|
||||
int nType = pSurf->GetType() ;
|
||||
// se TriMesh
|
||||
if ( nType == SRF_TRIMESH) {
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pSurf) ;
|
||||
if ( pStm != nullptr && pStm->IsValid() && pStm->GetTriangleCount() > 0)
|
||||
vpStm_supp.emplace_back( pStm) ;
|
||||
}
|
||||
// se Bezier
|
||||
else if ( nType == SRF_BEZIER) {
|
||||
const ISurfBezier* pSBz = GetSurfBezier( pSurf) ;
|
||||
if ( pSBz != nullptr && pSBz->IsValid()) {
|
||||
double dOldTol = GetSurfBezierAuxSurfRefinedTol() ;
|
||||
SetSurfBezierAuxSurfRefinedTol( 5. * EPS_SMALL) ;
|
||||
const ISurfTriMesh* pStm = pSBz->GetAuxSurfRefined() ;
|
||||
SetSurfBezierAuxSurfRefinedTol( dOldTol) ;
|
||||
if ( pStm != nullptr && pStm->IsValid() && pStm->GetTriangleCount() > 0)
|
||||
vpStm_supp.emplace_back( pStm) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( ! pCavParSilh_supp->SetData( vpStm_supp, frSfr, SILH_TOL))
|
||||
return false ;
|
||||
@@ -2327,7 +2372,7 @@ SurfRoughing::GetActiveSurfaces( INTVECTOR& vSurfId, INTVECTOR& vSurfSuppId) con
|
||||
{
|
||||
// NB.
|
||||
// - vSrufInd contiene gli Id delle superfici selezionate ( nel caso non ci siano superfici
|
||||
// seleionate, allora vengono considerate tutte le superfici presenti nei grezzi attivi della fase
|
||||
// selezionate, allora vengono considerate tutte le superfici presenti nei grezzi attivi della fase)
|
||||
// - vSurfSupp contiene gli Id delle superfici di supporto, quindi quelle superici da cui si vuole
|
||||
// mantenere una certa distanza con l'utensile ( senza che siano selezionate)
|
||||
|
||||
@@ -2337,10 +2382,11 @@ SurfRoughing::GetActiveSurfaces( INTVECTOR& vSurfId, INTVECTOR& vSurfSuppId) con
|
||||
// verifiche
|
||||
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// cerco tra gli oggetti selezionati
|
||||
// cerco tra gli oggetti selezionati ( superfici TriMesh o Bezier)
|
||||
for ( const auto& Id : m_vId) {
|
||||
int nEntId = Id.nId ;
|
||||
if ( m_pGeomDB->GetGeoType( nEntId) == SRF_TRIMESH)
|
||||
int nType = m_pGeomDB->GetGeoType( nEntId) ;
|
||||
if ( nType == SRF_TRIMESH || nType == SRF_BEZIER)
|
||||
vSurfId.emplace_back( nEntId) ;
|
||||
}
|
||||
// controllo se sono state trovate delle superfici
|
||||
@@ -2360,7 +2406,8 @@ SurfRoughing::GetActiveSurfaces( INTVECTOR& vSurfId, INTVECTOR& vSurfSuppId) con
|
||||
while ( nEntId != GDB_ID_NULL) {
|
||||
// se entità superficie e visibile, la aggiungo
|
||||
int nStat ;
|
||||
if ( m_pGeomDB->GetGeoType( nEntId) == SRF_TRIMESH &&
|
||||
if ( ( m_pGeomDB->GetGeoType( nEntId) == SRF_TRIMESH ||
|
||||
m_pGeomDB->GetGeoType( nEntId) == SRF_BEZIER) &&
|
||||
m_pGeomDB->GetCalcStatus( nEntId, nStat) && nStat != GDB_ST_OFF) {
|
||||
// se non sono state selezionate superfici precedentemente, memorizzo tale id
|
||||
if ( bNoSurfId)
|
||||
|
||||
Reference in New Issue
Block a user