DataWall :

- correzioni per verifica setup prima di simulazione
- aggiunto massimo affondamento di lama e fresa nella tavola
- in Gorge larghezza come gambo più sicurezza e impostata rotazione asse C
- nell'ordinamento si fanno le gole orizzontali (SideMill) prima di quelle inclinate
- migliorati controlli forature in nesting.
This commit is contained in:
DarioS
2022-02-03 21:28:04 +01:00
parent 3d0336e8e1
commit d97eb06293
5 changed files with 319 additions and 120 deletions
+115 -71
View File
@@ -1,4 +1,4 @@
-- WProcessLapJoint.lua by Egaltech s.r.l. 2022/01/17
-- WProcessLapJoint.lua by Egaltech s.r.l. 2022/02/03
-- Gestione calcolo mezzo-legno per Pareti
-- 2021/08/27 DS Se tre o più facce con flag PCKT=1 forzo svuotatura con fresa (per Variant).
-- 2021/08/29 DS Se svuotatura di fianco setto flag per farla dopo i tagli.
@@ -7,6 +7,7 @@
-- 2021/11/29 DS Correzione lav.ni SideMill quando più profonde che larghe.
-- 2022/01/04 DS Se U con fondo verso basso o alto non ci possono essere spigoli verticali da pulire.
-- 2022/01/17 ES Migliorata scelta fresa per lavorazione di fianco sotto.
-- 2022/02/03 DS Gorge larga come gambo più sicurezza.
-- Tabella per definizione modulo
local WPL = {}
@@ -1230,6 +1231,12 @@ local function MakeByChainSaw( Proc, nFacet, nRawId, b3Raw, dElev, dH, dV)
if WD.GetChainSawBlockedAxis then
sRot3Ang = WD.GetChainSawBlockedAxis( 1)
end
-- Calcolo angoli iniziali suggeriti
local sStartAngs
if WD.GetChainSawStartAngs then
local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, nFacAdj, GDB_ID.ROOT)
sStartAngs = WD.GetChainSawStartAngs( vtN2)
end
-- Lati chiusi
local bOpenStart = false
local bOpenEnd = false
@@ -1258,6 +1265,10 @@ local function MakeByChainSaw( Proc, nFacet, nRawId, b3Raw, dElev, dH, dV)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, EgtIf( bOpenEnd, 0, - dSawWidth / 2))
-- imposto angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, sRot3Ang)
-- imposto angoli iniziali suggeriti
if sStartAngs then
EgtSetMachiningParam( MCH_MP.INITANGS, sStartAngs)
end
-- imposto offset radiale
local dOffs = ( i - 1) * dStep
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
@@ -1365,19 +1376,14 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
-- dati della faccia
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacet, GDB_ID.ROOT)
local dElev = WL.GetFaceElevation( Proc.Id, nFacet, nRawId)
local dElevToPiece = dElev
local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacet, GDB_ID.ROOT)
local dThick = min( dH, dV)
local sMilling
-- verifico se ho lavorazione custom (lavorazione speciale)
-- se ho lavorazione custom
if sCustomMach then
sMilling = sCustomMach
-- ricalcolo l'elevazione della faccia dal pezzo finito
-- recupero l'ingombro della parete
local nPartId = EgtGetParent( EgtGetParent( Proc.Id) or GDB_ID.NULL)
dElevToPiece = WL.GetFaceElevation( Proc.Id, nFacet)
-- altrimenti la cerco
else
-- recupero la lavorazione
sMilling = WM.FindMilling( 'SideGroove')
end
if not sMilling then
@@ -1397,7 +1403,17 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
dMillLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dMillLen
dMillTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) or dMillTotLen
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
if ( EgtTdbGetCurrToolParam( MCH_TP.TYPE) & MCH_TF.SAWBLADE) ~= 0 then
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dMaxMat
if not dMaxDepthOnSide or dMaxDepthOnSide < 0.1 then
dMaxDepthOnSide = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
end
else
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
if not dMaxDepthOnSide or dMaxDepthOnSide < 0.1 then
dMaxDepthOnSide = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDEDEPTH', 'd')
end
end
dMillDiamTh = EgtTdbGetCurrToolThDiam() or dMillDiamTh
end
end
@@ -1535,7 +1551,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
dExtraLongIni = EgtIf( nModifyLeadInOut == 2, 1, dExtraLongExtPlus + dMillDiam/2 + 5)
dExtraLongEnd = EgtIf( nModifyLeadInOut > 0, 1, dExtraLongExtNeg + dMillDiam/2 + 5)
end
-- asseggno lato di lavoro seconda faccia
-- assegno lato di lavoro seconda faccia
if bMachFromDn then
nFace2ndFace = MCH_MILL_FU.ORTUP_BACK
else
@@ -1543,17 +1559,22 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
end
end
end
if not bEnablePreMill then
dExtraLongIni = 0
dExtraLongEnd = 0
end
-- se ho abilitato la lavorazione di fresatura per garantire passaggio gambo utensile inserisco la lavorazione
if bEnablePreMill then
-- calcolo di quanto deve essere largo e lungo il canale di fresatura
local dDimGorge = ( 0.5 * ( dMillDiam + dMillDiamTh)) - dElevToPiece + 2
-- calcolo quanto deve essere largo e lungo il canale di fresatura
local dDistGorge = ( dMillDiam - dMillDiamTh) / 2 - WD.COLL_SIC
local dDimGorge = dMillDiamTh + 2 * WD.COLL_SIC
-- se il materiale extra è inferiore della gola completa, ricalcolo la dimensione della gola
-- per fare meno fresature inutili
if ( dElev - dElevToPiece) < dDimGorge then
dDimGorge = ( dElev - dElevToPiece) + 5
if dElev + 2 * WD.COLL_SIC < dDistGorge + dDimGorge then
dDimGorge = max( dElev - dDistGorge + 2 * WD.COLL_SIC, 0)
end
-- calcolo extra allungamenti
local dExtraLongGorge = ( dMillDiamTh + 5) /2
local dExtraLongGorge = ( dMillDiamTh + WD.COLL_SIC) / 2
-- recupero la lavorazione
local sMillingGorge = WM.FindMilling( 'Gorge', nil, nil, nil, 80)
if not sMillingGorge then
@@ -1572,60 +1593,58 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
end
end
-- calcolo quanti passi devo fare in larghezza per scaricare l'area di impegno utensile
local nNumStep = ceil( ( dDimGorge - dMillDiamFirst) / ( dMillDiamFirst * 0.8)) + 1
local nNumStep = ceil( ( dDimGorge - dMillDiamFirst) / ( dMillDiamFirst * 0.9)) + 1
local dC = 0
if ( nNumStep - 1) > 0 then
dC = ( dDimGorge - dMillDiamFirst) / ( nNumStep - 1)
else
nNumStep = 1
end
-- inserisco lavorazione solo se ho la condizione per farlo
if bEnablePreMill then
local nNm = 0
-- passi di allargamento
for i = 1, nNumStep do
nNm = nNm + 1
-- inserisco la lavorazione di fresatura
local sNameGorge = 'Gorge_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. tostring( nFacet) .. '_' .. tostring( nNm)
local nMchFId = EgtAddMachining( sNameGorge, sMillingGorge)
if not nMchFId then
local sErr = 'Error adding machining ' .. sNameGorge .. '-' .. sMillingGorge
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, nFacet}})
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.ADIR_ZP
if AreSameVectorApprox( vtN, Z_AX()) then
nSCC = EgtIf( Proc.Box:getDimX() >= Proc.Box:getDimY(), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_XP)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- imposto modo di lavorare la faccia
local nFaceUse = WL.GetNearestParalOpposite( Z_AX(), vtN)
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- imposto elevazione e step
local dStep = EgtGetMachiningParam( MCH_MP.STEP)
if dStep < GEO.EPS_SMALL then dStep = dMaxMat end
-- se sto lavorando la gola centrale setto l'elevazione e l'affondamento
if nSinglePass and nSinglePass == 0 then
local dZElev = b3Raw:getDimZ()
local dDepth = Proc.Box:getMax():getZ() - b3Raw:getMin():getZ()
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dZElev, 3) .. ';')
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
end
EgtSetMachiningParam( MCH_MP.STEP, dStep)
-- aggiungo l'offset laterale
EgtSetMachiningParam( MCH_MP.OFFSR, ( dElevToPiece + (dC * (i-1)) + 1))
-- aggiungo allungamenti iniziali e finali
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dExtraLongIni + dExtraLongGorge)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dExtraLongEnd + dExtraLongGorge)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
-- inserisco la lavorazione
local nNm = 0
-- passi di allargamento
for i = 1, nNumStep do
nNm = nNm + 1
-- inserisco la lavorazione di fresatura
local sNameGorge = 'Gorge_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. tostring( nFacet) .. '_' .. tostring( nNm)
local nMchFId = EgtAddMachining( sNameGorge, sMillingGorge)
if not nMchFId then
local sErr = 'Error adding machining ' .. sNameGorge .. '-' .. sMillingGorge
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, nFacet}})
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.ADIR_ZP
if abs( vtN:getZ()) < GEO.EPS_SMALL then
nSCC = EgtIf( Proc.Box:getDimX() >= Proc.Box:getDimY(), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_XP)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- imposto modo di lavorare la faccia
local nFaceUse = WL.GetNearestParalOpposite( Z_AX(), vtN)
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- imposto elevazione e step
local dStep = EgtGetMachiningParam( MCH_MP.STEP)
if dStep < GEO.EPS_SMALL then dStep = dMaxMat end
-- se sto lavorando la gola centrale setto l'elevazione e l'affondamento
if nSinglePass and nSinglePass == 0 then
local dZElev = b3Raw:getDimZ()
local dDepth = Proc.Box:getMax():getZ() - b3Raw:getMin():getZ()
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dZElev, 3) .. ';')
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
end
EgtSetMachiningParam( MCH_MP.STEP, dStep)
-- aggiungo l'offset laterale
EgtSetMachiningParam( MCH_MP.OFFSR, ( dDistGorge + dC * ( i - 1)))
-- aggiungo allungamenti iniziali e finali
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dExtraLongIni + dExtraLongGorge)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dExtraLongEnd + dExtraLongGorge)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end
end
@@ -1641,10 +1660,11 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, nFacet}})
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.ADIR_ZP
if abs( vtN:getZ()) < GEO.EPS_SMALL then
nSCC = EgtIf( Proc.Box:getDimX() >= Proc.Box:getDimY(), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_XP)
end
--local nSCC = MCH_SCC.ADIR_ZP
--if abs( vtN:getZ()) < GEO.EPS_SMALL then
-- nSCC = EgtIf( Proc.Box:getDimX() >= Proc.Box:getDimY(), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_XP)
--end
local nSCC = MCH_SCC.ADIR_NEAR
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- imposto modo di lavorare la faccia
local nFaceUse = WL.GetNearestParalOpposite( Z_AX(), vtN)
@@ -2120,6 +2140,10 @@ local function MakeTwoFaces( Proc, nRawId, b3Raw)
-- se posso eseguire la lavorazione per distanza inferiore utensile o lavorazione preceduta da sgossatura gola
if bInsertMach then
return MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, EgtIf( bEnableMillOnSide and dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng)
else
local sErr = 'Error feature not machinable (dimensions)'
EgtOutLog( sErr)
return false, sErr
end
-- se altrimenti di fianco in alto
elseif vtN[1]:getZ() > dMaxZVers or vtN[2]:getZ() > dMaxZVers then
@@ -2298,7 +2322,7 @@ local function MakeMoreFaces( Proc, nRawId, b3Raw)
bInsertMach = true
bMakeFirstGroove = true
end
-- se posso eseguire la lavorazione per distanza inferiore utensile o lavorazione precedura da sgossatura gola
-- se posso eseguire la lavorazione per distanza inferiore utensile o lavorazione preceduta da sgossatura gola
-- e gola più grande o uguale spessore utensile
if bInsertMach and dMaxMat <= min( dH, dV) + 20 * GEO.EPS_SMALL then
local nSinglePass = 0
@@ -2316,9 +2340,29 @@ local function MakeMoreFaces( Proc, nRawId, b3Raw)
end
else
-- fresatura (se definita)
local sMilling, _, dMaxMat, dDiam = WM.FindMilling( 'SideGroove')
if sMilling and dElev < dDiam / 2 - 30 and dMaxMat <= min( dH, dV) + 20 * GEO.EPS_SMALL then
return MakeSideGrooveByMill( Proc, nFacInd, nRawId, b3Raw)
local sMilling = WM.FindMilling( 'SideGroove')
-- recupero i dati dell'utensile
local dMaxMat = 1000
local dMaxDepthOnSide = 0
if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
local dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
if ( EgtTdbGetCurrToolParam( MCH_TP.TYPE) & MCH_TF.SAWBLADE) ~= 0 then
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dMaxMat
dMaxDepthOnSide = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
else
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
dMaxDepthOnSide = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDEDEPTH', 'd')
end
if not dMaxDepthOnSide then
local dMillDiamTh = EgtTdbGetCurrToolThDiam() or 60
dMaxDepthOnSide = ( dMillDiam - dMillDiamTh) / 2
end
end
end
if sMilling and dElev < dMaxDepthOnSide and dMaxMat <= min( dH, dV) + 20 * GEO.EPS_SMALL then
return MakeSideGrooveByMill( Proc, nFacInd, nRawId, b3Raw, sMilling)
-- altrimenti sega a catena
else
return MakeByChainSaw( Proc, nFacInd, nRawId, b3Raw, dElev, dH, dV)