diff --git a/LuaLibs/WProcessDrill.lua b/LuaLibs/WProcessDrill.lua index 4b165e0..044db3a 100644 --- a/LuaLibs/WProcessDrill.lua +++ b/LuaLibs/WProcessDrill.lua @@ -74,7 +74,7 @@ function WPD.Make( Proc, nRawId, b3Raw) local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0 if AuxId then AuxId = AuxId + Proc.Id end if not AuxId or EgtGetType( AuxId) ~= GDB_TY.CRV_ARC then - local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing drill geometry' + local sErr = 'Error : missing drill geometry' EgtOutLog( sErr) return false, sErr end @@ -86,16 +86,22 @@ function WPD.Make( Proc, nRawId, b3Raw) -- verifico che il foro non sia fattibile solo da sotto local bToInvert = ( vtExtr:getZ() < 0) if bToInvert and ( not bOpen or Proc.Flg ~= 1) then - local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' drilling from bottom impossible' + local sErr = 'Error : drilling from bottom impossible' EgtOutLog( sErr) return false, sErr end if Proc.Fcs == 0 then bToInvert = true end if bToInvert then vtExtr = - vtExtr end -- recupero la lavorazione - local sDrilling, nType = WM.FindDrilling( dDiam) + local sDrilling, nType + if dDiam < 200 then + sDrilling, nType = WM.FindDrilling( dDiam) + else + sDrilling = WM.FindMilling( 'FreeContour') + nType = 'Mill' + end if not sDrilling then - local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' drilling not found in library' + local sErr = 'Error : drilling not found in library' EgtOutLog( sErr) return false, sErr end @@ -140,6 +146,18 @@ function WPD.Make( Proc, nRawId, b3Raw) else EgtSetMachiningParam( MCH_MP.TOOLINVERT, bToInvert) end + -- se fresatura gestisco il lato di lavoro + if nType == 'Mill' then + local frRef = EgtGetGlobFrame( AuxId) + local vtNa, _, dArea = EgtCurveArea( AuxId) + vtNa:toGlob( frRef) + if vtNa:getZ() * dArea > 0 then + EgtSetMachiningParam( MCH_MP.INVERT, true) + else + EgtSetMachiningParam( MCH_MP.INVERT, false) + end + EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) + end -- imposto posizione braccio porta testa local nSCC = MCH_SCC.ADIR_YM if vtExtr:getY() > 100 * GEO.EPS_ZERO then @@ -155,8 +173,12 @@ function WPD.Make( Proc, nRawId, b3Raw) EgtOutLog( sMyWarn .. ' (process ' .. tostring( Proc.Id) .. ')') end EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) - -- Note utente con dichiarazione nessuna generazione sfridi per Vmill - local sUserNotes = 'VMRS=0;' + -- Note utente + local sUserNotes = '' + -- se foratura o svuotatura, dichiarazione nessuna generazione sfridi per Vmill + if nType == 'Drill' or nType == 'Pocket' then + sUserNotes = 'VMRS=0;' + end -- se foratura if nType == 'Drill' then -- aggiungo alle note massima elevazione (coincide con affondamento) diff --git a/LuaLibs/WProcessFreeContour.lua b/LuaLibs/WProcessFreeContour.lua index 0675508..d12606e 100644 --- a/LuaLibs/WProcessFreeContour.lua +++ b/LuaLibs/WProcessFreeContour.lua @@ -1,4 +1,4 @@ --- ProcessFreeContour.lua by Egaltech s.r.l. 2020/06/30 +-- ProcessFreeContour.lua by Egaltech s.r.l. 2020/07/01 -- Gestione calcolo profilo libero per Pareti -- Tabella per definizione modulo @@ -14,7 +14,7 @@ EgtOutLog( ' WProcessFreeContour started', 1) local WD = require( 'WallData') local WM = require( 'WMachiningLib') local WHISK_SAFE = 5 -local MIN_LEN_CUT = 1 +local MIN_LEN_CUT = 5 --------------------------------------------------------------------- -- Riconoscimento della feature @@ -85,6 +85,8 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw) while i <= #vFace and vFace[i].Type == 4 do i = i + 1 end + local bAllType4 = ( i > #vFace) + if bAllType4 then i = 1 end while i <= #vFace do -- se inizio faccia senza taglio e non è successiva di senza taglio, inserisco una fresatura local j @@ -142,15 +144,15 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw) local dSal = EgtIf( ( vFace[i].Type & 2) ~= 0, vFace[i].Whisk - vFace[i].Len, 0) local dEal = 0 i = i + 1 - local j = EgtIf( i <= #vFace, i, 1) - while ( vFace[j].Type & 1) ~= 0 or vFace[j].Type == 4 do + local j = EgtIf( i <= #vFace, i, EgtIf( bAllType4, nil, 1)) + while j and ( ( vFace[j].Type & 1) ~= 0 or vFace[j].Type == 4) do table.insert( vGeom, { Proc.Id, j - 1}) dEal = EgtIf( ( vFace[j].Type & 1) ~= 0, vFace[j].Whisk - vFace[j].Len, 0) if ( vFace[j].Type & 1) ~= 0 then break end i = i + 1 - j = EgtIf( i <= #vFace, i, 1) + j = EgtIf( j + 1 <= #vFace, j + 1, EgtIf( bAllType4, nil, 1)) end EgtSetMachiningGeometry( vGeom) EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal) diff --git a/LuaLibs/WProcessLapJoint.lua b/LuaLibs/WProcessLapJoint.lua index f641f21..15f1ac7 100644 --- a/LuaLibs/WProcessLapJoint.lua +++ b/LuaLibs/WProcessLapJoint.lua @@ -17,7 +17,9 @@ local WM = require( 'WMachiningLib') --------------------------------------------------------------------- -- Riconoscimento della feature function WPL.Identify( Proc) - return ( ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 30) + return ( ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 30) or + ( ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 32) or + ( ( Proc.Grp == 4) and Proc.Prc == 39) end --------------------------------------------------------------------- @@ -41,6 +43,7 @@ function WPL.Classify( Proc, b3Raw) -- se più di 2 facce else local nFacInd, dElev, nFacInd2, dElev2 = WL.GetFaceWithMostAdj( Proc.Id, Proc.PartId) + if nFacInd < 0 then return false end -- dati della faccia local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT) -- verifico se è lavorabile da sopra