diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index 9975afa..eabcd4e 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -1,4 +1,4 @@ --- ProcessDrill.lua by Egaltech s.r.l. 2020/02/26 +-- ProcessDrill.lua by Egaltech s.r.l. 2020/03/04 -- Gestione calcolo forature per Travi -- Tabella per definizione modulo @@ -238,7 +238,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) else local _, sWarn = EgtGetMachMgrWarning( 0) if EgtIsMachiningEmpty() then - EgtSetOperationMode( nMchFId, false) + EgtSetOperationMode( nMchId, false) return false, sWarn else return true, ( sMyWarn or sWarn) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 4de73d7..8e83194 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -1,4 +1,4 @@ --- ProcessLapJoint.lua by Egaltech s.r.l. 2020/02/26 +-- ProcessLapJoint.lua by Egaltech s.r.l. 2020/03/04 -- Gestione calcolo mezzo-legno per Travi -- 2019/10/08 Agg. gestione OpenPocket. @@ -21,9 +21,18 @@ local BD = require( 'BeamData') local ML = require( 'MachiningLib') -- variabili assegnazione parametri Q -local sForceUseBlade = 'Q01' -- i -local sDepthChamferMill = 'Q04' -- d -local sPreemptiveChamfer = 'Q05' -- i +local sForceUseBlade = '' -- i +local sDepthChamferMill = '' -- d +local sPreemptiveChamfer = '' -- i +local sUseMill = '' -- i +local sUseRoughTool = '' -- i +local sUseRoughToolWithBAxis90 = '' -- i +local sUseRoughToolWithBAxis0 = '' -- i +local sInsertBoreOnCorner = '' -- 1 +local sMakeContourWithSmallTool = '' -- i +local sMakeOnlyContourOrFullPocket = '' -- i +local sMakeBySideRoughTool = '' -- i +local sAntisplintMode = '' -- i --------------------------------------------------------------------- -- Riconoscimento della feature @@ -39,6 +48,34 @@ function ProcessLapJoint.Identify( Proc) ( Proc.Grp == 4 and Proc.Prc == 39)) end +--------------------------------------------------------------------- +local function AssignQValues( Proc) + + if ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 16 then + sForceUseBlade = 'Q01' -- i + sDepthChamferMill = 'Q04' -- d + sPreemptiveChamfer = 'Q05' -- i + elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 17 then + sDepthChamferMill = 'Q01' -- d + sPreemptiveChamfer = 'Q02' -- i + elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 20 then + sDepthChamferMill = 'Q01' -- d + sUseMill = 'Q02' -- i + sUseRoughTool = 'Q03' -- i + sUseRoughToolWithBAxis90 = 'Q04' -- i + sUseRoughToolWithBAxis0 = 'Q05' -- i + sInsertBoreOnCorner = 'Q06' -- i + elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 30 then + sMakeContourWithSmallTool = 'Q01' -- i + sMakeOnlyContourOrFullPocket = 'Q02' -- i + sMakeBySideRoughTool = 'Q03' -- i + sAntisplintMode = 'Q06' -- i + sDepthChamferMill = 'Q07' -- d + elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 32 then + sMakeBySideRoughTool = 'Q01' -- i + -- le altre features gestite non hanno parametri Q nei parametri globali + end +end --------------------------------------------------------------------- local function TestElleShape3( Proc) @@ -727,6 +764,146 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, nFacInd, rfFac, dH, dV return true end +--------------------------------------------------------------------- +local function MakeDrillOnCorner( Proc, nPhase, nRawId, nPartId, b3Raw, nFacInd, nAddGrpId, dDiam) + -- Recupero le facce adiacenti alla principale + local sMyWarn + local vAdj = EgtSurfTmFacetAdjacencies( Proc.Id, nFacInd)[1] + local tFacAdj = {} + for i = 1, #vAdj do + if vAdj[i] >= 0 then + for j = 1, #vAdj do + if vAdj[j] >= 0 and j ~= i then + local bInsert = true + for k = 1, #tFacAdj do + local nFace1 = tFacAdj[k][1] + local nFace2 = tFacAdj[k][2] + if ( nFace1 == vAdj[i] and nFace2 == vAdj[j]) or + ( nFace1 == vAdj[j] and nFace2 == vAdj[i]) then + bInsert = false + end + end + if bInsert then + local _, ptP1, ptP2, _ = EgtSurfTmFacetsContact( Proc.Id, vAdj[i], vAdj[j], GDB_ID.ROOT) + if ptP1 and ptP2 then + local dLen = dist( ptP1, ptP2) + table.insert( tFacAdj, { vAdj[i], vAdj[j], dLen, ptP1, ptP2}) + end + end + end + end + end + end + -- tra le linee prendo quella più lunga + local dMaxLen = 0 + local nIdLine + for i = 1, #tFacAdj do + if tFacAdj[i][3] > dMaxLen then + nIdLine = i + dMaxLen = tFacAdj[i][3] + end + end + -- trovo il punto sulla superfice di riferimento + local _, ptLocP1, ptLocP2, _ = EgtSurfTmFacetsContact( Proc.Id, nFacInd, tFacAdj[nIdLine][1], GDB_ID.ROOT) + local nIdIniPoint + local nIdEndPoint + if ptLocP1 and ptLocP2 then + if ( dist( ptLocP1, tFacAdj[nIdLine][4]) < GEO.EPS_SMALL) or ( dist( ptLocP2, tFacAdj[nIdLine][4]) < GEO.EPS_SMALL) then + nIdEndPoint = 4 + nIdIniPoint = 5 + elseif ( dist( ptLocP1, tFacAdj[nIdLine][5]) < GEO.EPS_SMALL) or ( dist( ptLocP2, tFacAdj[nIdLine][5]) < GEO.EPS_SMALL) then + nIdEndPoint = 5 + nIdIniPoint = 4 + end + end + -- inserisco foro + if nIdIniPoint and nIdEndPoint then + -- versore direzione + local vtExtr = tFacAdj[nIdLine][nIdIniPoint] - tFacAdj[nIdLine][nIdEndPoint] + vtExtr:normalize() + -- se foratura da sotto salto la lavorazione + if vtExtr:getZ() < BD.DRILL_VZ_MIN then + local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' drilling from bottom impossible' + EgtOutLog( sErr) + return false, sErr + end + -- recupero la lavorazione + local sDrilling, nType = ML.FindDrilling( dDiam) + if not sDrilling then + local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' drilling not found in library' + EgtOutLog( sErr) + return false, sErr + end + -- recupero i dati dell'utensile + local dMaxDepth = 20 + local dDiamTool = 20 + local bIsDrilling + if EgtMdbSetCurrMachining( sDrilling) then + bIsDrilling = ( EgtMdbGetCurrMachiningParam( MCH_MP.TYPE) == MCH_MY.DRILLING) + local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then + if bIsDrilling then + dMaxDepth = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxDepth + else + dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth + end + dDiamTool = EgtTdbGetCurrToolParam( MCH_TP.DIAM) + end + end + -- setto griglia + EgtSetGridFrame( Frame3d( tFacAdj[nIdLine][nIdIniPoint], vtExtr)) + -- creo geometria + local AuxId = EgtCircle( nAddGrpId, {0,0,0}, EgtIf( bIsDrilling, dDiamTool/2, ( dDiamTool/2) + 0.1), GDB_RT.GRID) + EgtModifyCurveThickness( AuxId, -dMaxLen) + -- riporto la griglia a globale + EgtSetGridFrame() + -- inserisco la lavorazione + local sName = 'Drill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) + local nMchId = EgtAddMachining( sName, sDrilling) + if not nMchId then + local sErr = 'Error adding machining ' .. sName .. '-' .. sDrilling + EgtOutLog( sErr) + return false, sErr + end + -- aggiungo geometria + EgtSetMachiningGeometry( {{ AuxId, -1}}) + -- imposto posizione braccio porta testa + local nSCC = MCH_SCC.ADIR_YM + if vtExtr:getY() > 100 * GEO.EPS_ZERO then + nSCC = MCH_SCC.ADIR_YP + end + EgtSetMachiningParam( MCH_MP.SCC, nSCC) + -- aggiusto l'affondamento + local dDepth = dMaxLen + if dDepth > dMaxDepth + 10 * GEO.EPS_SMALL then + sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')' + dDepth = dMaxDepth + EgtOutLog( sMyWarn .. ' (process ' .. tostring( Proc.Id) .. ')') + end + EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) + -- Note utente con dichiarazione nessuna generazione sfridi per Vmill + local sUserNotes = 'VMRS=0;' + -- 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 + local _, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nMchId, false) + return false, sErr + else + local _, sWarn = EgtGetMachMgrWarning( 0) + if EgtIsMachiningEmpty() then + EgtSetOperationMode( nMchFId, false) + return false, sWarn + else + return true, ( sMyWarn or sWarn) + end + end + end + + return true, sMyWarn +end + --------------------------------------------------------------------- local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, rfFac, dH, dV, dElev, bForceUseBlade) -- Recupero le facce adiacenti alla principale @@ -941,7 +1118,7 @@ local function MakeAntiSplintBySaw( Proc, nFacet, vtN, b3Raw) end --------------------------------------------------------------------- -local function VerifyQParam( Proc, nRawId, bMakeVertCham, sDephtCham, sOnlyCham, sUseBlade) +local function EvaluateQParam( Proc, nRawId, bMakeVertCham, sDephtCham, sOnlyCham, sUseBlade) local nChamfer = 0 local bForceUseBlade = false -- verifico che lo smusso sia richiesto @@ -1008,7 +1185,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId) end -- verifico se sono presenti i parametri Q per la profondità smusso e -- per eseguire in esclusiva solo lo smusso - local nChamfer, dDepthCham, sChamfer, bForceUseBlade = VerifyQParam( Proc, nRawId, false, sDepthChamferMill, sPreemptiveChamfer, sForceUseBlade) + local nChamfer, dDepthCham, sChamfer, bForceUseBlade = EvaluateQParam( Proc, nRawId, false, sDepthChamferMill, sPreemptiveChamfer, sForceUseBlade) -- se non posso lavorare la feature perché condizionata dall'esecuzione del solo chamfer -- genero errore e non faccio nulla if nChamfer < 0 then @@ -1281,7 +1458,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId) local bMakeBySideMill, bHead, sMilling, dMaxMat = VerifyIfByBHSideMill( Proc) if bMakeBySideMill and ( dMaxMat <= dV) then -- se smusso non è esclusivo --- if nChamfer < 2 then + if nChamfer < 2 then -- inserisco la lavorazione di fresatura local sName = 'BHMill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local nMchFId = EgtAddMachining( sName, sMilling) @@ -1310,11 +1487,11 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId) EgtSetOperationMode( nMchFId, false) return false, sErr end --- end + end -- altrimenti lavoro con svuotatura else -- se smusso non è esclusivo --- if nChamfer < 2 then + if nChamfer < 2 then -- se orientata verso il basso, verifico l'alternativa if vtN:getZ() < BD.NZ_MINA and nFacInd2 then ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd2, GDB_ID.ROOT) @@ -1365,7 +1542,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId) end end -- se richiesti antischeggia con lama su U trasversale - if EgtGetInfo( Proc.Id, 'Q06', 'i') == 1 and bIsU and + -- rimane da gestire: se da eseguire con fresa o se richiesto lama ma impossibile utilizzarla, si utilizza fresa + if EgtGetInfo( Proc.Id, sAntisplintMode, 'i') == 1 and bIsU and ( Proc.Box:getDimY() > b3Raw:getDimY() - 1 or Proc.Box:getDimZ() > b3Raw:getDimZ() - 1) then -- va eseguito sulle facce diverse dalla principale for nFacet = 0, 2 do @@ -1375,12 +1553,14 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId) end end end - -- recupero i dati dell'utensile + -- recupero i dati dell'utensile: utilizzo il diametro utensile per il foro opzionale local dMaxDepth = 0 + local dDiamTool = 20 if EgtMdbSetCurrMachining( sPocketing) then local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then dMaxDepth = ( EgtTdbGetCurrToolMaxDepth() or dMaxDepth) + dDiamTool = EgtTdbGetCurrToolParam( MCH_TP.DIAM) end end -- inserisco la lavorazione di svuotatura @@ -1426,7 +1606,12 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId) return false, sErr end end --- end + -- se abilitato dal parametro Q inserisco foro sullo spigolo + if EgtGetInfo( Proc.Id, sInsertBoreOnCorner, 'i') == 1 then + local bOk, sWarn = MakeDrillOnCorner( Proc, nPhase, nRawId, nPartId, b3Raw, nFacInd, nAddGrpId, dDiamTool) + if not bOk then return false, sWarn end + end + end end end @@ -1484,7 +1669,8 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) local MAX_MILL_LIN = 80 -- recupero l'ingombro del grezzo di appartenenza local b3Raw = EgtGetRawPartBBox( nRawId) - + -- in base al tipo di feature attribuisco il significato dei parametri Q + AssignQValues( Proc) -- se lunghezza richiede spezzatura if Proc.Box:getDimX() > BD.LONGCUT_MAXLEN then -- una faccia @@ -1515,7 +1701,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) else -- una faccia if Proc.Fct == 1 then - local bForcedBlade = ( Proc.Prc == 20 and EgtGetInfo( Proc.Id, 'Q03', 'i') ~= 1 ) + local bForcedBlade = EgtGetInfo( Proc.Id, sUseRoughTool, 'i') ~= 1 -- se piccola, con fresa if not bForcedBlade and ( Proc.Box:getDimX() < MAX_MILL_LIN and ( Proc.Box:getDimZ() < MAX_MILL_LIN or Proc.Box:getDimY() < MAX_MILL_LIN)) then return MakeOneFaceByMill( Proc, nPhase, nRawId, nPartId) @@ -1527,7 +1713,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) elseif Proc.Fct == 2 then -- determino l'angolo tra le facce local bAdj, _, _, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT) - local bForcedBlade = ( Proc.Prc == 20 and EgtGetInfo( Proc.Id, 'Q03', 'i') ~= 1 ) + local bForcedBlade = EgtGetInfo( Proc.Id, sUseRoughTool, 'i') ~= 1 -- se ortogonali e piccole, con fresa if not bForcedBlade and bAdj and abs( dAng + 90) < 1 and ( Proc.Box:getDimX() < MAX_MILL_LIN and ( Proc.Box:getDimZ() < MAX_MILL_LIN or Proc.Box:getDimY() < MAX_MILL_LIN)) then diff --git a/LuaLibs/ProcessMortise.lua b/LuaLibs/ProcessMortise.lua index 76b2990..f24944b 100644 --- a/LuaLibs/ProcessMortise.lua +++ b/LuaLibs/ProcessMortise.lua @@ -1,4 +1,4 @@ --- ProcessMortise.lua by Egaltech s.r.l. 2020/01/29 +-- ProcessMortise.lua by Egaltech s.r.l. 2020/03/04 -- Gestione calcolo mortase per Travi -- Tabella per definizione modulo @@ -42,12 +42,11 @@ function ProcessMortise.Classify( Proc) return false end local bDown - -- Confronto le 2 direzioni Z dei versori - -- se differiscono allora la faccetta 0 della superficie non è il fondo della mortasa+ - -- e quindi la mortasa è passante + -- Confronto le direzioni Z dei 2 versori : se diverse la faccia 0 non è il fondo => mortasa passante if abs( vtExtr:getZ() - vtN:getZ()) > GEO.EPS_SMALL then bDown = false - else -- se è chiusa + -- altrimenti è chiusa + else -- verifico se la mortasa è lavorabile solo da sotto bDown = ( vtN:getZ() < - 0.1) end @@ -69,26 +68,46 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId) EgtOutLog( sErr) return false, sErr end - -- se curva aperta la allungo e chiudo - if not EgtCurveIsClosed( AuxId) then - local _, nCount = EgtCurveDomain( AuxId) - EgtCloseCurveCompo( AuxId) - EgtSetInfo( AuxId, 'OPEN', nCount) - end - -- recupero versore estrusione della curva supplementare e confronto la direzione Z - -- del versore della componente Z della superficie + -- recupero versore estrusione della curva supplementare local vtExtr = EgtCurveExtrusion( AuxId, GDB_ID.ROOT) - -- recupero i dati del bottom + -- Se curva di contorno aperta + if not EgtCurveIsClosed( AuxId) then + local NewId, nCount = EgtExtractSurfTmFacetLoops( Proc.Id, 0, EgtGetParent( Proc.Id)) + if NewId then + -- elimino eventuali loop interni (non dovrebbero comunque esserci) + for i = 1, nCount - 1 do + EgtErase( NewId + i) + end + -- sostituisco il loop esterno alla curva originale + EgtModifyCurveExtrusion( NewId, vtExtr, GDB_ID.ROOT) + EgtRelocate( NewId, AuxId, GDB_IN.AFTER) + EgtErase( AuxId) + EgtChangeId( NewId, AuxId) + -- sistemo i lati aperti + local vFacAdj = EgtSurfTmFacetAdjacencies( Proc.Id, 0)[1] + if vFacAdj then + local sOpen = '' + for i = 1, #vFacAdj do + if vFacAdj[i] < 0 then + sOpen = sOpen .. EgtIf( #sOpen > 0, ',', '') .. tostring( i - 1) + end + end + if #sOpen > 0 then + EgtSetInfo( AuxId, 'OPEN', sOpen) + end + end + end + + end + -- recupero i dati della faccia di fondo local frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0, GDB_ID.ROOT) local ptC = frMor:getOrigin() local vtN = frMor:getVersZ() - local bNotExistBtm - -- Confronto le 2 direzioni Z dei versori - -- se differiscono allora la faccetta 0 della superficie non è il fondo della mortasa+ - -- e quindi la mortasa è passante - if abs( vtExtr:getZ() - vtN:getZ()) > GEO.EPS_SMALL then + -- Confronto le direzioni Z dei 2 versori : se diverse la faccia 0 non è il fondo => mortasa passante + local bOpenBtm = ( abs( vtExtr:getZ() - vtN:getZ()) > GEO.EPS_SMALL) + if bOpenBtm then -- creo superficie chiusa - local nFlat = EgtSurfTmByFlatContour( EgtGetParent(AuxId), AuxId, 0.02) + local nFlat = EgtSurfTmByFlatContour( EgtGetParent( AuxId), AuxId, 0.02) if nFlat then frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( nFlat, 0, GDB_ID.ROOT) ptC = frMor:getOrigin() @@ -109,21 +128,20 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId) vtN = frMor:getVersZ() end -- cancello le prove del misfatto (superficie piana) - EgtErase(nFlat) - -- setto il flag che indica che non c'è il fondo - bNotExistBtm = true + EgtErase( nFlat) end end -- scrivo info nel log EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3) - if not bNotExistBtm then + if not bOpenBtm then -- verifico che la mortasa non sia orientata verso il basso (limite -5 deg) if vtN:getZ() < - 0.1 then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Mortise from bottom impossible' EgtOutLog( sErr) return false, sErr end - else -- se mortasa passante + -- se mortasa passante + else -- determino se la mortasa da lavorare sul lato opposto sia di angolo inferiore a quello consentito if abs(vtN:getZ()) > 0.1 then bForceOneSide = true @@ -190,7 +208,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId) local sWarn local nDepthMin -- se la mortasa è passante e non è forzata a un solo lato, riduco l'affondamento a metà profondità - if bNotExistBtm and not bForceOneSide then + if bOpenBtm and not bForceOneSide then dMorH = dMorH * 0.5 end -- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente @@ -198,7 +216,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId) sWarn = 'Warning in mortise : elevation (' .. EgtNumToString( dMorH,1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth,1) .. ')' -- se non ho invertito la direzione di estrusione if not bRevertSide then - nDepthMin = dMaxDepth - EgtIf( bNotExistBtm and not bForceOneSide, dMorH * 2, dMorH) + nDepthMin = dMaxDepth - EgtIf( bOpenBtm and not bForceOneSide, dMorH * 2, dMorH) else nDepthMin = dMaxDepth end @@ -206,7 +224,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId) dMorH = dMaxDepth EgtOutLog( sWarn .. ' (process ' .. tostring( Proc.Id) .. ')') else - if bNotExistBtm and not bForceOneSide then -- se mortasa passante setto metà profondità + if bOpenBtm and not bForceOneSide then -- se mortasa passante setto metà profondità nDepthMin = -dMorH EgtSetMachiningParam( MCH_MP.DEPTH, nDepthMin) end @@ -222,7 +240,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId) -- ESPERIMENTO: -- se non c'è il fondo e la lavorazione non ha lavorato tutta la superficie per limite altezza utensile -- inserisco una ulteriore lavorazione contraria - if bNotExistBtm and not bForceOneSide and nDepthMin and abs(nDepthMin) > 0 then + if bOpenBtm and not bForceOneSide and nDepthMin and abs(nDepthMin) > 0 then -- inserisco la lavorazione di svuotatura opposta sName = 'Mort_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_Oppo' nMchFId = EgtAddMachining( sName, sPocketing) diff --git a/LuaLibs/ProcessProfCamb.lua b/LuaLibs/ProcessProfCamb.lua index 2679e10..bff7b7c 100644 --- a/LuaLibs/ProcessProfCamb.lua +++ b/LuaLibs/ProcessProfCamb.lua @@ -1,4 +1,4 @@ --- ProcessProfCamb.lua by Egaltech s.r.l. 2020/02/18 +-- ProcessProfCamb.lua by Egaltech s.r.l. 2020/03/04 -- Gestione calcolo profilo caudato per Travi -- Tabella per definizione modulo @@ -88,7 +88,7 @@ local function ModifySideAndInvert( Proc, bHead, dToolDiam) local bInvertMode = EgtGetMachiningParam( MCH_MP.INVERT) EgtSetMachiningParam( MCH_MP.INVERT, not bInvertMode) -- riapplico la lavorazione - EgtApplyMachining() + EgtApplyMachining( true, false) end end end @@ -117,7 +117,6 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly -- recupero i dati della curva e del profilo local dWidth = abs( EgtCurveThickness( AuxId)) local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) - local nCanVert = 0 -- eseguo lo smusso solo se direzione orizzontale e il flag di lavorazione verticale è disabilitato if abs( vtExtr:getZ()) > 0.1 then if not bMakeVertCham then @@ -130,20 +129,6 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly EgtOutLog( sWarn) return 0, dDepth end - else - nCanVert = 1 - end - end - -- eseguo lo smusso solo se feature larga come la trave - if dWidth < EgtIf( nCanVert == 1, b3Raw:getDimZ(), b3Raw:getDimY()) - 1 then - if nChamfer == 2 then -- se devo fare solo smusso, genero errore - local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' feature smaller than beam' - EgtOutLog( sErr) - return -1, dDepth, sErr - else - local sWarn = 'Warning on process ' .. tostring( Proc.Id) .. ' skipped chamfer (feature smaller than beam)' - EgtOutLog( sWarn) - return 0, dDepth end end -- recupero la lavorazione @@ -439,8 +424,8 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if bFinish then -- inserisco la lavorazione local sNewName = 'Prof_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) - local nMchId = EgtCopyMachining( sNewName, sName) - if not nMchId then + local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) + if not nMch2Id then local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling EgtOutLog( sErr) return false, sErr @@ -451,7 +436,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- eseguo if not EgtApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() - EgtSetOperationMode( nMchId, false) + EgtSetOperationMode( nMch2Id, false) return false, sErr end end @@ -497,8 +482,8 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if bFinish then -- inserisco la lavorazione local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) - local nMchId = EgtCopyMachining( sNewName, sName) - if not nMchId then + local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) + if not nMch2Id then local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling EgtOutLog( sErr) return false, sErr @@ -509,7 +494,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- eseguo if not EgtApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() - EgtSetOperationMode( nMchId, false) + EgtSetOperationMode( nMch2Id, false) return false, sErr end end diff --git a/LuaLibs/ProcessProfConcave.lua b/LuaLibs/ProcessProfConcave.lua index cb766e9..7adbc46 100644 --- a/LuaLibs/ProcessProfConcave.lua +++ b/LuaLibs/ProcessProfConcave.lua @@ -1,4 +1,4 @@ --- ProcessProfConcave.lua by Egaltech s.r.l. 2020/02/18 +-- ProcessProfConcave.lua by Egaltech s.r.l. 2020/03/04 -- Gestione calcolo profilo caudato per Travi -- Tabella per definizione modulo @@ -77,7 +77,7 @@ local function ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, bNotModifLead EgtSetMachiningParam( MCH_MP.ENDADDLEN, (dToolDiam/3*2)) end -- riapplico la lavorazione - EgtApplyMachining() + EgtApplyMachining( true, false) else -- modifico attacco e uscita if not bNotModifLeadPar then @@ -86,7 +86,7 @@ local function ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, bNotModifLead EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, 0) EgtSetMachiningParam( MCH_MP.ENDADDLEN, (dToolDiam/3*2)) -- riapplico la lavorazione - EgtApplyMachining() + EgtApplyMachining( true, false) end end end @@ -116,7 +116,6 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly -- recupero i dati della curva e del profilo local dWidth = abs( EgtCurveThickness( AuxId)) local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) - local nCanVert = 0 -- eseguo lo smusso solo se direzione orizzontale e il flag di lavorazione verticale è disabilitato if abs( vtExtr:getZ()) > 0.1 then if not bMakeVertCham then @@ -129,20 +128,6 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly EgtOutLog( sWarn) return 0, dDepth end - else - nCanVert = 1 - end - end - -- eseguo lo smusso solo se feature larga come la trave - if dWidth < EgtIf( nCanVert == 1, b3Raw:getDimZ(), b3Raw:getDimY()) - 1 then - if nChamfer == 2 then -- se devo fare solo smusso, genero errore - local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' feature smaller than beam' - EgtOutLog( sErr) - return -1, dDepth, sErr - else - local sWarn = 'Warning on process ' .. tostring( Proc.Id) .. ' skipped chamfer (feature smaller than beam)' - EgtOutLog( sWarn) - return 0, dDepth end end -- recupero la lavorazione @@ -416,8 +401,8 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if bFinish then -- inserisco la lavorazione local sNewName = 'Prof_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) - local nMchId = EgtCopyMachining( sNewName, sName) - if not nMchId then + local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) + if not nMch2Id then local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling EgtOutLog( sErr) return false, sErr @@ -428,7 +413,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- eseguo if not EgtApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() - EgtSetOperationMode( nMchId, false) + EgtSetOperationMode( nMch2Id, false) return false, sErr end end @@ -475,8 +460,8 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if bFinish then -- inserisco la lavorazione local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) - local nMchId = EgtCopyMachining( sNewName, sName) - if not nMchId then + local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) + if not nMch2Id then local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling EgtOutLog( sErr) return false, sErr @@ -487,7 +472,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- eseguo if not EgtApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() - EgtSetOperationMode( nMchId, false) + EgtSetOperationMode( nMch2Id, false) return false, sErr end end diff --git a/LuaLibs/ProcessProfConvex.lua b/LuaLibs/ProcessProfConvex.lua index 9c10bdf..ff0e0d2 100644 --- a/LuaLibs/ProcessProfConvex.lua +++ b/LuaLibs/ProcessProfConvex.lua @@ -1,4 +1,4 @@ --- ProcessProfConvex.lua by Egaltech s.r.l. 2020/02/18 +-- ProcessProfConvex.lua by Egaltech s.r.l. 2020/03/04 -- Gestione calcolo profilo caudato per Travi -- Tabella per definizione modulo @@ -77,7 +77,7 @@ local function ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, bNotModifLead EgtSetMachiningParam( MCH_MP.ENDADDLEN, (dToolDiam/3*2)) end -- riapplico la lavorazione - EgtApplyMachining() + EgtApplyMachining( true, false) else -- modifico attacco e uscita if not bNotModifLeadPar then @@ -86,7 +86,7 @@ local function ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, bNotModifLead EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, 0) EgtSetMachiningParam( MCH_MP.ENDADDLEN, (dToolDiam/3*2)) -- riapplico la lavorazione - EgtApplyMachining() + EgtApplyMachining( true, false) end end end @@ -116,7 +116,6 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly -- recupero i dati della curva e del profilo local dWidth = abs( EgtCurveThickness( AuxId)) local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) - local nCanVert = 0 -- eseguo lo smusso solo se direzione orizzontale e il flag di lavorazione verticale è disabilitato if abs( vtExtr:getZ()) > 0.1 then if not bMakeVertCham then @@ -129,20 +128,6 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly EgtOutLog( sWarn) return 0, dDepth end - else - nCanVert = 1 - end - end - -- eseguo lo smusso solo se feature larga come la trave - if dWidth < EgtIf( nCanVert == 1, b3Raw:getDimZ(), b3Raw:getDimY()) - 1 then - if nChamfer == 2 then -- se devo fare solo smusso, genero errore - local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' feature smaller than beam' - EgtOutLog( sErr) - return -1, dDepth, sErr - else - local sWarn = 'Warning on process ' .. tostring( Proc.Id) .. ' skipped chamfer (feature smaller than beam)' - EgtOutLog( sWarn) - return 0, dDepth end end -- recupero la lavorazione @@ -416,8 +401,8 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if bFinish then -- inserisco la lavorazione local sNewName = 'Prof_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) - local nMchId = EgtCopyMachining( sNewName, sName) - if not nMchId then + local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) + if not nMch2Id then local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling EgtOutLog( sErr) return false, sErr @@ -428,7 +413,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- eseguo if not EgtApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() - EgtSetOperationMode( nMchId, false) + EgtSetOperationMode( nMch2Id, false) return false, sErr end end @@ -475,8 +460,8 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if bFinish then -- inserisco la lavorazione local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) - local nMchId = EgtCopyMachining( sNewName, sName) - if not nMchId then + local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) + if not nMch2Id then local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling EgtOutLog( sErr) return false, sErr @@ -487,7 +472,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- eseguo if not EgtApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() - EgtSetOperationMode( nMchId, false) + EgtSetOperationMode( nMch2Id, false) return false, sErr end end diff --git a/LuaLibs/ProcessProfFront.lua b/LuaLibs/ProcessProfFront.lua index 6791e57..5a918db 100644 --- a/LuaLibs/ProcessProfFront.lua +++ b/LuaLibs/ProcessProfFront.lua @@ -1,4 +1,4 @@ --- ProcessProfFront.lua by Egaltech s.r.l. 2020/02/07 +-- ProcessProfFront.lua by Egaltech s.r.l. 2020/03/04 -- Gestione calcolo profilo caudato per Travi -- Tabella per definizione modulo @@ -68,7 +68,7 @@ local function ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, bNotModifLead EgtSetMachiningParam( MCH_MP.ENDADDLEN, (dToolDiam/3*2)) end -- riapplico la lavorazione - EgtApplyMachining() + EgtApplyMachining( true, false) else -- modifico attacco e uscita if not bNotModifLeadPar then @@ -77,7 +77,7 @@ local function ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, bNotModifLead EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, 0) EgtSetMachiningParam( MCH_MP.ENDADDLEN, (dToolDiam/3*2)) -- riapplico la lavorazione - EgtApplyMachining() + EgtApplyMachining( true, false) end end end @@ -107,7 +107,6 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly -- recupero i dati della curva e del profilo local dWidth = abs( EgtCurveThickness( AuxId)) local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) - local nCanVert = 0 -- eseguo lo smusso solo se direzione orizzontale e il flag di lavorazione verticale è disabilitato if abs( vtExtr:getZ()) > 0.1 then if not bMakeVertCham then @@ -120,20 +119,6 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly EgtOutLog( sWarn) return 0, dDepth end - else - nCanVert = 1 - end - end - -- eseguo lo smusso solo se feature larga come la trave - if dWidth < EgtIf( nCanVert == 1, b3Raw:getDimZ(), b3Raw:getDimY()) - 1 then - if nChamfer == 2 then -- se devo fare solo smusso, genero errore - local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' feature smaller than beam' - EgtOutLog( sErr) - return -1, dDepth, sErr - else - local sWarn = 'Warning on process ' .. tostring( Proc.Id) .. ' skipped chamfer (feature smaller than beam)' - EgtOutLog( sWarn) - return 0, dDepth end end -- recupero la lavorazione @@ -411,8 +396,8 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if bFinish then -- inserisco la lavorazione local sNewName = 'Prof_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) - local nMchId = EgtCopyMachining( sNewName, sName) - if not nMchId then + local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) + if not nMch2Id then local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling EgtOutLog( sErr) return false, sErr @@ -423,7 +408,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- eseguo if not EgtApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() - EgtSetOperationMode( nMchId, false) + EgtSetOperationMode( nMch2Id, false) return false, sErr end end @@ -470,8 +455,8 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if bFinish then -- inserisco la lavorazione local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) - local nMchId = EgtCopyMachining( sNewName, sName) - if not nMchId then + local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) + if not nMch2Id then local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling EgtOutLog( sErr) return false, sErr @@ -482,7 +467,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- eseguo if not EgtApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() - EgtSetOperationMode( nMchId, false) + EgtSetOperationMode( nMch2Id, false) return false, sErr end end diff --git a/LuaLibs/ProcessProfHead.lua b/LuaLibs/ProcessProfHead.lua index 66b3001..9c08756 100644 --- a/LuaLibs/ProcessProfHead.lua +++ b/LuaLibs/ProcessProfHead.lua @@ -1,4 +1,4 @@ --- ProcessProfHead.lua by Egaltech s.r.l. 2020/02/18 +-- ProcessProfHead.lua by Egaltech s.r.l. 2020/03/04 -- Gestione calcolo profilo caudato per Travi -- Tabella per definizione modulo @@ -69,7 +69,7 @@ local function ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, bNotModifLead EgtSetMachiningParam( MCH_MP.ENDADDLEN, (dToolDiam/3*2)) end -- riapplico la lavorazione - EgtApplyMachining() + EgtApplyMachining( true, false) else -- modifico attacco e uscita if not bNotModifLeadPar then @@ -78,7 +78,7 @@ local function ModifySideAndInvertAndLead( Proc, bHead, dToolDiam, bNotModifLead EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, 0) EgtSetMachiningParam( MCH_MP.ENDADDLEN, (dToolDiam/3*2)) -- riapplico la lavorazione - EgtApplyMachining() + EgtApplyMachining( true, false) end end end @@ -108,7 +108,6 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly -- recupero i dati della curva e del profilo local dWidth = abs( EgtCurveThickness( AuxId)) local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) - local nCanVert = 0 -- eseguo lo smusso solo se direzione orizzontale e il flag di lavorazione verticale è disabilitato if abs( vtExtr:getZ()) > 0.1 then if not bMakeVertCham then @@ -121,20 +120,6 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly EgtOutLog( sWarn) return 0, dDepth end - else - nCanVert = 1 - end - end - -- eseguo lo smusso solo se feature larga come la trave - if dWidth < EgtIf( nCanVert == 1, b3Raw:getDimZ(), b3Raw:getDimY()) - 1 then - if nChamfer == 2 then -- se devo fare solo smusso, genero errore - local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' feature smaller than beam' - EgtOutLog( sErr) - return -1, dDepth, sErr - else - local sWarn = 'Warning on process ' .. tostring( Proc.Id) .. ' skipped chamfer (feature smaller than beam)' - EgtOutLog( sWarn) - return 0, dDepth end end -- recupero la lavorazione @@ -413,8 +398,8 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if bFinish then -- inserisco la lavorazione local sNewName = 'Prof_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) - local nMchId = EgtCopyMachining( sNewName, sName) - if not nMchId then + local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) + if not nMch2Id then local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling EgtOutLog( sErr) return false, sErr @@ -425,7 +410,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- eseguo if not EgtApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() - EgtSetOperationMode( nMchId, false) + EgtSetOperationMode( nMch2Id, false) return false, sErr end end @@ -472,8 +457,8 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if bFinish then -- inserisco la lavorazione local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) - local nMchId = EgtCopyMachining( sNewName, sName) - if not nMchId then + local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) + if not nMch2Id then local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling EgtOutLog( sErr) return false, sErr @@ -484,7 +469,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- eseguo if not EgtApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() - EgtSetOperationMode( nMchId, false) + EgtSetOperationMode( nMch2Id, false) return false, sErr end end