|
|
|
@@ -79,6 +79,14 @@ function OnSimulStart()
|
|
|
|
|
for j = 1, #( vTools or {}) do
|
|
|
|
|
if vTools[j] ~= '' then
|
|
|
|
|
EgtLoadTool( vTcPos[i], j, vTools[j])
|
|
|
|
|
-- Aggiunto controllo lunghezza lama minima * 0.9 per ricavare la tolleranza del VMILL
|
|
|
|
|
if EgtTdbSetCurrTool(vTools[j]) then -- set utensile corrente
|
|
|
|
|
if EgtTdbGetCurrToolParam( MCH_TP.TYPE) == MCH_TY.SAW_STD or EgtTdbGetCurrToolParam( MCH_TP.TYPE) == MCH_TY.SAW_FLAT then -- controllo tipo utensile sega
|
|
|
|
|
local dCurrSawLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) * 0.9
|
|
|
|
|
-- se non definito o minore del valore precedente aggiorna la tolleranza
|
|
|
|
|
EMT.VMILLTOL = EgtIf( not EMT.VMILLTOL or dCurrSawLen < EMT.VMILLTOL, dCurrSawLen, EMT.VMILLTOL)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
ShowToolInTcPos( vTcPos[i], true)
|
|
|
|
@@ -249,7 +257,7 @@ function OnSimulDispositionStart()
|
|
|
|
|
-- determino la risoluzione dello Zmap
|
|
|
|
|
local dTol = 4.71
|
|
|
|
|
if EmtGetVMillStep then
|
|
|
|
|
dTol = EmtGetVMillStep( b3Raw:getDimX(), b3Raw:getDimY(), b3Raw:getDimZ(), 4.71)
|
|
|
|
|
dTol = EmtGetVMillStep( b3Raw:getDimX(), b3Raw:getDimY(), b3Raw:getDimZ(), dTol)
|
|
|
|
|
else
|
|
|
|
|
local dArea = b3Raw:getDimX() * b3Raw:getDimY() + b3Raw:getDimX() * b3Raw:getDimZ() + b3Raw:getDimY() * b3Raw:getDimZ()
|
|
|
|
|
if dArea < 0.075e6 then
|
|
|
|
@@ -266,6 +274,7 @@ function OnSimulDispositionStart()
|
|
|
|
|
dTol = 3.77
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
dTol = min( dTol, EMT.VMILLTOL or dTol) -- imposto dTol al valore minore tra quello per volume e quello per spessore lama
|
|
|
|
|
-- creo lo Zmap
|
|
|
|
|
local VMillId = EgtVolZmapBox( nPartRawId, b3Raw:getMin(), b3Raw:getDimX(), b3Raw:getDimY(), b3Raw:getDimZ(), dTol, true, GDB_RT.GLOB)
|
|
|
|
|
if VMillId then
|
|
|
|
@@ -1373,7 +1382,7 @@ function OnSimulMoveEnd()
|
|
|
|
|
-- ricavo prossimo utensile
|
|
|
|
|
local sNextTool = GetNextTool( EMT.MCHID)
|
|
|
|
|
-- vado in home se è ultimo movimento ed è ultima lavorazione
|
|
|
|
|
local bToXhome = ( IsLastPath( EMT.PATHID) and not sNextTool and nHSet == 3) or ( nHSet == 1 and EMT.TTOTLEN > LongTool)
|
|
|
|
|
local bToXhome = ( IsLastPath( EMT.PATHID) and not sNextTool and nHSet == 3) or EMT.HEAD == 'H38' or ( nHSet == 1 and EMT.TTOTLEN > LongTool)
|
|
|
|
|
-- eseguo
|
|
|
|
|
ExecMoveZmax( EMT.MCHSPLIT, bToXhome)
|
|
|
|
|
EMT.TO_ZMAX = nil
|
|
|
|
@@ -1770,23 +1779,25 @@ function CheckClamping( sClampName)
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function GetCurveListFromIntersection( sPosIntersPlane, sIntersPlane, vtOffset)
|
|
|
|
|
local function GetCurveListFromIntersection( sPosIntersPlane, sIntersPlane, dDepth)
|
|
|
|
|
local idCurveList = {}
|
|
|
|
|
local vtIntersPlane
|
|
|
|
|
-- piano di interpolazione
|
|
|
|
|
if sIntersPlane == 'Y' then
|
|
|
|
|
if sIntersPlane == 'X' then
|
|
|
|
|
vtIntersPlane = X_AX()
|
|
|
|
|
elseif sIntersPlane == 'Y' then
|
|
|
|
|
vtIntersPlane = Y_AX()
|
|
|
|
|
elseif sIntersPlane == 'Z' then
|
|
|
|
|
vtIntersPlane = Z_AX()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
for i = 1, #EMT.VMILL do
|
|
|
|
|
local b3VMill = EgtGetBBoxGlob( EMT.VMILL[i], GDB_BB.STANDARD)
|
|
|
|
|
local b3VMill = EgtGetBBoxGlob( EMT.VMILL[i], GDB_BB.EXACT)
|
|
|
|
|
local ptPosIntersPlane
|
|
|
|
|
if sPosIntersPlane == 'MIN' then
|
|
|
|
|
ptPosIntersPlane = b3VMill:getMin() + vtOffset
|
|
|
|
|
ptPosIntersPlane = b3VMill:getMin() + dDepth * vtIntersPlane
|
|
|
|
|
elseif sPosIntersPlane == 'MAX' then
|
|
|
|
|
ptPosIntersPlane = b3VMill:getMax() + vtOffset
|
|
|
|
|
ptPosIntersPlane = b3VMill:getMax() - dDepth * vtIntersPlane
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local idLoop, nLoopCnt = EgtPlaneVolZmapInters( ptPosIntersPlane, vtIntersPlane, EMT.VMILL[i], CLAMP_CHECK_INTERS, GDB_RT.GLOB)
|
|
|
|
@@ -1801,31 +1812,36 @@ function CheckClamping( sClampName)
|
|
|
|
|
return idCurveList
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function CalculateIntersectionArea( sPosIntersPlane, sIntersPlane, vtOffset)
|
|
|
|
|
local function CalculateIntersectionArea( sPosIntersPlane, sIntersPlane, dDepth)
|
|
|
|
|
-- test piano frontale
|
|
|
|
|
local idCurveList = GetCurveListFromIntersection( sPosIntersPlane, sIntersPlane, vtOffset)
|
|
|
|
|
local idCurveList = GetCurveListFromIntersection( sPosIntersPlane, sIntersPlane, dDepth)
|
|
|
|
|
|
|
|
|
|
-- si copia curva intersezione e curva pinza in gruppo di confronto
|
|
|
|
|
local idFlatSurf, nFlatSurfCnt = EgtSurfFlatRegion( CLAMP_CHECK_GROUP, idCurveList)
|
|
|
|
|
local idClampSurf = EgtSurfFlatRegion( CLAMP_CHECK_GROUP, idClampPath)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if idFlatSurf then
|
|
|
|
|
local dTotalArea = 0
|
|
|
|
|
local dTotalXLenght = 0
|
|
|
|
|
for k = 1, nFlatSurfCnt do
|
|
|
|
|
local idTempSurf = idFlatSurf + k - 1
|
|
|
|
|
EgtSurfFrIntersect( idTempSurf, idClampSurf)
|
|
|
|
|
if idTempSurf then
|
|
|
|
|
dTotalArea = dTotalArea + ceil( EgtSurfArea( idTempSurf) or 0)
|
|
|
|
|
local b3BoxIntersectionBox = EgtGetBBoxGlob( idTempSurf, GDB_BB.STANDARD)
|
|
|
|
|
if b3BoxIntersectionBox then
|
|
|
|
|
dTotalXLenght = dTotalXLenght + ceil( b3BoxIntersectionBox:getDimX()) -- somma lunghezze (x) delle aree pinzate
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return dTotalArea
|
|
|
|
|
return dTotalArea, dTotalXLenght
|
|
|
|
|
end
|
|
|
|
|
return 0
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- minima area considerata per un corretto pinzaggio
|
|
|
|
|
DistZClampToTable = DistZClampToTable or 0
|
|
|
|
|
local MinJoin = BD.GetMinJoin( EMT.SB, EMT.HB, EgtIf( EMT.SPLIT, EMT.LT, EMT.LB))
|
|
|
|
|
local MinJoin = BD.GetMinJoin( EMT.HB, EMT.SB, EgtIf( EMT.SPLIT, EMT.LT, EMT.LB))
|
|
|
|
|
local MinZClamping = min( b3ClampingArea:getDimZ() + DistZClampToTable, EMT.SB) - DistZClampToTable
|
|
|
|
|
-- si moltiplica per un coefficiente minimo sotto al quale si da l'errore di pinzaggio
|
|
|
|
|
ClampingCoeffMin = EgtClamp( ClampingCoeffMin, 0.01, 1)
|
|
|
|
@@ -1837,15 +1853,12 @@ function CheckClamping( sClampName)
|
|
|
|
|
local bWriteWarnMessage = false
|
|
|
|
|
local bWriteErrMessage = false
|
|
|
|
|
-- controllo faccia frontale
|
|
|
|
|
local dArea = CalculateIntersectionArea( 'MIN', 'Y', Vector3d( 0, 1, 0))
|
|
|
|
|
local dArea, dXClampedLenght = CalculateIntersectionArea( 'MIN', 'Y', 3)
|
|
|
|
|
-- ERRORE: pinza troppo poco (meno di 1/3 del minimo richiesto)
|
|
|
|
|
if dArea and dArea < dMinClampingAreaErr then
|
|
|
|
|
-- solo se pinza almeno 1cm2, si prova un altro slice 5mm più all'interno, se aumenta al doppio non c'è errore (probabilmente siamo in presenza di un displuvio)
|
|
|
|
|
if dArea > 1000 then
|
|
|
|
|
local dNewArea = CalculateIntersectionArea( 'MIN', 'Y', Vector3d( 0, 5, 0))
|
|
|
|
|
if dNewArea > dArea * 2 then
|
|
|
|
|
bError = false
|
|
|
|
|
end
|
|
|
|
|
-- solo se pinza almeno 1cm2, e la somma della lunghezza pinzata è maggiore della lunghezza minima pinzabile da Warning e non errore
|
|
|
|
|
if dXClampedLenght >= MinJoin * ClampingCoeffMin and dArea > 1000 then
|
|
|
|
|
bError = false
|
|
|
|
|
end
|
|
|
|
|
-- pinzaggio non fattibile, errore
|
|
|
|
|
if bError then
|
|
|
|
@@ -1864,16 +1877,13 @@ function CheckClamping( sClampName)
|
|
|
|
|
-- controllo altro lato solo se non sono già in errore
|
|
|
|
|
if not bWriteErrMessage then
|
|
|
|
|
-- controllo faccia posteriore
|
|
|
|
|
dArea = CalculateIntersectionArea( 'MAX', 'Y', Vector3d( 0, -1, 0))
|
|
|
|
|
dArea = CalculateIntersectionArea( 'MAX', 'Y', 3)
|
|
|
|
|
-- ERRORE: pinza troppo poco (meno di 1/3 del minimo richiesto)
|
|
|
|
|
if dArea and dArea < dMinClampingAreaErr then
|
|
|
|
|
-- solo se pinza almeno 1cm2, si prova un altro slice 5mm più all'interno, se aumenta al doppio non c'è errore (probabilmente siamo in presenza di un displuvio)
|
|
|
|
|
if dArea > 1000 then
|
|
|
|
|
local dNewArea = CalculateIntersectionArea( 'MAX', 'Y', Vector3d( 0, -5, 0))
|
|
|
|
|
if dNewArea > dArea * 2 then
|
|
|
|
|
bError = false
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- solo se pinza almeno 1cm2, e la somma della lunghezza pinzata è maggiore della lunghezza minima pinzabile da Warning e non errore
|
|
|
|
|
if dXClampedLenght >= MinJoin * ClampingCoeffMin and dArea > 1000 then
|
|
|
|
|
bError = false
|
|
|
|
|
end
|
|
|
|
|
-- pinzaggio non fattibile, errore
|
|
|
|
|
if bError then
|
|
|
|
|
sErr = 'ERROR CLAMPING ' .. sClampName .. ' : '..tostring( ceil( ( dArea / dMinClampingAreaWarn) * 100))..'% ( '.. tostring( dArea/1000)..'cm2)'
|
|
|
|
|