diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 478d107..f23070a 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -608,6 +608,11 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, vBeam, b local b3Part = EgtGetBBoxGlob( Pz or GDB_ID.NULL, GDB_BB.EXACT) local b3Solid = vBeam[i].Box if b3Part:isEmpty() or b3Solid:isEmpty() then break end + -- creo o pulisco gruppo geometrie aggiuntive + if not BL.CreateOrEmptyAddGroup( Pz) then + local sOut = 'Error creating Additional Group in Part ' .. tostring( Pz) + return false, sOut + end -- analizzo le features per valutare l'esistenza di feature head/tail che renderebbero inutili le rispettive finiture o di tagli di testa/coda sostituiti da cui leggere il parametro Q05 local vProc = CollectFeatures( Pz, b3Solid, 0) local bSFinishingNeeded, nReplacedHeadCutFeatureId, nHeadCuttingFeatureId = AnalyzeHeadFeatures( b3Solid, vProc, dRawW, dRawH) @@ -677,11 +682,7 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, vBeam, b -- assegno ordine in lavorazione Cnt = Cnt + 1 EgtSetInfo( nRaw, 'ORD', Cnt) - -- creo o pulisco gruppo geometrie aggiuntive - if not BL.CreateOrEmptyAddGroup( Pz) then - local sOut = 'Error creating Additional Group in Part ' .. tostring( Pz) - return false, sOut - end + -- aggiungo faccia per taglio iniziale al pezzo BL.AddPartStartFace( Pz, b3Solid) -- se sovramateriale di testa, lo notifico @@ -1944,7 +1945,9 @@ local function VerifyDrillMirrored( Proc, vProc, b3Raw) -- recupero la lunghezza della parte inclinata della punta local dToolDoubleTipLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) - EgtTdbGetCurrToolParam( MCH_TP.LEN) -- se foratura splittata, verifico che la distanza minima tra le due punte sia rispettata - if abs( Proc.Flg) == 2 and not ( ( ( 2 * dDrillingStep - dToolTipLength - dToolDoubleTipLength) - MIRROR_DRILLINGS_MIN_DISTANCE) > 10 * GEO.EPS_SMALL) then + local dTipDistance = 2 * dDrillingStep - dToolTipLength - dToolDoubleTipLength + if abs( Proc.Flg) == 2 and not ( ( dTipDistance - MIRROR_DRILLINGS_MIN_DISTANCE) > 10 * GEO.EPS_SMALL) then + EgtOutLog( 'Double drilling skipped, tip distance too small ( ' .. dTipDistance .. ' mm) ') return end -- verifico se in doppio @@ -2138,7 +2141,8 @@ function GetFeatureInfoAndDependency( vProc, b3Raw, nPartId) end end -- verifico se feature tipo LapJoint è attraversata da almeno una mortasa a coda di rondine - if ( Proc.Topology == 'Pocket' or Proc.Topology == 'Tunnel' or Proc.Topology == 'Groove') and DtMortise.SideIdentify( ProcB) and Overlaps( Proc.Box, ProcB.Box) then + if ( Proc.Topology == 'Pocket' or Proc.Topology == 'Tunnel' or Proc.Topology == 'Groove') + and DtMortise.SideIdentify( ProcB) and Overlaps( Proc.Box, ProcB.Box) and DtMortise.IsDeeper( ProcB, b3Raw) then Proc.PassedByDtMortise = true end -- se tenone è attraversato da foro allora il foro deve essere fatto prima diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index 25e85e1..ee66572 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -698,17 +698,19 @@ function BeamLib.GetFaceHvRefDim( nSurfId, nFacet, b3Raw) local b3HV = EgtSurfTmGetFacetBBoxRef( nSurfId, nFacet, GDB_BB.STANDARD, frHV) local dDimH = b3HV:getDimX() local dDimV = b3HV:getDimY() + + -- Si mantiene rettangolo minimo perchè in alcuni casi andava in collisione. Lascio il calcolo in caso si debba ripristinare. -- se definito grezzo (o solido), applico eventuali limiti - if b3Raw then - local dCoeffY = abs( frHV:getVersX():getY()) - if dCoeffY > GEO.EPS_SMALL then - dDimH = min( dDimH, b3Raw:getDimY() / dCoeffY) - end - local dCoeffZ = abs( frHV:getVersY():getZ()) - if dCoeffZ > GEO.EPS_SMALL then - dDimV = min( dDimV, b3Raw:getDimZ() / dCoeffZ) - end - end + -- if b3Raw then + -- local dCoeffY = abs( frHV:getVersX():getY()) + -- if dCoeffY > GEO.EPS_SMALL then + -- dDimH = min( dDimH, b3Raw:getDimY() / dCoeffY) + -- end + -- local dCoeffZ = abs( frHV:getVersY():getZ()) + -- if dCoeffZ > GEO.EPS_SMALL then + -- dDimV = min( dDimV, b3Raw:getDimZ() / dCoeffZ) + -- end + -- end -- restituisco i valori calcolati return frHV, dDimH, dDimV end diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index 1777de0..8689717 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -65,11 +65,14 @@ function ProcessCut.Classify( Proc, b3Raw) end -- recupero i dati del taglio local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) - if vtN:getZ() <= - 0.5 and abs( vtN:getY()) > 0.1 or ( vtN:getZ() <= - 0.174 and abs( vtN:getY()) > 0.866) then - -- calcolo le massime estensioni lineari orizzontale e verticale della faccia - local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw) + -- calcolo le massime estensioni lineari orizzontale e verticale della faccia + local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw) + if ( vtN:getZ() <= - 0.5 and abs( vtN:getY()) > 0.1) or + ( vtN:getZ() <= - 0.174 and abs( vtN:getY()) > 0.866) or + ( vtN:getZ() <= - 0.174 and abs( vtN:getZ()) * DimV > BD.MAX_DIM_DICE) + then -- confronto queste estensioni con la massima dimensione del DiceCut (impossibile lavorare se entrambe maggiori) - if DimH > BD.MAX_DIM_DICE and DimV > BD.MAX_DIM_DICE then + if DimH > BD.MAX_DIM_DICE + 100 * GEO.EPS_SMALL and DimV > BD.MAX_DIM_DICE + 100 * GEO.EPS_SMALL then return true, true end end @@ -90,7 +93,7 @@ function ProcessCut.Classify( Proc, b3Raw) end end -- calcolo l'ingombro orizzontale della faccia - local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0) + _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0) -- confronto questo ingombro con il doppio della massima dimensione del DiceCut (impossibile lavorare sotto da sopra se più di 2 tagli oppure se tipo PF, taglio inclinato in Y e non taglio singolo orizzontale) if DimH > 2 * BD.MAX_DIM_DICE or ( BD.C_SIMM and ( abs( vtN:getY()) > 0.1) and dMaxMat < DimH + BD.CUT_EXTRA) then return true, true @@ -379,7 +382,9 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b local vCuts = {} local dDicingOffsetP local dDicingOffsetO - if ( ( not Proc.AdvTail) or bForceDicing) and ( dCutH > dMaxDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC or dCutV > dMaxVertDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC) then + if ( ( not Proc.AdvTail) or bForceDicing) and + ( dCutH - 100 * GEO.EPS_SMALL > dMaxDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC or + dCutV - 100 * GEO.EPS_SMALL > dMaxVertDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC) then local ptExtra, vtExtra local bAutoCalcSurf = true if Proc.AdvTail then diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index 509bd77..5dd095e 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -638,16 +638,6 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) end -- se lavorazione in doppio if Proc.Double and Proc.Double > 0 then - -- calcolo gli step reali - local dStep = EgtGetMachiningParam( MCH_MP.STEP) - local nNumStep = ceil( dDepth/dStep) - local dRealStep = dDepth / nNumStep - -- Se foro passante e nel penultimo step le punte si trovano più vicine del minimo ( MinDistX1X2 + Puntina centraggio H1 + puntina centraggio H2) ricalcolo facendo uno step in meno - if bOpen and ( nNumStep > 1) and ( ( dLen / 2) - ( dRealStep * (nNumStep - 1))) * 2 < ( 40 + 10 + 10) then - dRealStep = ceil( dDepth / (nNumStep - 1)) - EgtSetMachiningParam( MCH_MP.STEP, dRealStep) - sMyWarn ='Warning in drill-double : step changed to ' .. tostring(dRealStep) .. 'mm' - end sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double) if Proc.Double ~= Proc.PrevDouble then sUserNotes = EgtSetValInNotes( sUserNotes, 'StartZmax', 2) diff --git a/LuaLibs/ProcessDtMortise.lua b/LuaLibs/ProcessDtMortise.lua index d0d22e7..d95279e 100644 --- a/LuaLibs/ProcessDtMortise.lua +++ b/LuaLibs/ProcessDtMortise.lua @@ -51,6 +51,23 @@ function ProcessDtMortise.FrontIdentify( Proc) return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 56) end +--------------------------------------------------------------------- +-- Riconoscimento della feature profonda, non sulla faccia della trave +function ProcessDtMortise.IsDeeper( Proc, b3Raw) + -- recupero i dati della curva di contorno della faccia di fondo + local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') + if not AuxId then return false end + AuxId = AuxId + Proc.Id + local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) + if ( AreSameVectorApprox( vtExtr, -Y_AX()) and Proc.Box:getMin():getY() > b3Raw:getMin():getY() + 100 * GEO.EPS_SMALL) or + ( AreSameVectorApprox( vtExtr, Y_AX()) and Proc.Box:getMax():getY() < b3Raw:getMax():getY() - 100 * GEO.EPS_SMALL) or + ( AreSameVectorApprox( vtExtr, -Z_AX()) and Proc.Box:getMin():getZ() > b3Raw:getMin():getZ() + 100 * GEO.EPS_SMALL) or + ( AreSameVectorApprox( vtExtr, Z_AX()) and Proc.Box:getMax():getZ() < b3Raw:getMax():getZ() - 100 * GEO.EPS_SMALL) then + return true + end + return false +end + --------------------------------------------------------------------- -- Verifica se feature di coda function ProcessDtMortise.IsTailFeature( Proc, b3Raw) diff --git a/LuaLibs/ProcessHeadCut.lua b/LuaLibs/ProcessHeadCut.lua index 85ac1f5..d38e615 100644 --- a/LuaLibs/ProcessHeadCut.lua +++ b/LuaLibs/ProcessHeadCut.lua @@ -159,6 +159,105 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead) return true, nil end +--------------------------------------------------------------------- +-- smussi in testa +local function MakeHeadChamfer( idProc, nPartId) + local dDepthHeadChamfer = EgtGetInfo( idProc, 'Q08', 'd') or 0 + -- se non attivo esco subito + if dDepthHeadChamfer < 100 * GEO.EPS_SMALL then + return + end + + -- recupero gruppo per geometria aggiuntiva + local AddGrpId = BL.GetAddGroup( nPartId) + if not AddGrpId then + local sErr = 'Error on process StartFace impossible to find AddGroup' + EgtOutLog( sErr) + return false, sErr + end + + -- recupero la lavorazione + local sMilling = ML.FindMilling( 'Mark') + if not sMilling then + local sErr = 'Error : milling not found in library' + EgtOutLog( sErr) + return false, sErr + end + + local nLoopId, nLoopCnt = EgtExtractSurfTmFacetLoops( idProc, 0, AddGrpId) + if not nLoopId or nLoopCnt > 1 then + local sErr = 'Error MakeHeadChamfer : too many loops' + EgtOutLog( sErr) + return false, sErr + end + + -- setto direzione estrusione corretta + EgtModifyCurveExtrusion( nLoopId, X_AX()) + EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.RIGHT)) + + local dQ09Value = EgtGetInfo( idProc, 'Q09', 'd') + local bChamferedEdge = dQ09Value > 0 + + local nIdFirstEntity, nEntityCnt = EgtExplodeCurveCompo( nLoopId) + local p3MidPoint = EgtMP( nIdFirstEntity, GDB_ID.GRID) + + for i = 0, nEntityCnt - 1 do + if EgtCurveLength( nIdFirstEntity + i) - 10 < abs( dQ09Value) * 2 then + local sErr = 'Error MakeHeadChamfer : Q09 too high' + EgtOutLog( sErr) + return false, sErr + end + end + + -- creo raccordo o fillet + for i = 0, nEntityCnt - 1 do + local idFirst = nIdFirstEntity + i + local idSecond = EgtIf( i == nEntityCnt - 1, nIdFirstEntity, idFirst + 1) + local ptEndPointFirst = EgtEP( idFirst, GDB_ID.GRID) - ( abs( dQ09Value) * EgtEV( idFirst, GDB_ID.GRID)) + local ptStartPointSecond = EgtSP( idSecond, GDB_ID.GRID) + ( abs( dQ09Value) * EgtEV( idSecond, GDB_ID.GRID)) + + if bChamferedEdge then + EgtCurveChamfer( AddGrpId, idFirst, ptEndPointFirst, idSecond, ptStartPointSecond, abs( dQ09Value), true, GDB_RT.GRID) + else + EgtCurveFillet( AddGrpId, idFirst, ptEndPointFirst, idSecond, ptStartPointSecond, abs( dQ09Value), true, GDB_RT.GRID) + end + end + + EgtSelectPathObjs( nIdFirstEntity, true) + local idGeom, idGeomCnt = EgtCurveCompoByChain( AddGrpId, GDB_ID.SEL, {0,0,0}, true) + if not idGeom or idGeomCnt > 1 then + local sErr = 'Error MakeHeadChamfer : too many loops' + EgtOutLog( sErr) + return false, sErr + end + EgtChangeClosedCurveStartPoint( idGeom, p3MidPoint, GDB_RT.GRID) + + -- Inserisco la lavorazione del lato standard + local dExtra = 2 + local sName1 = 'HeadCham_' .. ( EgtGetName( idProc) or tostring( idProc)) + local nMch1Id = EgtAddMachining( sName1, sMilling) + if not nMch1Id then + local sErr = 'Error adding machining ' .. sName1 .. '-' .. sMilling + EgtOutLog( sErr) + return false, sErr + end + -- aggiungo geometria + EgtSetMachiningGeometry( {{ idGeom, -1}}) + -- assegno affondamento e offset radiale + EgtSetMachiningParam( MCH_MP.DEPTH, dDepthHeadChamfer + dExtra) + EgtSetMachiningParam( MCH_MP.OFFSR, dExtra) + -- assegno lato di lavoro + EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) + -- eseguo + if not ML.ApplyMachining( true, false) then + local _, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nMch1Id, false) + return false, sErr + end + + return true, nil +end + --------------------------------------------------------------------- -- tagli verticali aggiuntivi local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw, dOffsetBetweenCuts) @@ -533,6 +632,16 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut local bOk, sErr = MakeStandardCuts( Proc, b3Raw, nCuts, dOffsL, HeadCutType, Cutting1Data, Cutting2Data, nil, dOvmHead) + + -- alla fine del taglio si aggiungono gli smussi in testa + local _, sErrHeadChamfer = MakeHeadChamfer( nOriId or Proc.Id, nPartId) + if sErr then + sErr = sErr..'\n'..sErrHeadChamfer + else + sErr = sErrHeadChamfer + end + + return bOk, sErr end diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 9b4c6f1..e431417 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -146,7 +146,7 @@ local Q_MAX_ELEVATION = '' -- d local Q_SAW_PLUS_CHAIN = '' -- i local Q_FORCE_CHAINSAW = '' -- i local Q_CHAINSAW_FROM_SIDE = '' -- i - +local Q_MILL_AS_BLADE_CONVENTIONAL = '' -- i -- variabile smussi local bMadeChamfer @@ -195,11 +195,13 @@ local function AssignQIdent( Proc) Q_FORCE_CHAINSAW = 'Q12' -- TODO da riportare a Q13 quando è sistemata la gestione del movimento in macchina nell'attacco laterale Q_CHAINSAW_FROM_SIDE = 'Q999' + Q_MILL_AS_BLADE_CONVENTIONAL = '' if ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 16 then Q_FORCE_BLADE = 'Q01' -- i Q_DEPTH_CHAMFER = 'Q04' -- d Q_ONLY_CHAMFER = 'Q05' -- i + Q_MILL_AS_BLADE_CONVENTIONAL = 'Q14' -- i elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 17 then Q_DEPTH_CHAMFER = 'Q01' -- d Q_ONLY_CHAMFER = 'Q02' -- i @@ -220,6 +222,7 @@ local function AssignQIdent( Proc) Q_BLADE_ON_ALONG_FACE = 'Q04' -- i Q_ANTISPLINT_TYPE = 'Q06' -- i Q_DEPTH_CHAMFER = 'Q07' -- d + Q_MILL_AS_BLADE_CONVENTIONAL = 'Q14' -- i elseif ( Proc.Grp == 1 or Proc.Grp == 2) and Proc.Prc == 30 then Q_BLADE_ON_ALONG_FACE = 'Q04' -- i elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 32 then @@ -228,19 +231,23 @@ local function AssignQIdent( Proc) Q_ANTISPLINT_TYPE = 'Q06' -- i elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 33 then Q_ANTISPLINT_TYPE = 'Q06' -- i + Q_MILL_AS_BLADE_CONVENTIONAL = 'Q14' -- i elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 34 then Q_CONTOUR_SMALL_TOOL = 'Q01' -- i Q_USE_MILL = 'Q02' -- i Q_ANTISPLINT_TYPE = 'Q06' -- i elseif ( Proc.Grp == 4) and Proc.Prc == 37 then Q_ANTISPLINT_TYPE = 'Q06' -- i + Q_MILL_AS_BLADE_CONVENTIONAL = 'Q14' -- i elseif ( Proc.Grp == 4) and Proc.Prc == 39 then Q_CONTOUR_SMALL_TOOL = 'Q01' -- i Q_USE_MILL = 'Q02' -- i Q_ANTISPLINT_TYPE = 'Q06' -- i + Q_MILL_AS_BLADE_CONVENTIONAL = 'Q14' -- i elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 90 then Q_ANTISPLINT_TYPE = 'Q03' -- i Q_SIDE_ROUGH_TOOL = 'Q04' -- i + Q_MILL_AS_BLADE_CONVENTIONAL = 'Q14' -- i end -- le altre features gestite non hanno parametri Q end @@ -2856,7 +2863,13 @@ local function MakeByMillAsSaw( Proc, nPhase, nRawId, nPartId, nFacInd, for i = 1, nStep do local dOffs = ( i - 1) * dStep if vtN:getZ() < dVzLimDwnUp then dOffs = dOffs + dSawThick end - local bOk, sErr, nMchId = Fbs.MakeOne( Proc.Id, nFacAdj, sCutting, dSawDiam, nFaceUse, dVzLimDwnUp, 0, BD.CUT_SIC, dOffs, dStartDist, dEndDist, nil, b3Raw) + -- forzatura lavorazione discorde in base a parametro Q su feature + local nQ14Param = EgtGetInfo( Proc.Id, Q_MILL_AS_BLADE_CONVENTIONAL, 'd') or 0 + local bForceInvert = nQ14Param == 1 or ( nQ14Param == 2 and vtN:getX() < 0.1 and Proc.AffectedFaces.Bottom) + if bForceInvert and i == 1 then + dStartDist, dEndDist = dEndDist, dStartDist + end + local bOk, sErr, nMchId = Fbs.MakeOne( Proc.Id, nFacAdj, sCutting, dSawDiam, nFaceUse, dVzLimDwnUp, 0, BD.CUT_SIC, dOffs, dStartDist, dEndDist, nil, b3Raw, bForceInvert) if not bOk then return bOk, sErr end -- setto l'elevazione local sNotes = 'MaxElev=' .. EgtNumToString( 0, 1) .. ';' @@ -3565,6 +3578,11 @@ local function MakePocket( Proc, nPartId, b3Solid, ptPs, tvtN, nFaceRef, sMchFin if not ML.ApplyMachining( true, false) then -- provo ad allargare leggermente la tasca EgtSetMachiningParam( MCH_MP.OFFSR, -0.1) + -- se percorso a Zig-Zag, provo a cambiarlo in spirale + local nPocketSubType = EgtGetMachiningParam( MCH_MP.SUBTYPE) + if nPocketSubType == MCH_POCK_SUB.ZIGZAG then + EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN) + end if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index d50cbca..18979b6 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -167,6 +167,99 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmTail) return true, nil end +--------------------------------------------------------------------- +-- smussi in coda +local function MakeTailChamfer( idProc, nPartId, dDepthTailChamfer) + -- recupero gruppo per geometria aggiuntiva + local AddGrpId = BL.GetAddGroup( nPartId) + if not AddGrpId then + local sErr = 'Error on process StartFace impossible to find AddGroup' + EgtOutLog( sErr) + return false, sErr + end + + -- recupero la lavorazione + local sMilling = ML.FindMilling( 'Mark') + if not sMilling then + local sErr = 'Error : milling not found in library' + EgtOutLog( sErr) + return false, sErr + end + + local nLoopId, nLoopCnt = EgtExtractSurfTmFacetLoops( idProc, 0, AddGrpId) + if not nLoopId or nLoopCnt > 1 then + local sErr = 'Error MakeHeadChamfer : too many loops' + EgtOutLog( sErr) + return false, sErr + end + + -- setto direzione estrusione corretta + EgtModifyCurveExtrusion( nLoopId, -X_AX()) + EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.LEFT)) + + local dQ09Value = EgtGetInfo( idProc, 'Q09', 'd') + local bChamferedEdge = dQ09Value > 0 + + local nIdFirstEntity, nEntityCnt = EgtExplodeCurveCompo( nLoopId) + local p3MidPoint = EgtMP( nIdFirstEntity, GDB_ID.GRID) + + for i = 0, nEntityCnt - 1 do + if EgtCurveLength( nIdFirstEntity + i) - 10 < abs( dQ09Value) * 2 then + local sErr = 'Error MakeTailChamfer : Q09 too high' + EgtOutLog( sErr) + return false, sErr + end + end + + -- creo raccordo o fillet + for i = 0, nEntityCnt - 1 do + local idFirst = nIdFirstEntity + i + local idSecond = EgtIf( i == nEntityCnt - 1, nIdFirstEntity, idFirst + 1) + local ptEndPointFirst = EgtEP( idFirst, GDB_ID.GRID) - ( abs( dQ09Value) * EgtEV( idFirst, GDB_ID.GRID)) + local ptStartPointSecond = EgtSP( idSecond, GDB_ID.GRID) + ( abs( dQ09Value) * EgtEV( idSecond, GDB_ID.GRID)) + + if bChamferedEdge then + EgtCurveChamfer( AddGrpId, idFirst, ptEndPointFirst, idSecond, ptStartPointSecond, abs( dQ09Value), true, GDB_RT.GRID) + else + EgtCurveFillet( AddGrpId, idFirst, ptEndPointFirst, idSecond, ptStartPointSecond, abs( dQ09Value), true, GDB_RT.GRID) + end + end + + EgtSelectPathObjs( nIdFirstEntity, true) + local idGeom, idGeomCnt = EgtCurveCompoByChain( AddGrpId, GDB_ID.SEL, {0,0,0}, true) + if not idGeom or idGeomCnt > 1 then + local sErr = 'Error MakeTailChamfer : too many loops' + EgtOutLog( sErr) + return false, sErr + end + EgtChangeClosedCurveStartPoint( idGeom, p3MidPoint, GDB_RT.GRID) + + -- Inserisco la lavorazione del lato standard + local dExtra = 2 + local sName1 = 'TailCham_' .. ( EgtGetName( idProc) or tostring( idProc)) + local nMch1Id = EgtAddMachining( sName1, sMilling) + if not nMch1Id then + local sErr = 'Error adding machining ' .. sName1 .. '-' .. sMilling + EgtOutLog( sErr) + return false, sErr + end + -- aggiungo geometria + EgtSetMachiningGeometry( {{ idGeom, -1}}) + -- assegno affondamento e offset radiale + EgtSetMachiningParam( MCH_MP.DEPTH, dDepthTailChamfer + dExtra) + EgtSetMachiningParam( MCH_MP.OFFSR, dExtra) + -- assegno lato di lavoro + EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) + -- eseguo + if not ML.ApplyMachining( true, false) then + local _, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nMch1Id, false) + return false, sErr + end + + return true, nil +end + --------------------------------------------------------------------- -- lavorazione con sega a catena per sezioni alte e larghe local function MakeCutByChainSaw( nSurfId, sSawing, nFaceUse, dDepth, sNotes, dRadialOffset, bExtendStartEnd, bInvert) @@ -662,7 +755,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt local dMinTailScrapForAdditionalCuts = 10.123 local bNeedVerticalAddedCuts = not bSplit and ( Proc.Face[1].WidthTrimmed > BD.MAX_LEN_DICE) and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) local bNeedHorizontalAddedCuts = not bSplit and not bBigSectionCut and - ( Proc.Face[1].HeightTrimmed > ( BD.MIN_HEIGHT_ADDED_CUTS or BD.MAX_LEN_DICE)) and + ( Proc.Face[1].HeightTrimmed > ( BD.MIN_HEIGHT_ADDED_CUTS or BD.MAX_LEN_DICE) + 100 * GEO.EPS_SMALL) and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) and dOffsL < BD.MAX_DIM_DICE -- dati lavorazioni sopra e sotto @@ -819,6 +912,43 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt local bOk, sErr = MakeStandardCuts( Proc, b3Raw, nCuts, dOffsL, TailCutType, Cutting1Data, Cutting2Data, nil, dLenEndRaw) + -- se smussi in coda da aggiungere + local dDepthTailChamfer = EgtGetInfo( nOriId or Proc.Id, 'Q08', 'd') or 0 + if dDepthTailChamfer > 100 * GEO.EPS_SMALL then + -- creo subito nuova fase qui, a meno che non sia stata già creata + if nNewPhase == 0 then + BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET) + nNewPhase = EgtGetCurrPhase() + local nDispId = EgtGetPhaseDisposition( nNewPhase) + if sDownOrSideOrStd == 'down' then + EgtRotateRawPart( nRawId, X_AX(), 180) + EgtSetInfo( nDispId, 'TYPE', 'MID2') + EgtSetInfo( nDispId, 'ROT', -2) + elseif sDownOrSideOrStd == 'side' then + if bPreMove then EgtMoveRawPart( nRawId, vtMove) end + EgtRotateRawPart( nRawId, X_AX(), EgtIf( BD.RIGHT_LOAD, -90, 90)) + if not bPreMove then EgtMoveRawPart( nRawId, vtMove) end + EgtSetInfo( nDispId, 'TYPE', 'MID2') + EgtSetInfo( nDispId, 'ROT', -1) + else + EgtSetInfo( nDispId, 'TYPE', 'END') + end + EgtSetInfo( nDispId, 'ORD', nOrd) + -- se grezzo successivo senza pezzi e finale, va tolto + local nNextRawId = EgtGetNextRawPart( nRawId) + if nNextRawId and EgtGetPartInRawPartCount( nNextRawId) == 0 and EgtGetRawPartBBox( nNextRawId):getDimX() < BD.MinRaw then + EgtRemoveRawPartFromCurrPhase( nNextRawId) + end + end + -- alla fine del taglio si aggiungono gli smussi in testa + local _, sErrHeadChamfer = MakeTailChamfer( nOriId or Proc.Id, nPartId, dDepthTailChamfer) + if sErr then + sErr = sErr..'\n'..sErrHeadChamfer + else + sErr = sErrHeadChamfer + end + end + return bOk, sErr, nNewPhase end diff --git a/UpdateLog.txt b/UpdateLog.txt index 1108c23..f7eaa6e 100644 --- a/UpdateLog.txt +++ b/UpdateLog.txt @@ -1,5 +1,12 @@ ==== Beam Update Log ==== +Versione 2.7k1 (25/11/2024) +- Added : in tagli di testa e coda aggiunti smussi con possibilità di raccordare o smussare spigoli +- Added : in Lapjoint aggiunto Q14 per settare lavorazione discorde se longitudinale su faccia sotto +- Modif : migliorati i tagli +- Modif : migliorata lavorazione mortasa a coda di rondine +- Fixed : in Lapjoint alcune svuotature forzate a spirale + Versione 2.7j2 (30/10/2025) - Fixed : in DoubleCut gestito il caso in cui si ha una terza faccia piccola da non lavorare diff --git a/Version.lua b/Version.lua index c3c5547..b1465e5 100644 --- a/Version.lua +++ b/Version.lua @@ -2,5 +2,5 @@ -- Gestione della versione di Beam NAME = 'Beam' -VERSION = '2.7j2' +VERSION = '2.7k1' MIN_EXE = '2.7f2'