diff --git a/LuaLibs/FacesBySaw.lua b/LuaLibs/FacesBySaw.lua index 58d0145..c7da7aa 100644 --- a/LuaLibs/FacesBySaw.lua +++ b/LuaLibs/FacesBySaw.lua @@ -192,6 +192,27 @@ local function GetNameSolidFaceIncludingLine( b3Solid, ptP1Comp, ptP2Comp) return false end +--------------------------------------------------------------------- +local function AreSameOrOppositeDirApprox( vDir1, vDir2) + if abs( abs( vDir1) - abs( vDir2)) < 10 * GEO.EPS_SMALL then + return true + else + return false + end +end + +--------------------------------------------------------------------- +local function GetEdgeToMachineFromVector( nSurfId, nFacet, vtOrthO) + local _, EdgesEgt = EgtSurfTmGetFacetOutlineInfo( nSurfId, nFacet, GDB_ID.ROOT) + + for i = 1, #EdgesEgt do + if AreOppositeVectorApprox( EdgesEgt[i].Norm, vtOrthO) then + return ( i - 1) + end + end + return nil +end + --------------------------------------------------------------------- function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert, bMaximizeVerticalDepth, bSpecialTangentLeadInOut, bForceTangentLeadInOut, Par5Alternative) -- se lama con asse parallelo alla faccia, passo alla apposita funzione @@ -233,11 +254,8 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw if not dVzLimDwnUp then dVzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN, vtOrthO) end local bDownHead = ( dVzLimDwnUp and dVzLimDwnUp < - 1.5) local bDownUp = ( vtN:getZ() < dVzLimDwnUp) - -- Commentato perchè il vtFaceUse non funziona correttaemnte in caso che il lato da lavorare sia a 45°. Potrebbe ritornare una trilinea, non gestibile. Si passano le direzioni normali agli assi. - --local ptP1, ptPm, ptP2, vtV1, vtV2, dLen, dWidth = EgtSurfTmFacetOppositeSide( nSurfId, nFacet, vtOrthO, GDB_ID.ROOT) + local ptP1, ptPm, ptP2, vtV1, vtV2, dLen, dWidth = EgtSurfTmFacetOppositeSide( nSurfId, nFacet, vtOrthO, GDB_ID.ROOT) - -- linea o bilinea di lavorazione - local ptP1, ptPm, ptP2, vtV1, vtV2, dLen, dWidth = EgtSurfTmFacetOppositeSide( nSurfId, nFacet, BL.GetVersRef( nOrthoOpposite), GDB_ID.ROOT) if not dLen or dLen < 1.1 or not dWidth or dWidth < 1.1 then local sWarn = 'Face ' .. string.format( '%d,%d', nSurfId, nFacet) .. ' skipped : too small' @@ -551,9 +569,18 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw EgtSetMachiningGeometry( {{ nSurfId, nFacet}}) -- imposto uso faccia EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) - -- Commentato perchè il vtFaceUse non funziona correttaemnte in caso che il lato da lavorare sia a 45°. Potrebbe ritornare una trilinea, non gestibile. - -- local sNoteVtFaceUse = 'VtFaceUse=' .. EgtNumToString( vtOrthO:getX(),3) .. ',' .. EgtNumToString( vtOrthO:getY(),3) .. ',' .. EgtNumToString( vtOrthO:getZ(),3) .. ';' - -- EgtSetMachiningParam( MCH_MP.USERNOTES, sNoteVtFaceUse) + -- vtFaceUse non funziona correttaemnte in caso che il lato da lavorare sia a 45°. Potrebbe ritornare una trilinea, non gestibile. Quindi si setta l'EDGE + local nEdgeFaceUse = GetEdgeToMachineFromVector( nSurfId, nFacet, vtOrthO) + if nEdgeFaceUse and ( AreSameOrOppositeDirApprox( vtOrthO:getX(), 0.707) or AreSameOrOppositeDirApprox( vtOrthO:getY(), 0.707) or AreSameOrOppositeDirApprox( vtOrthO:getZ(), 0.707)) then + local sNoteEdgeFaceUse = 'EdgesFaceUse=' .. EgtNumToString( nEdgeFaceUse) .. ';' + EgtSetMachiningParam( MCH_MP.USERNOTES, sNoteEdgeFaceUse) + else + local sNoteVtFaceUse = 'VtFaceUse=' .. EgtNumToString( vtOrthO:getX(),3) .. ',' .. EgtNumToString( vtOrthO:getY(),3) .. ',' .. EgtNumToString( vtOrthO:getZ(),3) .. ';' + EgtSetMachiningParam( MCH_MP.USERNOTES, sNoteVtFaceUse) + -- imposto allungamenti iniziale e finale (in caso si utilizzi EDGE, non serve prolungare o accorciare) + EgtSetMachiningParam( MCH_MP.STARTADDLEN, dAllStart - dAccStart) + EgtSetMachiningParam( MCH_MP.ENDADDLEN, dAllEnd - dAccEnd) + end -- imposto posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- imposto inversione e lato correzione @@ -572,9 +599,6 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw EgtSetMachiningParam( MCH_MP.LOTANG, dLoTang) EgtSetMachiningParam( MCH_MP.LOPERP, dLoPerp) EgtSetMachiningParam( MCH_MP.LOCOMPLEN, dLoCompLength) - -- imposto allungamenti iniziale e finale - EgtSetMachiningParam( MCH_MP.STARTADDLEN, dAllStart - dAccStart) - EgtSetMachiningParam( MCH_MP.ENDADDLEN, dAllEnd - dAccEnd) -- imposto angolo 3° asse rot local sBlockedAxis = EgtIf( bMaximizeVerticalDepth, 'parallel', 'perpendicular') EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCutting, sBlockedAxis, b3Raw, vtN, vtOrthO)) diff --git a/LuaLibs/ProcessDtMortise.lua b/LuaLibs/ProcessDtMortise.lua index d15c819..aa14f59 100644 --- a/LuaLibs/ProcessDtMortise.lua +++ b/LuaLibs/ProcessDtMortise.lua @@ -111,9 +111,6 @@ local function CalcTopPath( nProcId, AuxId, nAddGrpId, dAltMort, dSideAng, b3Sol EgtAddCurveCompoLineTg( NewAuxId, 100, false) EgtAddCurveCompoLineTg( NewAuxId, 100, true) EgtMergeCurvesInCurveCompo( NewAuxId) - -- eseguo traslazione e offset per portarla sul top - local vtMove = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) * ( dAltMort - 10 * GEO.EPS_SMALL) - EgtMove( NewAuxId, vtMove, GDB_RT.GLOB) local dOffset = dAltMort * tan( dSideAng) if not EgtOffsetCurve( NewAuxId, dOffset) then return end -- la limito entro la trave @@ -121,6 +118,9 @@ local function CalcTopPath( nProcId, AuxId, nAddGrpId, dAltMort, dSideAng, b3Sol local vtBoxDiag = b3Solid:getMax() - b3Solid:getMin() local nCount NewAuxId, nCount = EgtTrimFlatCurveWithBox( NewAuxId, refBox, vtBoxDiag, true, true, GDB_RT.GLOB) + -- eseguo traslazione e offset per portarla sul top + local vtMove = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) * ( dAltMort - 10 * GEO.EPS_SMALL) + EgtMove( NewAuxId, vtMove, GDB_RT.GLOB) -- se divisa in più parti, le unisco congiungendole con segmenti if nCount > 1 then if EgtGetType( NewAuxId) ~= GDB_TY.CRV_COMPO then diff --git a/LuaLibs/ProcessDtTenon.lua b/LuaLibs/ProcessDtTenon.lua index e8f3686..e2e2a5c 100644 --- a/LuaLibs/ProcessDtTenon.lua +++ b/LuaLibs/ProcessDtTenon.lua @@ -70,8 +70,8 @@ local function VerifyOrientation( Proc, vtN, b3Raw) end -- altrimenti else - -- accetto fino a -5deg - return ( vtN:getZ() >= -0.088) + -- accetto fino a -7deg + return ( vtN:getZ() >= -0.122) end end diff --git a/LuaLibs/ProcessScarfJoint.lua b/LuaLibs/ProcessScarfJoint.lua index a785b95..286307d 100644 --- a/LuaLibs/ProcessScarfJoint.lua +++ b/LuaLibs/ProcessScarfJoint.lua @@ -196,27 +196,33 @@ local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Soli end end - -- controllo per eseguire solo un taglio ottimizzato - local bExecJustOneCut = false - local dDiceFaceDim = GEO.INFINITO - if ( i % 2) == 0 then - for cont = 1, #vCuts[i] do - local _, dDiceFaceH, dDiceFaceV = BL.GetFaceHvRefDim( vCuts[i][cont], 0) - -- se feature verso Z, si ammette anche lavorazione in doppio - if AreSameVectorApprox( vtRef, Z_AX()) then - if dMaxDepth * 2 > dDiceFaceH + BD.CUT_EXTRA then - bExecJustOneCut = true - dDiceFaceDim = dDiceFaceH - break - end - elseif AreSameVectorApprox( vtRef, Y_AX()) or AreSameVectorApprox( vtRef, -Y_AX()) then - if dMaxDepth > dDiceFaceV + BD.CUT_EXTRA then - bExecJustOneCut = true - dDiceFaceDim = dDiceFaceV - break + -- se non ho intersezione con la faccia tappo posso fare il taglio sul fianco + if not nGoodFace1 or nGoodFace1 == 0 then + -- controllo per eseguire solo un taglio ottimizzato + local bExecJustOneCut = false + local dDiceFaceDim = GEO.INFINITO + if ( i % 2) == 0 then + for cont = 1, #vCuts[i] do + local _, dDiceFaceH, dDiceFaceV = BL.GetFaceHvRefDim( vCuts[i][cont], 0) + -- se feature verso Z, si ammette anche lavorazione in doppio + if AreSameVectorApprox( vtRef, Z_AX()) then + if dMaxDepth * 2 > dDiceFaceH + BD.CUT_EXTRA then + bExecJustOneCut = true + dDiceFaceDim = dDiceFaceH + break + end + elseif AreSameVectorApprox( vtRef, Y_AX()) or AreSameVectorApprox( vtRef, -Y_AX()) then + if dMaxDepth > dDiceFaceV + BD.CUT_EXTRA then + bExecJustOneCut = true + dDiceFaceDim = dDiceFaceV + break + end end end end + -- se c'è intersezione non ci deve essere ExtraCut + else + dExtraCut = 0 end -- se si può fare, faccio unico taglio parallelo if bExecJustOneCut then @@ -522,10 +528,20 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa else dDiamMax = EgtIf( abs( frMor:getVersX():getY()) < abs( frMor:getVersY():getY()), dL, dW) end - -- determino la distanza tra le due facce inclinate + -- determino la distanza tra le due facce inclinate per determinare elevazione local dDistFaces if vFaceOrd[4] ~= 0 then - dDistFaces = abs((ptC[vFaceOrd[2]]-ptC[vFaceOrd[4]])*vtN[vFaceOrd[2]]) + local nElevationFace1 = 0 + -- controllo estensione faccia 1 + if vFaceOrd[1] ~= 0 then + frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( Proc.Id, vFaceOrd[1]-1, GDB_ID.ROOT) + if abs(vtRef:getY()) > 0.866 then + nElevationFace1 = EgtIf( abs( frMor:getVersX():getZ()) < abs( frMor:getVersY():getY()), dL, dW) + else + nElevationFace1 = EgtIf( abs( frMor:getVersX():getY()) < abs( frMor:getVersY():getY()), dL, dW) + end + end + dDistFaces = max( abs((ptC[vFaceOrd[2]]-ptC[vFaceOrd[4]])*vtN[vFaceOrd[2]]), nElevationFace1) end -- recupero la lavorazione. considerando l dimensione del lato e l'affondamento local sPocketing diff --git a/UpdateLog.txt b/UpdateLog.txt index e7aaa07..17f3d3e 100644 --- a/UpdateLog.txt +++ b/UpdateLog.txt @@ -1,5 +1,11 @@ ==== Beam Update Log ==== +Versione 2.7e2 (23/05/2025) +- Modif : in tagli di lama migliorie alla scelta del lato da lavorare +- Modif : in mortasa coda di rondine migliorati i percorsi +- Modif : in tenone coda di rondine migliorate le lavorazioni da sotto +- Fixed : in Scarf Joint correzione alla scelta faccia da lavorare + Versione 2.7e1 (05/05/2025) - Fixed : in taglio di separazione si riduce percorso di taglio solo se il pezzo è effettivamente alto - Fixed : in foratura corretto caso in cui non si sceglieva l'utensile più lungo disponibile diff --git a/Version.lua b/Version.lua index 3cdf535..0884bc1 100644 --- a/Version.lua +++ b/Version.lua @@ -2,5 +2,5 @@ -- Gestione della versione di Beam NAME = 'Beam' -VERSION = '2.7e1' +VERSION = '2.7e2' MIN_EXE = '2.6e5'