DataWall :
- migliorie a nesting - aggiunta gestione prefori - migliorie a rifinitura tagli inclinati.
This commit is contained in:
@@ -426,8 +426,8 @@ function WPD.Make( Proc, nRawId, b3Raw)
|
||||
sMyWarn = (sMyWarn or sWarn)
|
||||
end
|
||||
end
|
||||
|
||||
if WD.PREDRILL_DIAM and WD.PREDRILL_DIAM > 0 and vtExtr:getZ() < ( WD.PREDRILL_MINANGLE or 0.707) then
|
||||
-- se preforo inclinato impostato, inclinazione oltre limite impostato e foro non orizzontale
|
||||
if WD.PREDRILL_DIAM and WD.PREDRILL_DIAM > 0 and vtExtr:getZ() < ( WD.PREDRILL_MINANGLE or 0.707) and vtExtr:getZ() > 0.1 then
|
||||
-- gruppo ausiliario per preforo
|
||||
local nAddGrpId = WL.GetAddGroup( Proc.PartId)
|
||||
-- calcolo profondita' foro
|
||||
@@ -466,7 +466,6 @@ function WPD.Make( Proc, nRawId, b3Raw)
|
||||
EgtSetInfo( nMchId, 'MOVE_BEFORE', 1)
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ nPreHoleId, -1}})
|
||||
--EgtSetMachiningParam( MCH_MP.TOOLINVERT, bToInvert)
|
||||
|
||||
-- note utente, dichiarazione nessuna generazione sfridi per Vmill
|
||||
local sUserNotes = 'VMRS=0;'
|
||||
|
||||
@@ -112,9 +112,9 @@ function WPF.FlipClassify( Proc, b3Raw)
|
||||
nFlip1 = 100
|
||||
elseif dVtNZMedia >= 0 + GEO.EPS_SMALL then
|
||||
nFlip0 = 75
|
||||
nFlip1 = 25
|
||||
nFlip1 = 50
|
||||
else
|
||||
nFlip0 = 25
|
||||
nFlip0 = 50
|
||||
nFlip1 = 75
|
||||
end
|
||||
end
|
||||
@@ -1245,6 +1245,19 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
|
||||
end
|
||||
end
|
||||
local dEal = vFace[i].Whisk - vFace[i].Len
|
||||
-- se angolo interno prima e faccia precedente inclinata verso l'alto oltre 16.1deg
|
||||
if vFace[i].PrevAng < -30 and j and vFace[j].Norm:getZ() < 0.96078 and vFace[j].Norm:getZ() > 0 then
|
||||
dEal = dEal + vFace[j].Width * vFace[j].Norm:getZ()
|
||||
end
|
||||
-- se angolo interno dopo e faccia successiva inclinata verso l'alto oltre 16.1deg
|
||||
local k = EgtIf( i < #vFace, i + 1, EgtIf( bClosed, 1, nil))
|
||||
if k and vFace[k].PrevAng < -30 and vFace[k].Norm:getZ() < 0.96078 and vFace[k].Norm:getZ() > 0 then
|
||||
dEal = dEal + vFace[k].Width * vFace[j].Norm:getZ()
|
||||
-- se l'inclinazione è inferiore a 46.1deg
|
||||
if vFace[k].Norm:getZ() > 0.72055 then
|
||||
dEal = dEal - vFace[k].Width
|
||||
end
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal)
|
||||
-- percorso da non invertire
|
||||
@@ -1306,6 +1319,7 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
|
||||
local dSal = EgtIf( ( vFace[i].Type & 2) ~= 0, vFace[i].Whisk - vFace[i].Len, 0)
|
||||
local dEal = 0
|
||||
local OrigI = i
|
||||
local OrigH = j
|
||||
local LastJ
|
||||
i = i + 1
|
||||
local j = EgtIf( i <= #vFace, i, EgtIf( bAllType4 or not bClosed, nil, 1))
|
||||
@@ -1333,14 +1347,12 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
|
||||
local dTanA = -tan( vFace[OrigI].PlPrevAng + 90)
|
||||
dSal = -dMillDiam / 2 * ( 1 + ( 1 + dSinA) * dTanA) + min( 0, vFace[OrigI].Width * vFace[OrigI].Norm:getZ() * dTanA)
|
||||
-- se faccia precedente inclinata verso il basso
|
||||
local OrigH = EgtIf( OrigI > 1, OrigI - 1, EgtIf( bClosed, #vFace, nil))
|
||||
if OrigH and vFace[OrigH].Norm:getZ() < -0.017 then
|
||||
dSal = dSal + vFace[OrigH].Width * vFace[OrigH].Norm:getZ()
|
||||
end
|
||||
-- se angolo esterno prima
|
||||
elseif vFace[OrigI].PrevAng > 30 then
|
||||
-- se faccia precedente inclinata verso il basso
|
||||
local OrigH = EgtIf( OrigI > 1, OrigI - 1, EgtIf( bClosed, #vFace, nil))
|
||||
if OrigH and vFace[OrigH].Norm:getZ() < -0.017 then
|
||||
dSal = dSal - vFace[OrigH].Width * vFace[OrigH].Norm:getZ()
|
||||
end
|
||||
@@ -1348,8 +1360,8 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
|
||||
end
|
||||
-- se lavorazione completa o finale su faccia finale
|
||||
local LastFace = ( LastJ or OrigI)
|
||||
if vFace[LastFace].Type == 4 or vFace[LastFace].Type == 2 then
|
||||
local OrigK = EgtIf( LastFace < #vFace, LastFace + 1, EgtIf( bClosed, 1, nil))
|
||||
local OrigK = EgtIf( LastFace < #vFace, LastFace + 1, EgtIf( bClosed, 1, nil))
|
||||
if vFace[LastFace].Type == 4 or ( vFace[LastFace].Type & 2) ~= 0 then
|
||||
-- se angolo interno dopo
|
||||
if OrigK and vFace[OrigK].PrevAng < -30 then
|
||||
local dSinA = -sin( vFace[OrigK].PlPrevAng + 90)
|
||||
@@ -1367,6 +1379,21 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
|
||||
end
|
||||
end
|
||||
end
|
||||
-- per sola lavorazione finale
|
||||
if ( vFace[LastFace].Type & 2) ~= 0 then
|
||||
-- se angolo interno dopo e faccia successiva inclinata verso l'alto oltre 16.1 deg
|
||||
if OrigK and vFace[OrigK].PrevAng < -30 and vFace[OrigK].Norm:getZ() < 0.96078 and vFace[OrigK].Norm:getZ() > 0 then
|
||||
dSal = dSal + vFace[OrigK].Width * vFace[OrigK].Norm:getZ()
|
||||
end
|
||||
-- se angolo interno prima e faccia precedente inclinata verso l'alto oltre 16.1 deg
|
||||
if vFace[OrigI].PrevAng < -30 and OrigH and vFace[OrigH].Norm:getZ() < 0.96078 and vFace[OrigH].Norm:getZ() > 0 then
|
||||
dSal = dSal + vFace[OrigH].Width * vFace[OrigH].Norm:getZ()
|
||||
-- se l'inclinazione è inferiore a 46.1deg
|
||||
if vFace[OrigH].Norm:getZ() > 0.72055 then
|
||||
dSal = dSal - vFace[OrigH].Width
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se percorso chiuso e completo con fresa
|
||||
if bClosed and bAllType4 then
|
||||
dSal = 0
|
||||
|
||||
+167
-73
@@ -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
|
||||
|
||||
@@ -535,7 +535,7 @@ local function SortMachinings( nPhase, PrevMch, nPartId)
|
||||
-- Forature orizzontali con punte lunghe
|
||||
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.DRILLING, { 'LhDrill_'}, true, 'MOVE_AFTER', false, true)
|
||||
-- Preforature per fori inclinati
|
||||
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.POCKETING, { 'PreDrill_'}, true, nil, false, false)
|
||||
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.POCKETING, { 'PreDrill_'}, true)
|
||||
-- Forature e Svuotature
|
||||
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.DRILLING + MCH_OY.POCKETING + MCH_OY.MILLING, { 'SideMill_', 'Clean_'}, false, 'MOVE_AFTER', false, false, true)
|
||||
-- -- Forature ***
|
||||
@@ -552,9 +552,13 @@ local function SortMachinings( nPhase, PrevMch, nPartId)
|
||||
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, { 'SideMill_'}, true, 'MOVE_AFTER', false, false, true, true)
|
||||
-- Fresature che sono puliture di spigoli
|
||||
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, { 'Clean_'}, true, 'MOVE_AFTER', false)
|
||||
-- Tagli per gole
|
||||
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.SAWING, { 'GorgeCut_'}, true)
|
||||
-- Tagli con lama
|
||||
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.SAWING)
|
||||
-- Qui rimozione sfridi (se ci sono lavorazioni successive)
|
||||
-- Fresature dei lapjoint che necessitano di gorge
|
||||
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, { 'SideMill_'}, true, 'MOVE_AFTER', true, false, true, true)
|
||||
-- Tagli con sega a catena che vanno fatti dopo i tagli con lama
|
||||
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MORTISING, { 'Csaw_'}, true)
|
||||
-- Fresature (puliture di spigoli) che vanno fatte dopo i tagli con lama
|
||||
|
||||
+95
-33
@@ -136,7 +136,8 @@ local function CreateToolRectangle( ptP1, dValP1, ptP2, dValP2, vtFace, dValFace
|
||||
ptP1 = ptP1 - vtX * ( dValP1 + dExtra)
|
||||
ptP2 = ptP2 + vtX * ( dValP2 + dExtra)
|
||||
ptP2 = ptP2 + vtFace * ( dValFace + dExtra)
|
||||
local nId = EgtRectangle2P( nOutlineGrp, Point3d(ptP2:getX(), ptP2:getY(), 0), Point3d( ptP1:getX(), ptP1:getY(), 0))
|
||||
--local nId = EgtRectangle2P( nOutlineGrp, Point3d(ptP2:getX(), ptP2:getY(), 0), Point3d( ptP1:getX(), ptP1:getY(), 0))
|
||||
local nId = EgtRectangle2P( nOutlineGrp, ptP2, ptP1)
|
||||
return nId
|
||||
end
|
||||
|
||||
@@ -282,10 +283,12 @@ local function IdentifyLJFromTop( Proc, bCompute, nOutlineGrp)
|
||||
end
|
||||
end
|
||||
|
||||
-- caso 3 facce forma ad U
|
||||
elseif Proc.Fct == 3 and NEST.LAP_JOINT_U_MACH_AREA == 1 then
|
||||
-- caso 3 facce
|
||||
elseif Proc.Fct == 3 then
|
||||
local nFacInd, dElev, nFacInd2 = WL.GetFaceWithMostAdj( Proc.Id, Proc.PartId)
|
||||
if not nFacInd2 and nFacInd ~= GDB_ID.NULL then
|
||||
|
||||
-- forma ad U
|
||||
if not nFacInd2 and nFacInd ~= GDB_ID.NULL and NEST.LAP_JOINT_U_MACH_AREA == 1 then
|
||||
local vtFace = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
if vtFace:getZ() > dMinComp then
|
||||
bLJFromTop = true
|
||||
@@ -297,9 +300,49 @@ local function IdentifyLJFromTop( Proc, bCompute, nOutlineGrp)
|
||||
local dVal = WD.SIDEMILL_DIAM_UP / 2 + 5
|
||||
local ptMin = b3Face:getMin() - dVal * vtDir
|
||||
local ptMax = b3Face:getMax() + dVal * vtDir
|
||||
nRectId = EgtRectangle2P( nOutlineGrp, Point3d(ptMax:getX(), ptMax:getY(), 0), Point3d( ptMin:getX(), ptMin:getY(), 0))
|
||||
-- nRectId = EgtRectangle2P( nOutlineGrp, Point3d(ptMax:getX(), ptMax:getY(), 0), Point3d( ptMin:getX(), ptMin:getY(), 0))
|
||||
nRectId = EgtRectangle2P( nOutlineGrp, ptMax, ptMin)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
elseif nFacInd2 then
|
||||
local nFaceZ = -1
|
||||
for nIdx = 0, 2 do
|
||||
local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, nIdx, GDB_ID.ROOT)
|
||||
if vtN2:getZ() > dMinComp then
|
||||
nFaceZ = nIdx
|
||||
break
|
||||
end
|
||||
end
|
||||
if nFaceZ ~= -1 then
|
||||
local nFace = EgtIf( nFaceZ == nFacInd, nFacInd2, nFacInd)
|
||||
local nOtherFace = EgtIf( nFaceZ + nFace == 3, 0, EgtIf( nFaceZ + nFace == 2, 1, 2))
|
||||
local vtFace = {}
|
||||
vtFace[1] = EgtSurfTmFacetNormVersor( Proc.Id, nFace, GDB_ID.ROOT)
|
||||
vtFace[2] = EgtSurfTmFacetNormVersor( Proc.Id, nOtherFace, GDB_ID.ROOT)
|
||||
bLJFromTop = true
|
||||
if bCompute then
|
||||
local bAdj, ptP1, ptP2 = EgtSurfTmFacetsContact( Proc.Id, nFace, nFaceZ, GDB_ID.ROOT)
|
||||
local bAdj2, ptP3, ptP4 = EgtSurfTmFacetsContact( Proc.Id, nFace, nOtherFace, GDB_ID.ROOT)
|
||||
if AreSamePointApprox( ptP2, ptP3) or AreSamePointApprox( ptP2, ptP4) then
|
||||
ptP1, ptP2 = ptP2, ptP1
|
||||
end
|
||||
|
||||
local b3Face = EgtSurfTmGetFacetBBoxGlob( Proc.Id, nFaceZ, GDB_BB.STANDARD)
|
||||
local dDim = 0
|
||||
if vtFace[1]:getX() > dMinComp or vtFace[1]:getX() < - dMinComp then
|
||||
dDim = b3Face:getDimX()
|
||||
elseif vtFace[1]:getY() > dMinComp or vtFace[1]:getY() < - dMinComp then
|
||||
dDim = b3Face:getDimY()
|
||||
end
|
||||
local dValFace = max( dDim + WD.SIDEMILL_DIAM_UP / 2, WD.SIDEMILL_DIAM_UP)
|
||||
local dVal = WD.SIDEMILL_DIAM_UP / 2
|
||||
if NEST.MACH_AREA_USE_OTHER_DIAM == 1 then
|
||||
dVal = NEST.MACH_AREA_OTHER_DIAM / 2
|
||||
end
|
||||
nRectId = CreateToolRectangle( ptP1, 0, ptP2, dVal, vtFace[1], dValFace, nOutlineGrp)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -366,7 +409,8 @@ local function ComputeToolOutlines( nPartId)
|
||||
ptP1 = ptP1 - ( WD.MAX_WIDTH - dLen + dExtra) * Y_AX()
|
||||
ptP2 = ptP2 + ( WD.MAX_WIDTH - dLen + dExtra) * Y_AX()
|
||||
|
||||
local nId = EgtRectangle2P( nOutlineGrp, Point3d(ptP2:getX(), ptP2:getY(), 0), Point3d( ptP1:getX(), ptP1:getY(), 0))
|
||||
--local nId = EgtRectangle2P( nOutlineGrp, Point3d(ptP2:getX(), ptP2:getY(), 0), Point3d( ptP1:getX(), ptP1:getY(), 0))
|
||||
local nId = EgtRectangle2P( nOutlineGrp, ptP2, ptP1)
|
||||
EgtSetColor( nId, EgtStdColor("AQUA"))
|
||||
if nId ~= GDB_ID.NULL then table.insert(ToolOutlineId, nId) end
|
||||
end
|
||||
@@ -375,32 +419,50 @@ local function ComputeToolOutlines( nPartId)
|
||||
-- lati inclinati free contour
|
||||
if FreeContour.Identify( Proc) then
|
||||
for nInd = 0, Proc.Fct - 1 do
|
||||
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nInd, GDB_ID.ROOT)
|
||||
-- se inclinato verso il basso
|
||||
if vtN:getZ() < - GEO.EPS_SMALL then
|
||||
local bLeftOrRightFace = abs( vtN:getX()) > GEO.EPS_SMALL
|
||||
local bFrontOrBackFace = abs( vtN:getY()) > GEO.EPS_SMALL
|
||||
if ( bLeftOrRightFace ~= bFrontOrBackFace) then
|
||||
local vtMainDir = EgtIf( bLeftOrRightFace, X_AX(), Y_AX())
|
||||
local vtOtherDir = EgtIf( bLeftOrRightFace, Y_AX(), X_AX())
|
||||
local dCosAlpha = vtN * vtMainDir
|
||||
local dVal = ( NEST.OFFSET + 0.1) / dCosAlpha
|
||||
local b3Face = EgtSurfTmGetFacetBBoxGlob( Proc.Id, nInd, GDB_BB.STANDARD)
|
||||
local dDim = EgtIf( bLeftOrRightFace, b3Face:getDimY(), b3Face:getDimX())
|
||||
local ptP1
|
||||
if ( dCosAlpha < 0) then
|
||||
ptP1 = b3Face:getMin()
|
||||
else
|
||||
ptP1 = b3Face:getMax()
|
||||
dDim = -1 * dDim
|
||||
end
|
||||
|
||||
local ptP2 = ptP1 + dVal * vtMainDir + dDim * vtOtherDir
|
||||
local nRectId = EgtRectangle2P( nOutlineGrp, Point3d(ptP1:getX(), ptP1:getY(), 0), Point3d( ptP2:getX(), ptP2:getY(), 0))
|
||||
EgtSetColor( nRectId, EgtStdColor("AQUA"))
|
||||
if nRectId ~= GDB_ID.NULL then table.insert( ToolOutlineId, nRectId) end
|
||||
end
|
||||
end
|
||||
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nInd, GDB_ID.ROOT)
|
||||
-- se inclinato
|
||||
if abs( vtN:getZ()) > GEO.EPS_SMALL then
|
||||
local bUnderCut = vtN:getZ() < - GEO.EPS_SMALL
|
||||
|
||||
local frRect = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nInd, GDB_ID.ROOT)
|
||||
local vtX = frRect:getVersX()
|
||||
local vtY = Z_AX() ^ vtX
|
||||
local frLoc = Frame3d( ORIG(), vtX, vtY, Z_AX())
|
||||
vtN:toLoc( frLoc)
|
||||
|
||||
local dCosAlpha = vtN * Y_AX()
|
||||
local dVal
|
||||
if bUnderCut then
|
||||
dVal = ( NEST.OFFSET + 0.1) / dCosAlpha
|
||||
else
|
||||
dVal = ( NEST.OFFSET + 0.1) * dCosAlpha
|
||||
end
|
||||
|
||||
local b3Face = EgtSurfTmGetFacetBBoxRef( Proc.Id, nInd, GDB_BB.STANDARD, frLoc)
|
||||
local dExtra = NEST.OFFSET / 2
|
||||
local dDim = b3Face:getDimX() + 2 * dExtra
|
||||
|
||||
local dCoordZ = EgtIf( bUnderCut, b3Face:getDimZ(), 0)
|
||||
local ptP1
|
||||
if ( dCosAlpha < 0) then
|
||||
ptP1 = Point3d( b3Face:getMin():getX(), b3Face:getMin():getY(), dCoordZ)
|
||||
else
|
||||
ptP1 = Point3d( b3Face:getMax():getX(), b3Face:getMax():getY(), dCoordZ)
|
||||
dDim = -1 * dDim
|
||||
dExtra = -1 * dExtra
|
||||
end
|
||||
|
||||
ptP1 = ptP1 - dExtra * X_AX()
|
||||
local ptDir = ptP1 + dDim * X_AX()
|
||||
local ptCross = ptDir + dVal * Y_AX()
|
||||
ptP1:toGlob( frLoc)
|
||||
ptDir:toGlob( frLoc)
|
||||
ptCross:toGlob( frLoc)
|
||||
local nRectId = EgtRectangle3P( nOutlineGrp, ptP1, ptCross, ptDir)
|
||||
EgtSetColor( nRectId, EgtStdColor("AQUA"))
|
||||
if nRectId ~= GDB_ID.NULL then table.insert( ToolOutlineId, nRectId) end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user