Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ee7087b003 | |||
| be993f47df | |||
| 2522967e95 | |||
| 40e049dbb5 | |||
| 270039d7e3 | |||
| 9241a53f97 | |||
| ff984c30b4 | |||
| 001fd45f0c | |||
| 24e73d886d |
+35
-40
@@ -467,7 +467,7 @@ function OnSimulDispositionStart()
|
||||
end
|
||||
nRawId = nNextRawId
|
||||
end
|
||||
EMT.LB = b3Bar:getDimX()
|
||||
EMT.LB = b3Bar:getDimX()
|
||||
end
|
||||
-- Indicazione angolo rotazione pezzo
|
||||
EMT.ROT = EgtGetInfo( EMT.DISPID, 'ROT', 'i') or 0
|
||||
@@ -1099,16 +1099,17 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function CheckClamping( sClampName)
|
||||
nIndexClamp = EgtGetAxisId( sClampName)
|
||||
local idClampPath = EgtGetFirstInGroup( EgtGetFirstNameInGroup( nIndexClamp, 'CLAMP_CHECK') or GDB_ID.NULL)
|
||||
local b3ClampingArea = EgtGetBBoxGlob( idClampPath or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
|
||||
local nClampId = EgtGetAxisId( sClampName) or GDB_ID.NULL
|
||||
local nClampPathId = EgtGetFirstInGroup( EgtGetFirstNameInGroup( nClampId, 'CLAMP_CHECK') or GDB_ID.NULL)
|
||||
local b3ClampingArea = EgtGetBBoxGlob( nClampPathId or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
-- se non trovo percorso area di clamping, esco subito
|
||||
if not idClampPath or not EMT.VMILL or not ClampingCoeffMin then
|
||||
if not nClampPathId or not EMT.VMILL or not ClampingCoeffMin then
|
||||
return
|
||||
end
|
||||
|
||||
local function GetCurveListFromIntersection( sPosIntersPlane, sIntersPlane, dDepth)
|
||||
local idCurveList = {}
|
||||
local vCurveListId = {}
|
||||
local vtIntersPlane
|
||||
-- piano di interpolazione
|
||||
if sIntersPlane == 'X' then
|
||||
@@ -1127,57 +1128,49 @@ function CheckClamping( sClampName)
|
||||
elseif sPosIntersPlane == 'MAX' then
|
||||
ptPosIntersPlane = b3VMill:getMax() - dDepth * vtIntersPlane
|
||||
end
|
||||
|
||||
local idLoop, nLoopCnt = EgtPlaneVolZmapInters( ptPosIntersPlane, vtIntersPlane, EMT.VMILL[i], CLAMP_CHECK_INTERS, GDB_RT.GLOB)
|
||||
-- se c'è almeno una curva
|
||||
if idLoop then
|
||||
for j = 1, nLoopCnt do
|
||||
local idLoopTemp = idLoop + j - 1
|
||||
table.insert( idCurveList, idLoopTemp)
|
||||
end
|
||||
end
|
||||
local nLoopId, nLoopCnt = EgtPlaneVolZmapInters( ptPosIntersPlane, vtIntersPlane, EMT.VMILL[i], CLAMP_CHECK_INTERS, GDB_RT.GLOB)
|
||||
vCurveListId = EgtTableAdd( vCurveListId, nLoopId, nLoopCnt)
|
||||
end
|
||||
return idCurveList
|
||||
|
||||
return vCurveListId
|
||||
end
|
||||
|
||||
local function CalculateIntersectionArea( sPosIntersPlane, sIntersPlane, dDepth)
|
||||
-- test piano frontale
|
||||
local idCurveList = GetCurveListFromIntersection( sPosIntersPlane, sIntersPlane, dDepth)
|
||||
|
||||
local vCurveListId = 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)
|
||||
local nFlatSurfId, nFlatSurfCnt = EgtSurfFlatRegion( CLAMP_CHECK_GROUP, vCurveListId)
|
||||
local vFlatSurfId = EgtTableFill( nFlatSurfId, nFlatSurfCnt) or {}
|
||||
local nClampSurfId = EgtSurfFlatRegion( CLAMP_CHECK_GROUP, nClampPathId)
|
||||
|
||||
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
|
||||
local dTotalArea = 0
|
||||
local dTotalXLenght = 0
|
||||
for i = 1, #vFlatSurfId do
|
||||
local nTempSurfId = vFlatSurfId[i]
|
||||
EgtSurfFrIntersect( nTempSurfId, nClampSurfId)
|
||||
if nTempSurfId then
|
||||
dTotalArea = dTotalArea + ceil( EgtSurfArea( nTempSurfId) or 0)
|
||||
local b3BoxIntersectionBox = EgtGetBBoxGlob( nTempSurfId, GDB_BB.STANDARD)
|
||||
if b3BoxIntersectionBox then
|
||||
dTotalXLenght = dTotalXLenght + ceil( b3BoxIntersectionBox:getDimX()) -- somma lunghezze (x) delle aree pinzate
|
||||
end
|
||||
end
|
||||
return dTotalArea, dTotalXLenght
|
||||
end
|
||||
return 0
|
||||
return dTotalArea, dTotalXLenght
|
||||
end
|
||||
|
||||
-- minima area considerata per un corretto pinzaggio
|
||||
DistZClampToTable = DistZClampToTable or 0
|
||||
local MinJoin = BD.GetMinJoin( EMT.ST, EMT.HT, EgtIf( EMT.SPLIT, EMT.LT, EMT.LB))
|
||||
--local MinJoin = BD.GetMinJoin( EMT.ST, EMT.HT, EgtIf( EMT.SPLIT, EMT.LT, EMT.LB))
|
||||
UpdateMinJoinDeltaTol( EMT.ST, EMT.HT, EgtIf( EMT.SPLIT, EMT.LT, EMT.LB))
|
||||
local MinZClamping = min( b3ClampingArea:getDimZ() + DistZClampToTable, EMT.HT) - DistZClampToTable
|
||||
local dMinClamping = ( MinJoin * MinZClamping)
|
||||
-- si moltiplica per un coefficiente minimo sotto al quale si da l'errore di pinzaggio
|
||||
ClampingCoeffMin = EgtClamp( ClampingCoeffMin, 0.01, 1)
|
||||
if MinZClamping > 116 then
|
||||
dMinClamping = MinJoin * 116 + ( math.pow( MinJoin, 2) / 2)
|
||||
dMinClamping = MinJoin * 116 + ( pow( MinJoin, 2) / 2)
|
||||
if MinJoin > 280 then
|
||||
dMinClamping = dMinClamping + ( math.pow( MinJoin - 280, 2))
|
||||
dMinClamping = MinJoin * 116 + ( pow( 280, 2) / 2) + ( pow( MinJoin - 280, 2))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1213,13 +1206,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', 3)
|
||||
dArea, dXClampedLenght = 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, 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
|
||||
bError = false
|
||||
end
|
||||
-- pinzaggio non fattibile, errore
|
||||
if bError then
|
||||
sErr = 'ERROR CLAMPING ' .. sClampName .. ' : '..tostring( ceil( ( dArea / dMinClampingAreaWarn) * 100))..'% ( '.. tostring( dArea/1000)..'cm2)'
|
||||
@@ -1248,6 +1241,7 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function ExecMovePY( bClose)
|
||||
--SimulMoveAxes( 'PY', EgtIf( not bClose, MaxHoOpen, EMT.HB), MCH_SIM_STEP.RAPID)
|
||||
local dPY = MaxOpen
|
||||
if bClose then
|
||||
dPY = EgtIf( EMT.ROT == -1, EMT.HT, EMT.ST)
|
||||
@@ -1261,6 +1255,7 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function ExecMovePV( bClose)
|
||||
--EgtIf( not bClose, MaxHoOpen, EMT.HB), MCH_SIM_STEP.RAPID)
|
||||
local dPV = MaxOpen
|
||||
if bClose then
|
||||
dPV = EgtIf( EMT.ROT == -1, EMT.HT, EMT.ST)
|
||||
|
||||
+2
-60
@@ -31,20 +31,9 @@ end
|
||||
|
||||
---------- OnSpecialApplyDisposition & OnPostApplyMachining ---------
|
||||
----------------------- Costanti ------------------------------------
|
||||
local DELTA_TOL_V = 110
|
||||
local DELTA_TOL_S = 210
|
||||
local DELTA_TOL_L = 410
|
||||
local DELTA_TOL_FIXED = 50
|
||||
local DeltaTol = DELTA_TOL_S
|
||||
local DELTA_SIC = 1
|
||||
local AGG_LOAD = 50
|
||||
local MIN_JOIN_VV = EgtClamp( MinJoinVV or 75, 60, 150)
|
||||
local MIN_JOIN_SS = EgtClamp( MinJoinSS or 100, 80, 275)
|
||||
local MIN_JOIN_LS = EgtClamp( MinJoinLS or 290, 250, 400)
|
||||
local MIN_JOIN_SL = EgtClamp( MinJoinSL or 100, 80, 400)
|
||||
local MIN_JOIN_LL = EgtClamp( MinJoinLL or 400, 300, 600)
|
||||
local MinJoin = MIN_JOIN_SS
|
||||
local MinOther = abs( MinY) + abs( MaxV) + MinJoin
|
||||
|
||||
----------------------- Variabili -----------------------------------
|
||||
local Test = false
|
||||
@@ -153,53 +142,6 @@ local function IsFirstMachiningAfterRotation( nMchId)
|
||||
return ( nRot ~= nPrevRot)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function UpdateMinJoinDeltaTol()
|
||||
local L_SMALL = 800
|
||||
local H_V = 90
|
||||
local H_S = 200
|
||||
local H_L = 400
|
||||
local W_V = 90
|
||||
local W_S = 150
|
||||
local W_L = 250
|
||||
if EMC.SB <= W_V and EMC.HB <= H_V then
|
||||
MinJoin = MIN_JOIN_VV
|
||||
DeltaTol = DELTA_TOL_V
|
||||
elseif EMC.LB <= L_SMALL then
|
||||
MinJoin = MIN_JOIN_SS
|
||||
DeltaTol = DELTA_TOL_S
|
||||
else
|
||||
local dMinJoinS
|
||||
local dMinJoinL
|
||||
if EMC.SB <= W_S then
|
||||
dMinJoinS = MIN_JOIN_SS
|
||||
dMinJoinL = MIN_JOIN_LS
|
||||
elseif EMC.SB <= W_L then
|
||||
local Coeff = ( EMC.SB - W_S) / ( W_L - W_S)
|
||||
dMinJoinS = ( 1 - Coeff) * MIN_JOIN_SS + Coeff * MIN_JOIN_SL
|
||||
dMinJoinL = ( 1 - Coeff) * MIN_JOIN_LS + Coeff * MIN_JOIN_LL
|
||||
else
|
||||
dMinJoinS = MIN_JOIN_SL
|
||||
dMinJoinL = MIN_JOIN_LL
|
||||
end
|
||||
if EMC.HB <= H_S then
|
||||
MinJoin = dMinJoinS
|
||||
DeltaTol = DELTA_TOL_S
|
||||
elseif EMC.HB <= H_L then
|
||||
local Coeff = ( EMC.HB - H_S) / ( H_L - H_S)
|
||||
MinJoin = ( 1 - Coeff) * dMinJoinS + Coeff * dMinJoinL
|
||||
DeltaTol = ( 1 - Coeff) * DELTA_TOL_S + Coeff * DELTA_TOL_L
|
||||
else
|
||||
MinJoin = dMinJoinL
|
||||
DeltaTol = DELTA_TOL_L
|
||||
end
|
||||
if EMC.SB < W_V then
|
||||
DeltaTol = DELTA_TOL_V
|
||||
end
|
||||
end
|
||||
MinOther = abs( MinY) + abs( MaxV) + MinJoin
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function GetCUTID()
|
||||
-- recupero CUTID del pezzo in lavoro
|
||||
@@ -367,7 +309,7 @@ function OnSpecialApplyDisposition()
|
||||
EMC.ZMIN = b3Raw:getMin():getZ()
|
||||
|
||||
-- Aggiorno limiti di presa e tolleranza
|
||||
UpdateMinJoinDeltaTol()
|
||||
UpdateMinJoinDeltaTol( EMC.SB, EMC.HB, EMC.LB)
|
||||
|
||||
-- Assegno sovramateriale di testa e ingombro tagli di testa e di coda
|
||||
EMC.HOVM = EgtGetInfo( nCurrRawId, 'HOVM', 'd') or 0
|
||||
@@ -656,7 +598,7 @@ function SpecApplyPath( bPreSplit, bSplitting, bPreCut, bCutting, bUnload, bPreR
|
||||
EMC.ZMIN = b3Raw:getMin():getZ()
|
||||
|
||||
-- Aggiorno limiti di presa e tolleranza
|
||||
UpdateMinJoinDeltaTol()
|
||||
UpdateMinJoinDeltaTol( EMC.SB, EMC.HB, EMC.LB)
|
||||
|
||||
-- Recupero sovramateriale di testa e ingombro tagli di testa e di coda
|
||||
EMC.HOVM = EgtGetInfo( nCurrRawId, 'HOVM', 'd') or 0
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
==== Common_FAST Update Log ====
|
||||
|
||||
Versione 3.1a1 (08/01/2026)
|
||||
- (SIM) Ottimizzata scrittura funzione ClampCheck post aggiornamento dll
|
||||
- (SIM) Corretto problema della funzione OnSimulDispositionStart in caso di fase finale.
|
||||
- (MLDE-SIM-GEN) Variabile DeltaTol deve essere spostata in MLDE
|
||||
|
||||
Versione 2.7l3 (22/12/2025)
|
||||
- (SIM) Eliminata MinJoin, utilizzata al suo posto funzione già esistente UpdateMinJoin nell'mlde
|
||||
- (SIM) Modificata formula calcolo Area minima
|
||||
|
||||
Versione 2.7l2 (18/12/2025)
|
||||
- (SIM) Aggiunta funzione CheckClamping
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
|
||||
local InfoCommon_STD_PP = {
|
||||
NAME = 'Common_FAST', -- nome script PP standard
|
||||
VERSION = '2.7l2', -- versione script
|
||||
VERSION = '3.1a1', -- versione script
|
||||
MIN_MACH_VER_PP_COMMON = '2.5k1' -- versione minima kernel
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user