DataBeam :
- modifiche a gestione fori per punte in extracorsa da Y+.
This commit is contained in:
+81
-24
@@ -1,4 +1,4 @@
|
||||
-- ProcessDrill.lua by Egaltech s.r.l. 2020/12/02
|
||||
-- ProcessDrill.lua by Egaltech s.r.l. 2020/12/14
|
||||
-- Gestione calcolo forature per Travi
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
@@ -189,32 +189,30 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
|
||||
if Proc.Flg == -2 then bToInvert = true end
|
||||
-- profondità geometria foro
|
||||
local dDepth = dLen
|
||||
local dDepth2 = dLen
|
||||
if Proc.Flg == 2 or Proc.Flg == -2 then
|
||||
dDepth = dLen / 2 + BD.DRILL_OVERLAP
|
||||
end
|
||||
local dCheckDepth = dDepth
|
||||
local dCheckDepth2 = dDepth2
|
||||
local nErrorCode = 0
|
||||
-- se troppo inclinata sulla X o Y va troppo dietro o Z va in negativo o se il foro è splittato,
|
||||
-- annullo il valore della profondità nella ricerca utensile
|
||||
if abs(vtExtr:getX()) > 0.707 or vtExtr:getY() > 0.5 or vtExtr:getZ() < BD.DRILL_VZ_MIN or abs(Proc.Flg) == 2 then
|
||||
dCheckDepth = nil
|
||||
dCheckDepth2 = nil
|
||||
end
|
||||
-- primo gruppo di controlli con lunghezza utensile calcolata
|
||||
-- recupero la lavorazione
|
||||
local sDrilling, nType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, BD.DOWN_HEAD and Proc.Down)
|
||||
if not sDrilling then
|
||||
-- se non ho passato altezza di taglio utensile allora non è stato trovato utensile
|
||||
if not dCheckDepth then
|
||||
local sErr = 'Error : drilling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
-- altrimenti rifaccio la ricerca foratura senza passare altezza utensile
|
||||
else
|
||||
-- se ho passato altezza di taglio utensile allora rifaccio la ricerca senza passare altezza utensile
|
||||
if dCheckDepth then
|
||||
dCheckDepth = nil
|
||||
sDrilling, nType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, nil, BD.DOWN_HEAD and Proc.Down)
|
||||
if not sDrilling then
|
||||
local sErr = 'Error : drilling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
if not sDrilling then
|
||||
nErrorCode = 1
|
||||
end
|
||||
end
|
||||
-- se la lunghezza utensile massima supera il valore limite del BeamData e la componente Z supera i 10 gradi
|
||||
@@ -222,32 +220,91 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
|
||||
if dMaxToolLength > ( BD.MAX_TOOL_LEN_FOR_HOR_MACH or 300) and abs( vtExtr:getZ()) < ( BD.DRILL_VZ_MIN_LONG_TOOL or cos(10)) then
|
||||
-- se non ho passato altezza di taglio utensile allora la lunghezza utensile non è idonea per il taglio
|
||||
if not dCheckDepth then
|
||||
local sErr = 'Error : tool too long to machine with big angle from vertical'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
nErrorCode = 2
|
||||
-- rifaccio ricerca lavorazione senza specificare la profondità (dovrebbe trovare l'utensile più corto)
|
||||
else
|
||||
sDrilling, nType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam)
|
||||
if not sDrilling then
|
||||
local sErr = 'Error : drilling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
nErrorCode = 1
|
||||
end
|
||||
-- ultimo controllo sulla lunghezza utensile
|
||||
if dMaxToolLength > ( BD.MAX_TOOL_LEN_FOR_HOR_MACH or 300) and abs( vtExtr:getZ()) < ( BD.DRILL_VZ_MIN_LONG_TOOL or cos(10)) then
|
||||
local sErr = 'Error : tool too long to machine with big angle from vertical'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
nErrorCode = 2
|
||||
end
|
||||
end
|
||||
end
|
||||
-- secondo gruppo di controlli con lunghezza utensile calcolata
|
||||
-- recupero la lavorazione
|
||||
local sDrilling2, nType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2
|
||||
if dDepth2 > dDepth + BD.DRILL_OVERLAP then
|
||||
sDrilling2, nType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, dCheckDepth2, BD.DOWN_HEAD and Proc.Down)
|
||||
if not sDrilling2 then
|
||||
-- se ho passato altezza di taglio utensile allora rifaccio la ricerca senza passare altezza utensile
|
||||
if dCheckDepth2 then
|
||||
dCheckDepth2 = nil
|
||||
sDrilling2, nType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, nil, BD.DOWN_HEAD and Proc.Down)
|
||||
end
|
||||
if not sDrilling2 then
|
||||
nErrorCode = 1
|
||||
end
|
||||
end
|
||||
-- se la lunghezza utensile massima supera il valore limite del BeamData e la componente Z supera i 10 gradi
|
||||
-- allora ricerco un utensile senza lunghezza massima
|
||||
if dMaxToolLength2 > ( BD.MAX_TOOL_LEN_FOR_HOR_MACH or 300) and abs( vtExtr:getZ()) < ( BD.DRILL_VZ_MIN_LONG_TOOL or cos(10)) then
|
||||
-- se non ho passato altezza di taglio utensile allora la lunghezza utensile non è idonea per il taglio
|
||||
if not dCheckDepth2 then
|
||||
nErrorCode = 2
|
||||
-- rifaccio ricerca lavorazione senza specificare la profondità (dovrebbe trovare l'utensile più corto)
|
||||
else
|
||||
sDrilling2, nType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam)
|
||||
if not sDrilling2 then
|
||||
nErrorCode = 1
|
||||
end
|
||||
-- ultimo controllo sulla lunghezza utensile
|
||||
if dMaxToolLength2 > ( BD.MAX_TOOL_LEN_FOR_HOR_MACH or 300) and abs( vtExtr:getZ()) < ( BD.DRILL_VZ_MIN_LONG_TOOL or cos(10)) then
|
||||
nErrorCode = 2
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se esiste il parametro massima lunghezza per fori da dietro e il foro è passante e non è ancora stato invertito
|
||||
-- ed è orizzontale ed è orientato principalmente verso Y+ e non è la parte splittata e l'utensile supera una certa lunghezza
|
||||
-- lo inverto per premiare l'entrata davanti
|
||||
if BD.MAX_TOOL_LEN_BACK_HOR_MACH and bOpen and not bToInvert and vtExtr:getY() > 0.866 and abs(vtExtr:getX()) < 0.5 and abs(vtExtr:getZ()) < 0.5 and
|
||||
Proc.Flg == 1 and dMaxToolLength > ( BD.MAX_TOOL_LEN_BACK_HOR_MACH) then
|
||||
local bCommonCompare = BD.MAX_TOOL_LEN_BACK_HOR_MACH and bOpen and abs(vtExtr:getX()) < 0.5 and abs(vtExtr:getZ()) < 0.5
|
||||
if nErrorCode == 0 and not bToInvert and bCommonCompare and vtExtr:getY() > 0.866 and Proc.Flg == 1 and dMaxToolLength > BD.MAX_TOOL_LEN_BACK_HOR_MACH then
|
||||
bToInvert = true
|
||||
vtExtr = - vtExtr
|
||||
---------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
---------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- 14/12/2020 richiesta di Fabio Squaratti: con foro orizzontale passante e parametro Q02 = 0 (settato per fare in due parti),
|
||||
-- se punta più lunga del parametro BD.MAX_TOOL_LEN_BACK_HOR_MACH alloro ignoro la doppia foratura contrapposta e faccio foratura solo dal davanti
|
||||
-- Questo implica che il valore del parametro Q02 = 0 non è vincolante perchè basta che l'utensile supera il parametro allora la foratura si comporta
|
||||
-- come se il parametro Q02 sia = 1
|
||||
---------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
---------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
elseif nErrorCode == 0 and not bToInvert and bCommonCompare and abs(vtExtr:getY()) > 0.866 and Proc.Flg == 2 and dMaxToolLength2 > BD.MAX_TOOL_LEN_BACK_HOR_MACH then
|
||||
sDrilling = sDrilling2
|
||||
nType = nType2
|
||||
dMaxDepth = dMaxDepth2
|
||||
dDiamTh = dDiamTh2
|
||||
dToolFreeLen = dToolFreeLen2
|
||||
dDepth = dDepth2
|
||||
if vtExtr:getY() > 0 then
|
||||
bToInvert = true
|
||||
vtExtr = - vtExtr
|
||||
end
|
||||
-- se sono al secondo mezzo foro con utensile che supera la lunghezza di riferimento non lo eseguo
|
||||
elseif nErrorCode == 0 and bCommonCompare and abs(vtExtr:getY()) > 0.866 and Proc.Flg == -2 and dMaxToolLength2 > BD.MAX_TOOL_LEN_BACK_HOR_MACH then
|
||||
return true, ''
|
||||
end
|
||||
if nErrorCode == 1 then
|
||||
local sErr = 'Error : drilling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
elseif nErrorCode == 2 then
|
||||
local sErr = 'Error : tool too long to machine with big angle from vertical'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
local dSubL1 = 0
|
||||
local dSubL2 = 0
|
||||
|
||||
Reference in New Issue
Block a user