diff --git a/EXE_GdbCreateSurf.cpp b/EXE_GdbCreateSurf.cpp index 117f1b4..9d5720f 100644 --- a/EXE_GdbCreateSurf.cpp +++ b/EXE_GdbCreateSurf.cpp @@ -3096,7 +3096,7 @@ ExeCreateSurfExtensionFromMany( int nParentId, const INTVECTOR& vSurfId, double if ( pnCount != nullptr) ++ *pnCount ; } - if ( bDrawOffEdge && pOffEdge->IsValid()) { + if ( bDrawOffEdge && pOffEdge != nullptr && pOffEdge->IsValid()) { int nEdgeId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pOffEdge) ; if ( nEdgeId != GDB_ID_NULL) { if ( pnCount != nullptr) diff --git a/EXE_Trimming.cpp b/EXE_Trimming.cpp index 7688b52..4bf8442 100644 --- a/EXE_Trimming.cpp +++ b/EXE_Trimming.cpp @@ -649,7 +649,7 @@ ExeTrimmingGetRuledBezier( int nParentId, const INTVECTOR& vIds, int nEdge1Id, i // --------------------------------------------------------------------------- bool ExeTrimmingInterpolateSyncLines( int nParentId, int nSync1Id, int nSync2Id, int nBorder1Id, - int nBorder2Id, double dEdgeLinTol, double dEdgeAngTol, + int nBorder2Id, double dEdgeLinTol, double dEdgeAngTol, bool bShorterSide, bool bEraseOrigLines, int& nFirstId, int& nCount) { // Verifica database geometrico @@ -678,9 +678,41 @@ ExeTrimmingInterpolateSyncLines( int nParentId, int nSync1Id, int nSync2Id, int // Calcolo le Curve di sincornizzazione Interpolate BIPNTVECTOR vSyncPoints ; + GuideBounds gbGuideBounds ; bOk = bOk && GetTrimmingSyncInterpolation( pCrvEdge1, pCrvEdge2, pSync1, pSync2, dMyEdgeLinTol, - dMyEdgeAngTol, vSyncPoints) ; + dMyEdgeAngTol, bShorterSide, vSyncPoints, gbGuideBounds) ; if ( bOk && ! vSyncPoints.empty()) { + if ( bEraseOrigLines) { + // scorro tutte le curve si sync giĆ  presenti e le elimino se entro i limiti della zona di interpolazione + int nSyncId = pGeomDB->GetFirstInGroup( nParentId) ; + while ( nSyncId != GDB_ID_NULL) { + double dS, dE ; + Point3d ptStart, ptEnd ; + ICurve* pSync = GetCurve( pGeomDB->GetGeoObj( nSyncId)) ; + pSync->GetStartPoint( ptStart) ; + pSync->GetEndPoint( ptEnd) ; + if ( ! pCrvEdge1->GetParamAtPoint( ptStart, dS, dMyEdgeLinTol)) { + pSync->Invert() ; + swap( ptStart, ptEnd) ; + if ( ! pCrvEdge1->GetParamAtPoint( ptStart, dS, dMyEdgeLinTol)) { + pSync->Invert() ; + bOk = false ; + break ; + } + } + if ( ! pCrvEdge2->GetParamAtPoint( ptEnd, dE, dMyEdgeLinTol)) { + bOk = false ; + break ; + } + int nCurrId = nSyncId ; + nSyncId = pGeomDB->GetNext( nSyncId) ; + if ( ( gbGuideBounds.bDirect && + (( dS > gbGuideBounds.dS1 && dS < gbGuideBounds.dE1) || ( dE > gbGuideBounds.dS2 && dE < gbGuideBounds.dE2))) || + ( ! gbGuideBounds.bDirect && + (( dS < gbGuideBounds.dS1 || dS > gbGuideBounds.dE1) || ( dE < gbGuideBounds.dS2 || dE > gbGuideBounds.dE2)))) + pGeomDB->Erase( nCurrId) ; + } + } // Inserisco le curve di sincronizzazione nel DB // [orientate da pCrvEdge1 a pCrvEdge2] for ( int i = 0 ; bOk && i < ssize( vSyncPoints) ; ++ i) { diff --git a/EgtExecutor.rc b/EgtExecutor.rc index 54ef07b..b1a85cd 100644 Binary files a/EgtExecutor.rc and b/EgtExecutor.rc differ diff --git a/Lua_Trimming.cpp b/Lua_Trimming.cpp index 31d13dd..e1af756 100644 --- a/Lua_Trimming.cpp +++ b/Lua_Trimming.cpp @@ -226,7 +226,7 @@ LuaTrimmingGetRuledBezier( lua_State* L) static int LuaTrimmingInterpolateSyncLines( lua_State* L) { - // 7 parametri : nParentId, nFirstSyncId, nSecondSyncId, nBorder1Id, nBorder2Id, dEdgeLinTol, dEdgeAngTol + // 9 parametri : nParentId, nFirstSyncId, nSecondSyncId, nBorder1Id, nBorder2Id, dEdgeLinTol, dEdgeAngTol, bShorterSide, bEraseOrigLines int nParentId ; LuaCheckParam( L, 1, nParentId) ; int nSync1Id ; @@ -241,12 +241,16 @@ LuaTrimmingInterpolateSyncLines( lua_State* L) LuaCheckParam( L, 6, dEdgeLinTol) ; double dEdgeAngTol ; LuaCheckParam( L, 7, dEdgeAngTol) ; + bool bShorterSide = true ; + LuaCheckParam( L, 8, bShorterSide) ; + bool bEraseOrigLines = true ; + LuaCheckParam( L, 9, bEraseOrigLines) ; LuaClearStack( L) ; // Interpolo le curve di sincronizzazione int nFirstId = GDB_ID_NULL ; int nCount = 0 ; bool bOk = ExeTrimmingInterpolateSyncLines( nParentId, nSync1Id, nSync2Id, nBorder1Id, - nBorder2Id, dEdgeLinTol, dEdgeAngTol, nFirstId, nCount) ; + nBorder2Id, dEdgeLinTol, dEdgeAngTol, bShorterSide, bEraseOrigLines, nFirstId, nCount) ; LuaSetParam( L, bOk) ; LuaSetParam( L, nFirstId) ; LuaSetParam( L, nCount) ;