- implemento split e relative finiture per travi con sezioni grandi

- split con sega a catena
- distinzione finitura con lama o truciolatore in base al parametro Q05
- finiture evitate in presenza di feature che tagliano tutta la sezione
- gestione sovramateriale grezzo
This commit is contained in:
luca.mazzoleni
2022-06-10 17:50:22 +02:00
parent c9b0f1e90d
commit b29074cbb1
18 changed files with 833 additions and 348 deletions
+300 -199
View File
@@ -26,6 +26,9 @@
-- 2021/12/15 Corretta CompareFeature (risultato deve essere simmetrico scambiando le feature).
-- 2021/12/20 Ulteriore correzione a CompareFeature (caso con entrambe senza geometria).
-- 2022/05/04 Nell'ordinamento quando si confrontano i box delle feature aggiunta verifica preliminare della loro validità.
-- 2022/05/31 Aggiunta gestione sovramateriale per sezioni alte e larghe e informazione di eventuale creazione nuova fase dalla AddFeatureMachining.
-- 2022/06/10 Per sezioni alte e larghe modificata la gestione del sovramateriale per considerare la presenza di feature preesistenti e eventuale parametro Q05, che determinano la presenza o meno della finitura.
-- Create le funzioni AnalyzeHeadFeatures e AnalyzeTailFeatures. Spostate più in alto le funzioni CollectFeatures, isHeadFeature e isTailFeature.
-- Tabella per definizione modulo
local BeamExec = {}
@@ -122,163 +125,6 @@ EgtOutLog( ' BeamExec started', 1)
EgtMdbSetGeneralParam( MCH_GP.MAXDEPTHSAFE, BD.COLL_SIC)
EgtMdbSave()
-------------------------------------------------------------------------------------------------------------
-- *** Inserimento delle travi nel grezzo ***
-------------------------------------------------------------------------------------------------------------
function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroupOk)
-- Determinazione minimo grezzo scaricabile
BeamExec.CalcMinUnloadableRaw( dRawW, dRawH)
-- Creazione nuovo gruppo di lavoro
if not bMachGroupOk then
local sMgName = EgtGetMachGroupNewName( 'Mach_1')
local NewMgId = EgtAddMachGroup( sMgName)
if not NewMgId then
local sOut = 'Errore nella creazione del gruppo di lavoro ' .. sMgName
return false, sOut
end
end
-- Impostazione della tavola
EgtSetTable( 'Tab')
-- Area tavola
local b3Tab = EgtGetTableArea()
-- Calcolo posizione estremo TR/BR della tavola rispetto a sua origine in BL
BD.OriXR = Point3d( b3Tab:getDimX(), EgtIf( BD.RIGHT_LOAD, 0, b3Tab:getDimY()), 0)
BD.PosXR = EgtIf( BD.RIGHT_LOAD, MCH_CR.BR, MCH_CR.TR)
-- Impostazione dell'attrezzaggio di default
EgtImportSetup()
-- Inserimento dei pezzi con il loro grezzo
local Cnt = 0
local Len = dRawL
local nPrevRaw, dPrevDelta
local DeltaS = dOvmHead
local DeltaE = BD.OVM_MID
for i = 1, #vBeam do
-- assegno identificativo pezzo
local Pz = vBeam[i].Id
-- dati del pezzo
local b3Part = EgtGetBBoxGlob( Pz or GDB_ID.NULL, GDB_BB.EXACT)
local b3Solid = vBeam[i].Box
if b3Part:isEmpty() or b3Solid:isEmpty() then break end
EgtOutLog( 'PartSez=' .. EgtNumToString( b3Part:getDimY(), 1) .. 'x' .. EgtNumToString( b3Part:getDimZ(), 1), 3)
-- se sezione compatibile e lunghezza disponibile sufficiente
local PartLen = b3Solid:getDimX()
local PartWidth = b3Solid:getDimY()
local PartHeight = b3Solid:getDimZ()
local NextLen = Len - DeltaS - PartLen - DeltaE
if (( abs( PartWidth - dRawW) < 10 * GEO.EPS_SMALL and abs( PartHeight - dRawH) < 10 * GEO.EPS_SMALL) or
( abs( PartHeight - dRawW) < 10 * GEO.EPS_SMALL and abs( PartWidth - dRawH) < 10 * GEO.EPS_SMALL)) and
NextLen + DeltaE >= 0 then
-- eventuale sovramateriale di testa
if vBeam[i].PosX then
DeltaS = max( vBeam[i].PosX - ( dRawL - Len), 0)
end
-- dimensioni del grezzo
local CrawLen = min( PartLen + DeltaS + DeltaE, Len)
local Delta = CrawLen - PartLen - DeltaS
-- creo e posiziono il grezzo
local nRaw = EgtAddRawPart( Point3d(0,0,0), CrawLen, dRawW, dRawH, BD.RAWCOL)
EgtMoveToCornerRawPart( nRaw, BD.OriXR, BD.PosXR)
EgtMoveRawPart( nRaw, Vector3d( Len - dRawL, 0, 0))
-- assegno ordine in lavorazione
Cnt = Cnt + 1
EgtSetInfo( nRaw, 'ORD', Cnt)
-- creo o pulisco gruppo geometrie aggiuntive
if not BL.CreateOrEmptyAddGroup( Pz) then
local sOut = 'Error creating Additional Group in Part ' .. tostring( Pz)
return false, sOut
end
-- aggiungo faccia per taglio iniziale al pezzo
BL.AddPartStartFace( Pz, b3Solid)
-- se sovramateriale di testa, lo notifico
if DeltaS > 0.09 then
EgtSetInfo( nRaw, 'HOVM', DeltaS)
if nPrevRaw then
EgtSetInfo( nPrevRaw, 'BDST', DeltaS + dPrevDelta)
end
end
-- aggiungo faccia per taglio finale al pezzo
BL.AddPartEndFace( Pz, b3Solid)
-- inserisco il pezzo nel grezzo
EgtDeselectPartObjs( Pz)
local ptPos = b3Part:getMin() - b3Solid:getMin() + Vector3d( Delta, ( dRawW - PartWidth) / 2, ( dRawH - PartHeight) / 2)
EgtAddPartToRawPart( Pz, ptPos, nRaw)
if abs( PartWidth - dRawW) > 10 * GEO.EPS_SMALL then
-- rotazione attorno a centro geometria complessiva del pezzo
EgtRotatePartInRawPart( Pz, X_AX(), 90)
-- correggo per eccentricità solido rispetto a geometria complessiva del pezzo
local vtEccOri = b3Solid:getCenter() - b3Part:getCenter()
local vtEccRot = Vector3d( vtEccOri)
vtEccRot:rotate( X_AX(), 90)
EgtMovePartInRawPart( Pz, ( vtEccOri - vtEccRot))
end
-- aggiorno la lunghezza residua della barra
Len = Len - CrawLen
-- aggiorno grezzo precedente
nPrevRaw = nRaw
dPrevDelta = Delta
else
local sOut = 'Error: part L(' .. EgtNumToString( PartLen, 1) .. ') too big for raw part L(' .. EgtNumToString( Len - 0.1, 1) .. ')'
return false, sOut
end
-- se rimasto troppo poco grezzo, esco
--if Len < BD.MinRaw then break end
DeltaS = 0
end
if nPrevRaw then
EgtSetInfo( nPrevRaw, 'BDST', 10000)
end
-- Se rimasto materiale aggiungo grezzo dell'avanzo
if Len > 10 then
local nRaw = EgtAddRawPart( Point3d(0,0,0), Len, dRawW, dRawH, BD.RAWCOL)
EgtMoveToCornerRawPart( nRaw, BD.OriXR, BD.PosXR)
EgtMoveRawPart( nRaw, Vector3d( Len - dRawL, 0, 0))
-- assegno ordine in lavorazione
Cnt = Cnt + 1
EgtSetInfo( nRaw, 'ORD', Cnt)
end
return true
end
-------------------------------------------------------------------------------------------------------------
function BeamExec.CalcMinUnloadableRaw( dRawW, dRawH)
if BD.GetMinUnloadableRaw then
BD.MinRaw = BD.GetMinUnloadableRaw( dRawW, dRawH)
else
local H_S = 200
local H_L = 400
-- Determinazione minimo grezzo scaricabile
if dRawH <= H_S then
BD.MinRaw = BD.MINRAW_S
elseif dRawH <= H_L then
local Coeff = ( dRawH - H_S) / ( H_L - H_S)
BD.MinRaw = ( 1 - Coeff) * BD.MINRAW_S + Coeff * BD.MINRAW_L
else
BD.MinRaw = BD.MINRAW_L
end
end
end
-------------------------------------------------------------------------------------------------------------
-- *** Inserimento delle lavorazioni nelle travi ***
-------------------------------------------------------------------------------------------------------------
local function Verify90DegRotation( nRawId)
if not nRawId then return false end
-- dimensioni sezione trave in posizione normale (rotazione 0°)
local dRawW = EgtGetRawPartBBox( nRawId):getDimY()
local dRawH = EgtGetRawPartBBox( nRawId):getDimZ()
-- verifica dell'altezza rispetto alla massima larghezza
return ( dRawH < BD.MAX_WIDTH + 10 * GEO.EPS_SMALL and dRawW < BD.MAX_HEIGHT + 10 * GEO.EPS_SMALL) or
( dRawH < BD.MAX_WIDTH2 + 10 * GEO.EPS_SMALL and dRawW < BD.MAX_HEIGHT2 + 10 * GEO.EPS_SMALL)
end
-------------------------------------------------------------------------------------------------------------
local function IsHeadFeature( Proc, b3Raw, dCurrOvmH)
-- feature sempre di testa o coda per il gruppo
@@ -312,10 +158,12 @@ end
-------------------------------------------------------------------------------------------------------------
local function IsTailFeature( Proc, b3Raw, dCurrOvmH)
-- lunghezza di riferimento per spostare le feature di coda appena prima
local dAdvTailLen = BD.LEN_VERY_SHORT_PART or BD.LEN_SHORT_PART
-- feature sempre di testa o coda per il gruppo (se non troppo lunga)
if Proc.Grp == 1 or Proc.Grp == 2 then
-- se abilitato avanzamento lavorazione feature di coda e pezzo corto (quindi a caduta) e feature in coda
if BD.ADVANCE_TAIL_CUT and b3Raw:getDimX() < BD.LEN_SHORT_PART and Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH then
if BD.ADVANCE_TAIL_CUT and b3Raw:getDimX() < dAdvTailLen and Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH then
-- se taglio, lo avanzo
if Proc.Prc == 10 then
return false, true
@@ -328,7 +176,7 @@ local function IsTailFeature( Proc, b3Raw, dCurrOvmH)
if ( Proc.Grp == 3 or Proc.Grp == 4) and
( Proc.Prc == 38 or Proc.Prc == 51 or Proc.Prc == 56 or Proc.Prc == 100 or Proc.Prc == 101 or Proc.Prc == 102 or Proc.Prc == 103 or Proc.Prc == 106) then
-- se abilitato avanzamento lavorazione feature di coda e pezzo corto (quindi a caduta) e feature in coda
if BD.ADVANCE_TAIL_CUT and b3Raw:getDimX() < BD.LEN_SHORT_PART and Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH then
if BD.ADVANCE_TAIL_CUT and b3Raw:getDimX() < dAdvTailLen and Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH then
-- se profilo front solo con smusso, lo avanzo
if Proc.Prc == 100 and ProfFront.OnlyChamfer( Proc) then
return false, true
@@ -376,25 +224,6 @@ local function IsTailFeature( Proc, b3Raw, dCurrOvmH)
return false
end
-------------------------------------------------------------------------------------------------------------
local function PrintFeatures( vProc, b3Raw)
EgtOutLog( ' RawBox=' .. tostring( b3Raw))
for i = 1, #vProc do
local Proc = vProc[i]
local sOut = string.format( ' Id=%3d Grp=%1d Prc=%3d TC=%2d/%d Flg=%2d Down=%s Side=%s Head=%s Tail=%s Fcse=%1d,%1d Diam=%.2f Fct=%2d Box=%s',
Proc.Id, Proc.Grp, Proc.Prc, Proc.TaskId, Proc.CutId,
Proc.Flg, EgtIf( Proc.Down, 'T', 'F'), EgtIf( Proc.Side, 'T', 'F'),
EgtIf( Proc.Head, 'T', 'F'), EgtIf( Proc.Tail, 'T', EgtIf( Proc.AdvTail, 'A', 'F')),
Proc.Fcs, Proc.Fce, Proc.Diam, Proc.Fct, tostring( Proc.Box))
-- info speciali per Block Haus Half Lap
if Proc.Prc == 37 then
local sSpec = string.format( ' N=%s Hd=%s', tostring( Proc.vtN or V_NULL()), EgtIf( Proc.HeadDir, 'T', 'F'))
sOut = sOut .. sSpec
end
EgtOutLog( sOut)
end
end
-------------------------------------------------------------------------------------------------------------
local function CollectFeatures( PartId, b3Raw, dCurrOvmH)
-- recupero le feature
@@ -482,6 +311,268 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH)
return vProc
end
-------------------------------------------------------------------------------------------------------------
local function AnalyzeHeadFeatures( b3Solid, vProc, dRawW, dRawH)
local nReplacedFeatureId = nil
local bHeadFinishingNeeded = true
for i = 1, #vProc do
local Proc = vProc[i]
-- controllo se esiste già una feature taglio di testa
if not nReplacedFeatureId then
if ( Proc.Grp == 1 or Proc.Grp == 2) and Proc.Prc == 10 then
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
if ptC and vtN and AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL then
nReplacedFeatureId = Proc.Id
end
end
end
if Proc.Head and Proc.Id ~= nReplacedFeatureId and Proc.Prc ~= 340 then
-- controllo se la feature taglia l'intera sezione; in caso positivo la finitura non è necessaria
bHeadFinishingNeeded = not ((abs(Proc.Box:getDimY() - dRawW) < 10 * GEO.EPS_SMALL or Proc.Box:getDimY() > dRawW) and (abs(Proc.Box:getDimZ() - dRawH) < 10 * GEO.EPS_SMALL or Proc.Box:getDimZ() > dRawH))
end
end
return bHeadFinishingNeeded, nReplacedFeatureId
end
-------------------------------------------------------------------------------------------------------------
local function AnalyzeTailFeatures( b3Solid, vProc, dRawW, dRawH)
local nReplacedFeatureId = nil
local bTailFinishingNeeded = true
for i = 1, #vProc do
local Proc = vProc[i]
-- controllo se esistè già una feature taglio di coda
if not nReplacedFeatureId then
if ( Proc.Grp == 1 or Proc.Grp == 2) and Proc.Prc == 10 then
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
if ptC and vtN and AreSameVectorApprox( vtN, -X_AX()) and abs( ptC:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL then
nReplacedFeatureId = Proc.Id
end
end
end
if Proc.Tail and Proc.Id ~= nReplacedFeatureId and Proc.Prc ~= 350 then
-- controllo se la feature taglia l'intera sezione; in caso positivo la finitura non è necessaria
bTailFinishingNeeded = not ((abs(Proc.Box:getDimY() - dRawW) < 10 * GEO.EPS_SMALL or Proc.Box:getDimY() > dRawW) and (abs(Proc.Box:getDimZ() - dRawH) < 10 * GEO.EPS_SMALL or Proc.Box:getDimZ() > dRawH))
end
end
return bTailFinishingNeeded, nReplacedFeatureId
end
-------------------------------------------------------------------------------------------------------------
-- *** Inserimento delle travi nel grezzo ***
-------------------------------------------------------------------------------------------------------------
function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroupOk)
-- Determinazione minimo grezzo scaricabile
BeamExec.CalcMinUnloadableRaw( dRawW, dRawH)
-- Creazione nuovo gruppo di lavoro
if not bMachGroupOk then
local sMgName = EgtGetMachGroupNewName( 'Mach_1')
local NewMgId = EgtAddMachGroup( sMgName)
if not NewMgId then
local sOut = 'Errore nella creazione del gruppo di lavoro ' .. sMgName
return false, sOut
end
end
-- Impostazione della tavola
EgtSetTable( 'Tab')
-- Area tavola
local b3Tab = EgtGetTableArea()
-- Calcolo posizione estremo TR/BR della tavola rispetto a sua origine in BL
BD.OriXR = Point3d( b3Tab:getDimX(), EgtIf( BD.RIGHT_LOAD, 0, b3Tab:getDimY()), 0)
BD.PosXR = EgtIf( BD.RIGHT_LOAD, MCH_CR.BR, MCH_CR.TR)
-- Impostazione dell'attrezzaggio di default
EgtImportSetup()
-- Inserimento dei pezzi con il loro grezzo
local Cnt = 0
local Len = dRawL
local nPrevRaw, dPrevDelta
local DeltaS = dOvmHead
local DeltaSMin = 0
local DeltaE = BD.OVM_MID
-- controllo sezione larga e alta per considerare taglio con sega
local bBigSectionCut = false
if BD.MAX_DIM_HTCUT and BD.CUT_EXTRA_MIN and ( dRawW > 2 * BD.MAX_DIM_HTCUT - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and ( dRawH > 2 * BD.MAX_DIM_HTCUT - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) then
bBigSectionCut = true
end
for i = 1, #vBeam do
-- assegno identificativo pezzo
local Pz = vBeam[i].Id
-- dati del pezzo
local b3Part = EgtGetBBoxGlob( Pz or GDB_ID.NULL, GDB_BB.EXACT)
local b3Solid = vBeam[i].Box
if b3Part:isEmpty() or b3Solid:isEmpty() then break end
if bBigSectionCut then
-- lascio in coda solo il materiale necessario; il resto verrà tolto nell'head cut successivo
local lastB3Solid = nil
local dOffset = dOvmHead
if i > 1 then
lastB3Solid = vBeam[i-1].Box
dOffset = vBeam[i].PosX - vBeam[i-1].PosX - lastB3Solid:getDimX()
end
-- analizzo le features per valutare l'esistenza di feature head/tail che renderebbero inutili le rispettive finiture o di tagli di testa/coda sostituiti da cui leggere il parametro Q05
local vProc = CollectFeatures( Pz, b3Solid, 0)
local bSFinishingNeeded, nReplacedHeadCutFeatureId = AnalyzeHeadFeatures( b3Solid, vProc, dRawW, dRawH)
local iSQ05Value = nil
if nReplacedHeadCutFeatureId then
iSQ05Value = EgtGetInfo( nReplacedHeadCutFeatureId, 'Q05', 'i')
end
if ( dOffset <= BD.OVM_CHAIN_HBEAM and iSQ05Value == 0) or not bSFinishingNeeded then
DeltaSMin = 0
else
DeltaSMin = BD.OVM_BLADE_HBEAM
end
local bEFinishingNeeded, nReplacedTailCutFeatureId = AnalyzeTailFeatures( b3Solid, vProc, dRawW, dRawH)
local iEQ05Value = nil
if nReplacedTailCutFeatureId then
iEQ05Value = EgtGetInfo( nReplacedTailCutFeatureId, 'Q05', 'i')
end
if iEQ05Value == 0 or not bEFinishingNeeded then
DeltaE = BD.OVM_CHAIN_HBEAM
else
DeltaE = BD.OVM_CHAIN_HBEAM + BD.OVM_BLADE_HBEAM
end
end
EgtOutLog( 'PartSez=' .. EgtNumToString( b3Part:getDimY(), 1) .. 'x' .. EgtNumToString( b3Part:getDimZ(), 1), 3)
-- se sezione compatibile e lunghezza disponibile sufficiente
local PartLen = b3Solid:getDimX()
local PartWidth = b3Solid:getDimY()
local PartHeight = b3Solid:getDimZ()
local NextLen = Len - DeltaS - PartLen - DeltaE
if (( abs( PartWidth - dRawW) < 10 * GEO.EPS_SMALL and abs( PartHeight - dRawH) < 10 * GEO.EPS_SMALL) or
( abs( PartHeight - dRawW) < 10 * GEO.EPS_SMALL and abs( PartWidth - dRawH) < 10 * GEO.EPS_SMALL)) and
NextLen + DeltaE >= 0 then
-- eventuale sovramateriale di testa
if i > 1 and vBeam[i].PosX then
DeltaS = max( vBeam[i].PosX - ( dRawL - Len), DeltaSMin)
end
-- dimensioni del grezzo
local CrawLen = min( PartLen + DeltaS + DeltaE, Len)
local Delta = CrawLen - PartLen - DeltaS
-- creo e posiziono il grezzo
local nRaw = EgtAddRawPart( Point3d(0,0,0), CrawLen, dRawW, dRawH, BD.RAWCOL)
EgtMoveToCornerRawPart( nRaw, BD.OriXR, BD.PosXR)
EgtMoveRawPart( nRaw, Vector3d( Len - dRawL, 0, 0))
-- assegno ordine in lavorazione
Cnt = Cnt + 1
EgtSetInfo( nRaw, 'ORD', Cnt)
-- creo o pulisco gruppo geometrie aggiuntive
if not BL.CreateOrEmptyAddGroup( Pz) then
local sOut = 'Error creating Additional Group in Part ' .. tostring( Pz)
return false, sOut
end
-- aggiungo faccia per taglio iniziale al pezzo
BL.AddPartStartFace( Pz, b3Solid)
-- se sovramateriale di testa, lo notifico
if DeltaS > 0.09 then
EgtSetInfo( nRaw, 'HOVM', DeltaS)
if nPrevRaw then
EgtSetInfo( nPrevRaw, 'BDST', DeltaS + dPrevDelta)
end
end
if DeltaE > 0.09 then
EgtSetInfo( nRaw, 'TOVM', DeltaE)
end
-- aggiungo faccia per taglio finale al pezzo
BL.AddPartEndFace( Pz, b3Solid)
-- inserisco il pezzo nel grezzo
EgtDeselectPartObjs( Pz)
local ptPos = b3Part:getMin() - b3Solid:getMin() + Vector3d( Delta, ( dRawW - PartWidth) / 2, ( dRawH - PartHeight) / 2)
EgtAddPartToRawPart( Pz, ptPos, nRaw)
if abs( PartWidth - dRawW) > 10 * GEO.EPS_SMALL then
-- rotazione attorno a centro geometria complessiva del pezzo
EgtRotatePartInRawPart( Pz, X_AX(), 90)
-- correggo per eccentricità solido rispetto a geometria complessiva del pezzo
local vtEccOri = b3Solid:getCenter() - b3Part:getCenter()
local vtEccRot = Vector3d( vtEccOri)
vtEccRot:rotate( X_AX(), 90)
EgtMovePartInRawPart( Pz, ( vtEccOri - vtEccRot))
end
-- aggiorno la lunghezza residua della barra
Len = Len - CrawLen
-- aggiorno grezzo precedente
nPrevRaw = nRaw
dPrevDelta = Delta
else
local sOut = 'Error: part L(' .. EgtNumToString( PartLen, 1) .. ') too big for raw part L(' .. EgtNumToString( Len - 0.1, 1) .. ')'
return false, sOut
end
-- se rimasto troppo poco grezzo, esco
--if Len < BD.MinRaw then break end
DeltaS = 0
end
if nPrevRaw then
EgtSetInfo( nPrevRaw, 'BDST', 10000)
end
-- Se rimasto materiale aggiungo grezzo dell'avanzo
if Len > 10 then
local nRaw = EgtAddRawPart( Point3d(0,0,0), Len, dRawW, dRawH, BD.RAWCOL)
EgtMoveToCornerRawPart( nRaw, BD.OriXR, BD.PosXR)
EgtMoveRawPart( nRaw, Vector3d( Len - dRawL, 0, 0))
-- assegno ordine in lavorazione
Cnt = Cnt + 1
EgtSetInfo( nRaw, 'ORD', Cnt)
end
return true
end
-------------------------------------------------------------------------------------------------------------
function BeamExec.CalcMinUnloadableRaw( dRawW, dRawH)
if BD.GetMinUnloadableRaw then
BD.MinRaw = BD.GetMinUnloadableRaw( dRawW, dRawH)
else
local H_S = 200
local H_L = 400
-- Determinazione minimo grezzo scaricabile
if dRawH <= H_S then
BD.MinRaw = BD.MINRAW_S
elseif dRawH <= H_L then
local Coeff = ( dRawH - H_S) / ( H_L - H_S)
BD.MinRaw = ( 1 - Coeff) * BD.MINRAW_S + Coeff * BD.MINRAW_L
else
BD.MinRaw = BD.MINRAW_L
end
end
end
-------------------------------------------------------------------------------------------------------------
-- *** Inserimento delle lavorazioni nelle travi ***
-------------------------------------------------------------------------------------------------------------
local function Verify90DegRotation( nRawId)
if not nRawId then return false end
-- dimensioni sezione trave in posizione normale (rotazione 0°)
local dRawW = EgtGetRawPartBBox( nRawId):getDimY()
local dRawH = EgtGetRawPartBBox( nRawId):getDimZ()
-- verifica dell'altezza rispetto alla massima larghezza
return ( dRawH < BD.MAX_WIDTH + 10 * GEO.EPS_SMALL and dRawW < BD.MAX_HEIGHT + 10 * GEO.EPS_SMALL) or
( dRawH < BD.MAX_WIDTH2 + 10 * GEO.EPS_SMALL and dRawW < BD.MAX_HEIGHT2 + 10 * GEO.EPS_SMALL)
end
-------------------------------------------------------------------------------------------------------------
local function PrintFeatures( vProc, b3Raw)
EgtOutLog( ' RawBox=' .. tostring( b3Raw))
for i = 1, #vProc do
local Proc = vProc[i]
local sOut = string.format( ' Id=%3d Grp=%1d Prc=%3d TC=%2d/%d Flg=%2d Down=%s Side=%s Head=%s Tail=%s Fcse=%1d,%1d Diam=%.2f Fct=%2d Box=%s',
Proc.Id, Proc.Grp, Proc.Prc, Proc.TaskId, Proc.CutId,
Proc.Flg, EgtIf( Proc.Down, 'T', 'F'), EgtIf( Proc.Side, 'T', 'F'),
EgtIf( Proc.Head, 'T', 'F'), EgtIf( Proc.Tail, 'T', EgtIf( Proc.AdvTail, 'A', 'F')),
Proc.Fcs, Proc.Fce, Proc.Diam, Proc.Fct, tostring( Proc.Box))
-- info speciali per Block Haus Half Lap
if Proc.Prc == 37 then
local sSpec = string.format( ' N=%s Hd=%s', tostring( Proc.vtN or V_NULL()), EgtIf( Proc.HeadDir, 'T', 'F'))
sOut = sOut .. sSpec
end
EgtOutLog( sOut)
end
end
-------------------------------------------------------------------------------------------------------------
local function OrderFeatures( vProc, b3Raw)
@@ -929,10 +1020,10 @@ local function ClassifyFeatures( vProc, b3Raw, Stats)
end
-------------------------------------------------------------------------------------------------------------
local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bNeedHCut, b3Raw)
local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bNeedHCut, b3Raw, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dCurrOvmT)
local bOk = true
local sErr = ''
local bNewPhase = false
local nNewPhase = -1
EgtOutLog( ' * Process ' .. tostring( Proc.Id) .. ' *', 1)
-- se intestatura ( 1-340-X )
if Hcut.Identify( Proc) then
@@ -941,13 +1032,11 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
-- se separazione ( 2-350-X )
elseif Split.Identify( Proc) then
-- esecuzione separazione o eliminazione grezzo residuo
bOk, sErr = Split.Make( Proc, nPhase, nRawId, nPartId)
-- richiedo il passaggio alla seconda fase di lavorazione di questa trave
bNewPhase = true
bOk, sErr, nNewPhase = Split.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dCurrOvmT)
-- se taglio ( 1/2-010-X)
elseif Cut.Identify( Proc) then
-- esecuzione taglio
bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, nil, nil, nil, nil, nil, dCurrOvmT)
-- se doppio taglio ( 1/2-011-X)
elseif DoubleCut.Identify( Proc) then
-- esecuzione doppio taglio
@@ -968,7 +1057,7 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
-- se taglio con lama ( 0/3/4-013-X)
elseif SawCut.Identify( Proc) then
-- esecuzione taglio
bOk, sErr = SawCut.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bOk, sErr = SawCut.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, dCurrOvmT)
-- se mezzo-legno di testa ( 1/2-030-X)
elseif RidgeLap.Identify( Proc) then
-- esecuzione mezzo-legno di testa
@@ -990,11 +1079,11 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
-- se giunzione francese ( 1/2-035-X)
elseif FrenchRidgeLap.Identify( Proc) then
-- esecuzione giunzione francese
bOk, sErr = FrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bOk, sErr = FrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, dCurrOvmT)
-- se block house front ( 3/4-038-X)
elseif BlockHausFront.Identify( Proc) then
-- esecuzione giunzione francese
bOk, sErr = BlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bOk, sErr = BlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, dCurrOvmT)
-- se tenone ( 1/2-050-X)
elseif Tenon.Identify( Proc) then
-- esecuzione tenone
@@ -1022,11 +1111,11 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
-- se giunto Gerber ( 1/2-071-X)
elseif ScarfJoint.Identify( Proc) then
-- esecuzione giunto Gerber
bOk, sErr = ScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bOk, sErr = ScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, dCurrOvmT)
-- se giunto Gerber ( 1/2-070-X)
elseif Scarf.Identify( Proc) then
-- esecuzione giunto Gerber
bOk, sErr = Scarf.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bOk, sErr = Scarf.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, dCurrOvmT)
-- se giunto a gradino ( 1/2-080-X)
elseif StepJoint.Identify( Proc) then
-- esecuzione giunto a gradino
@@ -1061,10 +1150,10 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
bOk, sErr = ProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- se incastro tirolo ( 1/2/3/4-136-X)
elseif TyroleanDovetail.Identify( Proc) then
bOk, sErr = TyroleanDovetail.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bOk, sErr = TyroleanDovetail.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, dCurrOvmT)
-- se giunto coda di rondine ( 1/2/3/4-138-X)
elseif Dovetail.Identify( Proc) then
bOk, sErr = Dovetail.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bOk, sErr = Dovetail.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, dCurrOvmT)
-- se contorno libero ( 0/3/4-250-X)
elseif FreeContour.Identify( Proc) then
-- esecuzione contorno
@@ -1079,7 +1168,7 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
EgtOutLog( sErr)
bOk = false
end
return bOk, sErr, bNewPhase
return bOk, sErr, nNewPhase
end
-------------------------------------------------------------------------------------------------------------
@@ -1213,6 +1302,7 @@ function BeamExec.ProcessFeatures()
-- ingombro del grezzo e sovramateriale di testa
local b3Raw = EgtGetRawPartBBox( nRawId)
local dCurrOvmH = EgtGetInfo( nRawId, 'HOVM', 'd') or 0
local dCurrOvmT = EgtGetInfo( nRawId, 'TOVM', 'd') or 0
-- recupero le feature di lavorazione della trave
local vProc = CollectFeatures( nPartId, b3Raw, dCurrOvmH)
-- le ordino lungo X
@@ -1233,8 +1323,11 @@ function BeamExec.ProcessFeatures()
SetCutsOnFrontMortises( vProc)
-- eventuale spostamento fori sui tenoni
MoveDrillsOnTenon( vProc)
-- identifico la condizione di lavorazione, in base a bSomeDown e bSomeSide
local sDownOrSideOrStd = 'standard'
-- se richiesto ribaltamento (oppure rotazione)
if ( bSomeDown or bSomeSide) and not BD.DOWN_HEAD and not BD.TURN then
sDownOrSideOrStd = 'down'
-- ribalto le travi della fase corrente
local nRId = nRawId
while nRId do
@@ -1247,7 +1340,7 @@ function BeamExec.ProcessFeatures()
-- creo la lavorazione
local Proc = vProc[i]
if Proc.Flg ~= 0 and Proc.Down then
local bOk, sMsg, bNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bNeedHCut, b3Raw)
local bOk, sMsg, nNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bNeedHCut, b3Raw, nOrd, sDownOrSideOrStd, nil, nil, dCurrOvmT)
if not bOk then
nTotErr = nTotErr + 1
table.insert( Stats, {Err=1, Msg=sMsg, Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId})
@@ -1256,8 +1349,10 @@ function BeamExec.ProcessFeatures()
else
table.insert( Stats, {Err=0, Msg='', Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId})
end
-- se era taglio di separazione, aggiungo nuova fase
if bNewPhase then
-- se è taglio di separazione, verifico se ha già aggiunto una nuova fase oppure se è da creare
if nNewPhase > 0 then
nPhase = nNewPhase
elseif nNewPhase == 0 then
BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET)
EgtRotateRawPart( nRawId, X_AX(), 180)
-- se grezzo successivo senza pezzi e finale, va tolto
@@ -1295,6 +1390,7 @@ function BeamExec.ProcessFeatures()
end
-- se richiesta rotazione
if bSomeSide and not BD.DOWN_HEAD and not BD.TURN then
sDownOrSideOrStd = 'side'
-- vettore movimento grezzi per rotazione di 90deg
local dDeltaYZ = EgtGetRawPartBBox( nRawId):getDimY() - EgtGetRawPartBBox( nRawId):getDimZ()
local vtMove = Vector3d( 0, dDeltaYZ / 2, dDeltaYZ / 2)
@@ -1314,7 +1410,7 @@ function BeamExec.ProcessFeatures()
-- creo la lavorazione
local Proc = vProc[i]
if Proc.Flg ~= 0 and Proc.Side then
local bOk, sMsg, bNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw)
local bOk, sMsg, nNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dCurrOvmT)
if not bOk then
nTotErr = nTotErr + 1
table.insert( Stats, {Err=1, Msg=sMsg, Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId})
@@ -1325,7 +1421,9 @@ function BeamExec.ProcessFeatures()
end
if bOk then nSideMchOk = nSideMchOk + 1 end
-- se era taglio di separazione, aggiungo nuova fase
if bNewPhase then
if nNewPhase > 0 then
nPhase = nNewPhase
elseif nNewPhase == 0 then
BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET)
if bPreMove then EgtMoveRawPart( nRawId, vtMove) end
EgtRotateRawPart( nRawId, X_AX(), EgtIf( BD.RIGHT_LOAD, -90, 90))
@@ -1364,12 +1462,13 @@ function BeamExec.ProcessFeatures()
EgtSetInfo( nDispId, 'TYPE', EgtIf( not bSplitRot, 'MID', 'END2'))
EgtSetInfo( nDispId, 'ORD', nOrd)
end
sDownOrSideOrStd = 'standard'
-- inserisco le lavorazioni non ribaltate della trave
for i = 1, #vProc do
-- creo la lavorazione
local Proc = vProc[i]
if Proc.Flg ~= 0 and ( not ( Proc.Down or Proc.Side) or BD.DOWN_HEAD or BD.TURN) then
local bOk, sMsg, bNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw)
local bOk, sMsg, nNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw, nOrd, sDownOrSideOrStd, nil, nil, dCurrOvmT)
if not bOk then
nTotErr = nTotErr + 1
table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
@@ -1379,7 +1478,9 @@ function BeamExec.ProcessFeatures()
table.insert( Stats, {Err=0, Msg='', Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
end
-- se era taglio di separazione, aggiungo nuova fase
if bNewPhase then
if nNewPhase > 0 then
nPhase = nNewPhase
elseif nNewPhase == 0 then
BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET)
-- se grezzo successivo senza pezzi e finale, va tolto
local nNextRawId = EgtGetNextRawPart( nRawId)
+21 -14
View File
@@ -1,4 +1,4 @@
-- BeamLib.lua by Egaltech s.r.l. 2022/05/03
-- BeamLib.lua by Egaltech s.r.l. 2022/05/18
-- Libreria globale per Travi
-- 2020/07/28 Corretto calcolo attacchi e uscite di lame per non uscire dalla faccia sotto.
-- 2020/08/18 Aggiunto a GetNearestParalOpposite e GetNearestOrthoOpposite parametro opzionale vtNorm.
@@ -11,6 +11,7 @@
-- 2022/01/11 In GetNearest*Opposite ridotto vantaggio XY rispetto a Z da 1 -> 0.9 a 1 -> 0.99.
-- 2022/04/05 Modifiche a GetNzLimDownUp per FAST.
-- 2022/05/03 Ulteriore limitazione a GetNzLimDownUp per FAST.
-- 2022/05/18 Correzioni e migliorie a PutStartNearestToEdge.
-- Tabella per definizione modulo
local BeamLib = {}
@@ -194,30 +195,36 @@ function BeamLib.PutStartNearestToEdge( nCrvId, b3Raw, bDown)
-- recupero il versore normale al piano di lavoro o estrusione
local vtN = EgtCurveExtrusion( nCrvId, GDB_ID.ROOT)
-- coefficienti per riportare la distanza nel piano di lavoro
local dCoeffX = 1 / ( sqrt( 1 - vtN:getX() * vtN:getX()))
local dCoeffY = 1 / ( sqrt( 1 - vtN:getY() * vtN:getY()))
local dCoeffZ = 1 / ( sqrt( 1 - vtN:getZ() * vtN:getZ()))
local dCoeffY = 0
if abs( vtN:getY()) < 0.999 then dCoeffY= 1 / ( sqrt( 1 - vtN:getY() * vtN:getY())) end
local dCoeffZ = 0
if abs( vtN:getZ()) < 0.999 then dCoeffZ = 1 / ( sqrt( 1 - vtN:getZ() * vtN:getZ())) end
-- cerco l'estremo più vicino al box e lo imposto come inizio (se da sotto escludo Zmax e viceversa)
local dUopt = 0
local dDopt = GEO.INFINITO
local dZopt = GEO.INFINITO
local dUi, dUf = EgtCurveDomain( nCrvId)
for dU = dUi, dUf, 0.5 do
local ptP = EgtUP( nCrvId, dU, GDB_ID.ROOT)
if ptP then
local vtDp = EgtUV( nCrvId, dU, -1, GDB_ID.ROOT)
local vtDs = EgtUV( nCrvId, dU, 1, GDB_ID.ROOT)
local bTg = ( vtDp and vtDs and vtDp * vtDs > 0.96)
if ptP and bTg then
local vtMin = ptP - b3Raw:getMin()
local vtMax = ptP - b3Raw:getMax()
local dD = abs( vtMin:getX()) * dCoeffX
dD = min( abs( vtMax:getX()) * dCoeffX, dD)
dD = min( abs( vtMin:getY()) * dCoeffY, dD)
local dD = abs( vtMin:getY()) * dCoeffY
dD = min( abs( vtMax:getY()) * dCoeffY, dD)
if bDown then
dD = min( abs( vtMin:getZ()) * dCoeffZ, dD)
else
dD = min( abs( vtMax:getZ()) * dCoeffZ, dD)
end
if dD < dDopt + GEO.EPS_SMALL then
dD = min( abs( vtMin:getZ()) * dCoeffZ, dD)
dD = min( abs( vtMax:getZ()) * dCoeffZ, dD)
local dZ = abs( EgtIf( bDown, vtMin:getZ(), vtMax:getZ())) * dCoeffZ
if dD < dDopt + 10 and dZ < dZopt + GEO.EPS_SMALL then
dUopt = dU
dDopt = min( dD, dDopt)
dZopt = dZ
elseif dD < dDopt - 10 or ( dD < dDopt + GEO.EPS_SMALL and dZ < dZopt + GEO.EPS_SMALL) then
dDopt = dD
dUopt = dU
dZopt = dZ
end
end
end
+101
View File
@@ -0,0 +1,101 @@
-- FaceByPocket.lua by Egaltech s.r.l. 2022/05/82
-- Gestione svuotatura di feature con una faccia
-- Tabella per definizione modulo
local FaceByPocket = {}
-- Include
require( 'EgtBase')
local BL = require( 'BeamLib')
EgtOutLog( ' FaceByPocket started', 1)
-- Dati
local BD = require( 'BeamData')
local ML = require( 'MachiningLib')
---------------------------------------------------------------------
local function ApplyPocket( Proc, nSurfId, nFacet, sPocketing, nInd, dMaxElev, vtN)
-- inserisco la lavorazione di svuotatura
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. nInd
local nMchFId = EgtAddMachining( sName, sPocketing)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nSurfId, nFacet}})
-- imposto uso faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT)
if dMaxElev > 0.1 then
-- imposto elevazione
local sNotes = 'MaxElev=' .. EgtNumToString( dMaxElev, 2) .. ';'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
end
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE
if not BD.C_SIMM and not BD.TURN then
nSCC = EgtIf( vtN:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
return true
end
---------------------------------------------------------------------
function FaceByPocket.Make( Proc, nSurfId, nFacet, sPocketing, nPartId, b3Solid)
local bOk = true
local sErr
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati dell'utensile
local dStep = 30
local dMaxDepth = 100
if EgtMdbSetCurrMachining( sPocketing) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
dStep = EgtMdbGetCurrMachiningParam( MCH_MP.STEP) or dStep
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- dati della faccia
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT)
local dElev = BL.GetFaceElevation( nSurfId, nFacet, nPartId)
-- determino numero e valore degli step di lavorazione
local nSurfStep = ceil( dElev / dMaxDepth)
local dSurfStep = dElev / nSurfStep
-- copio superfice al passo superfice e vi applico la lavorazione
for i = nSurfStep, 2, -1 do
local ptOn = ptC + ( dSurfStep * ( i - 1)) * vtN
local nAddIdTmp = EgtSurfTmPlaneInBBox( nAddGrpId, ptOn, vtN, b3Solid, GDB_RT.GLOB)
if nAddIdTmp then
EgtSetName( nAddIdTmp, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( nAddIdTmp, 'TASKID', Proc.TaskId)
-- aggiungo lavorazione
bOk, sErr = ApplyPocket( Proc, nAddIdTmp, 0, sPocketing, i, dSurfStep, vtN)
if not bOk then
return false, sErr
end
end
end
-- faccio ultima superfice
bOk, sErr = ApplyPocket( Proc, nSurfId, nFacet, sPocketing, 1, EgtIf( nSurfStep > 1, dSurfStep, 0), vtN)
if not bOk then
return false, sErr
end
return true
end
return FaceByPocket
+1 -1
View File
@@ -356,7 +356,7 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead)
end
end
local bH2, sOrigType = EndsWith( sType, '_H2')
if ( not BEAM or not BEAM.BW) and MachineHeadUse == TWO_UP_DOWN_HEADS and bH2 and bTopHead then
if ( not BEAM or not BEAM.BW) and MachineHeadType == TWO_UP_DOWN_HEADS and bH2 and bTopHead then
return FindMachining( MachiningType, sOrigType, Params, true, false)
end
end
+7 -3
View File
@@ -1,5 +1,6 @@
-- ProcessBlockHausFront.lua by Egaltech s.r.l. 2020/08/03
-- Gestione calcolo giunzione block house in testa
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- Tabella per definizione modulo
local ProcessBlockHausFront = {}
@@ -43,7 +44,10 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
if not dOvmTail then
dOvmTail = BD.OVM_MID
end
-- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
@@ -141,7 +145,7 @@ function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCut = false
end
-- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
bCut = false
end
-- se va fatto, inserisco la lavorazione
@@ -233,7 +237,7 @@ function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCut = false
end
-- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
bCut = false
end
-- se va fatto, inserisco la lavorazione
+37 -23
View File
@@ -8,7 +8,8 @@
-- 2022/01/26 Taglio da sotto orizzontale deve avere direzione di riferimento ortogonale -Z.
-- 2022/02/02 Modifiche per tagli di coda spostati prima come lavorazione su pezzi a caduta.
-- 2022/02/06 Correzioni per tagli di coda spostati prima.
-- 2022/05/31 Alcune modifiche per utilizzare la ProcessCut.Make in ProcessSplit e ProcessHeadCut, per le sezioni alte e larghe.
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- Tabella per definizione modulo
local ProcessCut = {}
@@ -221,9 +222,11 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione con testa da sopra
local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut)
-- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId)
local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes)
if not b3Raw then
-- ingombro del grezzo
b3Raw = EgtGetRawPartBBox( nRawId)
end
-- ingombro del pezzo
local Ls = EgtGetFirstNameInGroup( nPartId, 'Box')
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
@@ -328,7 +331,11 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
vtExtra = X_AX()
bAutoCalcSurf = false
end
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA)
if bForced then
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Raw, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA)
else
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA)
end
-- se taglio sborda in coda e non è stato inserito nessun taglio a cubetti, lo rilancio con le dimensioni customizzate
if ( bFillTail or bCustDiceCut) and #vCuts == 0 then
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, Proc.Box:getDimY())
@@ -444,7 +451,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
end
local dVzLimDwnUp = dNzLimDwnUp
if not BD.C_SIMM and vtN:getZ() > 0.707 then dVzLimDwnUp = -0.708 end
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, sNotes, b3Raw)
if not bOk then
return bOk, sErr
end
@@ -692,27 +699,34 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut)
-- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId)
function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, dOvmTail)
if not dOvmTail then
dOvmTail = BD.OVM_MID
end
if not b3Raw then
-- ingombro del grezzo
b3Raw = EgtGetRawPartBBox( nRawId)
end
-- dati geometrici del taglio
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
-- se taglio di testa
if Proc.Head then
-- se coincide con il taglio di separazione precedente, non va fatto
if AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Raw:getMax():getX() + dOvmHead) < 10 * GEO.EPS_SMALL then
if not bForced then
if Proc.Head then
-- se coincide con il taglio di separazione precedente, non va fatto
if AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Raw:getMax():getX() + dOvmHead) < 10 * GEO.EPS_SMALL then
return true
end
-- altrimenti taglio di coda
else
-- se coincide con taglio di separazione, non va fatto
if AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
return true
end
end
-- se coincide con un taglio frontale non va fatto
if Proc.CutFront then
return true
end
-- altrimenti taglio di coda
else
-- se coincide con taglio di separazione, non va fatto
if AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
return true
end
end
-- se coincide con un taglio frontale non va fatto
if Proc.CutFront then
return true
end
-- abilitazione lavorazione da sotto (testa da sotto e direzione normale sotto -20deg e sbandato oltre 1deg oppure sezione larga o pezzo corto)
local bDownHead = ( BD.DOWN_HEAD and vtN:getZ() < -0.341 and
@@ -729,7 +743,7 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom,
end
-- se taglio con testa da sopra
if not bDownHead then
return MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut)
return MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes)
-- altrimenti taglio con testa da sotto
else
return MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut)
+9 -5
View File
@@ -1,5 +1,6 @@
-- ProcessDovetail.lua by Egaltech s.r.l. 2021/02/04
-- Gestione calcolo giunzione coda di rondine
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- Tabella per definizione modulo
local ProcessDovetail = {}
@@ -1380,7 +1381,7 @@ local function Make2Faces( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
end
---------------------------------------------------------------------
local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid)
local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, dOvmTail)
-- recupero la geometria ausiliaria
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
@@ -1427,7 +1428,7 @@ local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
return true
end
-- verifico se coincide con taglio di coda
if not bHead and AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
if not bHead and AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
return true
end
-- inserisco la lavorazione
@@ -1710,7 +1711,10 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
function ProcessDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
if not dOvmTail then
dOvmTail = BD.OVM_MID
end
-- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId)
-- in base al tipo di feature attribuisco il significato dei parametri Q
@@ -1735,7 +1739,7 @@ function ProcessDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- se ha due facce ( allora è di testa o coda)
if Proc.Fct == 2 then
-- eventuale taglio di testa o coda
local bAuxOk, sAuxErr = MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid)
local bAuxOk, sAuxErr = MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, dOvmTail)
if not bAuxOk then return bAuxOk, sAuxErr end
-- lavorazione della feature
local bOk, sErr = Make2Faces( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, bForceUseRough)
@@ -1743,7 +1747,7 @@ function ProcessDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- se ha 3 facce ed è di testa o coda
elseif Proc.Fct == 3 and ( Proc.Head or Proc.Tail) then
-- eventuale taglio di testa o coda
local bAuxOk, sAuxErr = MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid)
local bAuxOk, sAuxErr = MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, dOvmTail)
if not bAuxOk then return bAuxOk, sAuxErr end
-- lavorazione della feature
if bForceUseRough then
+7 -3
View File
@@ -1,5 +1,6 @@
-- ProcessFrenchRidgeLap.lua by Egaltech s.r.l. 2020/02/11
-- Gestione calcolo giunzione francese
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- Tabella per definizione modulo
local ProcessFrenchRidgeLap = {}
@@ -38,7 +39,10 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessFrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
function ProcessFrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
if not dOvmTail then
dOvmTail = BD.OVM_MID
end
-- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
@@ -192,7 +196,7 @@ function ProcessFrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCut = false
end
-- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
bCut = false
end
-- se va fatto, inserisco la lavorazione
@@ -212,7 +216,7 @@ function ProcessFrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCut = false
end
-- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
bCut = false
end
-- se va fatto, inserisco la lavorazione
+34 -4
View File
@@ -1,5 +1,7 @@
-- ProcessSplit.lua by Egaltech s.r.l. 2022/01/25
-- Gestione calcolo tagli di testa per Travi
-- 2022/05/31 Aggiunta gestione sezioni alte e larghe con taglio di tipo diceCut.
-- 2022/06/10 Per sezioni alte e larghe aggiunta gestione finitura in base a sovramateriale e a parametro Q05 dell' eventuale lavorazione sostituita.
-- Tabella per definizione modulo
local ProcessHeadCut = {}
@@ -8,6 +10,8 @@ local ProcessHeadCut = {}
require( 'EgtBase')
local BL = require( 'BeamLib')
local Fbs = require( 'FacesBySaw')
local Cut = require( 'ProcessCut')
local Pocket = require( 'FaceByPocket')
EgtOutLog( ' ProcessHeadCut started', 1)
@@ -170,10 +174,11 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
end
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
-- caratteristiche taglio
local bHorizCut = (( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA)
local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, BD.MAX_DIM_HTCUT_HBEAM)
local bDoubleHorizCut = ( BD.DOWN_HEAD and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and ( b3Raw:getDimZ() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bHorizCut = ( not bBigSectionCut and ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA)
local bDoubleHorizCut = ( BD.DOWN_HEAD and not bBigSectionCut and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bDoubleCut = ( not bBigSectionCut and not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
-- dati geometrici del taglio
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
-- se non obbligatorio e coincide con inizio grezzo, non va fatto
@@ -183,8 +188,33 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
-- determino se più tagli con offset
local nCuts = max( ceil( dOvmHead / ( BD.MAX_LEN_SCRAP_START or BD.MAX_LEN_SCRAP)), 1)
local dOffsL = dOvmHead / nCuts
-- se taglio per sezioni alte e larghe
if bBigSectionCut then
if dOvmHead > 0 then
-- se finitura con lama
if not nOriId or EgtGetInfo( nOriId, 'Q05', 'i') == 1 or EgtGetInfo( nOriId, 'Q05', 'i') == 0 then
local bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, dCurrOvmT)
if not bOk then return bOk, sErr end
-- se finitura con truciolatore
elseif EgtGetInfo( nOriId, 'Q05', 'i') == 2 then
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then
local sErr = 'Error : part box not found'
EgtOutLog( sErr)
return false, sErr
end
local sPocketing = ML.FindPocketing( 'OpenPocket', nil, 0)
if not sPocketing then
local sErr = 'Error : pocketing not found in library'
EgtOutLog( sErr)
return false, sErr
end
local bOk, sErr = Pocket.Make( Proc, Proc.Id, 0, sPocketing, nPartId, b3Solid)
if not bOk then return bOk, sErr end
end
end
-- se tagli standard
if not bDoubleHorizCut then
elseif not bDoubleHorizCut then
-- flag di lavorazione faccia
local nOrthoOpposite = EgtIf( bHorizCut, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_FRONT)
-- calcolo extra taglio ed accorciamento
+73 -47
View File
@@ -1,4 +1,4 @@
-- ProcessLapJoint.lua by Egaltech s.r.l. 2022/05/04
-- ProcessLapJoint.lua by Egaltech s.r.l. 2022/05/24
-- Gestione calcolo mezzo-legno per Travi
-- 2019/10/08 Agg. gestione OpenPocket.
-- 2021/01/24 Con sega a catena ora sempre impostato asse A.
@@ -41,6 +41,8 @@
-- 2022/03/29 Aggiunta gestione antischeggia con Q06 anche su 3/4-033-X.
-- 2022/04/28 Lavorazione BH forzata sempre OneWay.
-- 2022/05/04 Corretta classificazione due facce sotto. Modificati criteri assegnazione due facce alla coda.
-- 2022/05/24 Miglioramenti vari per BH, compreso controlli per lavorazione da sotto.
-- 2022/05/31 Rese globali le funzioni GetChainSawBlockedAxis e GetChainSawInitAngs per essere richiamate dalla ProcessSplit per taglio sega a catena in sezioni alte e larghe.
-- Tabella per definizione modulo
local ProcessLapJoint = {}
@@ -254,7 +256,7 @@ local function TestElleShape4( Proc)
end
---------------------------------------------------------------------
local function GetChainSawBlockedAxis( nInd)
function ProcessLapJoint.GetChainSawBlockedAxis( nInd)
if BD.GetChainSawBlockedAxis then
return BD.GetChainSawBlockedAxis( nInd)
else
@@ -267,7 +269,7 @@ local function GetChainSawBlockedAxis( nInd)
end
---------------------------------------------------------------------
local function GetChainSawInitAngs( vtN, vtO, nInd)
function ProcessLapJoint.GetChainSawInitAngs( vtN, vtO, nInd)
if BD.GetChainSawInitAngs then
return BD.GetChainSawInitAngs( vtN, vtO, nInd)
else
@@ -382,7 +384,7 @@ local function VerifyBHSideMill( Proc, bIsU, bIsL, bSinglePart, bPrevBhSideMill)
-- le facce devono contenere X e quelle di chiusura devono essere perpendicolari a X
local bStopY, bStopZ
for i = 1, Proc.Fct do
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, i-1, GDB_ID.ROOT)
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i-1, GDB_ID.ROOT)
if abs( vtN:getX()) > 0.001 and abs( vtN:getX()) < 0.999962 then
return false
end
@@ -412,20 +414,35 @@ local function VerifyBHSideMill( Proc, bIsU, bIsL, bSinglePart, bPrevBhSideMill)
-- recupero i dati dell'utensile
local dToolLength = 0
local dToolDiam = 0
local dMaxDepth = 0
local dThickTool = 0
local dToolMaxDepth = 0
local dToolThick = 0
local dToolFreeLen = 0
if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dToolLength = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dToolLength
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
dThickTool = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dThickTool
local dToolThDiam = EgtTdbGetCurrToolThDiam() or 150
if ( EgtTdbGetCurrToolParam( MCH_TP.TYPE) & MCH_TF.SAWBLADE) ~= 0 then
dToolMaxDepth = EgtTdbGetCurrToolMaxDepth() or dToolMaxDepth
dToolThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dToolThick
dToolFreeLen = dToolLength
else
dToolMaxDepth = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDEDEPTH', 'd') or 0.5 * ( dToolDiam - dToolThDiam)
dToolThick = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
dToolFreeLen = EgtTdbGetCurrToolMaxDepth() or dToolFreeLen
end
end
end
-- verifico se abbastanza larga (oppure L) rispetto all'utensile
if Proc.Box:getDimX() < dThickTool - 15 * GEO.EPS_SMALL and not bIsL then
if Proc.Box:getDimX() < dToolThick - 15 * GEO.EPS_SMALL and not bIsL then
return false
end
-- limiti trasversali
local dDepth = min( Proc.Box:getDimY(), Proc.Box:getDimZ())
if dDepth > dToolMaxDepth then
return false
end
@@ -440,14 +457,14 @@ local function VerifyBHSideMill( Proc, bIsU, bIsL, bSinglePart, bPrevBhSideMill)
local bHead = bHeadDir
-- verifico se raggiungibile con la testa senza collisioni
local bUseBHSideMill = EgtIf( bHead, ( dMaxT - dMinXF), ( dMaxXF - dMinT)) < dMaxDepth
local bUseBHSideMill = EgtIf( bHead, ( dMaxT - dMinXF), ( dMaxXF - dMinT)) < dToolFreeLen
-- se diametro utensile maggiore della testa
if BD.HEAD_DIM_FOR_BH and dToolDiam > BD.HEAD_DIM_FOR_BH then
if BD.HEAD_DIM_FOR_BH and dToolDiam - 2 * dDepth > BD.HEAD_DIM_FOR_BH then
bHead = true
bUseBHSideMill = true
end
return bUseBHSideMill, bHead, bHeadDir, sMilling, dThickTool, dToolDiam
return bUseBHSideMill, bHead, bHeadDir, sMilling, dToolThick, dToolDiam
end
---------------------------------------------------------------------
@@ -557,6 +574,29 @@ local function CalcCollisionSafety( vtDir)
return dCollSic
end
---------------------------------------------------------------------
local function UpdateEncumbrance( Proc, nRawId, b3Raw, b3Solid)
-- verifico siano una o due facce
if Proc.Fct > 2 then return end
-- eventuale segnalazione ingombro di testa o coda
local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ())
if Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng then
if Proc.Head then
local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX()
BL.UpdateHCING( nRawId, dOffs)
elseif Proc.Tail then
local dOffs = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
BL.UpdateTCING( nRawId, dOffs)
elseif Proc.Fct > 1 and Proc.Box:getCenter():getX() > b3Solid:getCenter():getX() then
local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX()
local dDist = b3Solid:getMax():getX() - Proc.Box:getMax():getX()
-- sempre concavo aumento la distanza (rimane una punta...)
dDist = dDist + 10
BL.UpdateHCING( nRawId, dOffs, dDist)
end
end
end
---------------------------------------------------------------------
-- Verifica se feature di testa
function ProcessLapJoint.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
@@ -660,11 +700,6 @@ end
function ProcessLapJoint.Classify( Proc, b3Raw)
-- se 1 faccia
if Proc.Fct == 1 then
-- dati della faccia
--local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
-- verifico se è lavorabile solo dal basso
--local bDown = ( vtN:getZ() < BD.NZ_MINA)
--return true, bDown
return true, false
-- se 2 facce
elseif Proc.Fct == 2 then
@@ -764,9 +799,14 @@ function ProcessLapJoint.Classify( Proc, b3Raw)
rfFac:rotate( rfFac:getOrigin(), rfFac:getVersZ(), 90)
end
-- se può essere fatto con utensile tipo lama
local bUseBHSideMill = VerifyBHSideMill( Proc)
local bUseBHSideMill, _, _, _, _, dTDiam = VerifyBHSideMill( Proc)
if bUseBHSideMill then
return true, false
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
if vtN:getZ() > -0.5 or b3Raw:getDimZ() - Proc.Box:getDimZ() < ( BD.MAX_DIST_BH_FROM_BOTTOM or 395) - dTDiam / 2 then
return true, false
else
return true, true
end
-- altrimenti controllo se deve essere ruotato con le altre lavorazioni
else
-- dati della faccia
@@ -863,16 +903,7 @@ local function MakeOneFaceByMill( Proc, nPhase, nRawId, nPartId)
return false, sErr
end
-- eventuale segnalazione ingombro di testa o coda
local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ())
if Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng then
if Proc.Head then
local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX()
BL.UpdateHCING( nRawId, dOffs)
elseif Proc.Tail then
local dOffs = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
BL.UpdateTCING( nRawId, dOffs)
end
end
UpdateEncumbrance( Proc, nRawId, b3Raw, b3Solid)
return true
end
@@ -1040,22 +1071,7 @@ local function MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId, bDownHead)
return false, sErr
end
-- eventuale segnalazione ingombro di testa o coda
local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ())
if Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng then
if Proc.Head then
local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX()
BL.UpdateHCING( nRawId, dOffs)
elseif Proc.Tail then
local dOffs = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
BL.UpdateTCING( nRawId, dOffs)
elseif Proc.Box:getCenter():getX() > b3Solid:getCenter():getX() then
local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX()
local dDist = b3Solid:getMax():getX() - Proc.Box:getMax():getX()
-- sempre concavo aumento la distanza (rimane una punta...)
dDist = dDist + 10
BL.UpdateHCING( nRawId, dOffs, dDist)
end
end
UpdateEncumbrance( Proc, nRawId, b3Raw, b3Solid)
return true
end
@@ -2664,7 +2680,6 @@ local function MakeByMillAsSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
return false, sErr
end
end
if bOrthoFaces then
-- ottengo le dimensioni del tunnel
local dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt = GetTunnelDimension( Proc, nPartId)
@@ -4531,6 +4546,15 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
if bMakeBySideMill then
-- se smusso non è esclusivo
if nChamfer < 2 then
-- verifico che la faccia non sia diretta come X, altrimenti cerco di cambiarla
if abs( vtN:getX()) > 0.866 and nFacInd2 then
local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd2, GDB_ID.ROOT)
if vtN2 and abs( vtN2:getX()) < 0.866 then
nFacInd, nFacInd2 = nFacInd2, nFacInd
dFacElev, dFacElev2 = dFacElev2, dFacElev
vtN, vtN2 = vtN2, vtN
end
end
-- se lavorazione da sotto e lunga, va divisa in due metà
local bDouble = ( vtN:getZ() < -0.5 and dH > ( BD.MAX_LEN_BH_FROM_BOTTOM or 200))
-- inserisco la lavorazione di fresatura
@@ -4573,7 +4597,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
EgtSetMachiningParam( MCH_MP.ENDADDLEN, 0)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG)
EgtSetMachiningParam( MCH_MP.LOTANG, -( dToolDiam / 2 + b3Raw:getDimY() + BD.CUT_SIC))
EgtSetMachiningParam( MCH_MP.LOPERP, dFacElev + BD.COLL_SIC)
EgtSetMachiningParam( MCH_MP.LOPERP, EgtIf( vtN:getZ() > -0.5, dFacElev + BD.COLL_SIC, BD.COLL_SIC))
if bDouble then
EgtSetMachiningParam( MCH_MP.ENDADDLEN, - dH / 2)
EgtSetMachiningParam( MCH_MP.LOTANG, -( dToolDiam / 2 + dH / 2 + BD.CUT_SIC))
@@ -5298,6 +5322,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
end
end
end
-- eventuale segnalazione ingombro di testa o coda
UpdateEncumbrance( Proc, nRawId, b3Raw, b3Solid)
end
return true, sWarn, bPrevBhSideMill
+32 -27
View File
@@ -254,7 +254,7 @@ local function CalcBladeUse( bUseBlade, bDown_Head, nSide, vtN1, vtN2, bConvex,
end
end
else
if ( vtN1 and vtN1:getZ() >= EgtIf( dCustomAngle, dCustomAngle, -0.5)) or ( vtN2 and vtN2:getZ() >= -0.5) then
if ( vtN1 and vtN1:getZ() >= EgtIf( dCustomAngle, dCustomAngle, -0.5)) and ( not vtN2 or vtN2:getZ() >= -0.5) then
bCanUseBlade = true
end
end
@@ -305,39 +305,21 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
local bConvex
local bOrtho
local ptM
local ptRef = ( ptC[1] + ptC[2]) / 2
if bInt then
bConvex = ( dAng >= 0)
bOrtho = ( abs( dAng + 90) < 1)
ptM = ( ptP1 + ptP2) / 2
else
bConvex = true
ptM = ptRef
local vtM1 = ptC[1] - ptM ; vtM1:normalize()
local vtM2 = ptC[2] - ptM ; vtM2:normalize()
bConvex = ( vtM1 * vtN[1] > 0 and vtM2 * vtN[2] > 0)
bOrtho = false
dAng = acos( vtN[1] * vtN[2])
ptM = ( ptC[1] + ptC[2]) / 2
-- se facce contrapposte e quindi concavo, angolo sempre negativo
if not bConvex and dAng > 0 then dAng = -dAng end
end
local ptRef = ( ptC[1] + ptC[2]) / 2
-- analisi del taglio
local vOrd = {}
local vFaceUse = {}
if nSide == 1 or ( nSide == -1 and ( BD.DOWN_HEAD or BD.TURN)) then
vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1})
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
elseif nSide == -1 then
vOrd = EgtIf( ptC[1]:getY() < ptM:getY(), { 1, 2}, { 2, 1})
vFaceUse = { BL.GetNearestParalOpposite( ptC[1] - ptM), BL.GetNearestParalOpposite( ptC[2] - ptM)}
else
local bFront = ( vtN[1]:getY() < 0)
if bFront then
vOrd = EgtIf( ptC[1]:getZ() < ptM:getZ(), { 1, 2}, { 2, 1})
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
else
vOrd = EgtIf( ptC[1]:getZ() < ptM:getZ(), { 2, 1}, { 1, 2})
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
end
end
local vWidth = {}
_, _, vWidth[1] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[1])
_, _, vWidth[2] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[2])
-- ottengo la distanza tra la fine del pezzo e il pezzo successivo
local dDistToNextPiece = EgtGetInfo( nRawId, 'BDST', 'd') or 5.4
@@ -380,6 +362,29 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
return false, sErr
end
-- analisi del taglio
local vOrd = {}
local vFaceUse = {}
if nSide == 1 or ( nSide == -1 and ( BD.DOWN_HEAD or BD.TURN)) then
vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1})
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
elseif nSide == -1 then
vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1})
vFaceUse = { BL.GetNearestParalOpposite( ptC[1] - ptM), BL.GetNearestParalOpposite( ptC[2] - ptM)}
else
local bFront = ( vtN[1]:getY() < 0)
if bFront then
vOrd = EgtIf( ptC[1]:getZ() < ptRef:getZ(), { 1, 2}, { 2, 1})
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
else
vOrd = EgtIf( ptC[1]:getZ() < ptRef:getZ(), { 2, 1}, { 1, 2})
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
end
end
local vWidth = {}
_, _, vWidth[1] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[1])
_, _, vWidth[2] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[2])
-- Se senza facce limitanti, da sopra o ( da tutte i lati con testa da sotto) e taglio di lama e lunghezza facce maggiore del parametro lunghezza minima
if nFaceLimit == 0 and ( bCanUseUnderBlade or bCanUseBlade) and bUseBlade and Proc.Box:getDimX() > dLimMinPiece - 1 then
@@ -755,7 +760,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- se faccia da sotto e Z centro faccia è minore del centro altra faccia, segno il limite angolare da passare
-- dovrebbe essere il limite angolare della testa 1 in sottosquadra
if nSide == -1 and not BD.DOWN_HEAD then
if ptC[vOrd[j]]:getZ() < ptC[vOrd[OthFace]]:getZ() then
if ptC[vOrd[j]]:getZ() < ptC[vOrd[OthFace]]:getZ() - 1. then
dSinLimit = -0.0157
else
dSinLimit = -0.5
+6 -2
View File
@@ -1,5 +1,6 @@
-- ProcessSawCut.lua by Egaltech s.r.l. 2022/03/07
-- Gestione calcolo taglio di lama per Travi
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- Tabella per definizione modulo
local ProcessSawCut = {}
@@ -36,7 +37,10 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
if not dOvmTail then
dOvmTail = BD.OVM_MID
end
-- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
@@ -71,7 +75,7 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- altrimenti taglio di coda
else
-- se coincide con taglio di separazione, non va fatto
if AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
if AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
return true
end
end
+6 -2
View File
@@ -1,6 +1,7 @@
-- ProcessScarfJoint.lua by Egaltech s.r.l. 2021/06/28
-- Gestione calcolo giunto Gerber per Travi
-- 2021/06/28 Aggiunto extra-taglio alle lamate orizzontali.
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- Tabella per definizione modulo
local ProcessScarfJoint = {}
@@ -198,7 +199,10 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
if not dOvmTail then
dOvmTail = BD.OVM_MID
end
-- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
@@ -401,7 +405,7 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCut = false
end
-- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[5]], - X_AX()) and abs( ptC[vFaceOrd[5]]:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[5]], - X_AX()) and abs( ptC[vFaceOrd[5]]:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
bCut = false
end
-- se va fatto, inserisco la lavorazione
+6 -2
View File
@@ -1,5 +1,6 @@
-- ProcessSimpleScarf.lua by Egaltech s.r.l. 2020/06/04
-- Gestione calcolo giunto Gerber per Travi
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- Tabella per definizione modulo
local ProcessSimpleScarf = {}
@@ -124,7 +125,10 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
if not dOvmTail then
dOvmTail = BD.OVM_MID
end
-- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
@@ -208,7 +212,7 @@ function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCut = false
end
-- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
bCut = false
end
-- se va fatto, inserisco la lavorazione
+173 -6
View File
@@ -1,5 +1,7 @@
-- ProcessSplit.lua by Egaltech s.r.l. 2022/01/25
-- Gestione calcolo tagli di separazione per Travi
-- 2022/05/31 Aggiunta gestione sezioni alte e larghe con taglio con sega a catena seguito da rifinitura con lama (aggiunta funzione MakeSplitByChainSaw); gestione eventuale creazione nuova fase dall'interno della Make.
-- 2022/06/10 Per sezioni alte e larghe aggiunta gestione finitura in base a sovramateriale e a parametro Q05 dell' eventuale lavorazione sostituita.
-- Tabella per definizione modulo
local ProcessSplit = {}
@@ -8,6 +10,9 @@ local ProcessSplit = {}
require( 'EgtBase')
local BL = require( 'BeamLib')
local Fbs = require( 'FacesBySaw')
local LapJoint = require( 'ProcessLapJoint')
local Cut = require( 'ProcessCut')
local Pocket = require( 'FaceByPocket')
EgtOutLog( ' ProcessSplit started', 1)
@@ -140,9 +145,94 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
return true, nil
end
---------------------------------------------------------------------
-- lavorazione con sega a catena per sezioni alte e larghe
local function MakeSplitByChainSaw( nSurfId, nFaceUse, dDepth, sNotes, dOffs)
-- Recupero i dati dell'utensile
local sSawing = ML.FindSawing('Sawing')
local dMaxMat = 0
local dSawCornerRad = 0
local dSawThick = 0
-- se non trova una lavorazione di sawing esco
if not sSawing then
local sErr = 'Error : Sawing not found in library'
EgtOutLog( sErr)
return false, sErr, 'MNF'
else
-- recupero i dati dell'utensile
if EgtMdbSetCurrMachining( sSawing) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick
dSawCornerRad = EgtTdbGetCurrToolParam( MCH_TP.CORNRAD) or dSawCornerRad
end
end
end
-- inserisco la lavorazione di sawing
local sName = 'Csaw_' .. ( EgtGetName( nSurfId) or tostring( nSurfId)) .. '_1'
local nMchFId = EgtAddMachining( sName, sSawing)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sSawing
EgtOutLog( sErr)
return false, sErr
end
sName = EgtGetOperationName( nMchFId)
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nSurfId, 0}})
-- imposto uso del lato faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- imposto angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, LapJoint.GetChainSawBlockedAxis( 2))
local _, vtN = EgtSurfTmFacetCenter( nSurfId, 0, GDB_ID.ROOT)
vtOrthO = BL.GetVersRef( nFaceUse)
EgtSetMachiningParam( MCH_MP.INITANGS, LapJoint.GetChainSawInitAngs( vtN, vtOrtho, 2))
-- imposto offset radiale per mantenere il materiale in coda per la finitura
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
-- imposto allungamento percorso iniziale e finale a zero
EgtSetMachiningParam( MCH_MP.STARTADDLEN, 0)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, 0)
-- faccio in modo che l'attacco della lama sia dal lato opposto rispetto al corpo macchina
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
if dMaxMat >= dDepth then
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- se massimo affondamento utensile inferiore fessura, setto affondamento ed emetto warning
else
EgtSetMachiningParam( MCH_MP.DEPTH, dMaxMat)
sWarn = 'Warning : elevation bigger than max tool depth'
EgtOutLog( sWarn)
end
-- eventuali note
if sNotes and #sNotes > 0 then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end
-- eseguo
if not ML.ApplyMachining( true, false) then
if EgtGetOutstrokeInfo() then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
-- impostazione alternativa angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, LapJoint.GetChainSawBlockedAxis( 1))
EgtSetMachiningParam( MCH_MP.INITANGS, LapJoint.GetChainSawInitAngs( vtN, vtOrtho, 1))
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end
if EgtIsMachiningEmpty() then
_, sWarn = EgtGetMachMgrWarning( 0)
EgtSetOperationMode( nMchFId, false)
return false, sWarn
end
--end
return true, sName, nMchFId
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dOvmTail)
-- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId)
-- inserimento smussi
@@ -170,10 +260,11 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
end
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
-- caratteristiche taglio
local bHorizCut = (( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA)
local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, BD.MAX_DIM_HTCUT_HBEAM)
local bDoubleHorizCut = ( BD.DOWN_HEAD and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and ( b3Raw:getDimZ() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bHorizCut = ( not bBigSectionCut and ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and ( b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA))
local bDoubleHorizCut = ( BD.DOWN_HEAD and not bBigSectionCut and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bDoubleCut = ( not bBigSectionCut and not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
-- dati geometrici del taglio
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
-- flag di lavorazione faccia
@@ -195,8 +286,84 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
b3Raw:Add( b3NextRaw)
end
end
-- se taglio per pezzi alti e larghi
local nNewPhase = 0
if bBigSectionCut then
local bFinishingNeeded = false
if bSplit then
--taglio sega a catena
local cutDepth = 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN
local sNotesSplit = 'Presplit;'
local dOffs = 0
if dOvmTail > BD.OVM_CHAIN_HBEAM then
dOffs = dOvmTail - BD.OVM_CHAIN_HBEAM
bFinishingNeeded = true
end
local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_BACK, cutDepth, sNotesSplit, dOffs)
if not bOk then return bOk, sErr, nNewPhase end
sNotesSplit = 'Split;'
bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_FRONT, cutDepth, sNotesSplit, dOffs)
if not bOk then return bOk, sErr, nNewPhase end
-- creo nuova fase per successiva finitura
BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET)
nNewPhase = EgtGetCurrPhase()
nDispId = EgtGetPhaseDisposition( nNewPhase)
if sDownOrSideOrStd == 'down' then
EgtRotateRawPart( nRawId, X_AX(), 180)
EgtSetInfo( nDispId, 'TYPE', 'MID2')
EgtSetInfo( nDispId, 'ROT', -2)
elseif sDownOrSideOrStd == 'side' then
if bPreMove then EgtMoveRawPart( nRawId, vtMove) end
EgtRotateRawPart( nRawId, X_AX(), EgtIf( BD.RIGHT_LOAD, -90, 90))
if not bPreMove then EgtMoveRawPart( nRawId, vtMove) end
EgtSetInfo( nDispId, 'TYPE', 'MID2')
EgtSetInfo( nDispId, 'ROT', -1)
else
EgtSetInfo( nDispId, 'TYPE', 'END')
end
EgtSetInfo( nDispId, 'ORD', nOrd)
-- se grezzo successivo senza pezzi e finale, va tolto
local nNextRawId = EgtGetNextRawPart( nRawId)
if nNextRawId and EgtGetPartInRawPartCount( nNextRawId) == 0 and EgtGetRawPartBBox( nNextRawId):getDimX() < BD.MinRaw then
EgtRemoveRawPartFromCurrPhase( nNextRawId)
end
-- fine creazione nuova fase
end
-- se è necessaria la finitura
if bFinishingNeeded or not bSplit then
local sNotes, sNotesFinal
-- se non c'è separazione va aggiunta la nota Cut per l'ultimo taglio e Precut per i tagli precedenti
if not bSplit then
sNotes = 'Precut;'
sNotesFinal = 'Cut;'
end
-- se finitura con lama
if not nOriId or EgtGetInfo( nOriId, 'Q05', 'i') == 1 or EgtGetInfo( nOriId, 'Q05', 'i') == 0 or not bSplit then
local bOk, sErr = Cut.Make( Proc, nNewPhase, nRawId, nPartId, dLenEndRaw, nil, false, true, b3Raw, sNotes, dCurrOvmT)
if not bOk then return bOk, sErr, nNewPhase end
-- se finitura con truciolatore
elseif EgtGetInfo( nOriId, 'Q05', 'i') == 2 then
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then
local sErr = 'Error : part box not found'
EgtOutLog( sErr)
return false, sErr
end
local sPocketing = ML.FindPocketing( 'OpenPocket', nil, 0)
if not sPocketing then
local sErr = 'Error : pocketing not found in library'
EgtOutLog( sErr)
return false, sErr
end
local bOk, sErr = Pocket.Make( Proc, Proc.Id, 0, sPocketing, nPartId, b3Solid)
if not bOk then return bOk, sErr, nNewPhase end
end
if sNotesFinal then
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotesFinal)
end
end
-- se tagli standard
if not bDoubleHorizCut then
elseif not bDoubleHorizCut then
-- calcolo extra taglio ed accorciamento
local dCutExtra = 0
local dAccStart = 0
@@ -285,7 +452,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
if not bOk then return false, sErr end
end
end
return true
return true, nil, nNewPhase
end
---------------------------------------------------------------------
+9 -4
View File
@@ -1,7 +1,8 @@
-- ProcessTenon.lua by Egaltech s.r.l. 2022/02/15
-- ProcessTenon.lua by Egaltech s.r.l. 2022/05/18
-- Gestione calcolo tenone per Travi
-- 2021/10/04 Corretto calcolo HCING per pezzi piccoli.
-- 2022/02/15 Aggiornata VerifyOrientation per macchine con testa da sotto.
-- 2022/05/18 Migliorata gestione attacco.
-- Tabella per definizione modulo
local ProcessTenon = {}
@@ -160,8 +161,6 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- abilitazione lavorazione da sotto
local bMillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259)
local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1)
-- porto inizio curva il più possibile sul bordo
BL.PutStartNearestToEdge( AuxId, b3Solid, bMillDown and not bShortPart)
-- se vero tenone inclinato o non esattamente alle estremità, necessario taglio di lama sulla testa
if Proc.Prc ~= 52 and
( not AreSameOrOppositeVectorApprox( vtN, X_AX()) or
@@ -234,7 +233,10 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
-- recupero la lavorazione
local sMillType = 'Tenon'
local sMilling = ML.FindMilling( sMillType, dTenH, nil, nil, nil, bMillUp, bMillDown) or ML.FindMilling( sMillType, nil, nil, nil, bMillUp, bMillDown)
local sMilling, _, _, bH2 = ML.FindMilling( sMillType, dTenH, nil, nil, nil, bMillUp, bMillDown)
if not sMilling then
sMilling, _, _, bH2 = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown)
end
if not sMilling then
local sErr = 'Error : milling not found in library'
EgtOutLog( sErr)
@@ -253,6 +255,9 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCW = ( dSpeed >= 0)
end
end
-- porto inizio curva il più possibile sul bordo
local bMyShortPart = ( bShortPart and abs( vtN:getX()) < 0.999)
BL.PutStartNearestToEdge( AuxId, b3Solid, bH2 ~= bMyShortPart)
-- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente
local sWarn
local dDepth = 0
+9 -5
View File
@@ -1,5 +1,6 @@
-- ProcessTyroleanDovetail.lua by Egaltech s.r.l. 2022/03/21
-- Gestione calcolo giunzione tirolese
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- Tabella per definizione modulo
local ProcessTyroleanDovetail = {}
@@ -141,7 +142,7 @@ local function EvaluateQParam( Proc, sDephtCham)
end
---------------------------------------------------------------------
local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nFacetCnt)
local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nFacetCnt, dOvmTail)
-- dati delle facce
local ptC = {}
@@ -224,7 +225,7 @@ local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw,
bCut = false
end
-- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
bCut = false
end
-- se va fatto, inserisco la lavorazione
@@ -323,7 +324,7 @@ local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw,
bCut = false
end
-- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
bCut = false
end
-- se va fatto, inserisco la lavorazione
@@ -672,7 +673,10 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessTyroleanDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
function ProcessTyroleanDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
if not dOvmTail then
dOvmTail = BD.OVM_MID
end
-- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId)
-- in base al tipo di feature attribuisco il significato dei parametri Q
@@ -694,7 +698,7 @@ function ProcessTyroleanDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
-- se ho due facce allora è di testa
if nFacetCnt == 2 then
local bOk, sErr = MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nFacetCnt)
local bOk, sErr = MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nFacetCnt, dOvmTail)
if not bOk then return bOk, sErr end
else
local bOk, sErr = MakeMachByMill( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nFacetCnt)
+2 -1
View File
@@ -131,7 +131,7 @@ local function TotPartLen(Parts)
end
-- Imposto direttorio libreria specializzata per Travi
EgtAddToPackagePath( NEST.BASEDIR .. 'LuaLibs\\?.lua')
EgtAddToPackagePath( NEST.BASEDIR .. '\\LuaLibs\\?.lua')
-- Imposto la macchina corrente e verifico sia abilitata per la lavorazione delle Travi
EgtSetCurrMachine( NEST.MACHINE)
@@ -311,6 +311,7 @@ _G.BEAM = {}
BEAM.FILE = NEST.FILE
BEAM.MACHINE = NEST.MACHINE
BEAM.FLAG = 6 -- CREATE_PANEL
BEAM.BASEDIR = NEST.BASEDIR
nMachGroup = EgtGetFirstMachGroup()
while nMachGroup do
local nNextMachGroup = EgtGetNextMachGroup( nMachGroup)