diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 93bd6f6..014b36d 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -47,12 +47,16 @@ -- 2023/03/31 Corretto ordinamento per fori di coda da lasciare in coda. -- 2023/07/31 Corretto errore nelle mortase in doppio. -- 2023/09/13 Aggiunta ClassifyTopology per la classificazione topologica delle feature. In CollectFeatures aggiunta la raccolta preliminare di alcune informazioni. --- 2022/09/26 Funzione IsFeatureCuttingEntireSection spostata in BeamLib --- 2022/09/26 In ClassifyTopology aggiunto passaggio del parametro nRawId +-- 2023/09/26 Funzione IsFeatureCuttingEntireSection spostata in BeamLib +-- 2023/09/26 In ClassifyTopology aggiunto passaggio del parametro nRawId -- 2023/10/24 Aggiunta scrittura parametro BARLEN nelle info del mach group -- 2023/11/08 Aggiunta gestione processi Variant. -- 2023/11/30 Migliorato il calcolo elevazione con l'utilizzo della nuova funzione EgtSurfTmFacetElevationInBBox. -- 2023/12/26 Modifiche per centrare i pezzi in Y sulla tavola. +-- 2024/02/26 Migliorata 'CompareFeatures' per ordine lavorazioni +-- Migliorata 'CompareFeatures' per ordine forature +-- 2024/02/19 In Collect aggiunta la scrittura nella Proc di Width e Height delle facce. +-- 2024/02/29 Migliorata 'CompareFeatures' per ordine forature -- Tabella per definizione modulo local BeamExec = {} @@ -342,7 +346,8 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT) if not Proc.Face then Proc.Face = {} for i = 1, Proc.Fct do - Proc.Face[i] = { Id = i - 1, VtN = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT )} + local _, dFaceWidth, dFaceHeight = BL.GetFaceHvRefDim( Proc.Id, i - 1, b3Raw) + Proc.Face[i] = { Id = i - 1, VtN = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT ), Width = dFaceWidth, Height = dFaceHeight} if Proc.Fct < 10 then Proc.Face[i].Elevation = EgtSurfTmFacetElevationInBBox( Proc.Id, i - 1, b3Solid, true, GDB_ID.ROOT) end @@ -785,10 +790,18 @@ local function OrderFeatures( vProc, b3Raw) if Hcut.Identify( B2) then return false end - -- se uno di testa e non l'altro, privilegio quello di testa - if B1.Head ~= B2.Head then + -- se uno di testa e non l'altro, privilegio quello di testa (a meno che non siano dei fori) + if B1.Head ~= B2.Head and not Drill.Identify(B1) and not Drill.Identify(B2) then return B1.Head end + -- se entrambi di testa e intersecano stesse facce e primo è scasso a due facce e secondo è un profilo caudato, lo scasso è una riduzione e va fatto prima + if ( ( B1.Head and B2.Head) or ( B1.Tail and B2.Tail)) and ( LapJoint.Identify( B1) and B1.Fct == 2) and ( ProfCamb.Identify( B2)) then + return true + end + -- se entrambi di testa e intersecano stesse facce e primo è un profilo caudato e secondo è scasso a due facce, lo scasso è una riduzione e va lasciato dopo + if ( ( B1.Head and B2.Head) or ( B1.Tail and B2.Tail)) and ( LapJoint.Identify( B2) and B2.Fct == 2) and ( ProfCamb.Identify( B1)) then + return false + end -- se entrambi di testa e primo è scasso o mortasa e secondo no va messo dopo if B1.Head and B2.Head and ( LapJoint.Identify( B1) or Mortise.Identify( B1) or DtMortise.Identify( B1)) and not ( LapJoint.Identify( B2) or Mortise.Identify( B2) or DtMortise.Identify( B2)) then @@ -807,6 +820,16 @@ local function OrderFeatures( vProc, b3Raw) if B2.AdvTail and ( not Split.Identify( B1) or not B1.Tail) then return true end + -- se primo è foro e secondo è un ribasso, il foro va sempre prima a meno che il ribasso non sia di testa + if Drill.Identify(B1) and ( LapJoint.Identify(B2) or Mortise.Identify(B2)) and not B2.Head and + B1.Box:getCenter():getX() > B2.Box:getMin():getX() and B1.Box:getCenter():getX() < B2.Box:getMax():getX() then + return true + end + -- se primo è un ribasso e secondo è un foro, il ribasso va sempre dopo a meno che il ribasso non sia di testa + if ( LapJoint.Identify(B1) or Mortise.Identify(B1))and not B1.Head and Drill.Identify(B2) and + B2.Box:getCenter():getX() > B1.Box:getMin():getX() and B2.Box:getCenter():getX() < B1.Box:getMax():getX() then + return false + end -- se primo è feature di coda e l'altro è separazione o non è feature di coda if B1.Tail and ( Split.Identify( B2) or not B2.Tail) then return false @@ -817,14 +840,22 @@ local function OrderFeatures( vProc, b3Raw) end -- se primo è scasso o mortasa di coda e secondo no, sempre dopo if B1.Tail and ( LapJoint.Identify( B1) or Mortise.Identify( B1) or DtMortise.Identify( B1)) and - not ( B2.Tail and ( LapJoint.Identify( B2) or Mortise.Identify( B2) or DtMortise.Identify( B2))) then + not B2.Tail and ( ( LapJoint.Identify( B2) or Mortise.Identify( B2) or DtMortise.Identify( B2))) then return false end -- se secondo è scasso o mortasa di coda e primo no, va lasciato dopo if B2.Tail and ( LapJoint.Identify( B2) or Mortise.Identify( B2) or DtMortise.Identify( B2)) and - not ( B1.Tail and ( LapJoint.Identify( B1) or Mortise.Identify( B1) or DtMortise.Identify( B1))) then + not B1.Tail and ( ( LapJoint.Identify( B1) or Mortise.Identify( B1) or DtMortise.Identify( B1))) then return true end + -- se entrambi di coda e il primo è una feature taglio di lama e il secondo no, feature taglio lama sempre prima + if B1.Tail and B2.Tail and ( Cut.Identify( B1) or DoubleCut.Identify( B1)) and ( not Cut.Identify( B2) and not DoubleCut.Identify( B2)) then + return true + end + -- se entrambi di coda e il secondo è una feature taglio di lama e il primo no, feature taglio lama sempre prima + if B1.Tail and B2.Tail and ( Cut.Identify( B2) or DoubleCut.Identify( B2)) and ( not Cut.Identify( B1) and not DoubleCut.Identify( B1)) then + return false + end -- se primo è taglio longitudinale completo o altra lav. lunga, dopo tutte le altre feature non di coda if abs( B1.Box:getDimX() - b3Raw:getDimX()) < 0.2 * b3Raw:getDimX() then -- se anche l'altra è lunga, faccio prima quello piccolo in YZ @@ -842,22 +873,12 @@ local function OrderFeatures( vProc, b3Raw) if abs( B2.Box:getDimX() - b3Raw:getDimX()) < 0.2 * b3Raw:getDimX() then return not ( B1.Tail or B2.Box:getMin():getX() + 20 > B1.Box:getCenter():getX()) end - -- se primo è foro e secondo è un ribasso, il foro va sempre prima - if Drill.Identify(B1) and ( LapJoint.Identify(B2) or Mortise.Identify(B2)) and - B1.Box:getCenter():getX() > B2.Box:getMin():getX() and B1.Box:getCenter():getX() < B2.Box:getMax():getX() then - return true - end - -- se primo è un ribasso e secondo è un foro, il ribasso va sempre dopo - if (LapJoint.Identify(B1) or Mortise.Identify(B1)) and Drill.Identify(B2) and - B2.Box:getCenter():getX() > B1.Box:getMin():getX() and B2.Box:getCenter():getX() < B1.Box:getMax():getX() then - return false - end -- se primo è foro e l'altro no, lo penalizzo - if B1.Prc == 40 and B2.Prc ~= 40 then + if Drill.Identify(B1) and not Drill.Identify(B2) then return ( B1.Box:getCenter():getX() > B2.Box:getMax():getX() + dDrillPenalty) end -- se primo è altro e secondo è foro, lo premio - if B1.Prc ~= 40 and B2.Prc == 40 then + if not Drill.Identify(B1) and Drill.Identify(B2) then return ( B1.Box:getMax():getX() + dDrillPenalty > B2.Box:getCenter():getX()) end -- se prima è mortasa coda di rondine sul fianco e secondo taglio longitudinale, la coda di rondine va sempre prima diff --git a/LuaLibs/FacesBySaw.lua b/LuaLibs/FacesBySaw.lua index 5d0a213..06caeee 100644 --- a/LuaLibs/FacesBySaw.lua +++ b/LuaLibs/FacesBySaw.lua @@ -26,6 +26,7 @@ -- 2024/01/07 Modifiche per OikosX (BD.TURN == 2). -- 2024/01/18 Gestita lama con aggregato con asse bloccato per massimizzare capacità di taglio verticale, se da sotto. -- Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile. +-- 2024/02/22 Migliorato calcolo area non pinzabile in testa HCING e coda TCING -- Tabella per definizione modulo local FacesBySaw = {} @@ -528,7 +529,7 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType, local bFaceOk = {} bFaceOk[1] = ( vtN[1]:getZ() >= BD.NZ_MINB or abs( vtN[1]:getY()) < 0.174) bFaceOk[2] = ( vtN[2]:getZ() >= BD.NZ_MINB or abs( vtN[2]:getY()) < 0.174) - if not bDownHead and not bFaceOk[1] and not bFaceOk[2] then + if not bDownHead and ( not bFaceOk[1] or not bFaceOk[2]) then local sErr = 'Error : TwoFacesBySaw from bottom impossible' EgtOutLog( sErr) return false, sErr @@ -714,13 +715,43 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType, -- eventuale segnalazione ingombro di testa o coda local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ()) local dMinZ = max( BD.MIN_HEIGHT, 0.35 * b3Raw:getDimZ()) - if bUpdateIng and Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinZ and - not ( abs( vtN[nBigInd]:getX()) < 0.05 and vtN[nBigInd]:getY() < 0 and Proc.Box:getDimX() > 500 and Proc.Box:getDimY() < 40) then + -- calcolo punto massimo in Z fino a dove considerare il pinzaggio. Minimo tra pinzaggio massimo e altezza pezzo + local dMaxHZ = b3Raw:getMin():getZ() + min( BD.VICE_MAXH or BD.MAX_HEIGHT, b3Raw:getDimZ()) + -- punto massimo in Z considerando anche la Z della feature + local dMaxHZFeat = min( dMaxHZ, Proc.Box:getMax():getZ()) + -- dimensione Z del pinzaggio (differenza massima Z pinzabile e box feature) + local dDeltaZClamp = ( ( dMaxHZ - b3Raw:getMin():getZ()) - max( 0, dMaxHZFeat - Proc.Box:getMin():getZ())) + -- se pinzaggio minimo è come il massimo (oppure come l'altezza massima del pezzo) significa che è verticale + local bIsVertClamps = BD.VICE_MINH > BD.MAX_HEIGHT - 100 * GEO.EPS_SMALL + + -- condizioni per limitare pinzaggio testa/coda + -- se dimensione del box della feature maggiore di metà pinzaggio minimo o metà spessore pezzo + bUpdateIng = bUpdateIng and Proc.Box:getDimZ() > dMinHIng + -- se la feature si trova più in basso del minimo pinzabile in Z o il 35% dello spessore pezzo + bUpdateIng = bUpdateIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinZ + -- riportata condizione, ma poco chiara + bUpdateIng = bUpdateIng and not ( abs( vtN[nBigInd]:getX()) < 0.05 and vtN[nBigInd]:getY() < 0 and Proc.Box:getDimX() > 500 and Proc.Box:getDimY() < 40) + -- se feature è al di sotto del pinzaggio massimo + bUpdateIng = bUpdateIng and Proc.Box:getMin():getZ() < dMaxHZ + -- se ho le morse verticali, o se la feature è in centro o verso alto, controllo se non prendo abbastanza. + if bIsVertClamps or ( Proc.Box:getMin():getZ() - b3Raw:getMin():getZ()) > BD.MIN_HEIGHT then + bUpdateIng = bUpdateIng and dDeltaZClamp < BD.VICE_MINH + end + + if bUpdateIng then if Proc.Head then local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX() + -- se pinze a 45° e pinza abbastanza materiale, compenso comunque, ma solo inclinazione morse + if not bIsVertClamps and dDeltaZClamp > BD.VICE_MINH and BD.VICE_MAXH then + dOffs = min( dOffs, BD.VICE_MAXH - BD.VICE_MINH) + end BL.UpdateHCING( nRawId, dOffs) elseif Proc.Tail then local dOffs = Proc.Box:getMax():getX() - b3Solid:getMin():getX() + -- se pinze a 45° e pinza abbastanza materiale, compenso comunque, ma solo inclinazione morse + if not bIsVertClamps and dDeltaZClamp > BD.VICE_MINH and BD.VICE_MAXH then + dOffs = min( dOffs, BD.VICE_MAXH - BD.VICE_MINH) + end BL.UpdateTCING( nRawId, dOffs) elseif Proc.Box:getCenter():getX() > b3Solid:getCenter():getX() then local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX() diff --git a/LuaLibs/ProcessDtTenon.lua b/LuaLibs/ProcessDtTenon.lua index 3d77ec7..1735c8f 100644 --- a/LuaLibs/ProcessDtTenon.lua +++ b/LuaLibs/ProcessDtTenon.lua @@ -5,6 +5,7 @@ -- 2023/02/08 Aumentato il range per cui i tenoni vengono lavorati in sottosquadro. -- 2023/03/27 Migliorate condizioni scelta pretaglio con lama o fresa; gestione unificata con ProcessTenon. -- 2023/03/28 Corretta gestione faccia di base quando divisa in più parti per distanza massima da lavorare. +-- 2024/02/29 Aumentato numero passaggi CR su tenone. Massimo 8 -- Tabella per definizione modulo local ProcessDtTenon = {} @@ -268,8 +269,8 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) dMaxDist = 2 * ( b3DtTen:getRadius() - b3DtAux:getRadius()) end EgtOutLog( 'MaxDist=' .. EgtNumToString( dMaxDist, 3), 3) - -- Cicli di lavorazione (max 6) - local MAX_PASS = 6 + -- Cicli di lavorazione (max 8) + local MAX_PASS = 8 local nStep = min( ceil( dMaxDist / ( 0.7 * dTDiam)), MAX_PASS) local dStep = min( dMaxDist, 0.7 * dTDiam * MAX_PASS) / nStep for i = nStep, 1, -1 do diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 314e656..274f21a 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -93,6 +93,10 @@ -- Aggiunta funzione GetToolEntryAngle per determinare l'angolo di ingresso dell'utensile nella faccia. -- 2024/02/08 Ora i rabbet lungo X che guardano in basso sono sempre fatti con fresatura di lato per evitare di ruotare. -- 2024/02/13 In MakeMoreFaces escluse le Groove 2 facce dalla gestione Special3faces. +-- 2024/02/22 Migliorato calcolo area non pinzabile in testa HCING e coda TCING +-- Rimosso un caso di controllo per HCING/TCING +-- 2024/02/29 In MakeMoreFaces passato b3Solid alla funzione ManageAntiSplintByMill +-- 2024/02/29 In lapjoint 2 facce (TestTwoFacesDownHead) migliorata la scelta della lama da sotto. -- Tabella per definizione modulo local ProcessLapJoint = {} @@ -615,21 +619,52 @@ 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()) local dMinZ = max( BD.MIN_HEIGHT, 0.35 * b3Raw:getDimZ()) - if Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinZ then + -- calcolo punto massimo in Z fino a dove considerare il pinzaggio. Minimo tra pinzaggio massimo e altezza pezzo + local dMaxHZ = b3Raw:getMin():getZ() + min( BD.VICE_MAXH or BD.MAX_HEIGHT, b3Raw:getDimZ()) + -- punto massimo in Z considerando anche la Z della feature + local dMaxHZFeat = min( dMaxHZ, Proc.Box:getMax():getZ()) + -- dimensione Z del pinzaggio (differenza massima Z pinzabile e box feature) + local dDeltaZClamp = ( ( dMaxHZ - b3Raw:getMin():getZ()) - max( 0, dMaxHZFeat - Proc.Box:getMin():getZ())) + -- se pinzaggio minimo è come il massimo (oppure come l'altezza massima del pezzo) significa che è verticale + local bIsVertClamps = BD.VICE_MINH > BD.MAX_HEIGHT - 100 * GEO.EPS_SMALL + + -- condizioni per limitare pinzaggio testa/coda + local bUpdateIng = true + -- se dimensione del box della feature maggiore di metà pinzaggio minimo o metà spessore pezzo + bUpdateIng = bUpdateIng and Proc.Box:getDimZ() > dMinHIng + -- se la feature si trova più in basso del minimo pinzabile in Z o il 35% dello spessore pezzo + bUpdateIng = bUpdateIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinZ + -- se feature è al di sotto del pinzaggio massimo + bUpdateIng = bUpdateIng and Proc.Box:getMin():getZ() < dMaxHZ + -- se ho le morse verticali, o se la feature è in centro o verso alto, controllo se non prendo abbastanza. + if bIsVertClamps or ( Proc.Box:getMin():getZ() - b3Raw:getMin():getZ()) > BD.MIN_HEIGHT then + bUpdateIng = bUpdateIng and dDeltaZClamp < BD.VICE_MINH + end + + if bUpdateIng then if Proc.Head then local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX() + -- se pinze a 45° e pinza abbastanza materiale, compenso comunque, ma solo inclinazione morse + if not bIsVertClamps and dDeltaZClamp > BD.VICE_MINH and BD.VICE_MAXH then + dOffs = min( dOffs, BD.VICE_MAXH - BD.VICE_MINH) + end BL.UpdateHCING( nRawId, dOffs) elseif Proc.Tail then local dOffs = Proc.Box:getMax():getX() - b3Solid:getMin():getX() + -- se pinze a 45° e pinza abbastanza materiale, compenso comunque, ma solo inclinazione morse + if not bIsVertClamps and dDeltaZClamp > BD.VICE_MINH and BD.VICE_MAXH then + dOffs = min( dOffs, BD.VICE_MAXH - BD.VICE_MINH) + end BL.UpdateTCING( nRawId, dOffs) - elseif Proc.Fct > 1 and Proc.Box:getCenter():getX() > b3Solid:getCenter():getX() then + 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 + -- se concavo aumento la distanza (rimane una punta...) + --if dAngT < 0 then dDist = dDist + 10 end BL.UpdateHCING( nRawId, dOffs, dDist) end end @@ -5256,8 +5291,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa dCollSic = BL.CalcCollisionSafety( tvtNx[2]) local dMachDepth = dFacElev + dCollSic local frFacRec, dFacDim1, dFacDim2 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT) - -- limito il diametro utensile massimo a 100 per queste lavorazioni - dToolTargetDiam = min( BD.MAXDIAM_POCK_CORNER, 100) + -- limito il diametro utensile massimo a 201 per queste lavorazioni + dToolTargetDiam = min( BD.MAXDIAM_POCK_CORNER, 201) -- se è 4 facce devo capire quale è il lato libero e settare dH e dV di conseguenza if Proc.Fct == 4 then local vAdj = {} @@ -5291,7 +5326,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa dToolMaxDiam = min ( ( min( dFacDim1, dFacDim2) * 2) - 1, dToolTargetDiam) -- in tutti gli altri casi l'utensile dovrà essere grande al massimo come il lato più piccolo else - dToolMaxDiam = min ( dFacDim1, dFacDim2, dToolTargetDiam) + dToolMaxDiam = dToolTargetDiam end local _, sPocketing = VerifyPocket( Proc, dToolMaxDiam, dFacElev, nil, sMyMchFind) bOk, sWarn2, sTuuidPk, dDiamTool, dDepth = MakePocket( Proc, nPartId, b3Solid, ptPs, tvtNx, nFacInd, sMyMchFind, nUseRoughTool, sPocketing, dMachDepth, nil, nil, bAllWithEndCap, nil, nPhase, nRawId) @@ -5467,9 +5502,9 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa if not bOk then return false, sWarn end end if nChamfer < 2 and nQAntisplintResult == 2 then - local bOk, sWarn2 - bOk, sWarn2 = ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw, - nFacInd, nAddGrpId, bMillDown) + local bOk, sWarn2 = ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw, + nFacInd, nAddGrpId, bMillDown, dDiamTool, nil, + nil, nil, nil, b3Solid) if not bOk then return false, sWarn2 end end -- se smusso non esclusivo @@ -5484,17 +5519,17 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa local dToolTotalLength = 0 local dToolThDiameter = 999 local dToolDiameter = 0 - if EgtMdbSetCurrMachining( sPocketing) then - local sTuuidPk = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) - if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuidPk) or '') then - dMaxToolCutDepth = EgtTdbGetCurrToolMaxDepth() or dMaxToolCutDepth - dMaxToolMaterial = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxToolMaterial - dToolDiameter = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiameter - dToolThLength = EgtTdbGetCurrToolThLength() or dToolThLength - dToolThDiameter = EgtTdbGetCurrToolParam( MCH_TP.STEMDIAM) or dToolThDiameter - dToolTotalLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) or dToolTotalLength - end + if EgtMdbSetCurrMachining( sPocketing) then + local sTuuidPk = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuidPk) or '') then + dMaxToolCutDepth = EgtTdbGetCurrToolMaxDepth() or dMaxToolCutDepth + dMaxToolMaterial = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxToolMaterial + dToolDiameter = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiameter + dToolThLength = EgtTdbGetCurrToolThLength() or dToolThLength + dToolThDiameter = EgtTdbGetCurrToolParam( MCH_TP.STEMDIAM) or dToolThDiameter + dToolTotalLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) or dToolTotalLength end + end local dMachiningDepth = 0 -- se il gambo è più largo dell'utensile verifico se la lunghezza del gambo è maggiore della distanza di sicurezza calcolata local dShankLength = dToolTotalLength - dToolThLength - dMaxToolCutDepth @@ -5758,19 +5793,49 @@ end --------------------------------------------------------------------- local function TestTwoFacesDownHead( Proc) - -- verifico ci siano due facce + -- test valido solo per due facce if Proc.Fct ~= 2 then return false end + local bDownHeadBlade = false + local bDownHeadMill = false -- verifico se da lavorare con testa da sotto - local bDownHead = false if BD.DOWN_HEAD then - local ptC = {} - local vtN = {} - ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) - ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT) - local vtNm = ( vtN[1] + vtN[2]) ; vtNm:normalize() - bDownHead = ( vtNm:getZ() < -0.5) + local vtNm = ( Proc.Face[1].VtN + Proc.Face[2].VtN) + vtNm:normalize() + bDownHeadMill = ( vtNm:getZ() < -0.5) + -- recupero il massimo materiale della lama sopra + local sCutting = ML.FindCutting( 'HeadSide', true, false) + if not sCutting then + local sErr = 'Error : cutting not found in library' + EgtOutLog( sErr) + return false, sErr + end + local dTopBladeMaxDepth = 0 + if EgtMdbSetCurrMachining( sCutting) then + local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then + dTopBladeMaxDepth = EgtTdbGetCurrToolMaxDepth() or dTopBladeMaxDepth + end + end + -- recupero le caratteristiche della feature e delle facce + local vtRes = Proc.Face[1].VtN ^ Proc.Face[2].VtN + Proc.IsTopDownRabbet = abs( vtRes:getZ()) > 10 * GEO.EPS_SMALL + for i = 1, Proc.Fct do + Proc.Face[i].IsTooDownwardForTopBlade = Proc.Face[i].VtN:getZ() < ( BD.CUT_VZ_MIN or -0.484) - 10 * GEO.EPS_SMALL + Proc.Face[i].IsTooWideForTopBlade = Proc.Face[i].Width > dTopBladeMaxDepth + end + -- serve la lama sotto se c'è almeno una faccia troppo inclinata verso il basso e non è un rabbet stretto lavorabile dal lato + if not ( Proc.Face[1].IsTooDownwardForTopBlade or Proc.Face[2].IsTooDownwardForTopBlade) then + bDownHeadBlade = false + else + for i = 1, Proc.Fct do + if Proc.Face[i].IsTooDownwardForTopBlade and ( not Proc.IsTopDownRabbet or Proc.Face[i].IsTooWideForTopBlade) then + bDownHeadBlade = true + break + end + end + end end - return bDownHead + return bDownHeadBlade, bDownHeadMill end --------------------------------------------------------------------- @@ -6034,7 +6099,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- due facce elseif Proc.Fct == 2 then -- verifico se da lavorare con testa da sotto - local bDownHead = TestTwoFacesDownHead( Proc) + local bDownHeadBlade = TestTwoFacesDownHead( Proc) -- dati delle facce local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, 0, GDB_BB.STANDARD) local b3Fac2 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, 1, GDB_BB.STANDARD) @@ -6062,7 +6127,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) if nForceUseBladeOnNotContinueFace and nForceUseBladeOnNotContinueFace > 0 then return LongCut.Make( Proc, nPhase, nRawId, nPartId, bUseBlade, nForceUseBladeOnNotContinueFace) else - return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHead, '_H2', ''), true, bDownHead) + return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHeadBlade, '_H2', ''), true, bDownHeadBlade) end else return LongCut.Make( Proc, nPhase, nRawId, nPartId) @@ -6073,7 +6138,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) if nForceUseBladeOnNotContinueFace and nForceUseBladeOnNotContinueFace > 0 then return LongCut.Make( Proc, nPhase, nRawId, nPartId, bUseBlade, nForceUseBladeOnNotContinueFace) else - return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHead, '_H2', ''), true, bDownHead) + return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHeadBlade, '_H2', ''), true, bDownHeadBlade) end else return LongCut.Make( Proc, nPhase, nRawId, nPartId) @@ -6081,7 +6146,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- altrimenti else if bUseBlade and ( abs( vtN1:getX()) > 0.5 or abs( vtN2:getX()) > 0.5) then - return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHead, '_H2', ''), true, bDownHead) + return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHeadBlade, '_H2', ''), true, bDownHeadBlade) else return MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead) end @@ -6152,7 +6217,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- altrimenti else -- verifico se da lavorare con testa da sotto - local bDownHead = TestTwoFacesDownHead( Proc) + local bDownHeadblade, bDownHeadMill = TestTwoFacesDownHead( Proc) -- determino l'angolo tra le facce local bAdj, _, _, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT) -- se con BH @@ -6162,7 +6227,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) elseif not bUseBlade then -- se piccole if Proc.Box:getDimX() < MAX_MILL_LIN and ( Proc.Box:getDimZ() < MAX_MILL_LIN or Proc.Box:getDimY() < MAX_MILL_LIN) and bAdj and abs( dAng + 90) < 1 then - return MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId, bDownHead) + return MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId, bDownHeadMill) else return MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, true) end @@ -6186,7 +6251,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) end -- se smusso non esclusivo if nChamfer < 2 then - return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHead, '_H2', ''), true, bDownHead or BD.TURN) + return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHeadblade, '_H2', ''), true, bDownHeadblade or BD.TURN) end return true end diff --git a/LuaLibs/ProcessMortise.lua b/LuaLibs/ProcessMortise.lua index fcb2478..5cfa542 100644 --- a/LuaLibs/ProcessMortise.lua +++ b/LuaLibs/ProcessMortise.lua @@ -14,6 +14,7 @@ -- 2023/07/21 Correzioni per mortise passanti con curva Aux che guarda in basso. -- 2023/08/10 Modificata scelta SCC per tasche in Y+/- in coda o quasi. -- 2024/01/18 Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile. +-- 2024/02/28 Forzata SPIRAL_IN se c'è anche un solo lato aperto -- Tabella per definizione modulo local ProcessMortise = {} @@ -463,6 +464,13 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if bRevertSide then EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) end + + -- se ho anche solo un lato aperto, forzo SPIRAL-IN + local vOpen = EgtGetInfo( AuxId, 'OPEN', 'vi') + if vOpen and #vOpen > 0 then + EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN) + end + -- aggiungo geometria EgtSetMachiningGeometry( {{ AuxId, -1}}) -- sistemo la direzione di lavoro diff --git a/UpdateLog.txt b/UpdateLog.txt index 8eedcb5..24b9f23 100644 --- a/UpdateLog.txt +++ b/UpdateLog.txt @@ -1,5 +1,13 @@ ==== Beam Update Log ==== +Versione 2.6c1 (29/02/2024) +- Modif : in FacesBySaw e LapJoint migliorato calcolo area non pinzabile in testa HCING e coda TCING +- Modif : vari miglioramenti all'ordinamento delle lavorazioni +- Modif : in Mortise forzata SPIRAL_IN se c'è almeno un lato aperto +- Modif : in tenone a coda di rondine aumentato a 8 il numero massimo di passate (era 6) +- Modif : in lapjoint a due facce migliorata la scelta della lama da sotto +- Fixed : in LapJoint corretto bug che impediva l'esecuzione della lavorazion con antischeggia attivo + Versione 2.6b1 (14/02/2024) - Fixed : corretto bug in Split in cui si chiamava la EgtSurfTmFacetNormVersor senza riferimento - Fixed : in L20 corretta gestione 2 facce diff --git a/Version.lua b/Version.lua index bab2abf..e53d7de 100644 --- a/Version.lua +++ b/Version.lua @@ -2,5 +2,5 @@ -- Gestione della versione di Beam NAME = 'Beam' -VERSION = '2.6b1' +VERSION = '2.6c1' MIN_EXE = '2.6a1'