diff --git a/LuaLibs/WProcessFreeContour.lua b/LuaLibs/WProcessFreeContour.lua index d76ec37..95eb62d 100644 --- a/LuaLibs/WProcessFreeContour.lua +++ b/LuaLibs/WProcessFreeContour.lua @@ -488,7 +488,7 @@ local function GetFacesData( Proc, bOpposite, bCalclForBlade, dToolDiam, dToolMa end --------------------------------------------------------------------- -local function GetTunnelDimension( nId, nPartId, nAddGrpId) +local function GetTunnelDimension( nId, nPartId, nAddGrpId, bClosed) -- sono necessarie almeno 2 facce local nFacCnt = EgtSurfTmFacetCount( nId) if nFacCnt < 2 then return end @@ -502,7 +502,7 @@ local function GetTunnelDimension( nId, nPartId, nAddGrpId) end -- determino l'asse medio (le facce sono già ordinate consecutivamente) local vtAx = V_NULL() - for i = 1, nFacCnt do + for i = 1, EgtIf( bClosed, nFacCnt, nFacCnt - 1) do local j = i % nFacCnt + 1 local vtOrtho = vtN[i] ^ vtN[j] if vtOrtho:normalize() then @@ -608,7 +608,7 @@ local function MakeCustomPath( vGeom, nConeCut, dMillDiam, nAddGrpId, dThick, bC -- in base al tipo di ripresa spigolo modifico il percorso if nConeCut == 2 then -- acquisisco la lunghezza utensile - sMilling, dMaxDepth = WM.FindMilling( 'CleanCorner30') + local sMilling = WM.FindMilling( 'CleanCorner30') if not sMilling then local sErr = 'Error : CleanCorner 30 not found in library' return 0, sErr @@ -641,7 +641,7 @@ local function MakeCustomPath( vGeom, nConeCut, dMillDiam, nAddGrpId, dThick, bC vtExtrExit:normalize() -- linea intermedia (componente lunghezza utensile in direzione bisettrice) local pEnd = ptP1 + ( dLenAdd * vtExtrExit) - nAuxId = EgtLine( nAddGrpId, ptP1, pEnd, GDB_RT.GLOB) + local nAuxId = EgtLine( nAddGrpId, ptP1, pEnd, GDB_RT.GLOB) table.insert( nPath, nAuxId) -- linea di ritorno nAuxId = EgtLine( nAddGrpId, pEnd, ptP1, GDB_RT.GLOB) @@ -670,7 +670,7 @@ local function MakeCustomPath( vGeom, nConeCut, dMillDiam, nAddGrpId, dThick, bC local dLenAdd = abs( (dMillDiam/2) / cos( nPathData[i][2]/2)) + dExtraCorner - (dMillDiam/2) -- linea intermedia (componente lunghezza utensile in direzione bisettrice) local pEnd = ptP1 + ( dLenAdd * vtExtrExit) - nAuxId = EgtLine( nAddGrpId, ptP1, pEnd, GDB_RT.GLOB) + local nAuxId = EgtLine( nAddGrpId, ptP1, pEnd, GDB_RT.GLOB) table.insert( nPath, nAuxId) -- linea di ritorno nAuxId = EgtLine( nAddGrpId, pEnd, ptP1, GDB_RT.GLOB) @@ -757,7 +757,7 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp -- riordino le facce ReorderFacesFromTab( nNewProcLoc, vFace) -- acquisisco il numero della faccia - nFacCnt = EgtSurfTmFacetCount( nNewProcLoc) + local nFacCnt = EgtSurfTmFacetCount( nNewProcLoc) nFacInd = nFacCnt - 1 else return true, '' @@ -1025,6 +1025,8 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw, dMillTotDiam = dMillDiam + ( abs( dThickTool) * tan( dSideAng)) * 2 end end + -- verifico se ciclo chiuso + local bClosed = ( abs( vFace[1].PrevAng) > 0.1) -- copio la feature nel layer di appoggio local nNewProc if nMasterNewProc then @@ -1037,7 +1039,7 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw, local bMakeLocSurf if nFacCnt <= 4 then -- recupero profondità e faccia di fondo - _, _, dDepth, _, _, nSurfInt = GetTunnelDimension( nNewProc, Proc.PartId, nAddGrpId) + _, _, dDepth, _, _, nSurfInt = GetTunnelDimension( nNewProc, Proc.PartId, nAddGrpId, bClosed) if nSurfInt then -- aggiungo la faccia di fondo appena calcolata nNewProc = EgtSurfTmBySewing( nAddGrpId, { nNewProc, nSurfInt}, true) @@ -1052,8 +1054,6 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw, else bMakeLocSurf = true end - -- verifico se ciclo chiuso - local bClosed = ( abs( vFace[1].PrevAng) > 0.1) -- ciclo di inserimento delle fresate sulle facce del contorno in esame local i = 1 -- se faccia finale con fine non lavorato, forzo partenza da prima faccia non tutta saltata (tipo 4) @@ -2339,7 +2339,7 @@ local function MakeByPocket( Proc, nRawId, b3Raw) return MakeByMill( Proc, nRawId, b3Raw) end -- se la faccia di fondo ha confini aperti, devo lavorarla direttamente - vAdj = EgtSurfTmFacetAdjacencies( Proc.Id, nFacet)[1] or {} + local vAdj = EgtSurfTmFacetAdjacencies( Proc.Id, nFacet)[1] or {} for i = 1, #vAdj do if vAdj[i] == - 1 then bPocketBotface = true