From a859e727071a39a9fab4a3eeec580842a39e2b39 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Tue, 19 Sep 2023 18:29:58 +0200 Subject: [PATCH] -in FreeContour piccola correzione a alle corner milling --- LuaLibs/WProcessFreeContour.lua | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/LuaLibs/WProcessFreeContour.lua b/LuaLibs/WProcessFreeContour.lua index c8f9e7b..cc83e7e 100644 --- a/LuaLibs/WProcessFreeContour.lua +++ b/LuaLibs/WProcessFreeContour.lua @@ -545,7 +545,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 @@ -559,7 +559,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 @@ -665,7 +665,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 @@ -698,7 +698,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) @@ -727,7 +727,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) @@ -814,7 +814,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, '' @@ -1082,6 +1082,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 @@ -1094,7 +1096,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) @@ -1109,8 +1111,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) @@ -2412,7 +2412,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