diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 1cb6c2d..727636b 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -1,4 +1,4 @@ --- BeamExec.lua by Egaltech s.r.l. 2020/07/27 +-- BeamExec.lua by Egaltech s.r.l. 2020/07/29 -- 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. @@ -546,7 +546,7 @@ local function ClassifyFeatures( vProc, b3Raw, Stats) nSplitting = i -- se taglio elseif Cut.Identify( Proc) then - bOk, bDown = Cut.Classify( Proc) + bOk, bDown = Cut.Classify( Proc, b3Raw) -- se doppio taglio elseif DoubleCut.Identify( Proc) then bOk, bDown = DoubleCut.Classify( Proc) diff --git a/LuaLibs/ProcessBlockHausFront.lua b/LuaLibs/ProcessBlockHausFront.lua index e7420db..f195399 100644 --- a/LuaLibs/ProcessBlockHausFront.lua +++ b/LuaLibs/ProcessBlockHausFront.lua @@ -1,4 +1,4 @@ --- ProcessBlockHausFront.lua by Egaltech s.r.l. 2020/04/20 +-- ProcessBlockHausFront.lua by Egaltech s.r.l. 2020/08/03 -- Gestione calcolo giunzione block house in testa -- Tabella per definizione modulo @@ -70,8 +70,9 @@ function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) local vFaceOrd = { 0, 0, 0} local dMinZedFace = 1 for i = 1, nFacetCnt do - if abs( vtN[i]:getX()) < dMinZedFace then - dMinZedFace = abs( vtN[i]:getX()) + local dXVal = EgtIf( abs( vtN[i]:getX()) < GEO.EPS_SMALL, 0, abs( vtN[i]:getX())) + if dXVal < dMinZedFace then + dMinZedFace = dXVal vFaceOrd[3] = i end end diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index e273152..7f431d7 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -1,4 +1,4 @@ --- ProcessCut.lua by Egaltech s.r.l. 2020/07/25 +-- ProcessCut.lua by Egaltech s.r.l. 2020/07/29 -- Gestione calcolo singoli tagli di lama per Travi -- Tabella per definizione modulo @@ -31,6 +31,18 @@ function ProcessCut.Classify( Proc, b3Raw) return true, true end end + -- verifico se c'è un taglio da sotto e se è nei limiti + local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw) + local bDownCut = ( vtN:getZ() <= dNzLimDwnUp) + if bDownCut then + local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0) + -- confronto anche qua la distanza maggiore della faccia con la massima distanza del DiceCut + -- e se il rapporto supera il 2 (implica che genera 3 tagli) dichiaro impossibile la lavorazione + if DimH and BD.MAX_DIM_DICE and abs(BD.MAX_DIM_DICE) > 20 * GEO.EPS_SMALL and + abs( DimH / BD.MAX_DIM_DICE) > 2 then + return true, true + end + end return true, false end @@ -272,7 +284,7 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom) end -- lavoro la faccia for j = 1, #vCuts[i] do - -- se taglio dal basso + -- se taglio dal basso if bDownCut then -- se strato pari composto da 1 o 2 elementi if ( i % 2) == 0 and #vCuts[i] <= 2 then diff --git a/LuaLibs/ProcessDovetail.lua b/LuaLibs/ProcessDovetail.lua index 8c7c5f3..35b3b3c 100644 --- a/LuaLibs/ProcessDovetail.lua +++ b/LuaLibs/ProcessDovetail.lua @@ -1,4 +1,4 @@ --- ProcessDovetail.lua by Egaltech s.r.l. 2020/05/02 +-- ProcessDovetail.lua by Egaltech s.r.l. 2020/08/03 -- Gestione calcolo giunzione coda di rondine -- Tabella per definizione modulo @@ -60,8 +60,9 @@ local function OrderFaces( Proc, vtN) -- se 2 facce : ordine (1=0, 2=interna, 3=intermedia) if #vtN <= 2 then for i = 1, #vtN do - if abs( vtN[i]:getX()) < dMinXFace then - dMinXFace = abs( vtN[i]:getX()) + local dXVal = EgtIf( abs( vtN[i]:getX()) < GEO.EPS_SMALL, 0, abs( vtN[i]:getX())) + if dXVal < dMinXFace then + dMinXFace = dXVal vFaceOrd[3] = i end end @@ -78,16 +79,16 @@ local function OrderFaces( Proc, vtN) end end end - -- se 3 facce : ordine (1=altra intermedia, 2=interna, 3=intermedia) elseif #vtN == 3 then for i = 1, #vtN do - if abs( vtN[i]:getX()) < dMinXFace then - dMinXFace = abs( vtN[i]:getX()) + local dXVal = EgtIf( abs( vtN[i]:getX()) < GEO.EPS_SMALL, 0, abs( vtN[i]:getX())) + if dXVal < dMinXFace then + dMinXFace = dXVal vFaceOrd[3] = i end - if abs( vtN[i]:getX()) > dPosXFace then - dPosXFace = abs( vtN[i]:getX()) + if dXVal > dPosXFace then + dPosXFace = dXVal vFaceOrd[2] = i end end @@ -109,7 +110,6 @@ local function OrderFaces( Proc, vtN) end end end - -- se 4 facce : ordine (1=altra intermedia, 2=interna, 3=intermedia, 4=esterna) else for i = 1, #vtN do @@ -565,7 +565,6 @@ local function MakeByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3So vtRef2nd = Vector3d( 0, vtN[vFaceOrd[1]]:getY(), vtN[vFaceOrd[1]]:getZ()) vtRef2nd:normalize() end - -- recupero la lavorazione local sCutting = ML.FindCutting( 'HeadSide') if not sCutting then diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 3e38d8d..638b466 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -1,4 +1,4 @@ --- ProcessLapJoint.lua by Egaltech s.r.l. 2020/07/23 +-- ProcessLapJoint.lua by Egaltech s.r.l. 2020/07/31 -- Gestione calcolo mezzo-legno per Travi -- 2019/10/08 Agg. gestione OpenPocket. @@ -2390,10 +2390,11 @@ local function CheckDiamToolByFaces( Proc, nFacInd, dH, dV, bIsU, bIsL, dElev) local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT) -- Cerco le facce adiacenti alla principale con angolo concavo >= 90 local tWidth = {} + local tExtremPt = {} for i = 1, #vAdj do if vAdj[i] >= 0 then - -- verifico l'angolo tra le facce - local bAdj, _, _, dAng = EgtSurfTmFacetsContact( Proc.Id, nFacInd, vAdj[i], GDB_ID.ROOT) + -- verifico l'angolo tra le facce ( esco se angolo compreso < 90) + local bAdj, pPt1, pPt2, dAng = EgtSurfTmFacetsContact( Proc.Id, nFacInd, vAdj[i], GDB_ID.ROOT) if bAdj and dAng < -90 - 20 * GEO.EPS_ANG_SMALL then return false end @@ -2404,6 +2405,7 @@ local function CheckDiamToolByFaces( Proc, nFacInd, dH, dV, bIsU, bIsL, dElev) local b3Ref = EgtSurfTmGetFacetBBoxRef( Proc.Id, nFacInd, GDB_BB.STANDARD, frRef) if b3Ref then table.insert( tWidth, b3Ref:getDimY()) + table.insert( tExtremPt, { pPt1, pPt2}) end end end @@ -2415,11 +2417,36 @@ local function CheckDiamToolByFaces( Proc, nFacInd, dH, dV, bIsU, bIsL, dElev) for i = 1, #tWidth do dLargeVal = max( dLargeVal, tWidth[i]) end + -- se facce U verifico se le distanze tra i punti sono maggiori delle distanze tra le facce + if bIsU then + local dLargeValU = 999999 + for i = 1, #tExtremPt do + local dLenPoint = dist( EgtIf( i == 1, tExtremPt[i][1], tExtremPt[1][2]), EgtIf( i == 1, tExtremPt[2][1], tExtremPt[i][2])) + -- prendo la distanza minore tra le maggiori ma solo se la distanza tra i punti non è minore della distanza tra le facce + if dLenPoint < dLargeVal then + dLargeValU = dLargeVal + break + else + dLargeValU = min( dLargeValU, dLenPoint) + end + -- inverto i punti e ricalcolo le distanze + dLenPoint = dist( EgtIf( i == 1, tExtremPt[i][1], tExtremPt[1][2]), EgtIf( i == 1, tExtremPt[2][2], tExtremPt[i][1])) + -- prendo la distanza minore tra le maggiori ma solo se la distanza tra i punti non è minore della distanza tra le facce + if dLenPoint < dLargeVal then + dLargeValU = dLargeVal + break + else + dLargeValU = min( dLargeValU, dLenPoint) + end + + end + dLargeVal = dLargeValU + end -- per essere accettabile, il diametro massimo deve essere minore della larghezza della faccia if dMaxDiam < dLargeVal + 20 * GEO.EPS_SMALL then - return dMaxDiam, 'OpenPocket', 1 + return dMaxDiam, 'OpenPocket', 1, dMaxDiam else - return false + return false, '', 0, dMaxDiam end end @@ -3062,10 +3089,11 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, bSinglePart) local sMchFind = EgtIf( bSinglePart, 'Pocket', 'OpenPocket') local nUseRoughTool = EgtIf( bSinglePart, 0, 1) local dDiam = min( dH, dV) + local dDiamMax -- 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 --verifico dimensioni con facce adiacenti - dDiam, sMchFind, nUseRoughTool = CheckDiamToolByFaces( Proc, nFacInd, dH, dV, bIsU, bIsL, ( dFacElev + dCollSic)) + dDiam, sMchFind, nUseRoughTool, dDiamMax = CheckDiamToolByFaces( Proc, nFacInd, dH, dV, bIsU, bIsL, ( dFacElev + dCollSic)) if not dDiam then sMchFind = 'Pocket' nUseRoughTool = 0 @@ -3079,6 +3107,9 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, bSinglePart) if nUseRT and nUseRT ~= 0 then sMchFind = 'OpenPocket' nUseRoughTool = 1 + if dDiamMax and Proc.Fct == 2 and bIsL then + dDiam = dDiamMax + end end end --EgtOutLog( 'Mortise Find Diam =' .. EgtNumToString( dDiam)) diff --git a/LuaLibs/ProcessLongDoubleCut.lua b/LuaLibs/ProcessLongDoubleCut.lua index 0dbbc3f..f95b9a3 100644 --- a/LuaLibs/ProcessLongDoubleCut.lua +++ b/LuaLibs/ProcessLongDoubleCut.lua @@ -1,4 +1,4 @@ --- ProcessLongDoubleCut.lua by Egaltech s.r.l. 2020/07/27 +-- ProcessLongDoubleCut.lua by Egaltech s.r.l. 2020/08/03 -- Gestione calcolo doppio taglio longitudinale per Travi -- Tabella per definizione modulo @@ -666,7 +666,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId) EgtSetMachiningParam( MCH_MP.INVERT, true) -- nel caso concavo, devo impostare la lunghezza di attacco ortogonale if not bConvex then - local dLioPerp = vWidth[i] * sqrt( 1 - vtN[i]:getZ() * vtN[i]:getZ()) / abs( vtN[i]:getZ()) + BD.COLL_SIC + local dNz = vtN[vOrd[i]]:getZ() + local dLioPerp = vWidth[vOrd[i]] * sqrt( 1 - dNz * dNz) / abs( dNz) + BD.COLL_SIC EgtSetMachiningParam( MCH_MP.LIPERP, dLioPerp) EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp) end diff --git a/LuaLibs/ProcessTyroleanDovetail.lua b/LuaLibs/ProcessTyroleanDovetail.lua index d1d8125..22b2873 100644 --- a/LuaLibs/ProcessTyroleanDovetail.lua +++ b/LuaLibs/ProcessTyroleanDovetail.lua @@ -1,4 +1,4 @@ --- ProcessTyroleanDovetail.lua by Egaltech s.r.l. 2020/04/28 +-- ProcessTyroleanDovetail.lua by Egaltech s.r.l. 2020/08/03 -- Gestione calcolo giunzione tirolese -- Tabella per definizione modulo @@ -150,8 +150,9 @@ local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, local vFaceOrd = { 0, 0, 0} local dMinZedFace = 1 for i = 1, nFacetCnt do - if abs( vtN[i]:getX()) < dMinZedFace then - dMinZedFace = abs( vtN[i]:getX()) + local dXVal = EgtIf( abs( vtN[i]:getX()) < GEO.EPS_SMALL, 0, abs( vtN[i]:getX())) + if dXVal < dMinZedFace then + dMinZedFace = dXVal vFaceOrd[3] = i end end