diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index 456de61..873709d 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -1,4 +1,4 @@ --- ProcessCut.lua by Egaltech s.r.l. 2020/11/13 +-- ProcessCut.lua by Egaltech s.r.l. 2020/11/20 -- Gestione calcolo singoli tagli di lama per Travi -- Tabella per definizione modulo @@ -191,6 +191,17 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom) -- dati geometrici del taglio local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) local bDownCut = ( vtN:getZ() <= dNzLimDwnUp) + local bFillAreaPiece + -- caso particolare: se faccia quasi piana e componente X negativa, si vuole evitare che i tagli a cubetti sulla faccia non iniziano dalla coda ma dalla testa + -- se non è taglio da sotto verifico se la faccia uccupa tutta l'area del pezzo, + -- cioè componente Z vicina a 1 e box faccia e box pezzo corrispondenti e non sborda sulla faccia inferiore + if not bDownCut and vtN:getZ() > 0.98 then + if abs( Proc.Box:getMin():getX() - b3Solid:getMin():getX() ) < 10*GEO.EPS_SMALL and abs( Proc.Box:getMax():getX() - b3Solid:getMax():getX() ) < 10*GEO.EPS_SMALL and + abs( Proc.Box:getMin():getY() - b3Solid:getMin():getY() ) < 10*GEO.EPS_SMALL and abs( Proc.Box:getMax():getY() - b3Solid:getMax():getY() ) < 10*GEO.EPS_SMALL and + b3Solid:getMin():getZ() < Proc.Box:getMin():getZ() - 100 * GEO.EPS_SMALL then + bFillAreaPiece = true + end + end -- se taglio di testa if Proc.Head then -- se coincide con il taglio di separazione precedente, non va fatto @@ -240,7 +251,13 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom) EgtOutLog( string.format( 'MaxDepth=%.1f MaxVertDepth=%.1f CutH=%.1f CutV=%.1f', dMaxDepth, dMaxVertDepth, dCutH, dCutV), 3) local vCuts = {} if dCutH > dMaxDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC or dCutV > dMaxVertDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC then - vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC, vtN, true, nil, nil, dMaxDepth - BD.CUT_EXTRA) + local ptExtra, vtExtra + if bFillAreaPiece then + local ptMiddle = ( b3Solid:getMin() + b3Solid:getMax()) / 2 + ptExtra = Point3d( b3Solid:getMin():getX() + 5*GEO.EPS_SMALL, ptMiddle:getY(), ptMiddle:getZ()) + vtExtra = X_AX() + end + vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC, vtN, true, ptExtra, vtExtra, dMaxDepth - BD.CUT_EXTRA) end --DC.PrintOrderCut( vCuts) if #vCuts > 0 then diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index ed3ea45..4115cae 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -1,4 +1,4 @@ --- ProcessDrill.lua by Egaltech s.r.l. 2020/11/06 +-- ProcessDrill.lua by Egaltech s.r.l. 2020/12/01 -- Gestione calcolo forature per Travi -- Tabella per definizione modulo @@ -197,7 +197,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) dCheckDepth = nil end -- recupero la lavorazione - local sDrilling, nType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, Proc.Down) + local sDrilling, nType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, BD.DOWN_HEAD and Proc.Down) if not sDrilling then -- se non ho passato altezza di taglio utensile allora non è stato trovato utensile if not dCheckDepth then @@ -207,7 +207,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) -- altrimenti rifaccio la ricerca foratura senza passare altezza utensile else dCheckDepth = nil - sDrilling, nType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, nil, Proc.Down) + sDrilling, nType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, nil, BD.DOWN_HEAD and Proc.Down) if not sDrilling then local sErr = 'Error : drilling not found in library' EgtOutLog( sErr) @@ -330,7 +330,16 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) end EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo - if not EgtApplyMachining( true, false) then + local bOk = EgtApplyMachining( true, false) + if not bOk and BD.DOWN_HEAD then + if nType == 'Drill' then + EgtSetMachiningParam( MCH_MP.INVERT, true) + else + EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) + end + bOk = EgtApplyMachining( true, false) + end + if not bOk then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr diff --git a/LuaLibs/ProcessFreeContour.lua b/LuaLibs/ProcessFreeContour.lua index dc9ebbe..5df276e 100644 --- a/LuaLibs/ProcessFreeContour.lua +++ b/LuaLibs/ProcessFreeContour.lua @@ -1,4 +1,4 @@ --- ProcessFreeContour.lua by Egaltech s.r.l. 2020/11/07 +-- ProcessFreeContour.lua by Egaltech s.r.l. 2020/11/20 -- Gestione calcolo profilo libero per Travi -- Tabella per definizione modulo @@ -451,9 +451,10 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead) for j = 1, nDouble do local sName local nMchId - -- se ho smusso abilitato e gruppo 0 e profondità geometria minore della profondità smusso, + local bEnableCham + -- se ho smusso abilitato e profondità geometria minore della profondità smusso, -- applico lavorazione smusso - if nChamfer > 0 and Proc.Grp == 0 and dOriDepth <= dDepthCham then + if nChamfer > 0 and dOriDepth <= dDepthCham then -- inserisco la lavorazione sName = 'FreeCham_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) nMchId = EgtAddMachining( sName, sChamfer) @@ -465,6 +466,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead) dOffsetPar = 0 -- assegno affondamento EgtSetMachiningParam( MCH_MP.DEPTH, dDepthCham) + bEnableCham = true else -- inserisco la lavorazione sName = 'Free_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) @@ -521,9 +523,11 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead) local bFinish local dOriOffset = 0 -- se parametro sovramateriale è maggiore di 0 abilito la finitura extra - if dOffsetPar > 0 then + if not bEnableCham and dOffsetPar > 0 then EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) bFinish = true + elseif bEnableCham and Proc.Grp ~= 0 then + EgtSetMachiningParam( MCH_MP.OFFSR, dDepthCham) end -- eseguo if not EgtApplyMachining( true, false) then diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index b2a6e18..ce3c951 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -1267,7 +1267,7 @@ local function MakeCleanCorner( Proc, nPhase, nRawId, nPartId, b3Raw, nFacInd, n if vtExtr:getZ() < BD.DRILL_VZ_MIN then local sErr = 'Error : clean corner milling from bottom impossible' EgtOutLog( sErr) - return false, sErrLX + return false, sErr end -- sommo i tre versori per avre una direzione media vtExtr = vtN1 + vtN2 + vtN3 diff --git a/LuaLibs/ProcessProfCamb.lua b/LuaLibs/ProcessProfCamb.lua index efec7f9..67c8bc3 100644 --- a/LuaLibs/ProcessProfCamb.lua +++ b/LuaLibs/ProcessProfCamb.lua @@ -1,4 +1,4 @@ --- ProcessProfCamb.lua by Egaltech s.r.l. 2020/11/17 +-- ProcessProfCamb.lua by Egaltech s.r.l. 2020/11/19 -- Gestione calcolo profilo caudato per Travi -- Tabella per definizione modulo @@ -23,7 +23,8 @@ local sOverMaterialForFinish = 'Q04' -- d local sPreemptiveChamfer = 'Q05' -- i -- abilitazioni extra -dMakeAntiSplintOnHead = 0 -- valore impronta antischeggia, per disattivare settare = nil o = 0 +local dMakeAntiSplintOnHead = 1 -- valore impronta antischeggia, per disattivare settare = nil o = 0 +local dActivateCompoAng = 0.175 -- valore componente Y per disattivare settare = nil --------------------------------------------------------------------- -- Riconoscimento della feature @@ -236,6 +237,18 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) local dToolMaxDepth = 0 local dMillDiam = 0 local sMilling + -- in base alla direzione iniziale della curva e al valore di entrata valido, setto l'antischeggia + local bMakeAs + local vtStart = EgtSV( AuxId, GDB_ID.ROOT) + if nSide == 0 then + if abs(vtStart:getY()) >= dActivateCompoAng and dMakeAntiSplintOnHead and abs(dMakeAntiSplintOnHead) > 0 then + bMakeAs = true + end + else + if abs(vtStart:getZ()) >= dActivateCompoAng and dMakeAntiSplintOnHead and abs(dMakeAntiSplintOnHead) > 0 then + bMakeAs = true + end + end -- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama if nChamfer < 2 then -- aggiungo taglio di lama di sgrossatura e lo lavoro @@ -392,7 +405,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP) -- inserisco la lavorazione local sName - if dMakeAntiSplintOnHead and abs(dMakeAntiSplintOnHead) > 0 then + if bMakeAs then sName = 'Prof_As_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) else sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) @@ -463,7 +476,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) ModifySideAndInvert( Proc, bHead) end -- se devo fare l'antischeggia in testa - if dMakeAntiSplintOnHead and abs(dMakeAntiSplintOnHead) > 0 then + if bMakeAs then local sNewName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) -- copio lavorazione per ingresso antischeggia (la copia è la lavorazione finale) local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) @@ -502,7 +515,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if bDouble then -- inserisco la lavorazione local sName - if dMakeAntiSplintOnHead and abs(dMakeAntiSplintOnHead) > 0 then + if bMakeAs then sName = 'ProfB_As_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) else sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) @@ -541,7 +554,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) ModifySideAndInvert( Proc, bHead) end -- se devo fare l'antischeggia in testa - if dMakeAntiSplintOnHead and abs(dMakeAntiSplintOnHead) > 0 then + if bMakeAs then local sNewName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) -- copio lavorazione per ingresso antischeggia (la copia è la lavorazione finale) local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) diff --git a/LuaLibs/ProcessProfConcave.lua b/LuaLibs/ProcessProfConcave.lua index 361fca0..ac18f4c 100644 --- a/LuaLibs/ProcessProfConcave.lua +++ b/LuaLibs/ProcessProfConcave.lua @@ -1,4 +1,4 @@ --- ProcessProfConcave.lua by Egaltech s.r.l. 2020/10/14 +-- ProcessProfConcave.lua by Egaltech s.r.l. 2020/11/19 -- Gestione calcolo profilo concavo per Travi -- Tabella per definizione modulo @@ -75,7 +75,8 @@ local function GetSawCutData( AuxId, vtN) end --------------------------------------------------------------------- -local function ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, bNotModifLeadPar) +local function ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, bNotModifLeadPar, dLenIni, + dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar) -- confronto il punto iniziale e finale della lavorazione con il box della feature -- e se è vicino alla parte esterna della trave inverto la lavorazione @@ -99,6 +100,15 @@ local function ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, bNotModifLead EgtSetMachiningParam( MCH_MP.LITANG, (dToolDiam/2)+0.5) EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, 0) EgtSetMachiningParam( MCH_MP.ENDADDLEN, (dToolDiam/3*2)) + elseif dLenIni and dLenLst then + -- se entità agi estremi sono inferiori del raggio utensile ed è abilitata la ripresa della faccia, + -- allungo attacco e/o uscita + if dLenIni < ( dToolDiam / 2) + ( 20 * GEO.EPS_SMALL) and bFirstTrim then + EgtSetMachiningParam( EgtIf( bFlagInvert, MCH_MP.STARTADDLEN, MCH_MP.ENDADDLEN), (dToolDiam/2)-dLenIni+dOffsetPar+1) + end + if dLenLst < ( dToolDiam / 2) + ( 20 * GEO.EPS_SMALL) and bLastTrim then + EgtSetMachiningParam( EgtIf( bFlagInvert, MCH_MP.ENDADDLEN, MCH_MP.STARTADDLEN), (dToolDiam/2)-dLenLst+dOffsetPar+1) + end end -- riapplico la lavorazione EgtApplyMachining( true, false) @@ -111,6 +121,15 @@ local function ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, bNotModifLead EgtSetMachiningParam( MCH_MP.ENDADDLEN, (dToolDiam/3*2)) -- riapplico la lavorazione EgtApplyMachining( true, false) + elseif dLenIni and dLenLst then + -- se entità agi estremi sono inferiori del raggio utensile ed è abilitata la ripresa della faccia, + -- allungo attacco e/o uscita + if dLenIni < ( dToolDiam / 2) + ( 20 * GEO.EPS_SMALL) and bFirstTrim then + EgtSetMachiningParam( EgtIf( bFlagInvert, MCH_MP.ENDADDLEN, MCH_MP.STARTADDLEN), (dToolDiam/2)-dLenIni+dOffsetPar+1) + end + if dLenLst < ( dToolDiam / 2) + ( 20 * GEO.EPS_SMALL) and bLastTrim then + EgtSetMachiningParam( EgtIf( bFlagInvert, MCH_MP.STARTADDLEN, MCH_MP.ENDADDLEN), (dToolDiam/2)-dLenLst+dOffsetPar+1) + end end end end @@ -196,6 +215,11 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) local nLastFacet = EgtSurfTmFacetCount( Proc.Id) - 1 -- faccia finale local nMidFacet = ( nLastFacet + 1) // 2 -- faccia a metà circa local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nMidFacet, GDB_ID.ROOT) + -- acquisisco informazioni sulle facce estreme + local _, _, dLenIni = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFirstFacet, GDB_ID.ROOT) + local _, _, dLenLst = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nLastFacet, GDB_ID.ROOT) + -- flag percorso invertito + local bFlagInvert = false -- verifico se in testa o coda local bHead = ( vtN:getX() > 0) EgtOutLog( 'vtN=' .. tostring( vtN), 3) @@ -245,6 +269,14 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if nChamfer > 0 then local bDoubleCham = false local dExtra = 2 + -- Recupero i dati dell'utensile + local dToolDiam = 0 + if EgtMdbSetCurrMachining( sChamfer) then + local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then + dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) + end + end -- inserisco la lavorazione local sNameCh = 'Cham_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local nMchId = EgtAddMachining( sNameCh, sChamfer) @@ -263,6 +295,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) ( not bHead and vtExtr:getY() > 0.1) then EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = not bFlagInvert end -- altrimenti lavorazione dal davanti o dal dietro else @@ -270,20 +303,21 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if vtExtr:getZ() < 0 then EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = not bFlagInvert end -- se lavorazione a destra da dietro o sinistra di fronte, inverto if ( bHead and vtNF:getY() > 0.1) or ( not bHead and vtNF:getY() < -0.1) then EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = not bFlagInvert end end -- assegno affondamento e offset radiale EgtSetMachiningParam( MCH_MP.DEPTH, dDepthCham + dExtra) EgtSetMachiningParam( MCH_MP.OFFSR, dExtra) - -- allungo inizio e fine attacco - EgtSetMachiningParam( MCH_MP.STARTADDLEN, 10) - EgtSetMachiningParam( MCH_MP.ENDADDLEN, 10) + -- cambio il tipo di attacco in tangente + EgtSetMachiningParam( MCH_MP.LEADINTYPE, 2) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- eseguo @@ -294,7 +328,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) else -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno -- della feature inverto il punto di inizio della lavorazione - ModifySideAndInvertAndLead( Proc, bHead, dMillDiam, true) + ModifySideAndInvertAndLead( Proc, bHead, dToolDiam + ( 2 * dExtra), true, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dExtra) end -- se lavorazione da due parti, aggiungo la seconda if bDoubleCham then @@ -308,19 +342,21 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end -- aggiungo geometria EgtSetMachiningGeometry( {{ AuxId, -1}}) + -- resetto il flag inversione percorso + bFlagInvert = false -- sempre lavorazione da sopra o da sotto -- se lavorazione a destra di fronte o sinistra da dietro, inverto if ( bHead and vtExtr:getY() > 0.1) or ( not bHead and vtExtr:getY() < -0.1) then EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = not bFlagInvert end -- assegno affondamento e offset radiale EgtSetMachiningParam( MCH_MP.DEPTH, dDepthCham + dExtra) EgtSetMachiningParam( MCH_MP.OFFSR, dExtra) - -- allungo inizio e fine attacco - EgtSetMachiningParam( MCH_MP.STARTADDLEN, 10) - EgtSetMachiningParam( MCH_MP.ENDADDLEN, 10) + -- cambio il tipo di attacco in tangente + EgtSetMachiningParam( MCH_MP.LEADINTYPE, 2) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- eseguo @@ -331,7 +367,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) else -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno -- della feature inverto il punto di inizio della lavorazione - ModifySideAndInvertAndLead( Proc, bHead, dMillDiam, true) + ModifySideAndInvertAndLead( Proc, bHead, dToolDiam + ( 2 * dExtra), true, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dExtra) end end end @@ -367,6 +403,8 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end -- aggiungo geometria EgtSetMachiningGeometry( {{ AuxId, -1}}) + -- resetto il flag inversione percorso + bFlagInvert = false -- se lavorazione da sopra o da sotto if nSide ~= 0 then if not bDouble and nSide == -1 then @@ -375,6 +413,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) ( not bHead and vtExtr:getY() < -0.1) then EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = not bFlagInvert end else -- se lavorazione a destra di fronte o sinistra da dietro, inverto @@ -382,6 +421,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) ( not bHead and vtExtr:getY() > 0.1) then EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = not bFlagInvert end end -- altrimenti lavorazione dal davanti o dal dietro @@ -390,12 +430,14 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if vtExtr:getZ() < 0 then EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = not bFlagInvert end -- se lavorazione a destra da dietro o sinistra di fronte, inverto if ( bHead and vtN:getY() > 0.1) or ( not bHead and vtN:getY() < -0.1) then EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = not bFlagInvert end end -- se in doppio, imposto l'affondamento @@ -423,7 +465,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno -- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco -- e uscita - ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, true) + ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, true, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar) end -- se abilitata, aggiungo lavorazione di finitura if bFinish then @@ -458,12 +500,15 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end -- aggiungo geometria EgtSetMachiningGeometry( {{ AuxId, -1}}) + -- resetto il flag inversione percorso + bFlagInvert = false -- sempre lavorazione da sopra o da sotto -- se lavorazione a destra di fronte o sinistra da dietro, inverto if ( bHead and vtExtr:getY() > 0.1) or ( not bHead and vtExtr:getY() < -0.1) then EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = not bFlagInvert end -- imposto l'affondamento EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) @@ -482,7 +527,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno -- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco -- e uscita - ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, true) + ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, true, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar) end -- se abilitata, aggiungo lavorazione di finitura if bFinish then diff --git a/LuaLibs/ProcessProfConvex.lua b/LuaLibs/ProcessProfConvex.lua index 293b662..38720e8 100644 --- a/LuaLibs/ProcessProfConvex.lua +++ b/LuaLibs/ProcessProfConvex.lua @@ -1,4 +1,4 @@ --- ProcessProfConvex.lua by Egaltech s.r.l. 2020/10/14 +-- ProcessProfConvex.lua by Egaltech s.r.l. 2020/11/19 -- Gestione calcolo profilo convesso per Travi -- Tabella per definizione modulo @@ -75,7 +75,8 @@ local function GetSawCutData( AuxId, vtN) end --------------------------------------------------------------------- -local function ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, bNotModifLeadPar) +local function ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, bNotModifLeadPar, dLenIni, + dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar) -- confronto il punto iniziale e finale della lavorazione con il box della feature -- e se è vicino alla parte esterna della trave inverto la lavorazione @@ -99,6 +100,15 @@ local function ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, bNotModifLead EgtSetMachiningParam( MCH_MP.LITANG, (dToolDiam/2)+0.5) EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, 0) EgtSetMachiningParam( MCH_MP.ENDADDLEN, (dToolDiam/3*2)) + elseif dLenIni and dLenLst then + -- se entità agi estremi sono inferiori del raggio utensile ed è abilitata la ripresa della faccia, + -- allungo attacco e/o uscita + if dLenIni < ( dToolDiam / 2) + ( 20 * GEO.EPS_SMALL) and bFirstTrim then + EgtSetMachiningParam( EgtIf( bFlagInvert, MCH_MP.STARTADDLEN, MCH_MP.ENDADDLEN), (dToolDiam/2)-dLenIni+dOffsetPar+1) + end + if dLenLst < ( dToolDiam / 2) + ( 20 * GEO.EPS_SMALL) and bLastTrim then + EgtSetMachiningParam( EgtIf( bFlagInvert, MCH_MP.ENDADDLEN, MCH_MP.STARTADDLEN), (dToolDiam/2)-dLenLst+dOffsetPar+1) + end end -- riapplico la lavorazione EgtApplyMachining( true, false) @@ -111,6 +121,15 @@ local function ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, bNotModifLead EgtSetMachiningParam( MCH_MP.ENDADDLEN, (dToolDiam/3*2)) -- riapplico la lavorazione EgtApplyMachining( true, false) + elseif dLenIni and dLenLst then + -- se entità agi estremi sono inferiori del raggio utensile ed è abilitata la ripresa della faccia, + -- allungo attacco e/o uscita + if dLenIni < ( dToolDiam / 2) + ( 20 * GEO.EPS_SMALL) and bFirstTrim then + EgtSetMachiningParam( EgtIf( bFlagInvert, MCH_MP.ENDADDLEN, MCH_MP.STARTADDLEN), (dToolDiam/2)-dLenIni+dOffsetPar+1) + end + if dLenLst < ( dToolDiam / 2) + ( 20 * GEO.EPS_SMALL) and bLastTrim then + EgtSetMachiningParam( EgtIf( bFlagInvert, MCH_MP.STARTADDLEN, MCH_MP.ENDADDLEN), (dToolDiam/2)-dLenLst+dOffsetPar+1) + end end end end @@ -196,6 +215,11 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) local nLastFacet = EgtSurfTmFacetCount( Proc.Id) - 1 -- faccia finale local nMidFacet = ( nLastFacet + 1) // 2 -- faccia a metà circa local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nMidFacet, GDB_ID.ROOT) + -- acquisisco informazioni sulle facce estreme + local _, _, dLenIni = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFirstFacet, GDB_ID.ROOT) + local _, _, dLenLst = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nLastFacet, GDB_ID.ROOT) + -- flag percorso invertito + local bFlagInvert = false -- verifico se in testa o coda local bHead = ( vtN:getX() > 0) EgtOutLog( 'vtN=' .. tostring( vtN), 3) @@ -245,6 +269,14 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if nChamfer > 0 then local bDoubleCham = false local dExtra = 2 + -- Recupero i dati dell'utensile + local dToolDiam = 0 + if EgtMdbSetCurrMachining( sChamfer) then + local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then + dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) + end + end -- inserisco la lavorazione local sNameCh = 'Cham_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local nMchId = EgtAddMachining( sNameCh, sChamfer) @@ -263,6 +295,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) ( not bHead and vtExtr:getY() > 0.1) then EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = not bFlagInvert end -- altrimenti lavorazione dal davanti o dal dietro else @@ -270,20 +303,21 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if vtExtr:getZ() < 0 then EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = not bFlagInvert end -- se lavorazione a destra da dietro o sinistra di fronte, inverto if ( bHead and vtNF:getY() > 0.1) or ( not bHead and vtNF:getY() < -0.1) then EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = not bFlagInvert end end -- assegno affondamento e offset radiale EgtSetMachiningParam( MCH_MP.DEPTH, dDepthCham + dExtra) EgtSetMachiningParam( MCH_MP.OFFSR, dExtra) - -- allungo inizio e fine attacco - EgtSetMachiningParam( MCH_MP.STARTADDLEN, 10) - EgtSetMachiningParam( MCH_MP.ENDADDLEN, 10) + -- cambio il tipo di attacco in tangente + EgtSetMachiningParam( MCH_MP.LEADINTYPE, 2) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- eseguo @@ -294,7 +328,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) else -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno -- della feature inverto il punto di inizio della lavorazione - ModifySideAndInvertAndLead( Proc, bHead, dMillDiam, true) + ModifySideAndInvertAndLead( Proc, bHead, dToolDiam + ( 2 * dExtra), true, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dExtra) end -- se lavorazione da due parti, aggiungo la seconda if bDoubleCham then @@ -308,19 +342,21 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end -- aggiungo geometria EgtSetMachiningGeometry( {{ AuxId, -1}}) + -- resetto il flag inversione percorso + bFlagInvert = false -- sempre lavorazione da sopra o da sotto -- se lavorazione a destra di fronte o sinistra da dietro, inverto if ( bHead and vtExtr:getY() > 0.1) or ( not bHead and vtExtr:getY() < -0.1) then EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = not bFlagInvert end -- assegno affondamento e offset radiale EgtSetMachiningParam( MCH_MP.DEPTH, dDepthCham + dExtra) EgtSetMachiningParam( MCH_MP.OFFSR, dExtra) - -- allungo inizio e fine attacco - EgtSetMachiningParam( MCH_MP.STARTADDLEN, 10) - EgtSetMachiningParam( MCH_MP.ENDADDLEN, 10) + -- cambio il tipo di attacco in tangente + EgtSetMachiningParam( MCH_MP.LEADINTYPE, 2) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- eseguo @@ -331,7 +367,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) else -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno -- della feature inverto il punto di inizio della lavorazione - ModifySideAndInvertAndLead( Proc, bHead, dMillDiam, true) + ModifySideAndInvertAndLead( Proc, bHead, dToolDiam + ( 2 * dExtra), true, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dExtra) end end end @@ -367,6 +403,8 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end -- aggiungo geometria EgtSetMachiningGeometry( {{ AuxId, -1}}) + -- resetto il flag inversione percorso + bFlagInvert = false -- se lavorazione da sopra o da sotto if nSide ~= 0 then if not bDouble and nSide == -1 then @@ -375,6 +413,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) ( not bHead and vtExtr:getY() < -0.1) then EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = not bFlagInvert end else -- se lavorazione a destra di fronte o sinistra da dietro, inverto @@ -382,6 +421,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) ( not bHead and vtExtr:getY() > 0.1) then EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = not bFlagInvert end end -- altrimenti lavorazione dal davanti o dal dietro @@ -390,12 +430,14 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if vtExtr:getZ() < 0 then EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = not bFlagInvert end -- se lavorazione a destra da dietro o sinistra di fronte, inverto if ( bHead and vtN:getY() > 0.1) or ( not bHead and vtN:getY() < -0.1) then EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = not bFlagInvert end end -- se in doppio, imposto l'affondamento @@ -423,7 +465,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno -- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco -- e uscita - ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, true) + ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, true, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar) end -- se abilitata, aggiungo lavorazione di finitura if bFinish then @@ -458,12 +500,15 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end -- aggiungo geometria EgtSetMachiningGeometry( {{ AuxId, -1}}) + -- resetto il flag inversione percorso + bFlagInvert = false -- sempre lavorazione da sopra o da sotto -- se lavorazione a destra di fronte o sinistra da dietro, inverto if ( bHead and vtExtr:getY() > 0.1) or ( not bHead and vtExtr:getY() < -0.1) then EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = not bFlagInvert end -- imposto l'affondamento EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) @@ -482,7 +527,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno -- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco -- e uscita - ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, true) + ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, true, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar) end -- se abilitata, aggiungo lavorazione di finitura if bFinish then diff --git a/LuaLibs/ProcessProfHead.lua b/LuaLibs/ProcessProfHead.lua index 3ee297e..c4c7072 100644 --- a/LuaLibs/ProcessProfHead.lua +++ b/LuaLibs/ProcessProfHead.lua @@ -1,4 +1,4 @@ --- ProcessProfHead.lua by Egaltech s.r.l. 2020/10/24 +-- ProcessProfHead.lua by Egaltech s.r.l. 2020/11/19 -- Gestione calcolo profilo di testa per Travi -- Tabella per definizione modulo @@ -67,7 +67,8 @@ local function GetSawCutData( AuxId, vtN) end --------------------------------------------------------------------- -local function ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, bNotModifLeadPar) +local function ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, bNotModifLeadPar, dLenIni, + dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar) -- confronto il punto iniziale e finale della lavorazione con il box della feature -- e se è vicino alla parte esterna della trave inverto la lavorazione @@ -91,6 +92,15 @@ local function ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, bNotModifLead EgtSetMachiningParam( MCH_MP.LITANG, (dToolDiam/2)+0.5) EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, 0) EgtSetMachiningParam( MCH_MP.ENDADDLEN, (dToolDiam/3*2)) + elseif dLenIni and dLenLst then + -- se entità agi estremi sono inferiori del raggio utensile ed è abilitata la ripresa della faccia, + -- allungo attacco e/o uscita + if dLenIni < ( dToolDiam / 2) + ( 20 * GEO.EPS_SMALL) and bFirstTrim then + EgtSetMachiningParam( EgtIf( bFlagInvert, MCH_MP.STARTADDLEN, MCH_MP.ENDADDLEN), (dToolDiam/2)-dLenIni+dOffsetPar+1) + end + if dLenLst < ( dToolDiam / 2) + ( 20 * GEO.EPS_SMALL) and bLastTrim then + EgtSetMachiningParam( EgtIf( bFlagInvert, MCH_MP.ENDADDLEN, MCH_MP.STARTADDLEN), (dToolDiam/2)-dLenLst+dOffsetPar+1) + end end -- riapplico la lavorazione EgtApplyMachining( true, false) @@ -103,6 +113,15 @@ local function ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, bNotModifLead EgtSetMachiningParam( MCH_MP.ENDADDLEN, (dToolDiam/3*2)) -- riapplico la lavorazione EgtApplyMachining( true, false) + elseif dLenIni and dLenLst then + -- se entità agi estremi sono inferiori del raggio utensile ed è abilitata la ripresa della faccia, + -- allungo attacco e/o uscita + if dLenIni < ( dToolDiam / 2) + ( 20 * GEO.EPS_SMALL) and bFirstTrim then + EgtSetMachiningParam( EgtIf( bFlagInvert, MCH_MP.ENDADDLEN, MCH_MP.STARTADDLEN), (dToolDiam/2)-dLenIni+dOffsetPar+1) + end + if dLenLst < ( dToolDiam / 2) + ( 20 * GEO.EPS_SMALL) and bLastTrim then + EgtSetMachiningParam( EgtIf( bFlagInvert, MCH_MP.STARTADDLEN, MCH_MP.ENDADDLEN), (dToolDiam/2)-dLenLst+dOffsetPar+1) + end end end end @@ -197,6 +216,11 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) vtN = vtN1 + vtN2 vtN:normalize() end + -- acquisisco informazioni sulle facce estreme + local _, _, dLenIni = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFirstFacet, GDB_ID.ROOT) + local _, _, dLenLst = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nLastFacet, GDB_ID.ROOT) + -- flag percorso invertito + local bFlagInvert = false -- verifico se in testa o coda local bHead = ( vtN:getX() > 0) EgtOutLog( 'vtN=' .. tostring( vtN), 3) @@ -249,6 +273,14 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if nChamfer > 0 then local bDoubleCham = false local dExtra = 2 + -- Recupero i dati dell'utensile + local dToolDiam = 0 + if EgtMdbSetCurrMachining( sChamfer) then + local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then + dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) + end + end -- inserisco la lavorazione local sNameCh = 'Cham_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local nMchId = EgtAddMachining( sNameCh, sChamfer) @@ -267,6 +299,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) ( not bHead and vtExtr:getY() > 0.1) then EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = not bFlagInvert end -- altrimenti lavorazione dal davanti o dal dietro else @@ -274,20 +307,21 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if vtExtr:getZ() < 0 then EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = not bFlagInvert end -- se lavorazione a destra da dietro o sinistra di fronte, inverto if ( bHead and vtNF:getY() > 0.1) or ( not bHead and vtNF:getY() < -0.1) then EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = not bFlagInvert end end -- assegno affondamento e offset radiale EgtSetMachiningParam( MCH_MP.DEPTH, dDepthCham + dExtra) EgtSetMachiningParam( MCH_MP.OFFSR, dExtra) - -- allungo inizio e fine attacco - EgtSetMachiningParam( MCH_MP.STARTADDLEN, 10) - EgtSetMachiningParam( MCH_MP.ENDADDLEN, 10) + -- cambio il tipo di attacco in tangente + EgtSetMachiningParam( MCH_MP.LEADINTYPE, 2) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- eseguo @@ -298,7 +332,8 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) else -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno -- della feature inverto il punto di inizio della lavorazione - ModifySideAndInvertAndLead( Proc, bHead, dMillDiam, true) + ModifySideAndInvertAndLead( Proc, bHead, dToolDiam + ( 2 * dExtra), true, dLenIni, + dLenLst, EgtIf( #vAngs > 0 and vAngs[1] == 0, true, false), EgtIf( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2), true, false), bFlagInvert, dExtra) end -- se lavorazione da due parti, aggiungo la seconda if bDoubleCham then @@ -312,19 +347,21 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end -- aggiungo geometria EgtSetMachiningGeometry( {{ AuxId, -1}}) + -- resetto il flag inversione percorso + bFlagInvert = false -- sempre lavorazione da sopra o da sotto -- se lavorazione a destra di fronte o sinistra da dietro, inverto if ( bHead and vtExtr:getY() > 0.1) or ( not bHead and vtExtr:getY() < -0.1) then EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = not bFlagInvert end -- assegno affondamento e offset radiale EgtSetMachiningParam( MCH_MP.DEPTH, dDepthCham + dExtra) EgtSetMachiningParam( MCH_MP.OFFSR, dExtra) - -- allungo inizio e fine attacco - EgtSetMachiningParam( MCH_MP.STARTADDLEN, 10) - EgtSetMachiningParam( MCH_MP.ENDADDLEN, 10) + -- cambio il tipo di attacco in tangente + EgtSetMachiningParam( MCH_MP.LEADINTYPE, 2) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- eseguo @@ -335,7 +372,8 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) else -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno -- della feature inverto il punto di inizio della lavorazione - ModifySideAndInvertAndLead( Proc, bHead, dMillDiam, true) + ModifySideAndInvertAndLead( Proc, bHead, dToolDiam + ( 2 * dExtra), true, dLenIni, + dLenLst, EgtIf( #vAngs > 0 and vAngs[1] == 0, true, false), EgtIf( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2), true, false), bFlagInvert, dExtra) end end end @@ -371,6 +409,8 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end -- aggiungo geometria EgtSetMachiningGeometry( {{ AuxId, -1}}) + -- resetto il flag inversione percorso + bFlagInvert = false -- se lavorazione da sopra o da sotto if nSide ~= 0 then if not bDouble and nSide == -1 then @@ -379,6 +419,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) ( not bHead and vtExtr:getY() < -0.1) then EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = not bFlagInvert end else -- se lavorazione a destra di fronte o sinistra da dietro, inverto @@ -386,6 +427,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) ( not bHead and vtExtr:getY() > 0.1) then EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = not bFlagInvert end end -- altrimenti lavorazione dal davanti o dal dietro @@ -394,12 +436,14 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if vtExtr:getZ() < 0 then EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = not bFlagInvert end -- se lavorazione a destra da dietro o sinistra di fronte, inverto if ( bHead and vtN:getY() > 0.1) or ( not bHead and vtN:getY() < -0.1) then EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = not bFlagInvert end end -- se in doppio, imposto l'affondamento @@ -427,7 +471,8 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno -- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco -- e uscita - ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, true) + ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, true, dLenIni, + dLenLst, EgtIf( #vAngs > 0 and vAngs[1] == 0, true, false), EgtIf( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2), true, false), bFlagInvert, dOffsetPar) end -- se abilitata, aggiungo lavorazione di finitura if bFinish then @@ -462,12 +507,15 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end -- aggiungo geometria EgtSetMachiningGeometry( {{ AuxId, -1}}) + -- resetto il flag inversione percorso + bFlagInvert = false -- sempre lavorazione da sopra o da sotto -- se lavorazione a destra di fronte o sinistra da dietro, inverto if ( bHead and vtExtr:getY() > 0.1) or ( not bHead and vtExtr:getY() < -0.1) then EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true) + bFlagInvert = not bFlagInvert end -- imposto l'affondamento EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) @@ -486,7 +534,8 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno -- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco -- e uscita - ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, true) + ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, true, dLenIni, + dLenLst, EgtIf( #vAngs > 0 and vAngs[1] == 0, true, false), EgtIf( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2), true, false), bFlagInvert, dOffsetPar) end -- se abilitata, aggiungo lavorazione di finitura if bFinish then