DataWall :

- aggiunto controllo attrezzaggio
- aggiunta gestione fori inclinati grandi e passanti da fare con contornatura inclinata
- aggiunta gestione facce triangolari in FreeContour
- aggiunto gorge con lama anche se non passante
- migliorato calcolo ingombro lavorazioni inclinate per nesting.
This commit is contained in:
DarioS
2022-02-28 10:37:09 +01:00
parent b484872281
commit 332011435b
6 changed files with 290 additions and 169 deletions
+177 -141
View File
@@ -1576,95 +1576,71 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
bThroughRaw = true
end
-- 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)
-- recupero la lavorazione di taglio
local sCuttingGorge = WM.FindCutting( 'Standard')
if not sCuttingGorge then
local sErr = 'Error : Sawblade not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- acquisisco dati utensile lama
local dSawThickness = 0
local dSawDiam = 0
if EgtMdbSetCurrMachining( sCuttingGorge) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dSawThickness = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThickness
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
end
end
-- dati utensile fresa piccola
local dMillDiamFirst = 0
local dMaxMatFirst = 0
local bMillInvert = false
local bSawInvertSE = false
-- se non passante, aggiungo fresatura area della fresa
if not bThroughRaw then
local SquareId -- Id della composita da fresare
local dSawShortening = sqrt( b3Raw:getDimZ() * ( dSawDiam - b3Raw:getDimZ())) -- da calcolare in base a raggio lama e spessore grezzo
-- gruppo ausiliario
local nAddGrpId = WL.GetAddGroup( Proc.PartId)
-- disegno quadrato di fresatura
local p3Start
-- se orientato lungo la Y (direzione)
if abs( vtN:getX()) > 0.9 then
local dStartX = EgtIf( vtN:getX() > 0.9, Proc.Box:getMax():getX(), Proc.Box:getMin():getX())
local dStartY = EgtIf( bStartPos, Proc.Box:getMin():getY(), Proc.Box:getMax():getY())
p3Start = Point3d( dStartX, dStartY, Proc.Box:getMin():getZ())
local vtNPerp = Vector3d( vtN)
vtNPerp:rotate(-Z_AX(), 90 * EgtIf( bStartPos, 1, -1) * EgtIf( vtN:getX() > 0.9, 1, -1))
local FirstLineId = EgtLinePVL( nAddGrpId, p3Start, vtNPerp, dMillDiam / 2 , GDB_RT.GLOB) -- Y_AX()
local SecondLineId = EgtLinePVL( nAddGrpId, EgtEP( FirstLineId, GDB_RT.GLOB), vtN, dMillDiam - dSideElev, GDB_RT.GLOB) -- -X_AX()
local dThirdLineLen = min( (dMillDiam / 2) + ( Proc.Box:getMax():getY() - Proc.Box:getMin():getY()), dSawShortening + 10)
local ThirdLineId = EgtLinePVL( nAddGrpId, EgtEP( SecondLineId, GDB_RT.GLOB), -vtNPerp, dThirdLineLen, GDB_RT.GLOB) -- -Y_AX()
local FourthLineId = EgtLinePVL( nAddGrpId, EgtEP( ThirdLineId, GDB_RT.GLOB), -vtN, dMillDiam -dSideElev , GDB_RT.GLOB) -- X_AX()
SquareId = EgtCurveCompo( nAddGrpId, { FirstLineId, SecondLineId, ThirdLineId, FourthLineId})
bMillInvert = EgtIf( vtN:getX() > 0.9, not (bStartPos or false), bStartPos or false)
bSawInvertSE = EgtIf( vtN:getX() > 0.9, bStartPos or false, not (bStartPos or false))
-- altrimenti orientato lungo la X
elseif abs( vtN:getY()) > 0.9 then
local dStartX = EgtIf( bStartPos, Proc.Box:getMin():getX(), Proc.Box:getMax():getX())
local dStartY = EgtIf( vtN:getY() > 0.9, Proc.Box:getMax():getY(), Proc.Box:getMin():getY())
p3Start = Point3d( dStartX, dStartY, Proc.Box:getMin():getZ())
local vtNPerp = Vector3d( vtN)
vtNPerp:rotate(-Z_AX(), 90 * EgtIf( bStartPos, -1, 1) * EgtIf( vtN:getY() > 0.9, 1, -1))
local FirstLineId = EgtLinePVL( nAddGrpId, p3Start, vtNPerp, dMillDiam / 2 , GDB_RT.GLOB) -- Y_AX()
local SecondLineId = EgtLinePVL( nAddGrpId, EgtEP( FirstLineId, GDB_RT.GLOB), vtN, dMillDiam -dSideElev, GDB_RT.GLOB) -- -X_AX()
local dThirdLineLen = min( (dMillDiam / 2) + ( Proc.Box:getMax():getX() - Proc.Box:getMin():getX()), dSawShortening + 10)
local ThirdLineId = EgtLinePVL( nAddGrpId, EgtEP( SecondLineId, GDB_RT.GLOB), -vtNPerp, dThirdLineLen, GDB_RT.GLOB) -- -Y_AX()
local FourthLineId = EgtLinePVL( nAddGrpId, EgtEP( ThirdLineId, GDB_RT.GLOB), -vtN, dMillDiam -dSideElev , GDB_RT.GLOB) -- X_AX()
SquareId = EgtCurveCompo( nAddGrpId, { FirstLineId, SecondLineId, ThirdLineId, FourthLineId})
bMillInvert = EgtIf( vtN:getY() > 0.9, bStartPos or false, not (bStartPos or false))
bSawInvertSE = EgtIf( vtN:getY() > 0.9, not (bStartPos or false), bStartPos or false)
end
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
-- 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
-- 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
-- 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
@@ -1673,8 +1649,6 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
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
@@ -1682,60 +1656,122 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
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
-- 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
-- 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
-- aggiungo geometria
EgtSetMachiningGeometry( SquareId)
-- 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)
-- imposto invert in base al lato fresa
local bWorkSide = EgtGetMachiningParam( MCH_MP.WORKSIDE)
if bWorkSide == MCH_MILL_WS.RIGHT then
bMillInvert = not bMillInvert
end
EgtSetMachiningParam( MCH_MP.INVERT, bMillInvert)
-- aggiungo allungamenti iniziali e finali
EgtSetMachiningParam( EgtIf( bMillInvert, MCH_MP.STARTADDLEN, MCH_MP.ENDADDLEN), -dMillDiamFirst / 2 - dSawThickness / 2)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end
-- calcolo larghezza 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
-- 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
-- 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)
-- assegno invert
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) -- EgtIf( bMillInvert, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT))
-- assegno l'attacco e l'uscita
if not bThroughRaw and bSawInvertSE then
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_SAW_LI.STRICT)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_SAW_LO.CENT)
-- aggiungo allungamento finale
if not bThroughRaw then
EgtSetMachiningParam( MCH_MP.STARTADDLEN, ( dMillDiam / 2) - ( dMillDiamFirst / 2))
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
elseif not bThroughRaw and not bSawInvertSE then
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_SAW_LO.CENT)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_SAW_LI.STRICT)
-- aggiungo allungamento finale
if not bThroughRaw then
EgtSetMachiningParam( MCH_MP.ENDADDLEN, ( dMillDiam / 2) - ( dMillDiamFirst / 2))
end
else
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_SAW_LO.CENT)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_SAW_LI.CENT)
end
-- 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
end
@@ -1749,7 +1785,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
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
if bEnablePreMill then
EgtSetInfo( nMchFId, 'MOVE_AFTER', 1)
end
-- aggiungo geometria