DataWall :

- migliorie a nesting
- aggiunta gestione prefori
- migliorie a rifinitura tagli inclinati.
This commit is contained in:
DarioS
2022-02-23 10:43:55 +01:00
parent 68be7a5b4a
commit b484872281
5 changed files with 302 additions and 116 deletions
+167 -73
View File
@@ -1379,6 +1379,9 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
local dElev = WL.GetFaceElevation( Proc.Id, nFacet, nRawId)
local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacet, GDB_ID.ROOT)
local dThick = min( dH, dV)
local frFace = Frame3d( ptC, vtN)
local b3Proc = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frFace)
local dSideElev = b3Proc:getDimZ()
local sMilling
-- se ho lavorazione custom
if sCustomMach then
@@ -1564,89 +1567,176 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
dExtraLongIni = 0
dExtraLongEnd = 0
end
-- se ho abilitato la lavorazione di fresatura per garantire passaggio gambo utensile inserisco la lavorazione
-- se ho abilitato la lavorazione di fresatura per garantire passaggio gambo utensile, inserisco la lavorazione
local bThroughRaw = false
if bEnablePreMill then
-- 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 + 2 * WD.COLL_SIC < dDistGorge + dDimGorge then
dDimGorge = max( dElev - dDistGorge + 2 * WD.COLL_SIC, 0)
-- verifico se feature e' passante
if ((Proc.Box:getMin():getX() < ( b3Raw:getMin():getX() + 50)) and (Proc.Box:getMax():getX() > ( b3Raw:getMax():getX() - 50))) or
((Proc.Box:getMin():getY() < ( b3Raw:getMin():getY() + 50)) and (Proc.Box:getMax():getY() > ( b3Raw:getMax():getY() - 50))) then
bThroughRaw = true
end
-- calcolo extra allungamenti
local dExtraLongGorge = ( dMillDiamTh + WD.COLL_SIC) / 2
-- recupero la lavorazione
local sMillingGorge = WM.FindMilling( 'Gorge', nil, nil, nil, 80)
if not sMillingGorge then
local sErr = 'Error : Gorge not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- acquisisco dati utensile
local dMillDiamFirst = 0
local dMaxMatFirst = 0
if EgtMdbSetCurrMachining( sMillingGorge) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMillDiamFirst = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiamFirst
dMaxMatFirst = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMatFirst
-- se passante
if bThroughRaw then
-- calcolo larghezza e lunghezza canale
local dGorgeWidth = dMillDiam
-- verifico se elevazione minore per fare meno tagli
if dElev + 2 * WD.COLL_SIC < dGorgeWidth then
dGorgeWidth = max( dElev + 2 * WD.COLL_SIC, 0)
end
end
-- calcolo quanti passi devo fare in larghezza per scaricare l'area di impegno utensile
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 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
local dGorgeExtraLength = ( dMillDiamTh + WD.COLL_SIC) / 2
-- recupero la lavorazione
local sCuttingGorge = WM.FindCutting( 'Standard')
if not sCuttingGorge then
local sErr = 'Error : Sawblade not found in library'
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)
-- acquisisco dati utensile
local dSawThickness = 0
if EgtMdbSetCurrMachining( sCuttingGorge) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dSawThickness = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThickness
end
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)
-- sottraggo lato esterno lapjoint per ottenere larghezza netta del gorge
dGorgeWidth = dGorgeWidth - dSideElev
-- calcolo quanti passi devo fare in larghezza per scaricare l'area di impegno utensile
local nNumStep = ceil( ( dGorgeWidth) / WD.SAWGORGE_INTERAX)
local dC = 0
if ( nNumStep - 1) > 0 then
dC = ( dGorgeWidth) / ( nNumStep)
else
nNumStep = 1
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)
-- inserisco la lavorazione
local nNm = 0
-- passi di allargamento
for i = 1, nNumStep - 1 do
nNm = nNm + 1
-- inserisco la lavorazione di taglio sfrido gorge
local sNameGorge = 'GorgeCut_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. tostring( nFacet) .. '_' .. tostring( nNm)
local nMchFId = EgtAddMachining( sNameGorge, sCuttingGorge)
if not nMchFId then
local sErr = 'Error adding machining ' .. sNameGorge .. '-' .. sCuttingGorge
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, nFacet}})
EgtSetInfo( nMchFId, 'Part', Proc.PartId)
-- percorso da non invertire
EgtSetMachiningParam( MCH_MP.INVERT, false)
-- assegno affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, 0)
-- assegno il lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- assegno l'attacco e l'uscita
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_SAW_LI.CENT)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_SAW_LO.CENT)
-- aggiungo l'offset laterale
EgtSetMachiningParam( MCH_MP.OFFSL, ( dSideElev - dSawThickness + ( dC * ( i))))
-- nessun criterio per il braccio è necessario
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.NONE)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end
-- se non passante
else
-- 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 + 2 * WD.COLL_SIC < dDistGorge + dDimGorge then
dDimGorge = max( dElev - dDistGorge + 2 * WD.COLL_SIC, 0)
end
-- calcolo extra allungamenti
local dExtraLongGorge = ( dMillDiamTh + WD.COLL_SIC) / 2
-- recupero la lavorazione
local sMillingGorge = WM.FindMilling( 'Gorge', nil, nil, nil, 80)
if not sMillingGorge then
local sErr = 'Error : Gorge not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- acquisisco dati utensile
local dMillDiamFirst = 0
local dMaxMatFirst = 0
if EgtMdbSetCurrMachining( sMillingGorge) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMillDiamFirst = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiamFirst
dMaxMatFirst = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMatFirst
end
end
-- calcolo quanti passi devo fare in larghezza per scaricare l'area di impegno utensile
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 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
end
-- inserisco la lavorazione di ribasso o gola
@@ -1658,6 +1748,10 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
return false, sErr
end
EgtSetInfo( nMchFId, 'Part', Proc.PartId)
-- se ho abilitato la lavorazione di lama per garantire passaggio utensile, setto la nota per spostare la fresatura dopo i tagli di lama
if bEnablePreMill and bThroughRaw then
EgtSetInfo( nMchFId, 'MOVE_AFTER', 1)
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, nFacet}})
-- imposto posizione braccio porta testa