BugFix/FreeContourBladeUpsideDownAdjFace:
- Aggiunto l'accorciamento della lama in caso di facce vicine orientate verso il basso - in Lapjoint piccola modifica al modo di oridinare le facce
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
-- 2022/08/05 Aggiunta segnalazione aree vietate non gestite.
|
||||
-- 2022/08/29 Corretta gestione tipo Pocket senza fondo (sono lavorabili da entrambe le parti con fresatura).
|
||||
-- 2022/12/13 Aggiunta la funzione Is3EdgesApprox per riconoscere come 3 lati anche facce con lati aggiuntivi molto corti (<15 mm)
|
||||
-- 2022/12/14 Aggiunto l'accorciamento della lama in caso di facce vicine orientate verso il basso
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local WPF = {}
|
||||
@@ -1281,13 +1282,19 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
|
||||
dMaxDepth = EgtIf( WD.MILL_MAX_DEPTH_AS_MAT, EgtTdbGetCurrToolParam( MCH_TP.MAXMAT), dFreeLen) or dMaxDepth
|
||||
end
|
||||
end
|
||||
-- verifico se la facce hanno alcuni lati molto corti e possono quindi essere approssimate a 3 lati
|
||||
for currentFace = 1, #vFace do
|
||||
if Is3EdgesApprox( Proc, vFace[currentFace].Fac, nAddGrpId) then
|
||||
vFace[currentFace].Is3EdgesApprox = true
|
||||
end
|
||||
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)
|
||||
if bClosed and ( ( vFace[#vFace].Type == 4 and vFace[#vFace].Edges > 3) or ( vFace[#vFace].Type & 2) ~= 0) then
|
||||
while i <= #vFace and vFace[i].Type == 4 and vFace[i].Edges > 3 and abs( vFace[i].SideAng) < 0.1 do
|
||||
if bClosed and ( ( vFace[#vFace].Type == 4 and ( vFace[#vFace].Edges > 3 and not vFace[#vFace].Is3EdgesApprox)) or ( vFace[#vFace].Type & 2) ~= 0) then
|
||||
while i <= #vFace and vFace[i].Type == 4 and ( vFace[i].Edges > 3 and not vFace[i].Is3EdgesApprox) and abs( vFace[i].SideAng) < 0.1 do
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
@@ -1350,6 +1357,10 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
|
||||
end
|
||||
end
|
||||
local dEal = vFace[i].Whisk - vFace[i].Len
|
||||
-- se faccia precedente inclinata verso il basso prolungo il finale per adeguarmi all percorso della lama
|
||||
if j and vFace[j].Norm:getZ() < -0.017 then
|
||||
dEal = dEal - vFace[j].Width * vFace[j].Norm:getZ()
|
||||
end
|
||||
-- se angolo interno prima e faccia precedente inclinata verso l'alto oltre 16.1deg
|
||||
if vFace[i].PrevAng < -30 and j and vFace[j].Norm:getZ() < 0.96078 and vFace[j].Norm:getZ() > 0 then
|
||||
dEal = dEal + vFace[j].Width * vFace[j].Norm:getZ()
|
||||
@@ -1386,10 +1397,8 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
|
||||
return 0, sErr
|
||||
end
|
||||
end
|
||||
-- verifico se la faccia ha alcuni lati molto corti e può essere approssimata ad una 3 lati
|
||||
local bIs3EdgesApprox = Is3EdgesApprox( Proc, vFace[i].Fac, nAddGrpId)
|
||||
-- se tutta la faccia o la sua fine senza taglio, inserisco una fresatura
|
||||
if ( vFace[i].Type & 2) ~= 0 or ( vFace[i].Type == 4 and ( vFace[i].Edges > 3 and not bIs3EdgesApprox)) then
|
||||
if ( vFace[i].Type & 2) ~= 0 or ( vFace[i].Type == 4 and ( vFace[i].Edges > 3 and not vFace[i].Is3EdgesApprox)) then
|
||||
-- inserisco la lavorazione
|
||||
local sName = 'Free_' .. ( EgtGetName( Proc.PartId) or tostring( Proc.PartId))
|
||||
local nMchId = EgtAddMachining( sName, sMilling)
|
||||
@@ -1430,7 +1439,7 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
|
||||
local LastJ
|
||||
i = i + 1
|
||||
local j = EgtIf( i <= #vFace, i, EgtIf( bAllType4 or not bClosed, nil, 1))
|
||||
while j and ( ( vFace[j].Type & 1) ~= 0 or ( vFace[j].Type == 4 and vFace[j].Edges > 3)) and abs( vFace[j].SideAng) < 0.1 and abs( vFace[OrigI].SideAng) < 0.1 do
|
||||
while j and ( ( vFace[j].Type & 1) ~= 0 or ( vFace[j].Type == 4 and ( vFace[j].Edges > 3 and not vFace[j].Is3EdgesApprox))) and abs( vFace[j].SideAng) < 0.1 and abs( vFace[OrigI].SideAng) < 0.1 do
|
||||
table.insert( vGeom, { Proc.Id, vFace[j].Fac})
|
||||
LastJ = j
|
||||
dEal = EgtIf( ( vFace[j].Type & 1) ~= 0, vFace[j].Whisk - vFace[j].Len, 0)
|
||||
@@ -1441,13 +1450,13 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
|
||||
j = EgtIf( j + 1 <= #vFace, j + 1, EgtIf( bAllType4 or not bClosed, nil, 1))
|
||||
end
|
||||
-- se faccia singola è da fare tutta senza oltrepassare estremi
|
||||
if #vFace == 1 and vFace[OrigI].Type == 4 and vFace[OrigI].Edges > 3 then
|
||||
if #vFace == 1 and vFace[OrigI].Type == 4 and ( vFace[OrigI].Edges > 3 and not vFace[OrigI].Is3EdgesApprox) then
|
||||
dSal = -dMillDiam / 2
|
||||
dEal = -dMillDiam / 2
|
||||
-- altrimenti va verificato
|
||||
else
|
||||
-- se lavorazione completa su faccia iniziale
|
||||
if vFace[OrigI].Type == 4 and vFace[OrigI].Edges > 3 then
|
||||
if vFace[OrigI].Type == 4 and ( vFace[OrigI].Edges > 3 and not vFace[OrigI].Is3EdgesApprox) then
|
||||
-- se angolo interno prima
|
||||
if vFace[OrigI].PrevAng < -30 then
|
||||
local dSinA = -sin( vFace[OrigI].PlPrevAng + 90)
|
||||
@@ -1468,7 +1477,7 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
|
||||
-- se lavorazione completa o finale su faccia finale
|
||||
local LastFace = ( LastJ or OrigI)
|
||||
local OrigK = EgtIf( LastFace < #vFace, LastFace + 1, EgtIf( bClosed, 1, nil))
|
||||
if ( vFace[LastFace].Type == 4 and vFace[LastFace].Edges > 3) or ( LastFace == OrigI and ( vFace[LastFace].Type & 2) ~= 0) then
|
||||
if ( vFace[LastFace].Type == 4 and ( vFace[LastFace].Edges > 3 and not vFace[LastFace].Is3EdgesApprox)) or ( LastFace == OrigI and ( vFace[LastFace].Type & 2) ~= 0) then
|
||||
-- se angolo interno dopo
|
||||
if OrigK and vFace[OrigK].PrevAng < -30 then
|
||||
local dSinA = -sin( vFace[OrigK].PlPrevAng + 90)
|
||||
@@ -1730,7 +1739,7 @@ local function AddSawings( sSawing, vFace, Proc, nRawId, b3Raw)
|
||||
end
|
||||
end
|
||||
-- se fine faccia non tagliato completamente o faccia non tagliata completamente e abbastanza lunga, inserisco un ripasso con sega a catena
|
||||
if ( vFace[i].Type & 2) ~= 0 or ( vFace[i].Type == 4 and vFace[i].Edges > 3 and vFace[i].Len > dSawDiam + 1) then
|
||||
if ( vFace[i].Type & 2) ~= 0 or ( vFace[i].Type == 4 and ( vFace[i].Edges > 3 and not vFace[i].Is3EdgesApprox) and vFace[i].Len > dSawDiam + 1) then
|
||||
-- inserisco la lavorazione
|
||||
local sName = 'Free_' .. ( EgtGetName( Proc.PartId) or tostring( Proc.PartId))
|
||||
local nMchId = EgtAddMachining( sName, sSawing)
|
||||
@@ -1791,6 +1800,8 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function AddCuts( sCutting, vFace, Proc, nRawId, b3Raw, dSawThick)
|
||||
-- verifico se ciclo chiuso
|
||||
local bClosed = ( abs( vFace[1].PrevAng) > 0.1)
|
||||
-- ciclo di inserimento dei tagli sulle facce del contorno in esame
|
||||
for i = 1, #vFace do
|
||||
-- verifico se faccia da saltare, perchè macchina travi e faccia su bordo longitudinale esterno già finito
|
||||
@@ -1799,6 +1810,8 @@ local function AddCuts( sCutting, vFace, Proc, nRawId, b3Raw, dSawThick)
|
||||
if not bToSkip and vFace[i].Type ~= 4 then
|
||||
-- indice del successivo
|
||||
local j = EgtIf( i < #vFace, i + 1, 1)
|
||||
-- indice del precedente
|
||||
local h = EgtIf( i > 1, i - 1, EgtIf( bClosed, #vFace, nil))
|
||||
-- inserisco la lavorazione
|
||||
local sName = 'Cut_' .. ( EgtGetName( Proc.PartId) or tostring( Proc.PartId)) .. '_' .. tostring( i)
|
||||
local nMchId = EgtAddMachining( sName, sCutting)
|
||||
@@ -1842,7 +1855,14 @@ local function AddCuts( sCutting, vFace, Proc, nRawId, b3Raw, dSawThick)
|
||||
EgtSetMachiningParam( MCH_MP.LEADINTYPE, nLeadIn)
|
||||
local dSal = 0
|
||||
if ( not bInvert and vFace[i].PrevAng < -0.1) or ( bInvert and vFace[j].PrevAng < -0.1) then
|
||||
dSal = -WHISK_SAFE
|
||||
-- se faccia precedente inclinata verso il basso
|
||||
if not bInvert and h and vFace[h].Norm:getZ() < -0.017 then
|
||||
dSal = vFace[h].Width * vFace[h].Norm:getZ() - WHISK_SAFE
|
||||
elseif bInvert and j and vFace[j].Norm:getZ() < -0.017 then
|
||||
dSal = vFace[j].Width * vFace[j].Norm:getZ() - WHISK_SAFE
|
||||
else
|
||||
dSal = -WHISK_SAFE
|
||||
end
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
|
||||
-- assegno i dati di uscita (sicurezza solo se angolo interno)
|
||||
@@ -1853,7 +1873,14 @@ local function AddCuts( sCutting, vFace, Proc, nRawId, b3Raw, dSawThick)
|
||||
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, nLeadOut)
|
||||
local dEal = 0
|
||||
if ( not bInvert and vFace[j].PrevAng < -0.1) or ( bInvert and vFace[i].PrevAng < -0.1) then
|
||||
dEal = -WHISK_SAFE
|
||||
-- se faccia precedente inclinata verso il basso
|
||||
if not bInvert and j and vFace[j].Norm:getZ() < -0.017 then
|
||||
dEal = vFace[j].Width * vFace[j].Norm:getZ() - WHISK_SAFE
|
||||
elseif bInvert and h and vFace[h].Norm:getZ() < -0.017 then
|
||||
dEal = vFace[h].Width * vFace[h].Norm:getZ() - WHISK_SAFE
|
||||
else
|
||||
dEal = -WHISK_SAFE
|
||||
end
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal)
|
||||
-- posizione braccio porta testa
|
||||
|
||||
Reference in New Issue
Block a user