diff --git a/.gitignore b/.gitignore index fce4515..89eac89 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,9 @@ /bin /obj /.vs +/32/*.lua +/32/LuaLibs/*.lua +/32/Images/*.png +/64/*.lua +/64/LuaLibs/*.lua +/64/Images/*.png \ No newline at end of file diff --git a/BatchProcess.lua b/BatchProcess.lua index f41ad50..7c53eee 100644 --- a/BatchProcess.lua +++ b/BatchProcess.lua @@ -117,8 +117,7 @@ local function UpdateAuxData( sAuxFile) end -- Imposto direttorio libreria specializzata per Travi -local sBaseDir = EgtGetSourceDir() -EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua') +EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua') -- Impostazione della macchina corrente EgtResetCurrMachGroup() diff --git a/BatchProcessNew.lua b/BatchProcessNew.lua index 7469ad1..d2330d4 100644 --- a/BatchProcessNew.lua +++ b/BatchProcessNew.lua @@ -112,8 +112,7 @@ local function ResetMachGroup( vBeam) end -- Imposto direttorio libreria specializzata per Travi -local sBaseDir = EgtGetSourceDir() -EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua') +EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua') -- Se necessario, impostazione della macchina corrente local sMachine = BEAM.MACHINE diff --git a/Compile.bat b/Compile.bat new file mode 100644 index 0000000..634b322 --- /dev/null +++ b/Compile.bat @@ -0,0 +1,99 @@ + +REM Compilazione degli script Beam Egaltech 2022.05.09 +REM Per togliere info di debug aggiungere flag -s prima del nome del file di input + +REM Compilazione 32 bit + +\EgtProg\Dll32\luac53 -o 32\LuaLibs\BeamExec.lua LuaLibs\BeamExec.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\BeamLib.lua LuaLibs\BeamLib.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\DiceCut.lua LuaLibs\DiceCut.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\FacesBySaw.lua LuaLibs\FacesBySaw.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\MachiningLib.lua LuaLibs\MachiningLib.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessBlockHausFront.lua LuaLibs\ProcessBlockHausFront.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessChamfer.lua LuaLibs\ProcessChamfer.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessCut.lua LuaLibs\ProcessCut.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDecor.lua LuaLibs\ProcessDecor.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDoubleCut.lua LuaLibs\ProcessDoubleCut.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDovetail.lua LuaLibs\ProcessDovetail.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDrill.lua LuaLibs\ProcessDrill.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDtMortise.lua LuaLibs\ProcessDtMortise.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDtTenon.lua LuaLibs\ProcessDtTenon.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessFreeContour.lua LuaLibs\ProcessFreeContour.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessFrenchRidgeLap.lua LuaLibs\ProcessFrenchRidgeLap.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessHeadCut.lua LuaLibs\ProcessHeadCut.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLapJoint.lua LuaLibs\ProcessLapJoint.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLapJointNew.lua LuaLibs\ProcessLapJointNew.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLongCut.lua LuaLibs\ProcessLongCut.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLongDoubleCut.lua LuaLibs\ProcessLongDoubleCut.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessMark.lua LuaLibs\ProcessMark.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessMortise.lua LuaLibs\ProcessMortise.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfCamb.lua LuaLibs\ProcessProfCamb.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfConcave.lua LuaLibs\ProcessProfConcave.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfConvex.lua LuaLibs\ProcessProfConvex.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfFront.lua LuaLibs\ProcessProfFront.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfHead.lua LuaLibs\ProcessProfHead.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessRidgeLap.lua LuaLibs\ProcessRidgeLap.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessRoundArch.lua LuaLibs\ProcessRoundArch.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessSawCut.lua LuaLibs\ProcessSawCut.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessScarfJoint.lua LuaLibs\ProcessScarfJoint.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessSimpleScarf.lua LuaLibs\ProcessSimpleScarf.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessSplit.lua LuaLibs\ProcessSplit.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessStepJoint.lua LuaLibs\ProcessStepJoint.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessStepJointNotch.lua LuaLibs\ProcessStepJointNotch.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessTenon.lua LuaLibs\ProcessTenon.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessText.lua LuaLibs\ProcessText.lua +\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessTyroleanDovetail.lua LuaLibs\ProcessTyroleanDovetail.lua +\EgtProg\Dll32\luac53 -o 32\BatchProcess.lua BatchProcess.lua +\EgtProg\Dll32\luac53 -o 32\BatchProcessNew.lua BatchProcessNew.lua +\EgtProg\Dll32\luac53 -o 32\NestProcess.lua NestProcess.lua +\EgtProg\Dll32\luac53 -o 32\Process.lua Process.lua +\EgtProg\Dll32\luac53 -o 32\Rotate.lua Rotate.lua +\EgtProg\Dll32\luac53 -o 32\Swap.lua Swap.lua + +REM Compilazione 64 bit + +\EgtProg\Dll64\luac53 -o 64\LuaLibs\BeamExec.lua LuaLibs\BeamExec.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\BeamLib.lua LuaLibs\BeamLib.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\DiceCut.lua LuaLibs\DiceCut.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\FacesBySaw.lua LuaLibs\FacesBySaw.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\MachiningLib.lua LuaLibs\MachiningLib.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessBlockHausFront.lua LuaLibs\ProcessBlockHausFront.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessChamfer.lua LuaLibs\ProcessChamfer.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessCut.lua LuaLibs\ProcessCut.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDecor.lua LuaLibs\ProcessDecor.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDoubleCut.lua LuaLibs\ProcessDoubleCut.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDovetail.lua LuaLibs\ProcessDovetail.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDrill.lua LuaLibs\ProcessDrill.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDtMortise.lua LuaLibs\ProcessDtMortise.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDtTenon.lua LuaLibs\ProcessDtTenon.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessFreeContour.lua LuaLibs\ProcessFreeContour.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessFrenchRidgeLap.lua LuaLibs\ProcessFrenchRidgeLap.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessHeadCut.lua LuaLibs\ProcessHeadCut.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessLapJoint.lua LuaLibs\ProcessLapJoint.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessLapJointNew.lua LuaLibs\ProcessLapJointNew.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessLongCut.lua LuaLibs\ProcessLongCut.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessLongDoubleCut.lua LuaLibs\ProcessLongDoubleCut.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessMark.lua LuaLibs\ProcessMark.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessMortise.lua LuaLibs\ProcessMortise.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfCamb.lua LuaLibs\ProcessProfCamb.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfConcave.lua LuaLibs\ProcessProfConcave.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfConvex.lua LuaLibs\ProcessProfConvex.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfFront.lua LuaLibs\ProcessProfFront.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfHead.lua LuaLibs\ProcessProfHead.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessRidgeLap.lua LuaLibs\ProcessRidgeLap.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessRoundArch.lua LuaLibs\ProcessRoundArch.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessSawCut.lua LuaLibs\ProcessSawCut.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessScarfJoint.lua LuaLibs\ProcessScarfJoint.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessSimpleScarf.lua LuaLibs\ProcessSimpleScarf.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessSplit.lua LuaLibs\ProcessSplit.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessStepJoint.lua LuaLibs\ProcessStepJoint.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessStepJointNotch.lua LuaLibs\ProcessStepJointNotch.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessTenon.lua LuaLibs\ProcessTenon.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessText.lua LuaLibs\ProcessText.lua +\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessTyroleanDovetail.lua LuaLibs\ProcessTyroleanDovetail.lua +\EgtProg\Dll64\luac53 -o 64\BatchProcess.lua BatchProcess.lua +\EgtProg\Dll64\luac53 -o 64\BatchProcessNew.lua BatchProcessNew.lua +\EgtProg\Dll64\luac53 -o 64\NestProcess.lua NestProcess.lua +\EgtProg\Dll64\luac53 -o 64\Process.lua Process.lua +\EgtProg\Dll64\luac53 -o 64\Rotate.lua Rotate.lua +\EgtProg\Dll64\luac53 -o 64\Swap.lua Swap.lua diff --git a/LuaLibs/FacesBySaw.lua b/LuaLibs/FacesBySaw.lua index ad27a4c..102f8ff 100644 --- a/LuaLibs/FacesBySaw.lua +++ b/LuaLibs/FacesBySaw.lua @@ -188,7 +188,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw -- eventuali note if sNotes and #sNotes > 0 then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -261,7 +261,7 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType, nUpInd = nBigInd end -- recupero la lavorazione - local sCutting = ML.FindCutting( sCutType) + local sCutting = ML.FindCutting( sCutType, nil, bDownHead) if not sCutting then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library' EgtOutLog( sErr) diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index d2f7d1f..926e5b2 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -1,5 +1,6 @@ --- MachiningLib.lua by Egaltech s.r.l. 2021/04/14 +-- MachiningLib.lua by Egaltech s.r.l. 2022/05/07 -- Libreria ricerca lavorazioni per Travi +-- 2022/05/07 ES Profonde modifiche per scelta ottimale lavorazioni in macchine con più teste. -- Tabella per definizione modulo local MachiningLib = {} @@ -17,6 +18,83 @@ local Pocketings = require( 'PocketingData') local Sawings = require( 'SawingData') local Drillings = require( 'DrillData') +-- tipo di teste macchina +local ONE_HEAD = 1 -- una testa (Fast, One, Turn1T) +local TWO_EQUAL_HEADS = 2 -- due teste uguali (PF, Turn) +local TWO_UP_DOWN_HEADS = 3 -- due teste una sopra l'altra sotto (PF1250) +local MachineHeadType = 0 + +-- testa correntementa attiva, e utensili correnti per ogni testa +local nActiveHead = 0 +local H1_TOOL = '' +local H2_TOOL = '' + +-- testa e utensile della lavorazione restituita ma non ancora confermata +local nNextMachHead = 0 +local H1_NEXT_TOOL = '' +local H2_NEXT_TOOL = '' + +-- teste con utensili fissi +local vFixedHeads = {} + +--------------------------------------------------------------------- +-- funzione che imposta il tipo di macchina corrente +local function SetCurrMachineHeadType() + -- se già inizializzato, esco + if MachineHeadType and MachineHeadType >= 1 and MachineHeadType <= 3 then return end + -- altrimenti, lo imposto + if BD.DOWN_HEAD then + MachineHeadType = TWO_UP_DOWN_HEADS + elseif BD.TWO_EQUAL_HEADS then + MachineHeadType = TWO_EQUAL_HEADS + else + MachineHeadType = ONE_HEAD + end + -- imposto eventuali teste con utensili fissi + if BD.C_SIMM then + vFixedHeads = { [31] = true} + elseif BD.TURN then + vFixedHeads = { [12] = true, [22] = true} + else -- FAST + vFixedHeads = { [2] = true} + end +end + +--------------------------------------------------------------------- +-- funzione che conferma e rende attivi testa e utensile ipotizzati +local function ConfirmNextMachining() + -- se non definita testa successiva, esco + if not nNextMachHead or nNextMachHead < 1 or nNextMachHead > 2 then return end + -- altrimenti, la confermo come attiva + nActiveHead = nNextMachHead + if nNextMachHead == 1 then + H1_TOOL = H1_NEXT_TOOL + elseif nNextMachHead == 2 then + H2_TOOL = H2_NEXT_TOOL + end + -- reset prossima testa + nNextMachHead = 0 + H1_NEXT_TOOL = '' + H2_NEXT_TOOL = '' +end + +--------------------------------------------------------------------- +-- funzione che traccia testa e utensile ipotizzati +local function SetNextMachining( sToolName, nHead, bFixed) + if nHead < 1 or nHead > 2 then return end + if bFixed then + nNextMachHead = 0 + H1_NEXT_TOOL = '' + H2_NEXT_TOOL = '' + end + nNextMachHead = nHead + if nHead == 1 then + H1_NEXT_TOOL = sToolName + elseif nHead == 2 then + H2_NEXT_TOOL = sToolName + end +end + --------------------------------------------------------------------- local function SetCurrMachiningAndTool( sMachName) if not EgtMdbSetCurrMachining( sMachName) then return false end @@ -24,106 +102,301 @@ local function SetCurrMachiningAndTool( sMachName) local sTool = EgtTdbGetToolFromUUID( sTuuid) if not sTool then return false end if not EgtTdbSetCurrTool( sTool) then return false end - return EgtTdbGetCurrToolParam( MCH_TP.ACTIVE) + local bActive = EgtTdbGetCurrToolParam( MCH_TP.ACTIVE) + local sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD) + local nHead = tonumber( sHead:sub( 2, #sHead)) + local bH2 = ( nHead >= 21 and nHead <= 29) + local bFixed = ( vFixedHeads[nHead]) + return bActive, sTool, bH2, bFixed end --------------------------------------------------------------------- -function MachiningLib.FindCutting( sType) - for i = 1, #Cuttings do - local Cutting = Cuttings[i] - if Cutting.On and Cutting.Type == sType and SetCurrMachiningAndTool( Cutting.Name) then - return Cutting.Name - end +local function StartsWith( sStr, sStart) + if ( sStart == "" or sStr:sub( 1, #sStart) == sStart) then + return true, sStr:sub( 1, #sStr - #sStart) + else + return false, sStr end end --------------------------------------------------------------------- -function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen) - for i = 1, #Millings do - local Milling = Millings[i] - if Milling.On and Milling.Type == sType and SetCurrMachiningAndTool( Milling.Name) then - local sTuuid = EgtGetMachiningParam( MCH_MP.TUUID) - local dTMaxDepth = EgtTdbGetCurrToolMaxDepth() - local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) - local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) - if ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and - ( not sTuuidMstr or sTuuidMstr == sTuuid) and - ( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and - ( not dMaxTotLen or dTTotLen < dMaxTotLen + GEO.EPS_SMALL) then - return Milling.Name, dTMaxDepth, dTDiam +local function EndsWith( sStr, sEnd) + if ( sEnd == "" or sStr:sub(-#sEnd) == sEnd) then + return true, sStr:sub(1, #sStr - #sEnd) + else + return false, sStr + end +end + +--------------------------------------------------------------------- +function VerifyDrill( dDiam, dDepth, bH2) + local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) + local dTMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) + local dMaxToolLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) + local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) + local dDiamTh = EgtTdbGetCurrToolThDiam() + local dLenTh = 72 + if EgtTdbGetCurrToolThLength then dLenTh = EgtTdbGetCurrToolThLength() end + local dFreeLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) - dLenTh - EgtMdbGetGeneralParam( MCH_GP.MAXDEPTHSAFE) + if dTDiam < dDiam + 10 * GEO.EPS_SMALL and + dTDiam > dDiam - BD.DRILL_TOL - 10 * GEO.EPS_SMALL and + ( not dDepth or dTMaxMat > dDepth - GEO.EPS_SMALL) then + return true, { TMaxMat = dTMaxMat, MaxToolLength = dMaxToolLength, ToolDiam = dToolDiam, DiamTh = dDiamTh, FreeLen = dFreeLen, H2 = bH2} + end +end + +--------------------------------------------------------------------- +function VerifyDrillPocket( dDiam, dDepth, bH2) + local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) + local dTMaxDepth = EgtTdbGetCurrToolMaxDepth() + local dMaxToolLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) + local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) + local dDiamTh = EgtTdbGetCurrToolThDiam() + local dFreeLen = dTMaxDepth + if dTDiam < dDiam - 10 * GEO.EPS_SMALL and + ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) then + return true, { TMaxDepth = dTMaxDepth, MaxToolLength = dMaxToolLength, ToolDiam = dToolDiam, DiamTh = dDiamTh, FreeLen = dFreeLen, H2 = bH2} + end +end + +--------------------------------------------------------------------- +function VerifyMill( dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bH2) + local sTuuid = EgtGetMachiningParam( MCH_MP.TUUID) + local dTMaxDepth = EgtTdbGetCurrToolMaxDepth() + local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) + local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) + if ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and + ( not sTuuidMstr or sTuuidMstr == sTuuid) and + ( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and + ( not dMaxTotLen or dTTotLen < dMaxTotLen + GEO.EPS_SMALL) then + return true, { TMaxDepth = dTMaxDepth, TDiam = dTDiam, H2 = bH2} + end +end + +--------------------------------------------------------------------- +function VerifyPocket( dMaxDiam, dDepth, dMaxTotLen, bH2) + local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) + local dTMaxDepth = EgtTdbGetCurrToolMaxDepth() + local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) + if ( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and + ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and + ( not dMaxTotLen or dTTotLen < dMaxTotLen + GEO.EPS_SMALL) then + return true, { TDiam = dTDiam, TMaxDepth = dTMaxDepth, H2 = bH2} + end +end + +--------------------------------------------------------------------- +function VerifyTool( MachiningType, sType, Params, bH2) + if MachiningType == MCH_MY.DRILLING then + if StartsWith( sType, 'Drill') then + return VerifyDrill( Params.Diam, Params.Depth, bH2) + elseif StartsWith( sType, 'Pocket') then + return VerifyDrillPocket( Params.Diam, Params.Depth, bH2) + end + elseif MachiningType == MCH_MY.SAWING then + return true, { H2 = bH2} + elseif MachiningType == MCH_MY.MILLING then + return VerifyMill( Params.Depth, Params.TuuidMstr, Params.MaxDiam, Params.MaxTotLen, bH2) + elseif MachiningType == MCH_MY.POCKETING then + return VerifyPocket( Params.MaxDiam, Params.Depth, Params.MaxTotLen, bH2) + elseif MachiningType == MCH_MY.MORTISING then + return true, { H2 = bH2} + else + return false + end +end + +--------------------------------------------------------------------- +function GetMachinings( MachiningType) + if MachiningType == MCH_MY.DRILLING then + return Drillings + elseif MachiningType == MCH_MY.SAWING then + return Cuttings + elseif MachiningType == MCH_MY.MILLING then + return Millings + elseif MachiningType == MCH_MY.POCKETING then + return Pocketings + elseif MachiningType == MCH_MY.MORTISING then + return Sawings + end +end + +--------------------------------------------------------------------- +function ReturnParams( MachiningType, MachiningName, sType, ToolParams) + if MachiningType == MCH_MY.DRILLING then + local _, sOrigType = EndsWith( sType, '_H2') + return MachiningName, sType, EgtIf( sOrigType == 'Drill', ToolParams.TMaxMat, ToolParams.TMaxDepth), ToolParams.MaxToolLength, ToolParams.ToolDiam, ToolParams.DiamTh, ToolParams.FreeLen + elseif MachiningType == MCH_MY.SAWING then + return MachiningName, ToolParams.H2 + elseif MachiningType == MCH_MY.MILLING then + return MachiningName, ToolParams.TMaxDepth, ToolParams.TDiam, ToolParams.H2 + elseif MachiningType == MCH_MY.POCKETING then + return MachiningName, ToolParams.TDiam, ToolParams.TMaxDepth, ToolParams.H2 + elseif MachiningType == MCH_MY.MORTISING then + return MachiningName + end +end + +--------------------------------------------------------------------- +local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead) + if bTopHead == nil and bDownHead == nil then + bTopHead = true + bDownHead = false + elseif bTopHead == nil then + bTopHead = not bDownHead + elseif bDownHead == nil then + bDownHead = not bTopHead + end + SetCurrMachineHeadType() + -- verifico se testa attiva va bene + local sH1Mach = '' + local sH1Tool = '' + local sH1Param + local sH2Mach = '' + local sH2Tool = '' + local sH2Param + -- ricerca sulle forature, dal diametro maggiore al minore + local Machinings = GetMachinings( MachiningType) + local ForStart = 1 + local ForEnd = #Machinings + local ForStep = 1 + if MachiningType == MCH_MY.DRILLING then + ForStart = #Machinings + ForEnd = 1 + ForStep = -1 + end + if ( BEAM and BEAM.BW) or MachineHeadType == ONE_HEAD or MachineHeadType == TWO_EQUAL_HEADS or ( MachineHeadType == TWO_UP_DOWN_HEADS and not bDownHead) then + _, sType = EndsWith( sType, '_H2') + elseif ( not BEAM or not BEAM.BW) and MachineHeadType == TWO_UP_DOWN_HEADS and bDownHead then + if not EndsWith( sType, '_H2') then + sType = sType .. '_H2' + end + end + local MachineHeadUse = MachineHeadType + if not BEAM or not BEAM.BW then + MachineHeadUse = ONE_HEAD + end + if BEAM and BEAM.BW and MachineHeadUse == TWO_UP_DOWN_HEADS and bTopHead and bDownHead then + -- se posso usare entrambe le teste, la gestisco come una macchina a due teste da sopra + MachineHeadUse = TWO_EQUAL_HEADS + end + for i = ForStart, ForEnd, ForStep do + local Machining = Machinings[i] + local sMachiningType = Machining.Type + if BEAM and BEAM.BW then + _, sMachiningType = EndsWith( Machining.Type, '_H2') + end + -- recupero dati utensile + local bToolActive, sToolName, bH2, bFixed = SetCurrMachiningAndTool( Machining.Name) + if Machining.On and sMachiningType == sType and bToolActive then + local bOk, ToolParams = VerifyTool( MachiningType, sType, Params, bH2) + if bOk then + if MachineHeadUse == ONE_HEAD then + SetNextMachining( sToolName, 1, bFixed) + return ReturnParams(MachiningType, Machining.Name, Machining.Type, ToolParams) + elseif MachineHeadUse == TWO_EQUAL_HEADS then + -- se nessuna testa attiva, prendo la prima lavorazione disponibile + if nActiveHead == 0 then + SetNextMachining( sToolName, EgtIf( bH2, 2, 1), bFixed) + return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams) + -- verifico se posso usare lo stesso utensile della testa attiva + elseif ( nActiveHead == 1 and not bH2 and sToolName == H1_TOOL) or ( nActiveHead == 2 and bH2 and sToolName == H2_TOOL) then + SetNextMachining( sToolName, nActiveHead, bFixed) + return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams) + else + -- segno le lavorazioni disponibili per entrambe le teste + if bH2 then + if not sH2Mach or sH2Mach == '' then + sH2Mach = Machining.Name + sH2Tool = sToolName + sH2Param = ToolParams + end + else + if not sH1Mach or sH1Mach == '' then + sH1Mach = Machining.Name + sH1Tool = sToolName + sH1Param = ToolParams + end + end + end + elseif MachineHeadUse == TWO_UP_DOWN_HEADS then + if bTopHead and not bH2 then + SetNextMachining( sToolName, 1, bFixed) + return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams) + elseif bDownHead and bH2 then + SetNextMachining( sToolName, 2, bFixed) + return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams) + end + end end end end -end - ---------------------------------------------------------------------- -function MachiningLib.FindPocketing( sType, dMaxDiam, dDepth, dMaxTotLen) - for i = 1, #Pocketings do - local Pocketing = Pocketings[i] - if Pocketing.On and Pocketing.Type == sType and SetCurrMachiningAndTool( Pocketing.Name) then - local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) - local dTMaxDepth = EgtTdbGetCurrToolMaxDepth() - local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) - if ( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and - ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and - ( not dMaxTotLen or dTTotLen < dMaxTotLen + GEO.EPS_SMALL) then - return Pocketing.Name, dTDiam, dTMaxDepth + if MachineHeadUse == TWO_EQUAL_HEADS then + -- verifico se cambiare testa o cambiare utensile su quella corrente + if nActiveHead == 1 then + if sH2Mach ~= "" then + SetNextMachining( sH2Tool, 2, bFixed) + return ReturnParams( MachiningType, sH2Mach, sType, sH2Param) + --return sH2Mach, sH2Param.Type, sH2Param.TMaxMat, sH2Param.MaxToolLength, sH2Param.ToolDiam, sH2Param.DiamTh, sH2Param.FreeLen + elseif sH1Mach ~= "" then + SetNextMachining( sH1Tool, 1, bFixed) + return ReturnParams( MachiningType, sH1Mach, sType, sH1Param) + --return sH1Mach, sH1Param.Type, sH1Param.TMaxMat, sH1Param.MaxToolLength, sH1Param.ToolDiam, sH1Param.DiamTh, sH1Param.FreeLen + end + elseif nActiveHead == 2 then + if sH1Mach ~= "" then + SetNextMachining( sH1Tool, 1, bFixed) + return ReturnParams( MachiningType, sH1Mach, sType, sH1Param) + --return sH1Mach, sH1Param.Type, sH1Param.TMaxMat, sH1Param.MaxToolLength, sH1Param.ToolDiam, sH1Param.DiamTh, sH1Param.FreeLen + elseif sH2Mach ~= "" then + SetNextMachining( sH2Tool, 2, bFixed) + return ReturnParams( MachiningType, sH2Mach, sType, sH2Param) + --return sH2Mach, sH2Param.Type, sH2Param.TMaxMat, sH2Param.MaxToolLength, sH2Param.ToolDiam, sH2Param.DiamTh, sH2Param.FreeLen end end end + local bH2, sOrigType = EndsWith( sType, '_H2') + if ( not BEAM or not BEAM.BW) and MachineHeadUse == TWO_UP_DOWN_HEADS and bH2 and bTopHead then + return FindMachining( MachiningType, sOrigType, Params, true, false) + end +end + +--------------------------------------------------------------------- +function MachiningLib.FindCutting( sType, bTopHead, bDownHead) + return FindMachining( MCH_MY.SAWING, sType, nil, bTopHead, bDownHead) +end + +--------------------------------------------------------------------- +function MachiningLib.FindDrilling( dDiam, dDepth, bTopHead, bDownHead) + local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, 'Drill', { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead) + if not MachiningName or MachiningName == '' then + MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, 'Pocket', { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead) + end + if MachiningName and MachiningName ~= '' then + return MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 + end +end + +--------------------------------------------------------------------- +function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bTopHead, bDownHead) + return FindMachining( MCH_MY.MILLING, sType, { Depth = dDepth, TuuidMstr = sTuuidMstr, MaxDiam = dMaxDiam, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead) +end + +--------------------------------------------------------------------- +function MachiningLib.FindPocketing( sType, dMaxDiam, dDepth, dMaxTotLen, bTopHead, bDownHead) + return FindMachining( MCH_MY.POCKETING, sType, { MaxDiam = dMaxDiam, Depth = dDepth, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead) end --------------------------------------------------------------------- function MachiningLib.FindSawing( sType) - for i = 1, #Sawings do - local Sawing = Sawings[i] - if Sawing.On and Sawing.Type == sType and SetCurrMachiningAndTool( Sawing.Name) then - return Sawing.Name - end - end - + return FindMachining( MCH_MY.MORTISING, sType) end ---------------------------------------------------------------------- -function MachiningLib.FindDrilling( dDiam, dDepth, bDown) - -- ricerca sulle forature, dal diametro maggiore al minore - local sDrType = 'Drill' .. EgtIf( bDown, '_H2', '') - for i = #Drillings, 1, -1 do - local Drilling = Drillings[i] - if Drilling.On and Drilling.Type == sDrType and SetCurrMachiningAndTool( Drilling.Name) then - local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) - local dTMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) - local dMaxToolLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) - local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) - local dDiamTh = EgtTdbGetCurrToolThDiam() - local dLenTh = 72 - if EgtTdbGetCurrToolThLength then dLenTh = EgtTdbGetCurrToolThLength() end - local dFreeLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) - dLenTh - EgtMdbGetGeneralParam( MCH_GP.MAXDEPTHSAFE) - if dTDiam < dDiam + 10 * GEO.EPS_SMALL and dTDiam > dDiam - BD.DRILL_TOL - 10 * GEO.EPS_SMALL then - if not dDepth or dTMaxMat > dDepth - GEO.EPS_SMALL then - return Drilling.Name, Drilling.Type, dTMaxMat, dMaxToolLength, dToolDiam, dDiamTh, dFreeLen - end - end - end - end - -- ricerca sulle svuotature, dal diametro maggiore al minore - local sPkType = 'Pocket' .. EgtIf( bDown, '_H2', '') - for i = #Drillings, 1, -1 do - local Drilling = Drillings[i] - if Drilling.On and Drilling.Type == sPkType and SetCurrMachiningAndTool( Drilling.Name) then - local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) - local dTMaxDepth = EgtTdbGetCurrToolMaxDepth() - local dMaxToolLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) - local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) - local dDiamTh = EgtTdbGetCurrToolThDiam() - local dFreeLen = dTMaxDepth - if dTDiam < dDiam - 10 * GEO.EPS_SMALL then - if not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL then - return Drilling.Name, Drilling.Type, dTMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dFreeLen - end - end - end - end +------------------------------------------------------------------------------------------------------------- +function MachiningLib.ApplyMachining( bRecalc, bApplyPost) + local bResult = EgtApplyMachining( bRecalc, bApplyPost) + if bResult then ConfirmNextMachining() end + return bResult end ------------------------------------------------------------------------------------------------------------- diff --git a/LuaLibs/ProcessChamfer.lua b/LuaLibs/ProcessChamfer.lua index 3540250..c6274e7 100644 --- a/LuaLibs/ProcessChamfer.lua +++ b/LuaLibs/ProcessChamfer.lua @@ -75,7 +75,7 @@ function ProcessChamfer.Make( Proc, nPhase, nRawId, nPartId) -- aggiungo geometria EgtSetMachiningGeometry( {{ AuxId, -1}}) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -178,7 +178,7 @@ function ProcessChamfer.Make( Proc, nPhase, nRawId, nPartId) -- aggiungo geometria EgtSetMachiningGeometry( {{ Proc.Id, 0}}) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index 03e7bf4..ff41a07 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -158,7 +158,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -181,7 +181,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -720,11 +720,8 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, local bTopHead = ( BD.DOWN_HEAD and ( vtN:getZ() > -0.342 or not bDownHead)) -- recupero la lavorazione local sCutType = EgtIf( Proc.Head, 'HeadSide', 'TailSide') - local sCutting = ML.FindCutting( sCutType .. EgtIf( bDownHead, '_H2', '')) - if not sCutting and bTopHead then - sCutting = ML.FindCutting( sCutType) - bDownHead = false - end + local sCutting + sCutting, bDownHead = ML.FindCutting( sCutType, bTopHead, bDownHead) if not sCutting then local sErr = 'Error : cutting not found in library' EgtOutLog( sErr) diff --git a/LuaLibs/ProcessDecor.lua b/LuaLibs/ProcessDecor.lua index 3b0fb77..c88bbea 100644 --- a/LuaLibs/ProcessDecor.lua +++ b/LuaLibs/ProcessDecor.lua @@ -69,7 +69,7 @@ function ProcessDecor.Make( Proc, nPhase, nRawId, nPartId) EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr diff --git a/LuaLibs/ProcessDoubleCut.lua b/LuaLibs/ProcessDoubleCut.lua index 2d7c444..a019e86 100644 --- a/LuaLibs/ProcessDoubleCut.lua +++ b/LuaLibs/ProcessDoubleCut.lua @@ -119,7 +119,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) EgtOutLog( sErr) return false, sErr end - local sMillingDw = ML.FindMilling( 'Mark_H2') + local sMillingDw = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true) if bVert and not sMillingDw then local sErr = 'Error : milling (Mark_H2) not found in library' EgtOutLog( sErr) @@ -141,7 +141,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -164,7 +164,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -259,11 +259,8 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) local bDownHead = ( BD.DOWN_HEAD and vtNm:getZ() < -0.5) -- recupero la lavorazione local sCutType = EgtIf( bHead, 'HeadSide', 'TailSide') - local sCutting = ML.FindCutting( sCutType .. EgtIf( bDownHead, '_H2', '')) - if not sCutting and bTopHead then - sCutting = ML.FindCutting( sCutType) - bDownHead = false - end + local sCutting + sCutting, bDownHead = ML.FindCutting( sCutType, bTopHead, bDownHead) if not sCutting then local sErr = 'Error : cutting not found in library' EgtOutLog( sErr) diff --git a/LuaLibs/ProcessDovetail.lua b/LuaLibs/ProcessDovetail.lua index f19cb7a..9fbffac 100644 --- a/LuaLibs/ProcessDovetail.lua +++ b/LuaLibs/ProcessDovetail.lua @@ -592,7 +592,7 @@ local function MachChainFacesByBlade( Proc, nCFaceSide, nCFaceInt1, nCFaceInt2, EgtSetMachiningParam( MCH_MP.STARTADDLEN, 50) EgtSetMachiningParam( MCH_MP.ENDADDLEN, 50) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -836,7 +836,7 @@ local function MakeMillCut( Proc, i, j, k, sMilling, end EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -1221,7 +1221,7 @@ local function Make2Faces( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol local nSCC = MCH_SCC.ADIR_YP EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index ed4e289..b0ddbca 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -214,16 +214,9 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) local bDrillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259) -- primo gruppo di controlli con lunghezza utensile pari a metà foro se passante -- recupero la lavorazione - local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillDown) - if not sDrilling and bDrillUp then - sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth) - end + local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown) if not sDrilling and dCheckDepth then - sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillDown) - if sDrilling then dCheckDepth = nil end - end - if not sDrilling and bDrillUp and dCheckDepth then - sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0) + sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown) if sDrilling then dCheckDepth = nil end end if not sDrilling then @@ -237,10 +230,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) nErrorCode = 2 -- rifaccio ricerca lavorazione senza specificare la profondità (dovrebbe trovare l'utensile più corto) else - sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillDown) - if not sDrilling and bDrillUp then - sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0) - end + sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown) if not sDrilling then nErrorCode = 1 elseif dMaxToolLength > ( BD.MAX_TOOL_LEN_FOR_HOR_MACH or 300) and abs( vtExtr:getZ()) < ( BD.DRILL_VZ_MIN_LONG_TOOL or cos(10)) then @@ -252,16 +242,9 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) -- recupero la lavorazione local sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 if dDepth2 > dDepth + BD.DRILL_OVERLAP then - sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, dCheckDepth2, bDrillDown) - if not sDrilling2 and bDrillUp then - sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, dCheckDepth2) - end + sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, dCheckDepth2, bDrillUp, bDrillDown) if not sDrilling2 and dCheckDepth2 then - sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0, bDrillDown) - if sDrilling2 then dCheckDepth2 = nil end - end - if not sDrilling2 and bDrillUp and dCheckDepth2 then - sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0) + sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown) if sDrilling2 then dCheckDepth2 = nil end end if not sDrilling2 then @@ -275,10 +258,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) nErrorCode = 2 -- rifaccio ricerca lavorazione senza specificare la profondità (dovrebbe trovare l'utensile più corto) else - sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0, bDrillDown) - if not sDrilling2 and bDrillUp then - sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0) - end + sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown) if not sDrilling2 then nErrorCode = 1 elseif dMaxToolLength2 > ( BD.MAX_TOOL_LEN_FOR_HOR_MACH or 300) and abs( vtExtr:getZ()) < ( BD.DRILL_VZ_MIN_LONG_TOOL or cos(10)) then @@ -432,14 +412,14 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) end EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo - local bOk = EgtApplyMachining( true, false) + local bOk = ML.ApplyMachining( true, false) if not bOk and BD.DOWN_HEAD then if sType == 'Drill' or sType == 'Drill_H2' then EgtSetMachiningParam( MCH_MP.INVERT, true) else EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) end - bOk = EgtApplyMachining( true, false) + bOk = ML.ApplyMachining( true, false) end if not bOk then local _, sErr = EgtGetLastMachMgrError() diff --git a/LuaLibs/ProcessDtMortise.lua b/LuaLibs/ProcessDtMortise.lua index de29e1a..d9eaf3d 100644 --- a/LuaLibs/ProcessDtMortise.lua +++ b/LuaLibs/ProcessDtMortise.lua @@ -202,9 +202,9 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) sMchExt = '_AT' end -- recupero la lavorazione : prima ricerca per sola tipologia - local sMilling = ML.FindMilling( sMillType..sMchExt) + local sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, nil, nil, bMillUp, bMillDown) if not sMilling and bMillUp then - sMilling = ML.FindMilling( sMillType) + sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown) end if not sMilling then local sErr = 'Milling not found in library : Error on DtMortise ' .. tostring( Proc.Id) @@ -212,9 +212,9 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) return false, sErr end -- recupero la lavorazione : seconda ricerca con tipologia e diametro massimo - sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, 2 * dMinRad) + sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown) if not sMilling and bMillUp then - sMilling = ML.FindMilling( sMillType, nil, nil, 2 * dMinRad) + sMilling = ML.FindMilling( sMillType, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown) sMchExt = '' end if not sMilling then @@ -261,14 +261,14 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end -- recupero la lavorazione local sPocketing - sPocketing = ML.FindPocketing( 'Mortise'..sMchExt, dToolDiam) + sPocketing = ML.FindPocketing( 'Mortise'..sMchExt, dToolDiam, nil, nil, bMillUp, bMillDown) if not sPocketing and bMillUp then - sPocketing = ML.FindPocketing( 'Mortise', dToolDiam) + sPocketing = ML.FindPocketing( 'Mortise', dToolDiam, nil, nil, bMillUp, bMillDown) end if not sPocketing then - sPocketing = ML.FindPocketing( 'Pocket'..sMchExt, dToolDiam) + sPocketing = ML.FindPocketing( 'Pocket'..sMchExt, dToolDiam, nil, nil, bMillUp, bMillDown) if not sPocketing and bMillUp then - sPocketing = ML.FindPocketing( 'Pocket', dToolDiam) + sPocketing = ML.FindPocketing( 'Pocket', dToolDiam, nil, nil, bMillUp, bMillDown) end end if not sPocketing then @@ -290,7 +290,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;' EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -372,7 +372,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) local sUserNotes = 'MaxElev='.. EgtNumToString( dAltMort, 1) .. '; VMRS=0;' EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -429,7 +429,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;' EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr diff --git a/LuaLibs/ProcessDtTenon.lua b/LuaLibs/ProcessDtTenon.lua index 264e90f..9bfe86c 100644 --- a/LuaLibs/ProcessDtTenon.lua +++ b/LuaLibs/ProcessDtTenon.lua @@ -112,7 +112,7 @@ local function ApplyPocket( Proc, sPocketing, nStep, dSurfStep, nIdSurf, vtExtr) end EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -232,10 +232,7 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174) -- recupero la lavorazione local sMillType = 'DtTenon' - local sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', '')) - if not sMilling and bMillUp then - sMilling = ML.FindMilling( sMillType) - end + local sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', ''), nil, nil, nil, nil, bMillUp, bMillDown) if not sMilling then local sErr = 'Error : milling not found in library' EgtOutLog( sErr) @@ -313,7 +310,7 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) end EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchRId, false) return false, sErr diff --git a/LuaLibs/ProcessFreeContour.lua b/LuaLibs/ProcessFreeContour.lua index 9650a7c..0b537cd 100644 --- a/LuaLibs/ProcessFreeContour.lua +++ b/LuaLibs/ProcessFreeContour.lua @@ -418,7 +418,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead) end EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -479,7 +479,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead) end EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -581,7 +581,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead) EgtSetMachiningParam( MCH_MP.OFFSR, dDepthCham) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -600,7 +600,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.STEP, 0) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMch2Id, false) return false, sErr @@ -680,7 +680,7 @@ local function MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead) -- imposto elevazione EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxDepth, 1) .. ';') -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr diff --git a/LuaLibs/ProcessHeadCut.lua b/LuaLibs/ProcessHeadCut.lua index cac9da3..090675f 100644 --- a/LuaLibs/ProcessHeadCut.lua +++ b/LuaLibs/ProcessHeadCut.lua @@ -109,7 +109,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -132,7 +132,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -220,7 +220,7 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut -- altrimenti necessari tagli da sopra e sotto con testa opportuna else -- recupero la lavorazione con lama da sotto - local sCutting2 = ML.FindCutting( 'HeadSide_H2') + local sCutting2 = ML.FindCutting( 'HeadSide_H2', false, true) if not sCutting2 then local sErr = 'Error : cutting H2 not found in library' EgtOutLog( sErr) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 5c12c40..6e58fa1 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -318,16 +318,16 @@ local function VerifyChainSaw( Proc, dMinDim, dMaxDim) end --------------------------------------------------------------------- -local function VerifyPocket( Proc, dDiam, dDepth, dMaxTotLen, sMchFindMaster) +local function VerifyPocket( Proc, dDiam, dDepth, dMaxTotLen, sMchFindMaster, bPocketDown) -- tipo di svuotatura local sMchFind = EgtIf( sMchFindMaster and #sMchFindMaster > 0, sMchFindMaster, 'Pocket') -- ricerca della svuotatura local sPocketing if dDepth then - sPocketing = ML.FindPocketing( sMchFind, dDiam, dDepth, dMaxTotLen) or - ML.FindPocketing( sMchFind, dDiam, 0.8 * dDepth, dMaxTotLen) or - ML.FindPocketing( sMchFind, dDiam, 0.6 * dDepth, dMaxTotLen) or - ML.FindPocketing( sMchFind, dDiam, 0.4 * dDepth, dMaxTotLen) or + sPocketing = ML.FindPocketing( sMchFind, dDiam, dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or + ML.FindPocketing( sMchFind, dDiam, 0.8 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or + ML.FindPocketing( sMchFind, dDiam, 0.6 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or + ML.FindPocketing( sMchFind, dDiam, 0.4 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or ML.FindPocketing( sMchFind, dDiam, 0, dMaxTotLen) else sPocketing = ML.FindPocketing( sMchFind, dDiam, 0, dMaxTotLen) @@ -857,7 +857,7 @@ local function MakeOneFaceByMill( Proc, nPhase, nRawId, nPartId) -- dichiaro non si generano sfridi per VMill EgtSetMachiningParam( MCH_MP.USERNOTES, 'VMRS=0;') -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -894,9 +894,9 @@ local function MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId, bDownHead) -- recupero la lavorazione local sMilling if nUseRM and nUseRM == 1 then - sMilling = ML.FindMilling( 'LongSmallCut' .. EgtIf( bDownHead, '_H2', '')) + sMilling = ML.FindMilling( 'LongSmallCut', nil, nil, nil, nil, not bDownHead, bDownHead) else - sMilling = ML.FindMilling( 'BirdsMouth' .. EgtIf( bDownHead, '_H2', '')) + sMilling = ML.FindMilling( 'BirdsMouth', nil, nil, nil, nil, not bDownHead, bDownHead) end if not sMilling then local sErr = 'Error : LongSmallCut & BirdsMouth not found in library' @@ -1001,7 +1001,7 @@ local function MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId, bDownHead) -- dichiaro non si generano sfridi per VMill EgtSetMachiningParam( MCH_MP.USERNOTES, 'VMRS=0;') -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -1034,7 +1034,7 @@ local function MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId, bDownHead) -- dichiaro non si generano sfridi per VMill EgtSetMachiningParam( MCH_MP.USERNOTES, 'VMRS=0;') -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -1216,7 +1216,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, nFacInd, rfFac, dH, dV EgtSetMachiningParam( MCH_MP.ENDADDLEN, EgtIf( bOpenStart, 0, - dTDiam / 2)) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -1487,7 +1487,7 @@ local function MakeRoundCleanCorner( Proc, nPhase, nRawId, nPartId, b3Raw, nFacInd, nAddGrpId, dDiam, bMillDown, bDoubleSide) -- recupero la lavorazione senza considerare l'elevazione - local sMilling = ML.FindMilling( 'SmallToolContour' .. EgtIf( bMillDown and not bDoubleSide, '_H2', '')) + local sMilling = ML.FindMilling( 'SmallToolContour', nil, nil, nil, nil, not ( bMillDown and not bDoubleSide), bMillDown and not bDoubleSide) if not sMilling then local sMyWarn = 'Warning : SmallToolContour not found in library' EgtOutLog( sMyWarn) @@ -1641,7 +1641,7 @@ local function MakeRoundCleanCorner( Proc, nPhase, nRawId, nPartId, b3Raw, sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( ( tFacAdj[i][3] + dDepth), 1) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo - if EgtApplyMachining( true, false) then + if ML.ApplyMachining( true, false) then _, sMyWarn = EgtGetMachMgrWarning( 0) if EgtIsMachiningEmpty() then EgtSetOperationMode( nMchId, false) @@ -1667,7 +1667,7 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw, dDepth, bOneShot) -- recupero la lavorazione senza considerare l'elevazione perché viene calcolata l'elevazione utile - local sMilling = ML.FindMilling( 'SmallToolContour' .. EgtIf( bMillDown and not bDoubleSide, '_H2', '')) + local sMilling = ML.FindMilling( 'SmallToolContour', nil, nil, nil, nil, not( bMillDown and not bDoubleSide), bMillDown and not bDoubleSide) if not sMilling then local sMyWarn = 'Warning : SmallToolContour not found in library' EgtOutLog( sMyWarn) @@ -1683,7 +1683,7 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw, dTMaxDepth = EgtTdbGetCurrToolMaxDepth() or dTMaxDepth end - local sMillingDn = ML.FindMilling( 'SmallToolContour' .. EgtIf( bMillDown and bDoubleSide, '_H2', '')) + local sMillingDn = ML.FindMilling( 'SmallToolContour', nil, nil, nil, nil, not( bMillDown and bDoubleSide), bMillDown and bDoubleSide) if not sMillingDn then local sMyWarn = 'Warning : Opposite SmallToolContour not found in library' EgtOutLog( sMyWarn) @@ -1880,7 +1880,7 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw, sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( ( dMaxElev + dMachDepth), 1) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo - if EgtApplyMachining( true, false) then + if ML.ApplyMachining( true, false) then _, sMyWarn = EgtGetMachMgrWarning( 0) if EgtIsMachiningEmpty() then EgtSetOperationMode( nMchId, false) @@ -1943,7 +1943,7 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw, sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( ( dMaxElev + dMachDepth), 1) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo - if EgtApplyMachining( true, false) then + if ML.ApplyMachining( true, false) then _, sMyWarn = EgtGetMachMgrWarning( 0) if EgtIsMachiningEmpty() then EgtSetOperationMode( nMchId, false) @@ -2154,7 +2154,7 @@ local function MakeSharpCleanCorner( Proc, nPhase, nRawId, nPartId, b3Raw, nFacI local sUserNotes = 'VMRS=0;MaxElev=' .. EgtNumToString( dMaxDepth, 1) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -2303,7 +2303,7 @@ local function MakeDrillOnCorner( Proc, nPhase, nRawId, nPartId, b3Raw, nFacInd, -- aggiungo alle note massima elevazione (coincide con affondamento) sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( dDepth, 1) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -2622,7 +2622,7 @@ local function MakeChamfer( Proc, bIs3Faces, nAddGrpId, vtOrtho, b3Solid, nSurfI -- EgtSetMachiningParam( MCH_MP.INVERT, true) -- end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return -1, sErr @@ -2774,7 +2774,7 @@ local function MakeByMillAsSaw( Proc, nPhase, nRawId, nPartId, nFacInd, EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) -- tolgo eventuale step EgtSetMachiningParam( MCH_MP.STEP, 0) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -2902,7 +2902,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, local bCutDown = ( BD.DOWN_HEAD and rfFac:getVersZ():getZ() < - 0.5) -- Recupero il massimo affondamento possibile con la lama local dSawMaxDepth = 0 - local sCutting = ML.FindCutting( 'HeadSide'..EgtIf( bCutDown, '_H2', '')) + local sCutting = ML.FindCutting( 'HeadSide', not bCutDown, bCutDown) if sCutting then if EgtMdbSetCurrMachining( sCutting) then local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) @@ -3052,7 +3052,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 2) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then if EgtGetOutstrokeInfo() then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) @@ -3061,7 +3061,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, -- impostazione alternativa angolo 3° asse rot EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, GetChainSawBlockedAxis( 2)) EgtSetMachiningParam( MCH_MP.INITANGS, GetChainSawInitAngs( vtN, rfFac:getVersZ(), 2)) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -3126,7 +3126,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then if EgtGetOutstrokeInfo() then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) @@ -3135,7 +3135,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, -- impostazione alternativa angolo 3° asse rot EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, GetChainSawBlockedAxis( 2)) EgtSetMachiningParam( MCH_MP.INITANGS, GetChainSawInitAngs( vtN, vtOrtho, 2)) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -3156,7 +3156,7 @@ end --------------------------------------------------------------------- local function MakeAntiSplintBySaw( Proc, nFacet, vtN, b3Raw, nFacInd, bReduceDepth, bMillDown) -- Recupero la lavorazione di lama - local sCutting = ML.FindCutting( 'HeadSide' .. EgtIf( bMillDown, '_H2', '')) + local sCutting = ML.FindCutting( 'HeadSide', not bMillDown, bMillDown) if not sCutting then local sErr = 'Error : HeadSide (cutting) not found in library' EgtOutLog( sErr) @@ -3319,10 +3319,10 @@ local function MakePocket( Proc, nPartId, ptPs, tvtN, nFaceRef, sMchFind, nUseRo local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';' sNotes = sNotes .. 'VMRS=0;' EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then -- provo ad allargare leggermente la tasca EgtSetMachiningParam( MCH_MP.OFFSR, -0.1) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -3393,7 +3393,7 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, tvtN, nBas local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';' sNotes = sNotes .. 'VMRS=0;' EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -3493,7 +3493,7 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, tvtN, nBas end end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -3577,7 +3577,7 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha local bMakePocket, sPocketing, dMaxDepth, dDiamTool = VerifyPocket( Proc, dDimMin, dDepth / 2, nil, sMchFind) local bMakePocketDn, sPocketingDn, dMaxDepthDn, dDiamToolDn if bMillDown then - bMakePocketDn, sPocketingDn, dMaxDepthDn, dDiamToolDn = VerifyPocket( Proc, dDimMin, dDepth / 2, nil, sMchFind..'_H2') + bMakePocketDn, sPocketingDn, dMaxDepthDn, dDiamToolDn = VerifyPocket( Proc, dDimMin, dDepth / 2, nil, sMchFind, true) -- se è negativo inverto il versore e la faccia if vtOrtho:getZ() < 0 then vtOrtho = -vtOrtho @@ -3696,10 +3696,10 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha sNotes = sNotes .. 'VMRS=0;' EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then -- provo ad allargare leggermente la tasca EgtSetMachiningParam( MCH_MP.OFFSR, -0.1) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return -1, sErr @@ -3778,10 +3778,10 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha sNotes = sNotes .. 'VMRS=0;' EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then -- provo ad allargare leggermente la tasca EgtSetMachiningParam( MCH_MP.OFFSR, -0.1) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return -1, sErr @@ -3848,10 +3848,10 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha local sNotes = 'VMRS=0;' EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then -- provo ad allargare leggermente la tasca EgtSetMachiningParam( MCH_MP.OFFSR, -0.1) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return -1, sErr @@ -3955,7 +3955,7 @@ local function ManageAntiSplintBySaw( Proc, b3Raw, bIsU, vtN, nFacInd, sWarn, bM EgtSetMachiningParam( MCH_MP.SCC, nPrevSCC) end -- rieseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nIdMach, false) return false, false, sErr @@ -4112,7 +4112,7 @@ local function MakeAntiSplintByMill( Proc, nPartId, pPaths, nPathInt, vtN1, sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( ( dMaxElev + dMachDepth), 1) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo - if EgtApplyMachining( true, false) then + if ML.ApplyMachining( true, false) then _, sMyWarn2 = EgtGetMachMgrWarning( 0) if EgtIsMachiningEmpty() then EgtSetOperationMode( nMchId, false) @@ -4162,9 +4162,9 @@ local function ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw, dCheckDepth = dDepth end end - sMilling = ML.FindMilling( 'AntiSplintMillCut' .. EgtIf( bMillDown and not bDoubleSide, '_H2', ''), dCheckDepth) or - ML.FindMilling( 'AntiSplintMillCut' .. EgtIf( bMillDown and not bDoubleSide , '_H2', ''), 2/3 * dCheckDepth) or - ML.FindMilling( 'AntiSplintMillCut' .. EgtIf( bMillDown and not bDoubleSide , '_H2', '')) + sMilling = ML.FindMilling( 'AntiSplintMillCut', dCheckDepth, nil, nil, nil, not( bMillDown and not bDoubleSide), bMillDown and not bDoubleSide) or + ML.FindMilling( 'AntiSplintMillCut', 2/3 * dCheckDepth, nil, nil, nil, not( bMillDown and not bDoubleSide), bMillDown and not bDoubleSide) or + ML.FindMilling( 'AntiSplintMillCut', nil, nil, nil, nil, not( bMillDown and not bDoubleSide), bMillDown and not bDoubleSide) if sMilling then @@ -4471,7 +4471,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa EgtOutLog( sWarn) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then if EgtGetOutstrokeInfo() then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) @@ -4479,7 +4479,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa end EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, GetChainSawBlockedAxis( 2)) EgtSetMachiningParam( MCH_MP.INITANGS, GetChainSawInitAngs( vtN, vtOrtho, 2)) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -4586,7 +4586,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa local nSCC = EgtIf( ( vtN:getY() > 0.5 or ( bHeadDir and vtN:getZ() > 0.5 ) or ( not bHeadDir and vtN:getZ() < -0.5)), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM) EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -4606,7 +4606,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( nWorkSide == MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)) EgtSetMachiningParam( MCH_MP.SCC, EgtIf( nSCC == MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFNId, false) return false, sErr @@ -4716,10 +4716,10 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa local sNotes = 'MaxElev=' .. EgtNumToString( dFacElev2, 1) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then -- provo ad allargare leggermente la tasca EgtSetMachiningParam( MCH_MP.OFFSR, -0.1) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -4852,7 +4852,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa end -- ricerca lavorazione local sPocketing - local _, sMyPocketing, dMyTMaxDepth, dMyTDiam = VerifyPocket( Proc, dDiam, dFacElev + dCollSic, dMaxTotLen, sMchFind .. EgtIf( bMillDown, '_H2', '')) + local _, sMyPocketing, dMyTMaxDepth, dMyTDiam = VerifyPocket( Proc, dDiam, dFacElev + dCollSic, dMaxTotLen, sMchFind, bMillDown) if not sMyPocketing and bMillUp then _, sMyPocketing, dMyTMaxDepth, dMyTDiam = VerifyPocket( Proc, dDiam, dFacElev + dCollSic, dMaxTotLen, sMchFind) bMillDown = false @@ -4925,11 +4925,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa ( Proc.TotBox and Proc.TotBox:getDimX() > BD.MIN_LEN_LAMELLO) or ( not Proc.TotBox and Proc.Box:getDimX() > BD.MIN_LEN_LAMELLO)) then -- recupero la lavorazione - if BD.DOWN_HEAD and vtN:getZ() < BD.NZ_MINA then - sMillingOnSide = ML.FindMilling( 'SideMillAsBlade_H2') - else - sMillingOnSide = ML.FindMilling( 'SideMillAsBlade') - end + local bDownHead = BD.DOWN_HEAD and vtN:getZ() < BD.NZ_MINA + sMillingOnSide = ML.FindMilling( 'SideMillAsBlade_H2', nil, nil, nil, nil, not bDownHead, bDownHead) if sMillingOnSide then -- recupero i dati dell'utensile @@ -5018,7 +5015,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa if not sMchFind then sMchFind = sMchFindBackUp end - sPocketing = ML.FindPocketing( sMchFind, dDiam) + sPocketing = ML.FindPocketing( sMchFind, dDiam, nil, nil, not bMillDown, bMillDown) if not sPocketing then local sErr = 'Error : '..sMchFind..' not found in library' EgtOutLog( sErr) @@ -5028,7 +5025,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa return false, sErr elseif nOk == 0 then if sStat == 'MNF' then - sPocketing = ML.FindPocketing( sMchFind, dDiam) + sPocketing = ML.FindPocketing( sMchFind, dDiam, nil, nil, not bMillDown, bMillDown) if not sPocketing then local sErr = 'Error : '..sMchFind..' not found in library' EgtOutLog( sErr) @@ -5042,7 +5039,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa return bOk, sErr end else - sPocketing = ML.FindPocketing( sMchFind, dDiam) + sPocketing = ML.FindPocketing( sMchFind, dDiam, nil, nil, not bMillDown, bMillDown) if not sPocketing then local sErr = 'Error : '..sMchFind..' not found in library' EgtOutLog( sErr) @@ -5093,7 +5090,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa if not sMchFind then sMchFind = sMchFindBackUp end - sPocketing = ML.FindPocketing( sMchFind, dDiam) + sPocketing = ML.FindPocketing( sMchFind, dDiam, nil, nil, not bMillDown, bMillDown) if not sPocketing then local sErr2 = 'Error : '..sMchFind..' not found in library' EgtOutLog( sErr2) diff --git a/LuaLibs/ProcessLapJointNew.lua b/LuaLibs/ProcessLapJointNew.lua index 2eb55f7..e19ba4b 100644 --- a/LuaLibs/ProcessLapJointNew.lua +++ b/LuaLibs/ProcessLapJointNew.lua @@ -489,19 +489,19 @@ local function VerifyChainSaw( dMinDim, dMaxDim) end --------------------------------------------------------------------- -local function VerifyPocket( dDiam, dDepth, dMaxTotLen, sMchFindMaster) +local function VerifyPocket( dDiam, dDepth, dMaxTotLen, sMchFindMaster, bPocketUp, bPocketDown) -- tipo di svuotatura local sMchFind = EgtIf( sMchFindMaster and #sMchFindMaster > 0, sMchFindMaster, 'Pocket') -- ricerca della svuotatura local sPocketing if dDepth then - sPocketing = ML.FindPocketing( sMchFind, dDiam, dDepth, dMaxTotLen) or + sPocketing, _, _, bPocketDown = ML.FindPocketing( sMchFind, dDiam, dDepth, dMaxTotLen) or ML.FindPocketing( sMchFind, dDiam, 0.8 * dDepth, dMaxTotLen) or ML.FindPocketing( sMchFind, dDiam, 0.6 * dDepth, dMaxTotLen) or ML.FindPocketing( sMchFind, dDiam, 0.4 * dDepth, dMaxTotLen) or ML.FindPocketing( sMchFind, dDiam, 0, dMaxTotLen) else - sPocketing = ML.FindPocketing( sMchFind, dDiam, 0, dMaxTotLen) + sPocketing, _, _, bPocketDown = ML.FindPocketing( sMchFind, dDiam, 0, dMaxTotLen) end if not sPocketing then return false @@ -516,7 +516,7 @@ local function VerifyPocket( dDiam, dDepth, dMaxTotLen, sMchFindMaster) dMaxDepth = TI.dMaxDepth or dMaxDepth bUsePocketing = true end - return bUsePocketing, sPocketing, dMaxDepth, dToolDiam + return bUsePocketing, sPocketing, dMaxDepth, dToolDiam, bPocketDown end --------------------------------------------------------------------- @@ -971,7 +971,7 @@ local function MakeOneFaceByMill( Proc) -- dichiaro non si generano sfridi per VMill EgtSetMachiningParam( MCH_MP.USERNOTES, 'VMRS=0;') -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -1019,7 +1019,7 @@ local function DoMill( Proc, sName, sMilling, offset, nFacInd, nFac2Ind, vtN) -- dichiaro non si generano sfridi per VMill EgtSetMachiningParam( MCH_MP.USERNOTES, 'VMRS=0;') -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -1034,11 +1034,7 @@ local function MakeTwoFacesByMill( Proc, bDownHead) assert( ( Proc.Fct == 2), 'Error : MakeTwoFacesByMill in LapJoint with ' .. tostring( Proc.Fct) .. ' faces') -- recupero la lavorazione local sMilling - if Q_USE_MILL and Q_USE_MILL == 1 then - sMilling = ML.FindMilling( 'LongSmallCut' .. EgtIf( bDownHead, '_H2', '')) - else - sMilling = ML.FindMilling( 'BirdsMouth' .. EgtIf( bDownHead, '_H2', '')) - end + sMilling = ML.FindMilling( EgtIf( Q_USE_MILL and Q_USE_MILL == 1, 'LongSmallCut', 'BirdsMouth'), nil , nil, nil, nil, not bDownHead, bDownHead) if not sMilling then local sErr = 'Error : LongSmallCut & BirdsMouth not found in library' EgtOutLog( sErr) @@ -1283,7 +1279,7 @@ local function MakeByMill( Proc, tFData, dCollSic, bSpecialApp, sMillMaster) EgtSetMachiningParam( MCH_MP.ENDADDLEN, EgtIf( bOpenStart, 0, - dTDiam / 2)) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -1557,7 +1553,7 @@ local function DoClean( sName, sMilling, nIdPath, vtN, dMaxElev, dMachDepth, dEx local sUserNotes = 'VMRS=0;MaxElev=' .. EgtNumToString( ( dMaxElev + dMachDepth), 1) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo - if EgtApplyMachining( true, false) then + if ML.ApplyMachining( true, false) then _, sMyWarn = EgtGetMachMgrWarning( 0) if EgtIsMachiningEmpty() then EgtSetOperationMode( nMchId, false) @@ -1574,7 +1570,7 @@ end --------------------------------------------------------------------- local function MakeRoundCleanCorner( Proc, nFacInd, dDiam, bMillDown, bDoubleSide) -- recupero la lavorazione senza considerare l'elevazione - local sMilling = ML.FindMilling( 'SmallToolContour' .. EgtIf( bMillDown and not bDoubleSide, '_H2', '')) + local sMilling = ML.FindMilling( 'SmallToolContour', nil, nil, nil, nil, not ( bMillDown and not bDoubleSide), bMillDown and not bDoubleSide) if not sMilling then local sMyWarn = 'Warning : SmallToolContour not found in library' EgtOutLog( sMyWarn) @@ -1695,7 +1691,7 @@ local function MakeRoundCleanContour( Proc, nFacInd, dDiam, bMillDown, dDepth, bOneShot) -- recupero la lavorazione senza considerare l'elevazione perché viene calcolata l'elevazione utile - local sMilling = ML.FindMilling( 'SmallToolContour' .. EgtIf( bMillDown and not bDoubleSide, '_H2', '')) + local sMilling = ML.FindMilling( 'SmallToolContour', nil, nil, nil, nil, not ( bMillDown and not bDoubleSide), bMillDown and not bDoubleSide) if not sMilling then local sMyWarn = 'Warning : SmallToolContour not found in library' EgtOutLog( sMyWarn) @@ -1711,7 +1707,7 @@ local function MakeRoundCleanContour( Proc, nFacInd, dDiam, bMillDown, dTMaxDepth = TI.dMaxDepth or dTMaxDepth end - local sMillingDn = ML.FindMilling( 'SmallToolContour' .. EgtIf( bMillDown and bDoubleSide, '_H2', '')) + local sMillingDn = ML.FindMilling( 'SmallToolContour', nil, nil, nil, nil, not ( bMillDown and bDoubleSide), bMillDown and bDoubleSide) if not sMillingDn then local sMyWarn = 'Warning : Opposite SmallToolContour not found in library' EgtOutLog( sMyWarn) @@ -2141,7 +2137,7 @@ local function MakeDrillOnCorner( Proc, nFacInd, dDiam, bSpecialMach) -- Note utente con dichiarazione nessuna generazione sfridi per Vmill e massima elevazione (coincide con affondamento) local sUserNotes = 'VMRS=0;MaxElev=' .. EgtNumToString( dDepth, 1) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -2407,7 +2403,7 @@ local function MakeChamfer( Proc, vtOrtho, nSurfInt) -- EgtSetMachiningParam( MCH_MP.INVERT, true) -- end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return -1, sErr @@ -2526,7 +2522,7 @@ local function MakeByMillAsSaw( Proc, tFData, nBottomFace, sMillingOnSide, dSawD EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) -- tolgo eventuale step EgtSetMachiningParam( MCH_MP.STEP, 0) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -2596,7 +2592,7 @@ local function DoHeadChainSaw( Proc, sName, sSawing, tFData, nFaceUse, nFacAdj, local sNotes = 'MaxElev=' .. EgtNumToString( tFData.dFacElev, 2) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then if EgtGetOutstrokeInfo() then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) @@ -2605,7 +2601,7 @@ local function DoHeadChainSaw( Proc, sName, sSawing, tFData, nFaceUse, nFacAdj, -- impostazione alternativa angolo 3° asse rot EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, GetChainSawBlockedAxis( 2)) EgtSetMachiningParam( MCH_MP.INITANGS, GetChainSawInitAngs( vtN, tFData.rfFac:getVersZ())) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -2688,7 +2684,7 @@ local function DoSideChainSaw( Proc, sName, sSawing, tFData, vtN, vtOrtho, nLong EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then if EgtGetOutstrokeInfo() then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) @@ -2697,7 +2693,7 @@ local function DoSideChainSaw( Proc, sName, sSawing, tFData, vtN, vtOrtho, nLong -- impostazione alternativa angolo 3° asse rot EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, GetChainSawBlockedAxis( 2)) EgtSetMachiningParam( MCH_MP.INITANGS, GetChainSawInitAngs( vtN, vtOrtho)) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -2946,7 +2942,7 @@ end --------------------------------------------------------------------- local function MakeAntiSplintBySaw( Proc, nFacet, vtN, nFacInd, bReduceDepth, bMillDown) -- Recupero la lavorazione di lama - local sCutting = ML.FindCutting( 'HeadSide' .. EgtIf( bMillDown, '_H2', '')) + local sCutting = ML.FindCutting( 'HeadSide', not bMillDown, bMillDown) if not sCutting then local sErr = 'Error : HeadSide (cutting) not found in library' EgtOutLog( sErr) @@ -3061,10 +3057,10 @@ local function DoPocketing( sName, sPocketing, sMchFind, vtN, nPathInt, nFaceIdx end EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then -- provo ad allargare leggermente la tasca EgtSetMachiningParam( MCH_MP.OFFSR, -0.1) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local bOk, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -3166,7 +3162,7 @@ local function DoHeadCut( Proc, sName, sMilling, nMchFId, dElev, nSideFace, tvtN -- imposto elevazione e dichiaro non si generano sfridi per VMill local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';VMRS=0;' EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -3302,7 +3298,7 @@ local function MachineByMill( Proc, tvtN, nBaseFace, nSideFace, ptPs, tDimAndRef end end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -3381,7 +3377,7 @@ local function MakeByPockets( Proc, bOrthoFacesMaster, bMillDown) local bMakePocket, sPocketing, dMaxDepth, dDiamTool = VerifyPocket( dDimMin, dDepth / 2, nil, sMchFind) local bMakePocketDn, sPocketingDn, dMaxDepthDn if bMillDown then - bMakePocketDn, sPocketingDn, dMaxDepthDn = VerifyPocket( dDimMin, dDepth / 2, nil, sMchFind .. '_H2') + bMakePocketDn, sPocketingDn, dMaxDepthDn = VerifyPocket( dDimMin, dDepth / 2, nil, sMchFind .. '_H2', false, true) -- se è negativo inverto il versore e la faccia if vtOrtho:getZ() < 0 then vtOrtho = -vtOrtho @@ -3634,7 +3630,7 @@ local function ManageAntiSplintBySaw( Proc, bIsU, vtN, nFacInd, sWarn, bMillDown EgtSetMachiningParam( MCH_MP.SCC, nPrevSCC) end -- rieseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nIdMach, false) return false, false, sErr @@ -3788,7 +3784,7 @@ local function MakeAntiSplintByMill( Proc, pPaths, nPathInt, vtN1, local sUserNotes = 'VMRS=0;MaxElev=' .. EgtNumToString( ( dMaxElev + dMachDepth), 1) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo - if EgtApplyMachining( true, false) then + if ML.ApplyMachining( true, false) then _, sMyWarn2 = EgtGetMachMgrWarning( 0) if EgtIsMachiningEmpty() then EgtSetOperationMode( nMchId, false) @@ -3835,9 +3831,9 @@ local function ManageAntiSplintByMill( Proc, nFacInd, bMillDown, bDoubleSide, dCheckDepth = dDepth end end - sMilling = ML.FindMilling( 'AntiSplintMillCut' .. EgtIf( bMillDown and not bDoubleSide, '_H2', ''), dCheckDepth) or - ML.FindMilling( 'AntiSplintMillCut' .. EgtIf( bMillDown and not bDoubleSide, '_H2', ''), 2/3 * dCheckDepth) or - ML.FindMilling( 'AntiSplintMillCut' .. EgtIf( bMillDown and not bDoubleSide, '_H2', '')) + sMilling = ML.FindMilling( 'AntiSplintMillCut', dCheckDepth, nil, nil, nil, not ( bMillDown and not bDoubleSide), bMillDown and not bDoubleSide) or + ML.FindMilling( 'AntiSplintMillCut', 2/3 * dCheckDepth, nil, nil, nil, not ( bMillDown and not bDoubleSide), bMillDown and not bDoubleSide) or + ML.FindMilling( 'AntiSplintMillCut', nil, nil, nil, nil, not ( bMillDown and not bDoubleSide), bMillDown and not bDoubleSide) if sMilling then @@ -4042,7 +4038,7 @@ local function DoSideMill( Proc, sName, sMilling, tFData, dMaxMat, dToolDiam, bH local nSCC = EgtIf( ( tFData.vtN:getY() > 0.5 or ( bHeadDir and tFData.vtN:getZ() > 0.5 ) or ( not bHeadDir and tFData.vtN:getZ() < -0.5)), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM) EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -4062,7 +4058,7 @@ local function DoSideMill( Proc, sName, sMilling, tFData, dMaxMat, dToolDiam, bH EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( nWorkSide == MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)) EgtSetMachiningParam( MCH_MP.SCC, EgtIf( nSCC == MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFNId, false) return false, sErr @@ -4184,10 +4180,10 @@ local function MakeSpecialThreeFaces( Proc, tFData) local sNotes = 'MaxElev=' .. EgtNumToString( tFData.dFacElev2, 1) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then -- provo ad allargare leggermente la tasca EgtSetMachiningParam( MCH_MP.OFFSR, -0.1) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -4256,7 +4252,7 @@ local function MakeByChainsaw( Proc, dDimMin, dDimMax, dDepth, vtOrtho, nLongFac EgtOutLog( sWarn) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then if EgtGetOutstrokeInfo() then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) @@ -4264,7 +4260,7 @@ local function MakeByChainsaw( Proc, dDimMin, dDimMax, dDepth, vtOrtho, nLongFac end EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, GetChainSawBlockedAxis( 2)) EgtSetMachiningParam( MCH_MP.INITANGS, GetChainSawInitAngs( vtN, vtOrtho)) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -4432,7 +4428,7 @@ local function MakeSidePocketings( Proc, tFData, dCollSic, bSpecialMillOnSide, -- eseguo bOk, sWarn, sStat = MakeByChainOrSaw( Proc, tFData, dDimMin, dDimMax, vtOrtho, nLongFaceId, bOrthoFaces, nBottomFace, nSurfInt) if not bOk and sStat == 'MNF' then - _, sPocketing = VerifyPocket( dDiam, tFData.dFacElev + dCollSic, nil, sMchFind) + _, sPocketing = VerifyPocket( dDiam, tFData.dFacElev + dCollSic, nil, sMchFind, bMillUp, bMillDown) if sPocketing then sWarn = '' else @@ -4565,12 +4561,8 @@ local function MakePocketingOrMilling( Proc, tFData, bSinglePart) dMaxTotLen = BD.GetBottomToolMaxTotLen( tFData.vtN) end -- ricerca lavorazione - local sPocketing - local _, sMyPocketing, dMyTMaxDepth, _ = VerifyPocket( dDiam, tFData.dFacElev + dCollSic, dMaxTotLen, sMchFind .. EgtIf( bMillDown, '_H2', '')) - if not sMyPocketing and bMillUp then - _, sMyPocketing, dMyTMaxDepth, _ = VerifyPocket( dDiam, tFData.dFacElev + dCollSic, dMaxTotLen, sMchFind) - bMillDown = false - end + local sPocketing, sMyPocketing, dMyTMaxDepth + _, sMyPocketing, dMyTMaxDepth, _, bMillDown = VerifyPocket( dDiam, tFData.dFacElev + dCollSic, dMaxTotLen, sMchFind .. EgtIf( bMillDown, '_H2', ''), bMillUp, bMillDown) --local sMyPocketing, dMyTDiam, dMyTMaxDepth = ML.FindPocketing( sMchFind .. EgtIf( bMillDown, '_H2', ''), dDiam, dFacElev + dCollSic, dMaxTotLen) --if not sMyPocketing then -- sMyPocketing, dMyTDiam, dMyTMaxDepth = ML.FindPocketing( sMchFind .. EgtIf( bMillDown, '_H2', ''), dDiam, nil, dMaxTotLen) @@ -4638,11 +4630,8 @@ local function MakePocketingOrMilling( Proc, tFData, bSinglePart) ( Proc.TotBox and Proc.TotBox:getDimX() > BD.MIN_LEN_LAMELLO) or ( not Proc.TotBox and Proc.Box:getDimX() > BD.MIN_LEN_LAMELLO)) then -- recupero la lavorazione - if BD.DOWN_HEAD and tFData.vtN:getZ() < BD.NZ_MINA then - sMillingOnSide = ML.FindMilling( 'SideMillAsBlade_H2') - else - sMillingOnSide = ML.FindMilling( 'SideMillAsBlade') - end + local bDownhead = BD.DOWN_HEAD and tFData.vtN:getZ() < BD.NZ_MINA + sMillingOnSide = ML.FindMilling( 'SideMillAsBlade_H2', nil, nil, nil, nil, not bDownhead, bDownhead) if sMillingOnSide then -- recupero i dati dell'utensile diff --git a/LuaLibs/ProcessLongCut.lua b/LuaLibs/ProcessLongCut.lua index c2c0ea3..038ffaf 100644 --- a/LuaLibs/ProcessLongCut.lua +++ b/LuaLibs/ProcessLongCut.lua @@ -99,7 +99,7 @@ local function MakeSideFace( nId, nFac, nSide, sMilling, dToolDiam, bForcedLim, EgtSetMachiningParam( MCH_MP.LOPERP, 0) EgtSetMachiningParam( MCH_MP.LOTANG, dToolDiam / 2 + 30) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -114,7 +114,7 @@ local function MakeAntiSplintBySaw( Proc, nFacet, vtN, b3Raw, nFacInd, bReduceDe if sMasterCutting and #sMasterCutting > 0 then sCutting = sMasterCutting else - sCutting = ML.FindCutting( 'HeadSide' .. EgtIf( bMillDown, '_H2', '')) + sCutting = ML.FindCutting( 'HeadSide', not bMillDown, bMillDown) end if not sCutting then local sErr = 'Error : HeadSide (cutting) not found in library' @@ -261,7 +261,7 @@ local function ManageAntiSplintBySaw( Proc, b3Raw, bIsU, vtN, nFacet, nFacInd, s EgtSetMachiningParam( MCH_MP.SCC, nPrevSCC) end -- rieseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nIdMach, false) return false, false, sErr @@ -320,10 +320,10 @@ local function MakeByPocketing( Proc, nPhase, nRawId, nPartId) sNotes = sNotes .. 'VMRS=0;' EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then -- provo ad allargare leggermente la tasca EgtSetMachiningParam( MCH_MP.OFFSR, -0.1) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -473,7 +473,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus local dMaxDepthDn = 0 -- recupero la lavorazione if bCanUseUnderBlade then - sCuttingDn = ML.FindCutting( 'HeadSide_H2') + sCuttingDn = ML.FindCutting( 'HeadSide_H2', false, true) if not sCuttingDn then local sErr = 'Error : sawing HeadSide_H2 not found in library' EgtOutLog( sErr) @@ -668,12 +668,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus -- determino la massima elevazione local dElev = BL.GetFaceElevation( Proc.Id, 0, nPartId) -- recupero la lavorazione - local sMilling - if bCanUseUnderBlade then - sMilling = ML.FindMilling( 'Long2Cut_H2', dElev) - else - sMilling = ML.FindMilling( 'Long2Cut', dElev) - end + local sMilling = ML.FindMilling( 'Long2Cut_H2', dElev, nil, nil, nil, not bCanUseUnderBlade, bCanUseUnderBlade) if not sMilling then local sErr = 'Error : milling Long2Cut (_H2) not found in library' EgtOutLog( sErr) @@ -846,7 +841,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus -- imposto posizione braccio porta testa per non ingombrare agli estremi EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -859,8 +854,9 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus -- determino la massima elevazione local dElev = BL.GetFaceElevation( Proc.Id, 0, nPartId) -- recupero la lavorazione - local sMchType = EgtIf( nSide ~= - 1, 'Long2Cut', 'Long2Cut_H2') - local sMilling = ML.FindMilling( sMchType, dElev) + local bDownHead = ( nSide == - 1) + sMchType = EgtIf( bDownHead, 'Long2Cut_H2', 'Long2Cut') + local sMilling = ML.FindMilling( sMchType, dElev, nil, nil, nil, not bDownHead, bDownHead) if not sMilling then local sErr = 'Error : milling '..sMchType..' not found in library' EgtOutLog( sErr) @@ -1014,7 +1010,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus local dDepth = min( 0, dMaxDepth - dElev ) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -1076,7 +1072,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus -- se testa da sotto if nSide ~= 1 and BD.DOWN_HEAD then sMchTypeDn = 'Long2CutSide_H2' - sMillingDn = ML.FindMilling( sMchTypeDn) + sMillingDn = ML.FindMilling( sMchTypeDn, nil, nil, nil, nil, false, true) sPrefixDn = 'L2CSH2_' end -- lavorazione da sotto @@ -1091,7 +1087,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus -- se testa da sotto if BD.DOWN_HEAD then sMchTypeDn = 'Long2CutDown_H2' - sMillingDn = ML.FindMilling( sMchTypeDn) + sMillingDn = ML.FindMilling( sMchTypeDn, nil, nil, nil, nil, false, true) sPrefixDn = 'L2CDH2_' end end @@ -1399,12 +1395,12 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus EgtSetMachiningParam( MCH_MP.LIPERP, dLioPerp1) EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp1) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then -- se feature orientata su faccia da sotto provo a cambiare l'attacco if nSide == -1 then EgtSetMachiningParam( MCH_MP.LIPERP, min( dLioPerp1, dLioPerp2)) EgtSetMachiningParam( MCH_MP.LOPERP, min( dLioPerp1, dLioPerp2)) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) -- esco se non sono nella seconda lavorazione o non nella faccia da sotto diff --git a/LuaLibs/ProcessLongDoubleCut.lua b/LuaLibs/ProcessLongDoubleCut.lua index 0d7d12c..86342ff 100644 --- a/LuaLibs/ProcessLongDoubleCut.lua +++ b/LuaLibs/ProcessLongDoubleCut.lua @@ -144,7 +144,7 @@ local function MakeSideFace( nId, nFac, nSide, sMilling, dToolDiam, nL2CSide) EgtSetMachiningParam( MCH_MP.STARTPOS, 80) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -155,8 +155,9 @@ end -- Applicazione della lavorazione local function MakeByPocketing( Proc, nPhase, nRawId, nPartId, nSide, nFacInd, dFacElev) -- cerco la svuotatura opportuna - local sPockType = EgtIf( nSide ~=1 and BD.DOWN_HEAD, 'OpenPocket_H2', 'OpenPocket') - local sPocketing = ML.FindPocketing( sPockType, Proc.Box:getDimX()) + local bDownHead = nSide ~=1 and BD.DOWN_HEAD + local sPockType = EgtIf( bDownHead, 'OpenPocket_H2', 'OpenPocket') + local sPocketing = ML.FindPocketing( sPockType, Proc.Box:getDimX(), nil, nil, not bDownHead, bDownHead) if not sPocketing then local sErr = 'Error : OpenPocket not found in library' EgtOutLog( sErr) @@ -197,10 +198,10 @@ local function MakeByPocketing( Proc, nPhase, nRawId, nPartId, nSide, nFacInd, d sNotes = sNotes .. 'VMRS=0;' EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then -- provo ad allargare leggermente la tasca EgtSetMachiningParam( MCH_MP.OFFSR, -0.1) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -392,7 +393,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster local dMaxDepthDn = 0 -- recupero la lavorazione if bCanUseUnderBlade then - sCuttingDn = ML.FindCutting( 'HeadSide_H2') + sCuttingDn = ML.FindCutting( 'HeadSide_H2', false, true) if not sCuttingDn then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' sawing underneath not found in library' EgtOutLog( sErr) @@ -715,7 +716,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- imposto posizione braccio porta testa per non ingombrare agli estremi EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -844,7 +845,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- determino e imposto l'utilizzo della faccia EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse[vOrd[j]]) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -868,11 +869,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster end -- recupero la lavorazione local sMilling - if nSide == -1 and BD.DOWN_HEAD then - sMilling = ML.FindMilling( 'Long2Cut_H2', dElev) - else - sMilling = ML.FindMilling( 'Long2Cut', dElev) - end + local bDownHead = ( nSide == -1 and BD.DOWN_HEAD) + sMilling = ML.FindMilling( 'Long2Cut_H2', dElev, nil, nil, nil, not bDownHead, bDownHead) if not sMilling then local sErr = 'Error : Long2Cut not found in library' @@ -1097,7 +1095,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster EgtSetMachiningParam( MCH_MP.STARTPOS, 80) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -1138,7 +1136,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- se testa da sotto if nSide ~= 1 and BD.DOWN_HEAD then sMchTypeDn = 'Long2CutSide_H2' - sMillingDn = ML.FindMilling( sMchTypeDn) + sMillingDn = ML.FindMilling( sMchTypeDn, nil, nil, nil, nil, false, true) sPrefixDn = 'L2CSH2_' end -- lavorazione da sotto @@ -1153,7 +1151,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- se testa da sotto if BD.DOWN_HEAD then sMchTypeDn = 'Long2CutDown_H2' - sMillingDn = ML.FindMilling( sMchTypeDn) + sMillingDn = ML.FindMilling( sMchTypeDn, nil, nil, nil, nil, false, true) sPrefixDn = 'L2CDH2_' end end @@ -1543,12 +1541,12 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster EgtSetMachiningParam( MCH_MP.DEPTH, dDepth - dExtraElev) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then -- se feature orientata su faccia da sotto e concave provo a cambiare l'attacco if nSide == -1 and not bConvex then EgtSetMachiningParam( MCH_MP.LIPERP, dLioPerp1) EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp1) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr diff --git a/LuaLibs/ProcessMark.lua b/LuaLibs/ProcessMark.lua index aec2e5c..3af4b44 100644 --- a/LuaLibs/ProcessMark.lua +++ b/LuaLibs/ProcessMark.lua @@ -70,11 +70,8 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId) local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174) -- recupero la lavorazione local sMillType = 'Text' - local sMchExt = EgtIf( bMillDown, '_H2', '') - local sMilling = ML.FindMilling( sMillType..sMchExt) - if not sMilling and bMillUp then - sMilling = ML.FindMilling( sMillType) - end + --local sMchExt = EgtIf( bMillDown, '_H2', '') + local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown) if not sMilling then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library' EgtOutLog( sErr) @@ -97,7 +94,7 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId) EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -121,7 +118,7 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId) EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchF2Id, false) return false, sErr diff --git a/LuaLibs/ProcessMortise.lua b/LuaLibs/ProcessMortise.lua index a4d2f13..2eecb76 100644 --- a/LuaLibs/ProcessMortise.lua +++ b/LuaLibs/ProcessMortise.lua @@ -236,14 +236,14 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end local sPocketing if Proc.Prc ~= 53 then - sPocketing = ML.FindPocketing( sPockType..sMchExt, dW) + sPocketing = ML.FindPocketing( sPockType..sMchExt, dW, nil, nil, not bPockDown, bPockDown) if not sPocketing and bPockUp then sPocketing = ML.FindPocketing( sPockType, dW) end end if not sPocketing then sPockType = 'Pocket' - sPocketing = ML.FindPocketing( sPockType..sMchExt, dW) + sPocketing = ML.FindPocketing( sPockType..sMchExt, dW, nil, nil, not bPockDown, bPockDown) if not sPocketing and bPockUp then sPocketing = ML.FindPocketing( sPockType, dW) end @@ -321,7 +321,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- imposto elevazione EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMorH, 1) .. ';') -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -362,7 +362,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- imposto elevazione EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( (-nDepthMin+BD.CUT_EXTRA), 1) .. ';') -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr diff --git a/LuaLibs/ProcessProfCamb.lua b/LuaLibs/ProcessProfCamb.lua index a894ebd..a346bcc 100644 --- a/LuaLibs/ProcessProfCamb.lua +++ b/LuaLibs/ProcessProfCamb.lua @@ -135,7 +135,7 @@ local function ModifySideAndInvert( Proc, bHead, bForceInvert, nCutLengthMach) EgtSetMachiningParam( MCH_MP.ENDADDLEN, nCutLengthMach) end -- riapplico la lavorazione - EgtApplyMachining( true, false) + ML.ApplyMachining( true, false) end end end @@ -181,19 +181,15 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly -- recupero la lavorazione local sMilling, sMilling2 if nChamfer > 0 then - if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 and BD.DH_MAX_TOP and ( Proc.Box:getMax():getZ() - b3Raw:getMax():getZ()) < BD.DH_MAX_TOP then - sMilling = ML.FindMilling( 'Mark_H2') - if not sMilling then sMilling = ML.FindMilling( 'Mark') end - else - sMilling = ML.FindMilling( 'Mark') - end + local bDownHead = BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 and BD.DH_MAX_TOP and ( Proc.Box:getMax():getZ() - b3Raw:getMax():getZ()) < BD.DH_MAX_TOP + sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, true, bDownHead) if not sMilling then local sErr = 'Error : chamfer not found in library' EgtOutLog( sErr) return -1, 0, sErr end if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then - sMilling2 = ML.FindMilling( 'Mark_H2') + sMilling2 = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true) if not sMilling2 then local sErr = 'Error : chamfer2 not found in library' EgtOutLog( sErr) @@ -296,11 +292,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- leggo anticipatamente i parametri utensile fresa per dare un valore opportuno all'elevazione della lama -- recupero la lavorazione di fresatura local sMillType = 'Prof' - sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', '')) - if not sMilling and bMillDown then - sMilling = ML.FindMilling( sMillType) - bMillDown = false - end + sMilling, _, _, bMillDown = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bMillDown) if not sMilling then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library' EgtOutLog( sErr) @@ -319,7 +311,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if ( nSide ~= -1 or bMillDown) and nLastFacet and EgtGetInfo( Proc.Id, sEnableExtraBladeUpperFace, 'i') == 1 then -- recupero la lavorazione local sCutType = 'HeadSide' - local sCutting = ML.FindCutting( sCutType .. EgtIf( bMillDown, '_H2', '')) + local sCutting = ML.FindCutting( sCutType, not bMillDown, bMillDown) -- se richiesto taglio con lama da sotto e non trovato non posso utilizzare quello da sopra if not sCutting then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' sawing not found in library' @@ -390,7 +382,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -437,7 +429,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -516,7 +508,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) bFinish = true end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -554,7 +546,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMch2Id, false) return false, sErr @@ -594,7 +586,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -632,7 +624,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMch2Id, false) return false, sErr @@ -670,7 +662,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchVId, false) return false, sErr diff --git a/LuaLibs/ProcessProfConcave.lua b/LuaLibs/ProcessProfConcave.lua index d8fd375..9b26dd6 100644 --- a/LuaLibs/ProcessProfConcave.lua +++ b/LuaLibs/ProcessProfConcave.lua @@ -123,7 +123,7 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen) end -- riapplico la lavorazione - EgtApplyMachining( true, false) + ML.ApplyMachining( true, false) end end @@ -171,7 +171,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly sMilling = ML.FindMilling( 'Mark') if not sMilling then if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 then - sMilling = ML.FindMilling( 'Mark_H2') + sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true) end if not sMilling then local sErr = 'Error : chamfer not found in library' @@ -180,7 +180,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly end end if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then - sMilling2 = ML.FindMilling( 'Mark_H2') + sMilling2 = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true) if not sMilling2 then local sErr = 'Error : chamfer2 not found in library' EgtOutLog( sErr) @@ -328,7 +328,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -378,7 +378,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -477,7 +477,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) bFinish = true end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -501,7 +501,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMch2Id, false) return false, sErr @@ -539,7 +539,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -563,7 +563,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMch2Id, false) return false, sErr @@ -601,7 +601,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.STEP, 0) EgtSetMachiningParam( MCH_MP.OFFSR, 0) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchVId, false) return false, sErr @@ -634,7 +634,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, 0) EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1)) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchV2Id, false) return false, sErr diff --git a/LuaLibs/ProcessProfConvex.lua b/LuaLibs/ProcessProfConvex.lua index 7664e1c..6ca8742 100644 --- a/LuaLibs/ProcessProfConvex.lua +++ b/LuaLibs/ProcessProfConvex.lua @@ -123,7 +123,7 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen) end -- riapplico la lavorazione - EgtApplyMachining( true, false) + ML.ApplyMachining( true, false) end end @@ -171,7 +171,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly sMilling = ML.FindMilling( 'Mark') if not sMilling then if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 then - sMilling = ML.FindMilling( 'Mark_H2') + sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true) end if not sMilling then local sErr = 'Error : chamfer not found in library' @@ -180,7 +180,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly end end if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then - sMilling2 = ML.FindMilling( 'Mark_H2') + sMilling2 = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true) if not sMilling2 then local sErr = 'Error : chamfer2 not found in library' EgtOutLog( sErr) @@ -328,7 +328,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -378,7 +378,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -477,7 +477,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) bFinish = true end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -501,7 +501,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMch2Id, false) return false, sErr @@ -539,7 +539,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -563,7 +563,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMch2Id, false) return false, sErr @@ -601,7 +601,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.STEP, 0) EgtSetMachiningParam( MCH_MP.OFFSR, 0) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchVId, false) return false, sErr @@ -634,7 +634,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, 0) EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1)) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchV2Id, false) return false, sErr diff --git a/LuaLibs/ProcessProfFront.lua b/LuaLibs/ProcessProfFront.lua index 93cc78c..3a68535 100644 --- a/LuaLibs/ProcessProfFront.lua +++ b/LuaLibs/ProcessProfFront.lua @@ -94,7 +94,7 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam) local bInvertMode = EgtGetMachiningParam( MCH_MP.INVERT) EgtSetMachiningParam( MCH_MP.INVERT, not bInvertMode) -- riapplico la lavorazione - EgtApplyMachining( true, false) + ML.ApplyMachining( true, false) end end end @@ -143,7 +143,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly sMilling = ML.FindMilling( 'Mark') if not sMilling then if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 then - sMilling = ML.FindMilling( 'Mark_H2') + sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true) end if not sMilling then local sErr = 'Error : chamfer not found in library' @@ -152,7 +152,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly end end if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then - sMilling2 = ML.FindMilling( 'Mark_H2') + sMilling2 = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true) if not sMilling2 then local sErr = 'Error : chamfer2 not found in library' EgtOutLog( sErr) @@ -289,7 +289,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -337,7 +337,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -430,7 +430,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) bFinish = true end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -454,7 +454,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMch2Id, false) return false, sErr @@ -489,7 +489,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -513,7 +513,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMch2Id, false) return false, sErr @@ -558,7 +558,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchVId, false) return false, sErr diff --git a/LuaLibs/ProcessProfHead.lua b/LuaLibs/ProcessProfHead.lua index 4f841b0..7dd73d9 100644 --- a/LuaLibs/ProcessProfHead.lua +++ b/LuaLibs/ProcessProfHead.lua @@ -116,7 +116,7 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen) end -- riapplico la lavorazione - EgtApplyMachining( true, false) + ML.ApplyMachining( true, false) end end @@ -161,19 +161,15 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly -- recupero la lavorazione local sMilling, sMilling2 if nChamfer > 0 then - if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 and BD.DH_MAX_TOP and ( Proc.Box:getMax():getZ() - b3Raw:getMax():getZ()) < BD.DH_MAX_TOP then - sMilling = ML.FindMilling( 'Mark_H2') - if not sMilling then sMilling = ML.FindMilling( 'Mark') end - else - sMilling = ML.FindMilling( 'Mark') - end + local bDownHead = BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 and BD.DH_MAX_TOP and ( Proc.Box:getMax():getZ() - b3Raw:getMax():getZ()) < BD.DH_MAX_TOP + sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, true, bDownHead) if not sMilling then local sErr = 'Error : chamfer not found in library' EgtOutLog( sErr) return -1, 0, sErr end if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then - sMilling2 = ML.FindMilling( 'Mark_H2') + sMilling2 = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true) if not sMilling2 then local sErr = 'Error : chamfer2 not found in library' EgtOutLog( sErr) @@ -335,7 +331,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -387,7 +383,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -403,10 +399,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if nChamfer < 2 then -- recupero la lavorazione local sMillType = 'Prof' - local sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', '')) - if not sMilling then - sMilling = ML.FindMilling( sMillType) - end + local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bMillDown) if not sMilling then local sErr = 'Error : milling not found in library' EgtOutLog( sErr) @@ -491,7 +484,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) bFinish = true end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -516,7 +509,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMch2Id, false) return false, sErr @@ -554,7 +547,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -579,7 +572,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMch2Id, false) return false, sErr @@ -625,7 +618,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchV2Id, false) return false, sErr @@ -665,7 +658,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchVId, false) return false, sErr diff --git a/LuaLibs/ProcessRidgeLap.lua b/LuaLibs/ProcessRidgeLap.lua index e91c45b..e453b80 100644 --- a/LuaLibs/ProcessRidgeLap.lua +++ b/LuaLibs/ProcessRidgeLap.lua @@ -97,7 +97,7 @@ function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- determino se da lavorare con testa da sotto local bDownHead = ( BD.DOWN_HEAD and vtN[vFaceOrd[3]]:getZ() < -0.1) -- recupero la lavorazione - local sCutting = ML.FindCutting( 'HeadSide' .. EgtIf( bDownHead, '_H2', '')) + local sCutting = ML.FindCutting( 'HeadSide', not bDownHead, bDownHead) if not sCutting then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library' EgtOutLog( sErr) diff --git a/LuaLibs/ProcessRoundArch.lua b/LuaLibs/ProcessRoundArch.lua index 08a30a5..31477a5 100644 --- a/LuaLibs/ProcessRoundArch.lua +++ b/LuaLibs/ProcessRoundArch.lua @@ -230,7 +230,7 @@ function ProcessRoundArch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr diff --git a/LuaLibs/ProcessSawCut.lua b/LuaLibs/ProcessSawCut.lua index 807f995..8e800d5 100644 --- a/LuaLibs/ProcessSawCut.lua +++ b/LuaLibs/ProcessSawCut.lua @@ -219,7 +219,7 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- imposto uso della faccia EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr diff --git a/LuaLibs/ProcessScarfJoint.lua b/LuaLibs/ProcessScarfJoint.lua index 04540e4..0f67f60 100644 --- a/LuaLibs/ProcessScarfJoint.lua +++ b/LuaLibs/ProcessScarfJoint.lua @@ -92,7 +92,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -115,7 +115,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -473,7 +473,7 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dDistFaces, 1) .. ';') end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr diff --git a/LuaLibs/ProcessSimpleScarf.lua b/LuaLibs/ProcessSimpleScarf.lua index 7f64b22..2d773e5 100644 --- a/LuaLibs/ProcessSimpleScarf.lua +++ b/LuaLibs/ProcessSimpleScarf.lua @@ -91,7 +91,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -114,7 +114,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index af7488e..ab690e9 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -109,7 +109,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -132,7 +132,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -237,7 +237,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId) -- altrimenti necessari tagli da sopra e sotto con testa opportuna else -- recupero la lavorazione con lama da sotto - local sCutting2 = ML.FindCutting( 'TailSide_H2') + local sCutting2 = ML.FindCutting( 'TailSide_H2', false, true) if not sCutting2 then local sErr = 'Error : cutting H2 not found in library' EgtOutLog( sErr) diff --git a/LuaLibs/ProcessStepJoint.lua b/LuaLibs/ProcessStepJoint.lua index 38e6f8d..1c4f6e8 100644 --- a/LuaLibs/ProcessStepJoint.lua +++ b/LuaLibs/ProcessStepJoint.lua @@ -83,11 +83,8 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) -- recupero la lavorazione local sMillType = 'Mark' local bDownHead = ( BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1) - local sMilling = ML.FindMilling( sMillType .. EgtIf( bDownHead, '_H2', '')) - if not sMilling and bDownHead then - sMilling = ML.FindMilling( sMillType) - bDownHead = false - end + local sMilling + sMilling, _, _, bDownHead = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bDownHead) if not sMilling then local sErr = 'Error : milling not found in library' EgtOutLog( sErr) @@ -109,7 +106,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -132,7 +129,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr diff --git a/LuaLibs/ProcessStepJointNotch.lua b/LuaLibs/ProcessStepJointNotch.lua index edbfe86..5fabb26 100644 --- a/LuaLibs/ProcessStepJointNotch.lua +++ b/LuaLibs/ProcessStepJointNotch.lua @@ -57,11 +57,8 @@ local function MachineByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Solid, local bDownHead = ( BD.DOWN_HEAD and vtN[nBigInd]:getZ() < -0.5) -- recupero la lavorazione local sCutType = 'HeadSide' - local sCutting = ML.FindCutting( sCutType .. EgtIf( bDownHead, '_H2', '')) - if not sCutting and bTopHead then - sCutting = ML.FindCutting( sCutType) - bDownHead = false - end + local sCutting + sCutting, bDownHead = ML.FindCutting( sCutType, bTopHead, bDownHead) if not sCutting then local sErr = 'Error : cutting not found in library' EgtOutLog( sErr) @@ -162,11 +159,7 @@ local function MakePocket( Proc, nPartId, ptPs, vtN, nFaceRef, nDiffWidth, sMchF local bTopHead = ( BD.DOWN_HEAD and vtN[nFaceRef]:getZ() > -0.1) local bDownHead = ( BD.DOWN_HEAD and vtN[nFaceRef]:getZ() < 0.1) -- recupero la lavorazione - local sPocketing = ML.FindPocketing( sMchFind.. EgtIf( bDownHead, '_H2', ''), dDiamTool, dElev + dCollSic) - if not sPocketing and bTopHead then - sPocketing = ML.FindPocketing( sMchFind, dDiamTool, dElev + dCollSic) - bDownHead = false - end + local sPocketing, _, _, bDownHead = ML.FindPocketing( sMchFind.. EgtIf( bDownHead, '_H2', ''), dDiamTool, dElev + dCollSic, nil, bTopHead, bDownHead) if not sPocketing then local sErr = 'Error : pocketing not found in library' EgtOutLog( sErr) @@ -202,10 +195,10 @@ local function MakePocket( Proc, nPartId, ptPs, vtN, nFaceRef, nDiffWidth, sMchF -- imposto elevazione local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then -- provo ad allargare leggermente la tasca EgtSetMachiningParam( MCH_MP.OFFSR, -0.1) - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -271,10 +264,7 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, ptC, vtN, -- scelta lavorazione local sMilling local sTypeMill = EgtIf( nUseRoughTool > 0, 'Long2Cut', 'LongSmallCut') - sMilling = ML.FindMilling( sTypeMill .. EgtIf( bDownHead, '_H2', ''), nil, sTuuidMstr) - if not sMilling and bTopHead then - sMilling = ML.FindMilling( sTypeMill, nil, sTuuidMstr) - end + sMilling = ML.FindMilling( sTypeMill, nil, sTuuidMstr, nil, nil, bTopHead, bDownHead) if not sMilling then local sErr = 'Error : milling not found in library' EgtOutLog( sErr) @@ -319,7 +309,7 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, ptC, vtN, EgtSetMachiningParam( MCH_MP.LIPERP, 20) EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.AS_LI) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -534,11 +524,8 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) -- recupero la lavorazione local sMillType = 'Mark' local bDownHead = ( BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1) - local sMilling = ML.FindMilling( sMillType .. EgtIf( bDownHead, '_H2', '')) - if not sMilling and bDownHead then - sMilling = ML.FindMilling( sMillType) - bDownHead = false - end + local sMilling + sMilling, _, _, bDownHead = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bDownHead) if not sMilling then local sErr = 'Error : milling not found in library' EgtOutLog( sErr) @@ -561,7 +548,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr @@ -586,7 +573,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr diff --git a/LuaLibs/ProcessTenon.lua b/LuaLibs/ProcessTenon.lua index 2e650b0..38a360a 100644 --- a/LuaLibs/ProcessTenon.lua +++ b/LuaLibs/ProcessTenon.lua @@ -104,7 +104,7 @@ local function ApplyPocket( Proc, sPocketing, nStep, dSurfStep, nIdSurf, vtExtr) end EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr @@ -182,7 +182,7 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- se pezzo piccolo, in coda, con piano inclinato verso il basso e macchina con testa da sotto applico svuotatura if bShortPart and vtExtr:getX() < 0 and vtExtr:getZ() < -0.09 and BD.DOWN_HEAD then local sPockType = EgtIf( bMillDown, 'OpenPocket_H2', 'OpenPocket') - local sPocketing = ML.FindPocketing( sPockType) + local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, not bMillDown, bMillDown) local dMaxDepth = 100 local dStep = 30 local nSurfStep @@ -234,11 +234,7 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) end -- recupero la lavorazione local sMillType = 'Tenon' - local sCurrType = sMillType .. EgtIf( bMillDown, '_H2', '') - local sMilling = ML.FindMilling( sCurrType, dTenH) or ML.FindMilling( sCurrType) - if not sMilling and bMillUp then - sMilling = ML.FindMilling( sMillType, dTenH) or ML.FindMilling( sMillType) - end + local sMilling = ML.FindMilling( sMillType, dTenH, nil, nil, nil, bMillUp, bMillDown) or ML.FindMilling( sMillType, nil, nil, nil, bMillUp, bMillDown) if not sMilling then local sErr = 'Error : milling not found in library' EgtOutLog( sErr) @@ -306,7 +302,7 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) end EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr diff --git a/LuaLibs/ProcessText.lua b/LuaLibs/ProcessText.lua index 040e3ac..aff5c02 100644 --- a/LuaLibs/ProcessText.lua +++ b/LuaLibs/ProcessText.lua @@ -56,11 +56,8 @@ function ProcessText.Make( Proc, nPhase, nRawId, nPartId) local bMillDown = ( BD.DOWN_HEAD and vtN:getZ() < 0.174) -- recupero la lavorazione local sMillType = 'Text' - local sMchExt = EgtIf( bMillDown, '_H2', '') - local sMilling = ML.FindMilling( sMillType..sMchExt) - if not sMilling and bMillUp then - sMilling = ML.FindMilling( sMillType) - end + --local sMchExt = EgtIf( bMillDown, '_H2', '') + local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown) if not sMilling then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library' EgtOutLog( sErr) @@ -83,7 +80,7 @@ function ProcessText.Make( Proc, nPhase, nRawId, nPartId) EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) end -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr diff --git a/LuaLibs/ProcessTyroleanDovetail.lua b/LuaLibs/ProcessTyroleanDovetail.lua index 4df1ffe..e3f3a3a 100644 --- a/LuaLibs/ProcessTyroleanDovetail.lua +++ b/LuaLibs/ProcessTyroleanDovetail.lua @@ -457,7 +457,7 @@ local function MakeMillCut( Proc, i, j, k, sMilling, nFacInd, TabNAD, rfFac, dOf end EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo - if not EgtApplyMachining( true, false) then + if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr diff --git a/NestProcess.lua b/NestProcess.lua index 7bcb751..3c09f69 100644 --- a/NestProcess.lua +++ b/NestProcess.lua @@ -131,8 +131,7 @@ local function TotPartLen(Parts) end -- Imposto direttorio libreria specializzata per Travi -local sBaseDir = EgtGetSourceDir() -EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua') +EgtAddToPackagePath( NEST.BASEDIR .. 'LuaLibs\\?.lua') -- Imposto la macchina corrente e verifico sia abilitata per la lavorazione delle Travi EgtSetCurrMachine( NEST.MACHINE) @@ -149,14 +148,6 @@ end EgtRemoveBaseMachineDirFromPackagePath() EgtAddToPackagePath( sMachDir .. '\\Beam\\?.lua') ----- Carico le librerie ---_G.package.loaded.WallExec = nil ---local WE = require( 'BeamExec') ---_G.package.loaded.WallLib = nil ---local WL = require( 'BeamLib') ---_G.package.loaded.WProcessLapJoint = nil ---local LapJoint = require( 'WProcessLapJoint') - -- Inizializzo contatori errori e avvisi local nErrCnt = 0 local nWarnCnt = 0 diff --git a/Process.lua b/Process.lua index d9b7f05..396666c 100644 --- a/Process.lua +++ b/Process.lua @@ -11,8 +11,7 @@ _ENV = EgtProtectGlobal() EgtEnableDebug( false) -- Imposto direttorio libreria specializzata per Travi -local sBaseDir = EgtGetSourceDir() -EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua') +EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua') -- Verifico che la macchina corrente sia abilitata per la lavorazione delle Travi local sMachDir = EgtGetCurrMachineDir()