EgtExecutor :
- piccole correzioni e migliorie a trimming.
This commit is contained in:
+27
-11
@@ -974,7 +974,7 @@ ExeTrimmingGetToolOrientationLines( int nParentId, int nMainEdgeId, int nOtherEd
|
||||
// Recupero gli Estremi
|
||||
Point3d ptStart ; pLine->GetStartPoint( ptStart) ;
|
||||
Point3d ptEnd ; pLine->GetEndPoint( ptEnd) ;
|
||||
// Mi assicuro che gli estremi siano sulle curve di Bordo e orientati correttamente ( nel caso inverto)
|
||||
// Mi assicuro che gli estremi siano sulle curve di Bordo ( in un verso o nell'altro, mantengo il verso)
|
||||
double dDistS1 = INFINITO ;
|
||||
if ( ! DistPointCurve( ptStart, *pCrvMainEdge).GetDist( dDistS1)) {
|
||||
nLineId = pGeomDB->GetNext( nLineId) ;
|
||||
@@ -989,16 +989,15 @@ ExeTrimmingGetToolOrientationLines( int nParentId, int nMainEdgeId, int nOtherEd
|
||||
}
|
||||
else {
|
||||
double dDistS2 = INFINITO ;
|
||||
if ( ! DistPointCurve( ptStart, *pCrvMainEdge).GetDist( dDistS2) || dDistS2 > dLinTol) {
|
||||
if ( ! DistPointCurve( ptStart, *pCrvOtherEdge).GetDist( dDistS2) || dDistS2 > dLinTol) {
|
||||
nLineId = pGeomDB->GetNext( nLineId) ;
|
||||
continue ;
|
||||
}
|
||||
double dDistE1 = INFINITO ;
|
||||
if ( ! DistPointCurve( ptEnd, *pCrvOtherEdge).GetDist( dDistE1) || dDistE1 > dLinTol) {
|
||||
if ( ! DistPointCurve( ptEnd, *pCrvMainEdge).GetDist( dDistE1) || dDistE1 > dLinTol) {
|
||||
nLineId = pGeomDB->GetNext( nLineId) ;
|
||||
continue ;
|
||||
}
|
||||
swap( ptStart, ptEnd) ;
|
||||
}
|
||||
vSyncPoints.emplace_back( make_pair( ptStart, ptEnd)) ;
|
||||
}
|
||||
@@ -1242,7 +1241,7 @@ struct TrimmingInterval {
|
||||
typedef vector<TrimmingInterval> TRIMMINGINTERVALVECTOR ;
|
||||
// ---------------------------------------------------------------------------
|
||||
bool
|
||||
GetTrimmingInterval( const IGeomDB* pGeomDB, const ICurveComposite* pCompo, const Frame3d& frCompo, int nIdS, int nIdE, TrimmingInterval& TrimmingInt)
|
||||
GetTrimmingInterval( const IGeomDB* pGeomDB, const ICurveComposite* pCompo, const Frame3d& frCompo, int nIdS, int nIdE, bool bInvert, TrimmingInterval& TrimmingInt)
|
||||
{
|
||||
// Verifico validità dei parametri
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
@@ -1253,9 +1252,17 @@ GetTrimmingInterval( const IGeomDB* pGeomDB, const ICurveComposite* pCompo, cons
|
||||
const ICurve* pGeoCrvS = GetCurve( pGeomDB->GetGeoObj( nIdS)) ;
|
||||
const ICurve* pGeoCrvE = GetCurve( pGeomDB->GetGeoObj( nIdE)) ;
|
||||
if ( pGeoCrvS != nullptr && pGeoCrvE != nullptr && pGeoCrvS->IsValid() && pGeoCrvE->IsValid()) {
|
||||
// Recupero i punti base e i vettori direzioni ( sono ICurveLine*, ma le tratto come ICurve* generiche)
|
||||
Point3d ptS = P_INVALID ; pGeoCrvS->GetStartPoint( ptS) ; // Line1.ptStart
|
||||
Point3d ptE = P_INVALID ; pGeoCrvE->GetStartPoint( ptE) ; // Line2.ptStart
|
||||
// Recupero i punti base ches stanno sulla pCompo e i vettori direzioni ( sono ICurveLine*, ma le tratto come ICurve* generiche)
|
||||
Point3d ptS = P_INVALID ;
|
||||
Point3d ptE = P_INVALID ;
|
||||
if ( ! bInvert) {
|
||||
pGeoCrvS->GetStartPoint( ptS) ; // Line1.ptStart
|
||||
pGeoCrvE->GetStartPoint( ptE) ; // Line2.ptStart
|
||||
}
|
||||
else {
|
||||
pGeoCrvS->GetEndPoint( ptS) ;
|
||||
pGeoCrvE->GetEndPoint( ptE) ;
|
||||
}
|
||||
Vector3d vtS = V_INVALID ; pGeoCrvS->GetStartDir( vtS) ; // Line1.vtStart
|
||||
Vector3d vtE = V_INVALID ; pGeoCrvE->GetStartDir( vtE) ; // Line2.vtStart
|
||||
if ( ptS.IsValid() && ptE.IsValid() && vtS.IsValid() && vtE.IsValid()) {
|
||||
@@ -1313,25 +1320,34 @@ Exe5AxTrimmingModifyToolDir( int nCrvId, int nPathId, int nTrimLayId, const INTV
|
||||
Frame3d frCompo ;
|
||||
bOk = bOk && ( pGeomDB->GetGlobFrame( nCrvId, frCompo)) ;
|
||||
|
||||
bool bInvert = false ;
|
||||
if ( ssize( vnOrientingISId) > 0 && vnOrientingISId[0] != GDB_ID_NULL) {
|
||||
const ICurve* pGeoCrvS = GetCurve( pGeomDB->GetGeoObj( vnOrientingISId[0])) ;
|
||||
Point3d ptS ; pGeoCrvS->GetStartPoint( ptS) ;
|
||||
double dDist = 1 ;
|
||||
if ( DistPointCurve( ptS, *pCompoBorder).GetDist( dDist) && dDist > EPS_SMALL)
|
||||
bInvert = true ;
|
||||
}
|
||||
|
||||
// Recupero i versori di interpolazione e creo dei gruppi
|
||||
TRIMMINGINTERVALVECTOR vInterval ; vInterval.reserve( 3 * ssize( vnOrientingId)) ;
|
||||
for ( int i = 0 ; bOk && i < ssize( vnOrientingId) ; ++ i) {
|
||||
// Se presente Interpolazione iniziale
|
||||
if ( vnOrientingISId[i] != GDB_ID_NULL && vnOrientingSId[i] != GDB_ID_NULL) {
|
||||
TrimmingInterval myTrimInt ;
|
||||
if ( GetTrimmingInterval( pGeomDB, pCompoBorder, frCompo, vnOrientingISId[i], vnOrientingSId[i], myTrimInt))
|
||||
if ( GetTrimmingInterval( pGeomDB, pCompoBorder, frCompo, vnOrientingISId[i], vnOrientingSId[i], bInvert, myTrimInt))
|
||||
vInterval.emplace_back( myTrimInt) ;
|
||||
}
|
||||
// Interpolazione ( deve essere sempre presente, ma per scrupolo si controlla lo stesso)
|
||||
if ( vnOrientingSId[i] != GDB_ID_NULL && vnOrientingEId[i] != GDB_ID_NULL) {
|
||||
TrimmingInterval myTrimInt ;
|
||||
if ( GetTrimmingInterval( pGeomDB, pCompoBorder, frCompo, vnOrientingSId[i], vnOrientingEId[i], myTrimInt))
|
||||
if ( GetTrimmingInterval( pGeomDB, pCompoBorder, frCompo, vnOrientingSId[i], vnOrientingEId[i], bInvert, myTrimInt))
|
||||
vInterval.emplace_back( myTrimInt) ;
|
||||
}
|
||||
// Se presente Interpolazione finale
|
||||
if ( vnOrientingEId[i] != GDB_ID_NULL && vnOrientingIEId[i] != GDB_ID_NULL) {
|
||||
TrimmingInterval myTrimInt ;
|
||||
if ( GetTrimmingInterval( pGeomDB, pCompoBorder, frCompo, vnOrientingEId[i], vnOrientingIEId[i], myTrimInt))
|
||||
if ( GetTrimmingInterval( pGeomDB, pCompoBorder, frCompo, vnOrientingEId[i], vnOrientingIEId[i], bInvert, myTrimInt))
|
||||
vInterval.emplace_back( myTrimInt) ;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user