DataBeam :

- aggiunta gestione feature Dovetail (1/2/3/4-138-X)
- correzioni e migliorie varie.
This commit is contained in:
Dario Sassi
2020-04-25 09:51:20 +00:00
parent 2c5529b87b
commit 4ba7936167
7 changed files with 1917 additions and 182 deletions
+26 -11
View File
@@ -1,4 +1,4 @@
-- BeamExec.lua by Egaltech s.r.l. 2020/04/04
-- BeamExec.lua by Egaltech s.r.l. 2020/04/23
-- Libreria esecuzione lavorazioni per Travi
-- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3.
-- 2019/09/04 Corretto controllo feature di testa e coda con sovramateriale di testa elevato.
@@ -8,6 +8,7 @@
-- 2020/02/11 Aggiunta gestione BlockHausFront
-- 2020/04/02 Fori di testa dal basso non danno errore e fanno ribaltare la trave.
-- 2020/04/07 Aggiunta gestione TyroleanDovetail
-- 2020/04/14 Aggiunta gestione Dovetail
-- Tabella per definizione modulo
local BeamExec = {}
@@ -59,8 +60,6 @@ _G.package.loaded.ProcessFrenchRidgeLap = nil
local FrenchRidgeLap = require( 'ProcessFrenchRidgeLap')
_G.package.loaded.ProcessBlockHausFront = nil
local BlockHausFront = require( 'ProcessBlockHausFront')
_G.package.loaded.ProcessTyroleanDovetail = nil
local TyroleanDovetail = require( 'ProcessTyroleanDovetail')
_G.package.loaded.ProcessTenon = nil
local Tenon = require( 'ProcessTenon')
_G.package.loaded.ProcessMortise = nil
@@ -93,6 +92,10 @@ _G.package.loaded.ProcessProfHead = nil
local ProfHead = require( 'ProcessProfHead')
_G.package.loaded.ProcessRoundArch = nil
local RoundArch = require( 'ProcessRoundArch')
_G.package.loaded.ProcessTyroleanDovetail = nil
local TyroleanDovetail = require( 'ProcessTyroleanDovetail')
_G.package.loaded.ProcessDovetail = nil
local Dovetail = require( 'ProcessDovetail')
_G.package.loaded.ProcessFreeContour = nil
local FreeContour = require( 'ProcessFreeContour')
_G.package.loaded.ProcessDecor = nil
@@ -248,6 +251,9 @@ local function IsHeadFeature( Proc, b3Raw, dCurrOvmH)
if RoundArch.Identify( Proc) then
return RoundArch.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
end
if Dovetail.Identify( Proc) then
return Dovetail.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
end
if FreeContour.Identify( Proc) then
return FreeContour.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
end
@@ -279,6 +285,9 @@ local function IsTailFeature( Proc, b3Raw, dCurrOvmH)
if RoundArch.Identify( Proc) then
return RoundArch.IsTailFeature( Proc, b3Raw)
end
if Dovetail.Identify( Proc) then
return Dovetail.IsTailFeature( Proc, b3Raw)
end
if FreeContour.Identify( Proc) then
return FreeContour.IsTailFeature( Proc, b3Raw)
end
@@ -523,11 +532,11 @@ local function ClassifyFeatures( vProc, b3Raw, Stats)
bOk, bDown = SawCut.Classify( Proc)
-- se mezzo-legno di testa
elseif RidgeLap.Identify( Proc) then
bOk, bDown = RidgeLap.Classify( Proc)
bOk, bDown = RidgeLap.Classify( Proc, b3Raw)
-- se scanalatura, scanalatura frontale, tacca, tacca cantonale, mezzo-legno, scanalatura-battuta,
-- mezzolegno tipo chalet-tavola di chiusura, rivestimento, mezzolegno chalet, tasca, taglio triangolato
elseif LapJoint.Identify( Proc) then
bOk, bDown = LapJoint.Classify( Proc)
bOk, bDown = LapJoint.Classify( Proc, b3Raw)
-- se foratura
elseif Drill.Identify( Proc) then
bOk, bDown = Drill.Classify( Proc, b3Raw)
@@ -541,9 +550,6 @@ local function ClassifyFeatures( vProc, b3Raw, Stats)
-- se block house front
elseif BlockHausFront.Identify( Proc) then
bOk, bDown = BlockHausFront.Classify( Proc)
-- se incastro tirolo
elseif TyroleanDovetail.Identify( Proc) then
bOk, bDown = TyroleanDovetail.Classify( Proc)
-- se mortasa (anche frontale)
elseif Mortise.Identify( Proc) then
bOk, bDown = Mortise.Classify( Proc)
@@ -574,6 +580,12 @@ local function ClassifyFeatures( vProc, b3Raw, Stats)
-- se arco
elseif RoundArch.Identify( Proc) then
bOk, bDown = RoundArch.Classify( Proc)
-- se incastro tirolo
elseif TyroleanDovetail.Identify( Proc) then
bOk, bDown = TyroleanDovetail.Classify( Proc, b3Raw)
-- se giunto coda di rondine
elseif Dovetail.Identify( Proc) then
bOk, bDown = Dovetail.Classify( Proc, b3Raw)
-- se contorno libero
elseif FreeContour.Identify( Proc) then
bOk, bDown = FreeContour.Classify( Proc, b3Raw)
@@ -700,9 +712,6 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, b3
elseif BlockHausFront.Identify( Proc) then
-- esecuzione giunzione francese
bOk, sErr = BlockHausFront.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)
-- se tenone ( 1/2-050-X)
elseif Tenon.Identify( Proc) then
-- esecuzione tenone
@@ -767,6 +776,12 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, b3
elseif ProfHead.Identify( Proc) then
-- esecuzione profilo
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)
-- 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)
-- se contorno libero ( 0/3/4-250-X)
elseif FreeContour.Identify( Proc) then
-- esecuzione contorno
+9 -14
View File
@@ -225,7 +225,7 @@ function BeamLib.GetNearestParalOpposite( vtRef)
else
return MCH_MILL_FU.PARAL_RIGHT
end
elseif abs( vtRef:getY()) > abs( vtRef:getZ()) then
else
if vtRef:getY() > 0 then
return MCH_MILL_FU.PARAL_FRONT
else
@@ -359,17 +359,11 @@ function BeamLib.GetFaceElevation( nSurfId, nFac, nPartId)
end
---------------------------------------------------------------------
function BeamLib.GetFaceWithMostAdj( nSurfId, nPartId, bCompare3Fc, dSinAngleUSquare)
function BeamLib.GetFaceWithMostAdj( nSurfId, nPartId, bCompare3Fc, dCosSideAng)
-- recupero il numero di facce
local nFacCnt = EgtSurfTmFacetCount( nSurfId)
local dSinAngUsq
local bNotCheckUsq
if not dSinAngleUSquare then
dSinAngUsq = -0.05
elseif dSinAngleUSquare == -2 then
bNotCheckUsq = true
else
dSinAngUsq = dSinAngleUSquare
if not dCosSideAng then
dCosSideAng = -0.05
end
-- recupero le normali delle facce
local vvtN = {}
@@ -394,16 +388,17 @@ function BeamLib.GetFaceWithMostAdj( nSurfId, nPartId, bCompare3Fc, dSinAngleUSq
vAdj[i] = nCount
-- ne determino eventuale sottosquadra ( dal valore passato o - 3deg) e ortogonalità
local bUcut = false
local bOrto = false
local bOrtho = true
for j = 1, #vFacAdj do
if vFacAdj[j] >= 0 then
local vtN = vvtN[i]
local vtN2 = vvtN[vFacAdj[j]+1]
local dResV = vtN * vtN2
if not bNotCheckUsq and dResV < dSinAngUsq - GEO.EPS_SMALL then
if dResV < dCosSideAng - GEO.EPS_SMALL then
bUcut = true
elseif abs(dResV) < GEO.EPS_SMALL then
bOrtho = true
end
if abs( dResV) > 2 * GEO.EPS_SMALL then
bOrtho = false
end
end
end
File diff suppressed because it is too large Load Diff
+11 -6
View File
@@ -1,4 +1,4 @@
-- ProcessFreeContour.lua by Egaltech s.r.l. 2020/03/18
-- ProcessFreeContour.lua by Egaltech s.r.l. 2020/04/24
-- Gestione calcolo profilo libero per Travi
-- Tabella per definizione modulo
@@ -68,7 +68,7 @@ function ProcessFreeContour.IsTailFeature( Proc, b3Raw)
return ( vtN:getX() <= - 0.5)
end
-- deve occupare la maggior parte dell'area
if Proc.Box:getDimY() > 0.75 * b3Raw:getDimY() or Proc.Box:getDimZ() > 0.75 * b3Raw:getDimZ() then
if Proc.Box:getDimY() > 0.75 * b3Raw:getDimY() and Proc.Box:getDimZ() > 0.75 * b3Raw:getDimZ() then
return true
end
-- non è di coda
@@ -244,10 +244,15 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
end
-- eventuale segnalazione ingombro di testa o coda
if Proc.Head then
BL.UpdateHCING( nRawId, b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX())
elseif Proc.Tail then
BL.UpdateTCING( nRawId, Proc.Box:getMax():getX() - b3Solid:getMin():getX())
local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ())
if Proc.Box:getDimZ() > 0.75 * b3Raw:getDimZ() and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng then
if Proc.Head then
local dOffs = b3Raw:getMax():getX() - dOvmHead - 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
return true
end
+10 -10
View File
@@ -1,4 +1,4 @@
-- ProcessLapJoint.lua by Egaltech s.r.l. 2020/04/20
-- ProcessLapJoint.lua by Egaltech s.r.l. 2020/04/24
-- Gestione calcolo mezzo-legno per Travi
-- 2019/10/08 Agg. gestione OpenPocket.
@@ -417,7 +417,7 @@ end
---------------------------------------------------------------------
-- Classificazione della feature
function ProcessLapJoint.Classify( Proc)
function ProcessLapJoint.Classify( Proc, b3Raw)
-- se 1 faccia
if Proc.Fct == 1 then
-- dati della faccia
@@ -434,8 +434,8 @@ function ProcessLapJoint.Classify( Proc)
ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT)
-- verifico se è lavorabile solo dal basso
local bSmall = ( ( Proc.Head or Proc.Tail) and Proc.Box:getDimX() < BD.MAX_LEN_RIDGELAP_FROM_BOTTOM) or
( not ( Proc.Head or Proc.Tail) and Proc.Box:getDimY() < BD.MAX_LEN_RIDGELAP_FROM_BOTTOM)
local bSmall = ( ( Proc.Head or Proc.Tail) and Proc.Box:getDimX() <= BD.GetMaxLenRidgeLapFromBottom( b3Raw:getDimZ())) or
( not ( Proc.Head or Proc.Tail) and Proc.Box:getDimY() <= BD.GetMaxLenRidgeLapFromBottom( b3Raw:getDimZ()))
local bDown = ( vtN[1]:getZ() < BD.NZ_MINB and vtN[2]:getZ() < BD.NZ_MINB) or
( vtN[1]:getZ() < BD.NZ_MINA and ( vtN[2]:getZ() < -0.1 or not bSmall)) or
( vtN[2]:getZ() < BD.NZ_MINA and ( vtN[1]:getZ() < -0.1 or not bSmall))
@@ -523,7 +523,7 @@ function ProcessLapJoint.Classify( Proc)
if bDown then
if nFacInd2 and dElev2 < 2 * dElev then
local ptC2, vtN2 = EgtSurfTmFacetCenter( Proc.Id, nFacInd2, GDB_ID.ROOT)
bDown = ( vtN2:getZ() < BD.NZ_MINA)
bDown = ( vtN2:getZ() < BD.NZ_MINB)
end
end
return true, bDown
@@ -2719,7 +2719,7 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
end
---------------------------------------------------------------------
local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId)
local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, bSinglePart)
local sWarn
-- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId)
@@ -3062,8 +3062,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId)
-- recupero la lavorazione
local dCollSic = 2 * BD.COLL_SIC
if abs( vtN:getX()) > 0.996 or abs( vtN:getY()) > 0.996 or abs( vtN:getZ()) > 0.996 then dCollSic = 0 end
local sMchFind = 'Pocket'
local nUseRoughTool = 0
local sMchFind = EgtIf( bSinglePart, 'Pocket', 'OpenPocket')
local nUseRoughTool = EgtIf( bSinglePart, 0, 1)
local dDiam = min( dH, dV)
-- verifico dalla forma se non posso prendere utensile grande
if ( Proc.Fct == 3 and bIsU) or ( Proc.Fct == 2 and bIsL) or Proc.Fct == 1 then
@@ -3246,7 +3246,7 @@ local function MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId)
local b3Box = EgtGetBBoxGlob( vAddId[i], GDB_BB.STANDARD)
local nFct = EgtSurfTmFacetCount( vAddId[i])
local AddProc = { Id = vAddId[i], Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Box, Fct = nFct, Flg = Proc.Flg}
local bOk, sMyWarn = MakeMoreFaces( AddProc, nPhase, nRawId, nPartId)
local bOk, sMyWarn = MakeMoreFaces( AddProc, nPhase, nRawId, nPartId, false)
if not sWarn then sWarn = sMyWarn end
if not bOk then return bOk, sWarn end
end
@@ -3316,7 +3316,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
-- tre o più facce
else
return MakeMoreFaces( Proc, nPhase, nRawId, nPartId)
return MakeMoreFaces( Proc, nPhase, nRawId, nPartId, true)
end
end
end
+3 -3
View File
@@ -1,4 +1,4 @@
-- ProcessRidgeLap.lua by Egaltech s.r.l. 2019/10/02
-- ProcessRidgeLap.lua by Egaltech s.r.l. 2020/04/23
-- Gestione calcolo mezzolegno di testa per Travi
-- Tabella per definizione modulo
@@ -23,9 +23,9 @@ end
---------------------------------------------------------------------
-- Classificazione della feature
function ProcessRidgeLap.Classify( Proc)
function ProcessRidgeLap.Classify( Proc, b3Raw)
-- Se più corta del limite si può fare anche da sotto
if Proc.Box:getDimX() < BD.MAX_LEN_RIDGELAP_FROM_BOTTOM then
if Proc.Box:getDimX() <= BD.GetMaxLenRidgeLapFromBottom( b3Raw:getDimZ()) then
return true, false
end
-- verifico le normali delle facce
+28 -138
View File
@@ -1,4 +1,4 @@
-- ProcessTyroleanDovetail.lua by Egaltech s.r.l. 2020/04/20
-- ProcessTyroleanDovetail.lua by Egaltech s.r.l. 2020/04/23
-- Gestione calcolo giunzione tirolese
-- Tabella per definizione modulo
@@ -83,7 +83,7 @@ end
---------------------------------------------------------------------
-- Classificazione della feature
function ProcessTyroleanDovetail.Classify( Proc)
function ProcessTyroleanDovetail.Classify( Proc, b3Raw)
-- verifico le normali delle facce
local nFacetCnt = EgtSurfTmFacetCount( Proc.Id)
local nFlatFaceNeg
@@ -98,7 +98,7 @@ function ProcessTyroleanDovetail.Classify( Proc)
end
-- se trovata faccia rastremata rivolta verso Z-
-- verifico se lunghezza faccia piatta è compatibile con il taglio di lama
if FlatFaceNeg then
if nFlatFaceNeg then
-- se ho 3 facce sicuramente è gruppo 3 o 4, setto il ribaltamento senza ulteriori controlli
if nFacetCnt == 3 then
bDown = true
@@ -110,15 +110,18 @@ function ProcessTyroleanDovetail.Classify( Proc)
local nOtherFace = EgtIf( nFlatFaceNeg == 0, nFlatFaceNeg + 1, nFlatFaceNeg - 1)
local bAdj , ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, nFlatFaceNeg, nOtherFace, GDB_ID.ROOT)
local dDist = dist( ptP1, ptP2)
local dLenface
-- se non sono uguali prendo la dimensione diversa dalla lunghezza di adiacenza
if abs( dDist - dH) < 10 * GEO.EPS_SMALL then
dLenface = dV
local dLargeface
local dDelta = 100000
local dDeltadH = abs( dDist - dH)
local dDeltadV = abs( dDist - dV)
-- prendo la dimensione diversa dalla lunghezza di adiacenza
if dDeltadH < dDeltadV then
dLargeface = dV
else
dLenface = dH
end
dLargeface = dH
end
-- se lunghezza faccia maggiore di taglio lama da sotto setto il ribaltamento
if dLenface > BD.MAX_LEN_RIDGELAP_FROM_BOTTOM - 10 * GEO.EPS_SMALL then
if dLargeface > BD.GetMaxLenRidgeLapFromBottom( b3Raw:getDimZ()) then
bDown = true
end
-- se angolo tra le facce è maggiore di 90 non è raggiungibile dalla lama setto il ribaltamento
@@ -407,104 +410,8 @@ local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw,
return true
end
--[[
---------------------------------------------------------------------
local function MakePocket( Proc, nPartId, ptPs, tvtN, nFaceRef, sMchFind, sMasterPocket, dPrevFaceElev, sPrefixName, tDimAndRef, dAng)
-- calcolo l'elevazione dal punto medio
local dElev
local dLenIn, dLedOut = BL.GetPointDirDepth( nPartId, ptPs, tvtN[2])
if dLenIn > 0 then
dElev = dLenIn
elseif dLedOut then
dElev = dLedOut
end
local dCollSic = 2 * BD.COLL_SIC
-- calcolo il diametro utensile
local dDiamTool
local dFaceDiamTool
if tDimAndRef then
-- prendo il valore dalle dimensioni minime delle facce
dFaceDiamTool = min( tDimAndRef[2][1], tDimAndRef[2][2])
end
-- se ho lavorazione precedente ricalcolo grossolanamente l'elevazione
if dPrevFaceElev and dPrevFaceElev > 0 and dAng then
dElev = dElev + ( sqrt( ( dElev * dElev) - ( dPrevFaceElev * dPrevFaceElev)) * sin(dAng))
elseif dPrevFaceElev and dPrevFaceElev > dElev then
dElev = dPrevFaceElev
end
local sPocketing
if sMasterPocket then
sPocketing = sMasterPocket
else
sPocketing = ML.FindPocketing( sMchFind, dFaceDiamTool, dElev + dCollSic)
end
if not sPocketing then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' pocketing not found in library'
EgtOutLog( sErr)
return false, sErr
end
dDiamTool = 20
local dMaxDepth = 0
local sTuuidPk
if EgtMdbSetCurrMachining( sPocketing) then
sTuuidPk = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuidPk) or '') then
dMaxDepth = ( EgtTdbGetCurrToolMaxDepth() or dMaxDepth)
dDiamTool = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
end
end
-- se nome svuotatura non è stato ricalcolato, confronto il diametro utensile utilizzato con il minimo faccia e se non sono compatibili esco
if sMasterPocket and dFaceDiamTool and dDiamTool >= dFaceDiamTool then
return false, '', sTuuidPk, dDiamTool, dElev
end
-- inserisco la lavorazione di svuotatura
local sName = sPrefixName .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. 'F' .. tostring( nFaceRef)
local nMchFId = EgtAddMachining( sName, sPocketing)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, (nFaceRef)}})
-- imposto uso faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT)
-- imposto posizione braccio porta testa
if tvtN[2]:getY() < GEO.EPS_SMALL then
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
else
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end
-- imposto opportuno attacco
EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN)
-- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente
local sWarn
-- if dElev > dMaxDepth + 10 * GEO.EPS_SMALL then
-- EgtSetMachiningParam( MCH_MP.DEPTH, dMaxDepth - dElev)
-- dElev = dMaxDepth
-- sWarn = 'Warning in process ' .. tostring( Proc.Id) .. ' : elevation bigger than max tool depth'
-- EgtOutLog( sWarn)
-- end
-- imposto elevazione e dichiaro non si generano sfridi per VMill
local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';'
sNotes = sNotes .. 'VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
if not EgtApplyMachining( true, false) then
-- provo ad allargare leggermente la tasca
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end
return true, sWarn, sTuuidPk, dDiamTool
end
]]--
---------------------------------------------------------------------
local function MakeMillCut( Proc, i, j, k, sMilling, nFacInd, pPPnt, rfFac, dOffs, dOffrRad, dAddOffsRad, nStep, dToolDiam, dStep)
local function MakeMillCut( Proc, i, j, k, sMilling, nFacInd, TabNAD, rfFac, dOffs, dOffrRad, dAddOffsRad, nStep, dToolDiam, dStep)
local sWarn = ''
-- inserisco la lavorazione di fresatura
-- per evitare nomi lavorazioni coincidenti, concateno anche il Proc.Id se il nome (del Proc.Id) è presente
@@ -523,7 +430,7 @@ local function MakeMillCut( Proc, i, j, k, sMilling, nFacInd, pPPnt, rfFac, dOff
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, nFacInd}})
-- imposto uso faccia
local nFaceUse = BL.GetNearestOrthoOpposite( pPPnt[j][1])
local nFaceUse = BL.GetNearestOrthoOpposite( TabNAD[j][1])
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.ADIR_YM
@@ -620,10 +527,10 @@ local function MakeMachByMill( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b
dStepmach = dMaxMat * 0.5
end
-- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa
local nFacInd, dFacElev, nFacInd2, dFacElev2 = BL.GetFaceWithMostAdj( Proc.Id, nPartId, false, sin(dSideAngle))
local nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc.Id, nPartId, false, sin(dSideAngle))
if not nFacInd or nFacInd < 0 then
-- provo eliminando i sottosquadra
nFacInd, dFacElev, nFacInd2, dFacElev2 = BL.GetFaceWithMostAdj( Proc.Id, nPartId, false, -2)
nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc.Id, nPartId, false, -2)
if not nFacInd or nFacInd < 0 then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' MakeMachByMill could not find reference face'
EgtOutLog( sErr)
@@ -663,7 +570,7 @@ local function MakeMachByMill( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b
-- vettore di riferimento per le facce ortogonali all'asse trave
local vtRef = Vector3d( 0, vtN:getY(), vtN:getZ())
vtRef:normalize()
local pPPnt = {}
local TabNAD = {}
-- ciclo inserimento tagli antischeggia sulle facce
for i = 1, nFacetCnt do
if (i-1) ~= nFacInd then
@@ -673,7 +580,7 @@ local function MakeMachByMill( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b
local dTrim
local bTouch, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, nFacInd, (i-1), GDB_ID.ROOT)
if dAng then
pPPnt[i] = { vtN2, dAng, dist( ptP1, ptP2)}
TabNAD[i] = { vtN2, dAng, dist( ptP1, ptP2)}
end
if bTouch and dAng < 0 and dAng > -90 - 5 * GEO.EPS_SMALL then
dTrim = 0
@@ -704,11 +611,11 @@ local function MakeMachByMill( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b
-- calcolo la larghezza (solo 1 volta)
if i == 1 then
-- se ho un sottosquadra maggiore dell'angolo di spoglia utensile
if bUCutMax and ( 90 + pPPnt[j][2]) < dSideAngle then
if bUCutMax and ( 90 + TabNAD[j][2]) < dSideAngle then
dParzElev = dFacElev
end
local dDeltadH = abs( pPPnt[j][3] - dH)
local dDeltadV = abs( pPPnt[j][3] - dV)
local dDeltadH = abs( TabNAD[j][3] - dH)
local dDeltadV = abs( TabNAD[j][3] - dV)
if dDeltadH < dDeltadV then
if dDeltadH < dDelta + 10 * GEO.EPS_SMALL then
dDelta = dDeltadH
@@ -724,7 +631,7 @@ local function MakeMachByMill( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b
end
end
-- valori negativi di offset corrispondono ad un allargamento (perchè dParzElev è negativo)
dOffsSide = dOffsSide + ( tan( 90 + pPPnt[j][2]) * dParzElev)
dOffsSide = dOffsSide + ( tan( 90 + TabNAD[j][2]) * dParzElev)
end
end
-- se la larghezza è più grande dell'utensile allora posso lavorare il passo
@@ -734,12 +641,12 @@ local function MakeMachByMill( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b
for j = 1, nFacetCnt do
if (j-1) ~= nFacInd then
-- calcolo l'offset radiale in base all'affondamento
local dOffrRad = ( tan( 90 + pPPnt[j][2]) * dOffs)
if bUCutMax and ( 90 + pPPnt[j][2]) < dSideAngle then
dOffrRad = -( tan( 90 + pPPnt[j][2]) * dFacElev)
local dOffrRad = ( tan( 90 + TabNAD[j][2]) * dOffs)
if bUCutMax and ( 90 + TabNAD[j][2]) < dSideAngle then
dOffrRad = -( tan( 90 + TabNAD[j][2]) * dFacElev)
end
-- inserisco la lavorazione di fresatura
local bOk, sErr = MakeMillCut( Proc, i, j, nil, sMilling, nFacInd, pPPnt, rfFac, dOffs, dOffrRad, 0, nStep, dToolDiam, dStep)
local bOk, sErr = MakeMillCut( Proc, i, j, nil, sMilling, nFacInd, TabNAD, rfFac, dOffs, dOffrRad, 0, nStep, dToolDiam, dStep)
if not bOk then
return false, sErr
else
@@ -752,7 +659,7 @@ local function MakeMachByMill( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b
for k = 1, nStepSide do
local dAddOffsRad = ( k * dStepSide) + EgtIf( k == nStepSide, ( dToolDiam * 0.1), 0)
-- inserisco la lavorazione di fresatura
local bOk, sErr = MakeMillCut( Proc, i, j, k, sMilling, nFacInd, pPPnt, rfFac, dOffs, dOffrRad, dAddOffsRad, nStep, dToolDiam, dStep)
local bOk, sErr = MakeMillCut( Proc, i, j, k, sMilling, nFacInd, TabNAD, rfFac, dOffs, dOffrRad, dAddOffsRad, nStep, dToolDiam, dStep)
if not bOk then
return false, sErr
else
@@ -777,23 +684,6 @@ local function MakeMachByMill( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b
-- return false, sErr
-- end
-- recupero la lavorazione
--local dCollSic = 2 * BD.COLL_SIC
--if abs( vtN:getX()) > 0.996 or abs( vtN:getY()) > 0.996 or abs( vtN:getZ()) > 0.996 then dCollSic = 0 end
--local dDiam = min( dH, dV)
--sMchFind = 'OpenPocketTCone'
--local sPocketing = ML.FindPocketing( sMchFind, dDiam, dFacElev + dCollSic)
---- se non trova una svuotatura adatta emetto un warning
--if not sPocketing then
-- local sWarn = 'Warning on process ' .. tostring( Proc.Id) .. ' not found any pocket or tool'
-- EgtOutLog( sErr)
-- return false, sErr
--end
---- eseguo la svuotatura della faccia principale
--local tvtNx = {}
--tvtNx[2] = vtN
--local bOk, sWarn = MakePocket( Proc, nPartId, ptC, tvtNx, nFacInd, sMchFind, sPocketing, dFacElev, 'PockTCone')
--if not bOk then return false, sWarn end
return true, sWarn
end