From 0337d8ae85957d74fa5d4a3e0be49632f76b12d0 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Tue, 19 Jan 2021 19:44:36 +0000 Subject: [PATCH] DataWall : - modifiche Filippo per pulitura spigoli. --- LuaLibs/WProcessFreeContour.lua | 256 +++++++++++++++++++---------- LuaLibs/WProcessLapJoint.lua | 275 +++++++++++++++++++++++++++----- Process.lua | 2 +- 3 files changed, 409 insertions(+), 124 deletions(-) diff --git a/LuaLibs/WProcessFreeContour.lua b/LuaLibs/WProcessFreeContour.lua index 4bbcad0..510950e 100644 --- a/LuaLibs/WProcessFreeContour.lua +++ b/LuaLibs/WProcessFreeContour.lua @@ -1,4 +1,4 @@ --- ProcessFreeContour.lua by Egaltech s.r.l. 2020/12/01 +-- ProcessFreeContour.lua by Egaltech s.r.l. 2021/01/19 -- Gestione calcolo profilo libero per Pareti -- Tabella per definizione modulo @@ -252,9 +252,16 @@ local function GetFacesData( Proc, bOpposite, bCalclForBlade, dToolDiam, dToolMa -- recupero le dimensioni della faccia local _, dLen, dWidth = WL.GetFaceHvRefDim( nNewProc, nFac) -- recupero l'angolo con la faccia precedente - local bAdj, _, _, dAng = EgtSurfTmFacetsContact( nNewProc, nPrecFac, nFac, GDB_ID.ROOT) + local bAdj, ptLocP1, ptLocP2, dAng = EgtSurfTmFacetsContact( nNewProc, nPrecFac, nFac, GDB_ID.ROOT) -- salvo i dati vFace[i] = { Fac = nFac, Cen = ptCen, Norm = vtN, Len = dLen, Width = dWidth, AngPrev = EgtIf( bAdj, dAng, 0)} + if bAdj then + if ptLocP1:getZ() < ptLocP2:getZ() then + vFace[i].PPrev = ptLocP1 + else + vFace[i].PPrev = ptLocP2 + end + end end -- analizzo le facce local dMaxWidth = 0 @@ -524,7 +531,8 @@ local function MakeCustomPath( vGeom, nConeCut, dMillDiam, nAddGrpId, dThick) -- aggiungo linea precedente table.insert( nPath, ( nId1st + i - 1)) -- se non è la linea finale e l'angolo tra le due facce è ammesso - if i < nIdCount and dThick <= ( WD.MAX_CLEAN_CRN30 + 20 * GEO.EPS_SMALL) and nPathData[i][2] > -(180-dAngleSmall + 10 * GEO.EPS_SMALL) then + if i < nIdCount and dThick <= ( WD.MAX_CLEAN_CRN30 + 20 * GEO.EPS_SMALL) and nPathData[i][2] < 0 and + nPathData[i][2] > -(180-dAngleSmall + 10 * GEO.EPS_SMALL) then -- aggiungo una retta sulla bisettrice local _, vtN2 = EgtSurfTmFacetCenter( vGeom[i][1], vGeom[i][2], GDB_ID.ROOT) local _, vtN3 = EgtSurfTmFacetCenter( vGeom[i][1], vGeom[i+1][2], GDB_ID.ROOT) @@ -549,8 +557,8 @@ local function MakeCustomPath( vGeom, nConeCut, dMillDiam, nAddGrpId, dThick) for i = 1, nIdCount do -- aggiungo linea precedente table.insert( nPath, ( nId1st + i - 1)) - -- se non è la linea finale - if i < nIdCount then + -- se non è la linea finale e l'angolo tra le due facce è ammesso + if i < nIdCount and nPathData[i][2] < 0 then -- aggiungo una retta sulla bisettrice local _, vtN2 = EgtSurfTmFacetCenter( vGeom[i][1], vGeom[i][2], GDB_ID.ROOT) local _, vtN3 = EgtSurfTmFacetCenter( vGeom[i][1], vGeom[i+1][2], GDB_ID.ROOT) @@ -582,57 +590,105 @@ local function MakeCustomPath( vGeom, nConeCut, dMillDiam, nAddGrpId, dThick) end --------------------------------------------------------------------- -local function CalcInterference( nNewProc, vtExtr, ptCentr, dDiamToolMax, nAuxPath, - bMakeExtPath, nAddGrpId, dThSurf, bNegZ, vtNZ) +local function CalcInterference( nNewProc, vtExtr, ptCentr, dDiam1, dDiam2, + dTall1, dTall2, dDiam3, dTall3) - local nExtPath - if bMakeExtPath then - nExtPath = EgtCopyGlob( nAuxPath, nAddGrpId) or GDB_ID.NULL - else - nExtPath = EgtCopyGlob( nAuxPath, nAddGrpId) or GDB_ID.NULL + local ptCentrGrid1 = ptCentr + ( vtExtr * 0.01) + local frOriTool = Frame3d( ptCentrGrid1, vtExtr) + local bColl1 = EgtCDeConeSolid( frOriTool, dDiam1/2, dDiam2/2, dTall1, nNewProc, 0, GDB_RT.GLOB) + if bColl1 then return true end + local ptCentrGrid2 = ptCentr + ( vtExtr * ( dTall1 + 0.01)) + frOriTool = Frame3d( ptCentrGrid2, vtExtr) + local bColl2 = EgtCDeCylSolid( frOriTool, dDiam2/2, (dTall2-dTall1), nNewProc, 0, GDB_RT.GLOB) + if bColl2 then return true end + local ptCentrGrid3 = ptCentr + ( vtExtr * ( dTall2 + 0.01)) + frOriTool = Frame3d( ptCentrGrid3, vtExtr) + local bColl3 = EgtCDeCylSolid( frOriTool, dDiam3/2, (dTall3-dTall2), nNewProc, 0, GDB_RT.GLOB) + if bColl3 then return true end + -- restituisco risultato controllo collisioni + return false +end + +--------------------------------------------------------------------- +local function MakeLocalSurf( ptP1, ptP2, ptP3, nAddGrpId) + + if not ptP1 or not ptP2 or not ptP3 then + return nil end - -- setto a 0 lo spessore - EgtModifyCurveThickness( nExtPath, 0) - -- se versore negativo devo spostare il percorso del suo spessore - if bNegZ then - -- setto griglia normale al percorso - EgtSetGridFrame( Frame3d( ptCentr, vtNZ)) - EgtMove( nExtPath, Point3d(0,0,dThSurf) - ORIG(), GDB_RT.GLOB) - EgtSetGridFrame() + + local pAuxId = {} + local nAuxId, AuxId + nAuxId = EgtLine( nAddGrpId, ptP1, ptP2, GDB_RT.GLOB) + table.insert( pAuxId, nAuxId) + nAuxId = EgtLine( nAddGrpId, ptP2, ptP3, GDB_RT.GLOB) + table.insert( pAuxId, nAuxId) + nAuxId = EgtLine( nAddGrpId, ptP3, ptP1, GDB_RT.GLOB) + table.insert( pAuxId, nAuxId) + -- trasformo in percorso + if #pAuxId ~= 3 then + return nil end - -- setto griglia - EgtSetGridFrame( Frame3d( ptCentr, vtExtr)) - --creo il cerchio - local nIdCircle = EgtCircle( nAddGrpId, {0,0,0}, dDiamToolMax/2, GDB_RT.GRID) - -- verifico se c'è punto intersezione - local pPint = EgtIP( nIdCircle, nExtPath, {0,0,0}, GDB_RT.GRID) - -- riporto la griglia a globale - EgtSetGridFrame() - -- cancello il cerchio e il contorno - EgtErase( nExtPath) - EgtErase( nIdCircle) - if pPint then - return true - else - return false + AuxId = EgtCurveCompo( nAddGrpId, pAuxId, true) + -- se non c'é il percorso esco + if not AuxId then + return nil end + -- creo la superfice piana + local nidFace = EgtSurfTmByFlatContour( nAddGrpId, AuxId, 0.01) + if not nidFace then + EgtErase(AuxId) + return nil + end + -- se normale negativa inverto + local _, vtN1 = EgtSurfTmFacetCenter( nidFace, 0, GDB_ID.ROOT) + if vtN1:getZ() < -0.5 then EgtInvertSurf( nidFace) end + + EgtErase(AuxId) + return nidFace end --------------------------------------------------------------------- local function AddMillCornerMachining( nNewProc, nFacInd, tFacAdj, nTypeConeCut, nAddGrpId, dToolDiam, dThick, sMilling, dOffsAng, dDepthMach, - nCheckPath, dDiamToolMax, bThruThick, dThSurf, bNegZ) + bThruThick, dThSurf, dDiam1, dDiam2, dTall1, + dTall2, dDiam3, dTall3, bMakeLocSurf, vFace) -- variabili costruzione geometria local pAuxId = {} local nAuxId local ptApPoint local AuxId + local nNewProcLoc + -- se devo creare superfice locale + if bMakeLocSurf then + -- creo superfice locale o esco + local nSurfToAdd = MakeLocalSurf( tFacAdj[1][7], tFacAdj[1][8], tFacAdj[1][9], nAddGrpId) + if nSurfToAdd then + local nFacCntPre = EgtSurfTmFacetCount( nNewProc) + -- creo copia del percorso principale e gli aggiungo la nuova faccia + nNewProcLoc = EgtCopyGlob( nNewProc, nAddGrpId) + nNewProcLoc = EgtSurfTmBySewing( nAddGrpId, {nNewProcLoc,nSurfToAdd} , true) + -- riordino le facce + nNewProcLoc = ReorderFacesFromTab( nNewProcLoc, vFace) + -- acquisisco il numero della faccia + nFacCnt = EgtSurfTmFacetCount( nNewProcLoc) + nFacInd = nFacCnt - 1 + else + return true, '' + end + else + nNewProcLoc = nNewProc + end -- prendo il primo versore - local _, vtN1 = EgtSurfTmFacetCenter( nNewProc, nFacInd, GDB_ID.ROOT) - local _, vtN2 = EgtSurfTmFacetCenter( nNewProc, tFacAdj[1][1], GDB_ID.ROOT) - local _, vtN3 = EgtSurfTmFacetCenter( nNewProc, tFacAdj[1][2], GDB_ID.ROOT) + local _, vtN1 = EgtSurfTmFacetCenter( nNewProcLoc, nFacInd, GDB_ID.ROOT) + local _, vtN2 = EgtSurfTmFacetCenter( nNewProcLoc, tFacAdj[1][1], GDB_ID.ROOT) + local _, vtN3 = EgtSurfTmFacetCenter( nNewProcLoc, tFacAdj[1][2], GDB_ID.ROOT) -- trovo il punto sulla superfice di riferimento - local _, ptLocP1, ptLocP2, _ = EgtSurfTmFacetsContact( nNewProc, nFacInd, tFacAdj[1][1], GDB_ID.ROOT) + local _, ptLocP1, ptLocP2, _ = EgtSurfTmFacetsContact( nNewProcLoc, nFacInd, tFacAdj[1][1], GDB_ID.ROOT) + local _, ptLocP3, ptLocP4, _ = EgtSurfTmFacetsContact( nNewProcLoc, nFacInd, tFacAdj[1][2], GDB_ID.ROOT) + -- se ho creato faccia locale su copia superficie, calcella la copia + if bMakeLocSurf then + EgtErase( nNewProcLoc) + end local nIdIniPoint local nIdEndPoint if ptLocP1 and ptLocP2 then @@ -668,9 +724,14 @@ local function AddMillCornerMachining( nNewProc, nFacInd, tFacAdj, nTypeConeCut, vtExtr = vtExtrExit + Vector3d(0,0,1.539865) end vtExtr:normalize() + local vtCheck = Vector3d(vtExtr) + -- se ho un offset angolare ruoto il percorso + if abs(dOffsAng) > 100 * GEO.EPS_SMALL then + vtCheck:rotate( Z_AX(), dOffsAng) + end -- controllo se c'è collisione con le facce della superfice - if nTypeConeCut == 1 and CalcInterference( nNewProc, vtExtr, tFacAdj[1][nIdEndPoint] + Point3d( 0, 0, -dDepthMach), dDiamToolMax, nCheckPath, - false, nAddGrpId, dThSurf, bNegZ, vtN1) then + if nTypeConeCut == 1 and CalcInterference( nNewProc, vtCheck, tFacAdj[1][nIdEndPoint] + Point3d( 0, 0, -dDepthMach), dDiam1, dDiam2, + dTall1, dTall2, dDiam3, dTall3) then return true, '' end nAuxId = EgtLine( nAddGrpId, tFacAdj[1][nIdIniPoint], tFacAdj[1][nIdEndPoint] + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB) @@ -711,7 +772,7 @@ local function AddMillCornerMachining( nNewProc, nFacInd, tFacAdj, nTypeConeCut, end -- inserisco le ultime tre linee -- trovo il secondo punto sulla superfice di riferimento - _, ptLocP1, ptLocP2, _ = EgtSurfTmFacetsContact( nNewProc, nFacInd, tFacAdj[1][2], GDB_ID.ROOT) + ptLocP1, ptLocP2 = ptLocP3, ptLocP4 if ptLocP1 and ptLocP2 then -- se il punto finale corrisponde con il punto utilizzato in precedenza, uso l'altro if dist( tFacAdj[1][nIdEndPoint], ptLocP1) < 10 * GEO.EPS_SMALL then @@ -828,7 +889,7 @@ end --------------------------------------------------------------------- local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw, dToolDiam, nAddGrpId, dThick, nMasterNewProc, dDepthMach, - AuxId, bThruThick, bNegZ) + bThruThick) local sMilling, dMaxDepth -- se ripresa angolo con fresa cono 60° con ripresa @@ -850,13 +911,20 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw, end end -- recupero i dati dell'utensile + local dMillDiam = 20 local dMillTotDiam = 20 local dMillDiamTh = 20 + local dToolLength = 20 + local dThickTool = 20 if EgtMdbSetCurrMachining( sMilling) then local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then - dMillTotDiam = EgtTdbGetCurrToolParam( MCH_TP.TOTDIAM) or dMillTotDiam dMillDiamTh = EgtTdbGetCurrToolThDiam() or dMillDiamTh + dMillTotDiam = EgtTdbGetCurrToolParam( MCH_TP.TOTDIAM) or dMillTotDiam + dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam + dThickTool = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dThickTool + dToolLength = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dToolLength + dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth end end -- copio la feature nel layer di appoggio @@ -866,30 +934,28 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw, else nNewProc = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL end - local nFacInd - -- ottengo le dimensioni apertura, la normale e la faccia inferiore - local dDimMin, dDimMax, dDepth, vtOrtho, _, nSurfInt = GetTunnelDimension( nNewProc, Proc.PartId, nAddGrpId) - if nSurfInt then - -- uso la dimensione minima anche nel caso che la cava sborda perchè la lavorazione potrebbe collidere con un pezzo limitrofo - local dMinWidth = dDimMin --- local dMinWidth = EgtIf( dMiddleFacetLength > 0.01, dMiddleFacetLength, dDimMin) - -- controllo le dimensioni della faccia, se dimensione minima al di sotto di un certo valore esco - -- per evitare collisioni --- if dDepth >= dMinWidth / 2 or dMinWidth < WD.MIN_DIM_ALLOW_CLEAN + 100 * GEO.EPS_SMALL then --- EgtErase( nNewProc) --- return true --- end - local nFacCntPre = EgtSurfTmFacetCount( nNewProc) - nNewProc = EgtSurfTmBySewing( nAddGrpId, {nNewProc,nSurfInt} , true) - -- riordino le facce - nNewProc = ReorderFacesFromTab( nNewProc, vFace) - -- acquisisco il numero della faccia - local nFacCnt = EgtSurfTmFacetCount( nNewProc) - nFacInd = nFacCnt - 1 + local nFacCnt = EgtSurfTmFacetCount( nNewProc) + local nFacInd, dDimMin, dDimMax, dDepth, nSurfInt + local bMakeLocSurf + if nFacCnt <= 4 then + -- ottengo le dimensioni apertura, la normale e la faccia inferiore + dDimMin, dDimMax, dDepth, _, _, nSurfInt = GetTunnelDimension( nNewProc, Proc.PartId, nAddGrpId) + if nSurfInt then + -- uso la dimensione minima anche nel caso che la cava sborda perchè la lavorazione potrebbe collidere con un pezzo limitrofo + local dMinWidth = dDimMin + nNewProc = EgtSurfTmBySewing( nAddGrpId, {nNewProc,nSurfInt} , true) + -- riordino le facce + nNewProc = ReorderFacesFromTab( nNewProc, vFace) + -- acquisisco il numero della faccia + nFacCnt = EgtSurfTmFacetCount( nNewProc) + nFacInd = nFacCnt - 1 + else + local sErr = 'Error : cannot create base surface' + EgtOutLog( sErr) + return false, sErr + end else - local sErr = 'Error : cannot create base surface' - EgtOutLog( sErr) - return false, sErr + bMakeLocSurf = true end -- verifico se ciclo chiuso local bClosed = ( abs( vFace[1].AngPrev) > 0.1) @@ -911,16 +977,26 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw, local tFacAdj = {} local nFace1 = vFace[i].Fac local nFace2 + -- ricavo i tre punti per eventuale superficie locale + local ptLoc1, ptLoc2, ptLoc3 + -- punto precedente (punto precedente della faccia [i]) + ptLoc3 = vFace[i].PPrev -- aggiungo geometria i = i + 1 local j = EgtIf( i <= #vFace, i, EgtIf( bAllType4, nil, 1)) nFace2 = vFace[j].Fac + -- punto in comune tra le due facce (punto precedente della faccia [j]) + ptLoc1 = vFace[j].PPrev + -- punto successivo ( precedente della faccia successiva) + j = j + 1 + local k = EgtIf( j <= #vFace, j, EgtIf( bAllType4, nil, 1)) + ptLoc2 = vFace[k].PPrev -- ricavo i punti e l'angolo interno local _, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( nNewProc, nFace1, nFace2, GDB_ID.ROOT) -- se punti validi e angolo è interno e >= 90 creo istanza if ptP1 and ptP2 and dAng < 0 and dAng > EgtIf( nTypeConeCut == 1, -(90 + 10 * GEO.EPS_SMALL), -(180-dAngleSmall + 10 * GEO.EPS_SMALL)) then local dLen = dist( ptP1, ptP2) - table.insert( tFacAdj, { nFace1, nFace2, dLen, ptP1, ptP2, dAng}) + table.insert( tFacAdj, { nFace1, nFace2, dLen, ptP1, ptP2, dAng, ptLoc1, ptLoc2, ptLoc3}) end -- se ho un elemento creo percorso o percorsi in base al tipo di cono e all'apertura dall'angolo rispetto ai 90° -- con una tolleranza di 2 gradi @@ -930,18 +1006,21 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw, -- primo taglio local bOk, sErr = AddMillCornerMachining( nNewProc, nFacInd, tFacAdj, nTypeConeCut, nAddGrpId, dToolDiam, dThick, sMilling, -dAngOffs, dDepthMach, - AuxId, max( dMillTotDiam, dMillDiamTh), bThruThick, dDepth, bNegZ) + bThruThick, dDepth, dMillDiam, dMillTotDiam, abs(dThickTool), + dMaxDepth, dMillDiamTh, dToolLength, bMakeLocSurf, vFace) if not bOk then return bOk, sErr end -- secondo taglio bOk, sErr = AddMillCornerMachining( nNewProc, nFacInd, tFacAdj, nTypeConeCut, nAddGrpId, dToolDiam, dThick, sMilling, dAngOffs, dDepthMach, - AuxId, max( dMillTotDiam, dMillDiamTh), bThruThick, dDepth, bNegZ) + bThruThick, dDepth, dMillDiam, dMillTotDiam, abs(dThickTool), + dMaxDepth, dMillDiamTh, dToolLength, bMakeLocSurf, vFace) if not bOk then return bOk, sErr end -- altrimenti ho un solo percorso else local bOk, sErr = AddMillCornerMachining( nNewProc, nFacInd, tFacAdj, nTypeConeCut, nAddGrpId, dToolDiam, dThick, sMilling, 0, dDepthMach, - AuxId, max( dMillTotDiam, dMillDiamTh), bThruThick, dDepth, bNegZ) + bThruThick, dDepth, dMillDiam, dMillTotDiam, abs(dThickTool), + dMaxDepth, dMillDiamTh, dToolLength, bMakeLocSurf, vFace) if not bOk then return bOk, sErr end end end @@ -961,6 +1040,7 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd -- flag per fresature non passanti local bNotThrou local dThick + local dOriDepth -- recupero i dati dell'utensile local dMillDiam = 20 local dMaxDepth = 0 @@ -1008,6 +1088,7 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd end -- se affondamento superiore ai limiti della fresa if dDepth > dMaxDepth then + dOriDepth = dDepth -- lo limito e tolgo eventuali Tabs dDepth = dMaxDepth EgtSetMachiningParam( MCH_MP.LEAVETAB, false) @@ -1059,6 +1140,7 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd end -- se affondamento superiore ai limiti della fresa if dDepth > dMaxDepth then + dOriDepth = dDepth -- lo limito e tolgo eventuali Tabs dDepth = dMaxDepth EgtSetMachiningParam( MCH_MP.LEAVETAB, false) @@ -1084,6 +1166,8 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd EgtSetMachiningGeometry( vGeom) EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal) + -- tolgo sempre i Tabs per permettere rimozione sfrido + EgtSetMachiningParam( MCH_MP.LEAVETAB, false) -- percorso da non invertire EgtSetMachiningParam( MCH_MP.INVERT, false) -- assegno utilizzo faccia @@ -1107,7 +1191,12 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd -- assegno utilizzo faccia EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN) -- assegno affondamento - EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) +-- EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) + if bNotThrou then + EgtSetMachiningParam( MCH_MP.DEPTH, ( dDepth - dOriDepth)) + else + EgtSetMachiningParam( MCH_MP.DEPTH, 0) + end -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.CENTER) -- posizione braccio porta testa @@ -1125,7 +1214,12 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd -- assegno utilizzo faccia EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN) -- assegno affondamento - EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) +-- EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) + if bNotThrou then + EgtSetMachiningParam( MCH_MP.DEPTH, ( dDepth - dOriDepth)) + else + EgtSetMachiningParam( MCH_MP.DEPTH, 0) + end -- assegno lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.CENTER) -- posizione braccio porta testa @@ -1383,7 +1477,7 @@ local function MakeByCut( Proc, nRawId, b3Raw, bDeleteBottomFacet) if ( nConeCut == 1 and nMlOk == 1) or ( nConeCut == 2 and dThick <= ( WD.MAX_CLEAN_CRN30 + 20 * GEO.EPS_SMALL)) then local bMcok, sMcErr = AddMillCorner( nConeCut, vFace, Proc, nRawId, b3Raw, sMlErr, nAddGrpId, dThick, nNewProc, 0, - AuxId, true, bNegZ) + true) if not bMcok then return bMcok, sMcErr end end -- altrimenti provo con la sega a catena @@ -1394,7 +1488,7 @@ local function MakeByCut( Proc, nRawId, b3Raw, bDeleteBottomFacet) if nConeCut == 1 and nCsOk == 1 then local bMcok, sMcErr = AddMillCorner( nConeCut, vFace, Proc, nRawId, b3Raw, sCSErr, nAddGrpId, nil, nNewProc, 0, - AuxId, true, bNegZ) + true) if not bMcok then return bMcok, sMcErr end end end @@ -1593,6 +1687,7 @@ local function MakeByPocket( Proc, nRawId, b3Raw) nSCC = EgtIf( Proc.Box:getDimX() >= Proc.Box:getDimY(), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_XP) end EgtSetMachiningParam( MCH_MP.SCC, nSCC) + local sWarn = '' if bPocketBotface then local dThElev = dThDiam / 2 * sqrt( vtExtr:getX() * vtExtr:getX() + vtExtr:getY() * vtExtr:getY()) if dElev + dThElev > dMaxDepth + 10 * GEO.EPS_SMALL then @@ -1604,7 +1699,7 @@ local function MakeByPocket( Proc, nRawId, b3Raw) -- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente if dDepth > dMaxDepth + 10 * GEO.EPS_SMALL then dDepth = dMaxDepth - local sWarn = 'Warning : elevation bigger than max tool depth' + sWarn = 'Warning : elevation bigger than max tool depth' EgtOutLog( sWarn) end end @@ -1625,11 +1720,12 @@ local function MakeByPocket( Proc, nRawId, b3Raw) -- se abilitata la lavorazione corner con stop macchina e lavorazione precedente passante if nConeCut == 1 then local bMcok, sMcErr = AddMillCorner( nConeCut, vFace, Proc, nRawId, b3Raw, - dMillDiam, nAddGrpId, nil, nNewProc, EgtIf( bPocketBotface, dDepth, ( dDepth - dOriDepth)), - AuxId, nil, bNegZ) + dMillDiam, nAddGrpId, nil, nNewProc, EgtIf( bPocketBotface, dDepth, ( dDepth - dOriDepth))) if not bMcok then return bMcok, sMcErr end + else + EgtErase( nNewProc) end - return true + return true, sWarn end --------------------------------------------------------------------- diff --git a/LuaLibs/WProcessLapJoint.lua b/LuaLibs/WProcessLapJoint.lua index 298c32c..b19541f 100644 --- a/LuaLibs/WProcessLapJoint.lua +++ b/LuaLibs/WProcessLapJoint.lua @@ -1,4 +1,4 @@ --- WProcessLapJoint.lua by Egaltech s.r.l. 2020/11/18 +-- WProcessLapJoint.lua by Egaltech s.r.l. 2020/11/19 -- Gestione calcolo mezzo-legno per Pareti -- Tabella per definizione modulo @@ -204,6 +204,51 @@ local function GetOtherRegions( nPartId) return vOthers end +--------------------------------------------------------------------- +local function ReorderFaces( nIdSurf, nNumFacet) + local vAdj = {} + for i = 1, nNumFacet do + local vFacAdj = EgtSurfTmFacetAdjacencies( nIdSurf, i - 1)[1] + -- le conto + local nCount = 0 + for j = 1, #vFacAdj do + if vFacAdj[j] >= 0 then + nCount = nCount + 1 + end + end + vAdj[i] = nCount + end + local nIdFace + local nAdjMin = 1000 + for i = #vAdj, 1, -1 do + if vAdj[i] <= nAdjMin then + nAdjMin = vAdj[i] + nIdFace = i + end + end + -- se il numero faccia minore con minori adiacenze è <> 1 faccio lo scambio + if nIdFace and nIdFace ~= 1 then + EgtSurfTmSwapFacets( nIdSurf, nIdFace-1, 0) + end + -- ordino il numero di facce in modo da avere una sequenza di facce concatenate + for i = 1, (nNumFacet-1) do + -- recupero l'angolo con la faccia precedente + local bAdj, _, _, _ = EgtSurfTmFacetsContact( nIdSurf, i-1, i, GDB_ID.ROOT) + -- se non ho adiacenza + if not bAdj then + for j = i+1, nNumFacet do + bAdj, _, _, _ = EgtSurfTmFacetsContact( nIdSurf, i-1, j-1, GDB_ID.ROOT) + -- se ho adiacenza scambio le facce + if bAdj then + EgtSurfTmSwapFacets( nIdSurf, i, (j-1)) + break + end + end + end + end + return nIdSurf +end + --------------------------------------------------------------------- local function RemoveBottomFaceAndReorder( Proc, nAddGrpId, nFaceToDel) @@ -211,6 +256,8 @@ local function RemoveBottomFaceAndReorder( Proc, nAddGrpId, nFaceToDel) local nNewProc = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL EgtSurfTmRemoveFacet( nNewProc, nFaceToDel) local nNumFacet = EgtSurfTmFacetCount( nNewProc) + nNewProc = ReorderFaces( nNewProc, nNumFacet) +--[[ -- ordino il numero di facce in modo da avere una sequenza di facce concatenate for i = 1, (nNumFacet-1) do -- recupero l'angolo con la faccia precedente @@ -227,7 +274,7 @@ local function RemoveBottomFaceAndReorder( Proc, nAddGrpId, nFaceToDel) end end end - +]]-- return nNewProc, nNumFacet end @@ -254,6 +301,13 @@ local function GetFacesData( nNewProc, bOpposite, bCalclForBlade, dToolDiam, dTo local bAdj, _, _, dAng = EgtSurfTmFacetsContact( nNewProc, nPrecFac, nFac, GDB_ID.ROOT) -- salvo i dati vFace[i] = { Fac = nFac, Cen = ptCen, Norm = vtN, Len = dLen, Width = dWidth, AngPrev = EgtIf( bAdj, dAng, 0)} + if bAdj then + if ptLocP1:getZ() < ptLocP2:getZ() then + vFace[i].PPrev = ptLocP1 + else + vFace[i].PPrev = ptLocP2 + end + end end -- analizzo le facce local dMaxWidth = 0 @@ -443,7 +497,7 @@ local function GetTunnelDimension( nId, nPartId, nAddGrpId) end --------------------------------------------------------------------- -local function ReorderFaces( nIdSurf, vFace) +local function ReorderFacesFromTab( nIdSurf, vFace) local nFacCnt = EgtSurfTmFacetCount( nIdSurf) for i = 1, #vFace do @@ -463,18 +517,105 @@ local function ReorderFaces( nIdSurf, vFace) end --------------------------------------------------------------------- -local function AddMillCornerMachining( nNewProc, nFacInd, tFacAdj, nTypeConeCut, nAddGrpId, dToolDiam, dThick, sMilling, dOffsAng, dDepthMach) +local function CalcInterference( nNewProc, vtExtr, ptCentr, dDiam1, dDiam2, + dTall1, dTall2, dDiam3, dTall3) + + local ptCentrGrid1 = ptCentr + ( vtExtr * 0.01) + local frOriTool = Frame3d( ptCentrGrid1, vtExtr) + local bColl1 = EgtCDeConeSolid( frOriTool, dDiam1/2, dDiam2/2, dTall1, nNewProc, 0, GDB_RT.GLOB) + if bColl1 then return true end + local ptCentrGrid2 = ptCentr + ( vtExtr * ( dTall1 + 0.01)) + frOriTool = Frame3d( ptCentrGrid2, vtExtr) + local bColl2 = EgtCDeCylSolid( frOriTool, dDiam2/2, (dTall2-dTall1), nNewProc, 0, GDB_RT.GLOB) + if bColl2 then return true end + local ptCentrGrid3 = ptCentr + ( vtExtr * ( dTall2 + 0.01)) + frOriTool = Frame3d( ptCentrGrid3, vtExtr) + local bColl3 = EgtCDeCylSolid( frOriTool, dDiam3/2, (dTall3-dTall2), nNewProc, 0, GDB_RT.GLOB) + if bColl3 then return true end + -- restituisco risultato controllo collisioni + return false +end + +--------------------------------------------------------------------- +local function MakeLocalSurf( ptP1, ptP2, ptP3, nAddGrpId) + + if not ptP1 or not ptP2 or not ptP3 then + return nil + end + + local pAuxId = {} + local nAuxId, AuxId + nAuxId = EgtLine( nAddGrpId, ptP1, ptP2, GDB_RT.GLOB) + table.insert( pAuxId, nAuxId) + nAuxId = EgtLine( nAddGrpId, ptP2, ptP3, GDB_RT.GLOB) + table.insert( pAuxId, nAuxId) + nAuxId = EgtLine( nAddGrpId, ptP3, ptP1, GDB_RT.GLOB) + table.insert( pAuxId, nAuxId) + -- trasformo in percorso + if #pAuxId ~= 3 then + return nil + end + AuxId = EgtCurveCompo( nAddGrpId, pAuxId, true) + -- se non c'é il percorso esco + if not AuxId then + return nil + end + -- creo la superfice piana + local nidFace = EgtSurfTmByFlatContour( nAddGrpId, AuxId, 0.01) + if not nidFace then + EgtErase(AuxId) + return nil + end + -- se normale negativa inverto + local _, vtN1 = EgtSurfTmFacetCenter( nidFace, 0, GDB_ID.ROOT) + if vtN1:getZ() < -0.5 then EgtInvertSurf( nidFace) end + + EgtErase(AuxId) + return nidFace +end + +--------------------------------------------------------------------- +local function AddMillCornerMachining( nNewProc, nFacInd, tFacAdj, nTypeConeCut, nAddGrpId, + dToolDiam, dThick, sMilling, dOffsAng, dDepthMach, + bThruThick, dThSurf, dDiam1, dDiam2, dTall1, + dTall2, dDiam3, dTall3, bMakeLocSurf, vFace) -- variabili costruzione geometria local pAuxId = {} local nAuxId local ptApPoint local AuxId + local nNewProcLoc + -- se devo creare superfice locale + if bMakeLocSurf then + -- creo superfice locale o esco + local nSurfToAdd = MakeLocalSurf( tFacAdj[1][7], tFacAdj[1][8], tFacAdj[1][9], nAddGrpId) + if nSurfToAdd then + local nFacCntPre = EgtSurfTmFacetCount( nNewProc) + -- creo copia del percorso principale e gli aggiungo la nuova faccia + nNewProcLoc = EgtCopyGlob( nNewProc, nAddGrpId) + nNewProcLoc = EgtSurfTmBySewing( nAddGrpId, {nNewProcLoc,nSurfToAdd} , true) + -- riordino le facce + nNewProcLoc = ReorderFacesFromTab( nNewProcLoc, vFace) + -- acquisisco il numero della faccia + nFacCnt = EgtSurfTmFacetCount( nNewProcLoc) + nFacInd = nFacCnt - 1 + else + return true, '' + end + else + nNewProcLoc = nNewProc + end -- prendo il primo versore - local _, vtN1 = EgtSurfTmFacetCenter( nNewProc, nFacInd, GDB_ID.ROOT) - local _, vtN2 = EgtSurfTmFacetCenter( nNewProc, tFacAdj[1][1], GDB_ID.ROOT) - local _, vtN3 = EgtSurfTmFacetCenter( nNewProc, tFacAdj[1][2], GDB_ID.ROOT) + local _, vtN1 = EgtSurfTmFacetCenter( nNewProcLoc, nFacInd, GDB_ID.ROOT) + local _, vtN2 = EgtSurfTmFacetCenter( nNewProcLoc, tFacAdj[1][1], GDB_ID.ROOT) + local _, vtN3 = EgtSurfTmFacetCenter( nNewProcLoc, tFacAdj[1][2], GDB_ID.ROOT) -- trovo il punto sulla superfice di riferimento - local _, ptLocP1, ptLocP2, _ = EgtSurfTmFacetsContact( nNewProc, nFacInd, tFacAdj[1][1], GDB_ID.ROOT) + local _, ptLocP1, ptLocP2, _ = EgtSurfTmFacetsContact( nNewProcLoc, nFacInd, tFacAdj[1][1], GDB_ID.ROOT) + local _, ptLocP3, ptLocP4, _ = EgtSurfTmFacetsContact( nNewProcLoc, nFacInd, tFacAdj[1][2], GDB_ID.ROOT) + -- se ho creato faccia locale su copia superficie, calcella la copia + if bMakeLocSurf then + EgtErase( nNewProcLoc) + end local nIdIniPoint local nIdEndPoint if ptLocP1 and ptLocP2 then @@ -510,6 +651,16 @@ local function AddMillCornerMachining( nNewProc, nFacInd, tFacAdj, nTypeConeCut, vtExtr = vtExtrExit + Vector3d(0,0,1.539865) end vtExtr:normalize() + local vtCheck = Vector3d(vtExtr) + -- se ho un offset angolare ruoto il percorso + if abs(dOffsAng) > 100 * GEO.EPS_SMALL then + vtCheck:rotate( Z_AX(), dOffsAng) + end + -- controllo se c'è collisione con le facce della superfice + if nTypeConeCut == 1 and CalcInterference( nNewProc, vtCheck, tFacAdj[1][nIdEndPoint] + Point3d( 0, 0, -dDepthMach), dDiam1, dDiam2, + dTall1, dTall2, dDiam3, dTall3) then + return true, '' + end nAuxId = EgtLine( nAddGrpId, tFacAdj[1][nIdIniPoint], tFacAdj[1][nIdEndPoint] + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB) table.insert( pAuxId, nAuxId) -- se uso utensile cono 60° @@ -548,7 +699,7 @@ local function AddMillCornerMachining( nNewProc, nFacInd, tFacAdj, nTypeConeCut, end -- inserisco le ultime tre linee -- trovo il secondo punto sulla superfice di riferimento - _, ptLocP1, ptLocP2, _ = EgtSurfTmFacetsContact( nNewProc, nFacInd, tFacAdj[1][2], GDB_ID.ROOT) + ptLocP1, ptLocP2 = ptLocP3, ptLocP4 if ptLocP1 and ptLocP2 then -- se il punto finale corrisponde con il punto utilizzato in precedenza, uso l'altro if dist( tFacAdj[1][nIdEndPoint], ptLocP1) < 10 * GEO.EPS_SMALL then @@ -622,6 +773,10 @@ local function AddMillCornerMachining( nNewProc, nFacInd, tFacAdj, nTypeConeCut, EgtOutLog( sErr) return false, sErr end + -- se flag lavorazione spessore passante setto la nota per spostarla dopo i tagli di lama + if bThruThick then + EgtSetInfo( nMchId, 'MOVE_AFTER', 1) + end -- aggiungo geometria EgtSetMachiningGeometry( {{ AuxId, -1}}) -- imposto posizione braccio porta testa @@ -659,7 +814,9 @@ local function AddMillCornerMachining( nNewProc, nFacInd, tFacAdj, nTypeConeCut, end --------------------------------------------------------------------- -local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw, dToolDiam, nAddGrpId, dThick, nMasterNewProc, dDepthMach, dMiddleFacetLength) +local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw, + dToolDiam, nAddGrpId, dThick, nMasterNewProc, dDepthMach, + bThruThick) local sMilling, dMaxDepth -- se ripresa angolo con fresa cono 60° con ripresa @@ -680,6 +837,23 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw, dToolDia return false, sErr end end + -- recupero i dati dell'utensile + local dMillDiam = 20 + local dMillTotDiam = 20 + local dMillDiamTh = 20 + local dToolLength = 20 + local dThickTool = 20 + if EgtMdbSetCurrMachining( sMilling) then + local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then + dMillDiamTh = EgtTdbGetCurrToolThDiam() or dMillDiamTh + dMillTotDiam = EgtTdbGetCurrToolParam( MCH_TP.TOTDIAM) or dMillTotDiam + dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam + dThickTool = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dThickTool + dToolLength = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dToolLength + dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth + end + end -- copio la feature nel layer di appoggio local nNewProc if nMasterNewProc then @@ -687,30 +861,28 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw, dToolDia else nNewProc = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL end - local nFacInd - -- ottengo le dimensioni apertura, la normale e la faccia inferiore - local dDimMin, dDimMax, dDepth, vtOrtho, _, nSurfInt = GetTunnelDimension( nNewProc, Proc.PartId, nAddGrpId) - if nSurfInt then - -- uso la dimensione minima anche nel caso che la cava sborda perchè la lavorazione potrebbe collidere con un pezzo limitrofo - local dMinWidth = dDimMin --- local dMinWidth = EgtIf( dMiddleFacetLength > 0.01, dMiddleFacetLength, dDimMin) - -- controllo le dimensioni della faccia, se dimensione minima al di sotto di un certo valore esco - -- per evitare collisioni - if dDepth >= dMinWidth / 2 or dMinWidth < WD.MIN_DIM_ALLOW_CLEAN + 100 * GEO.EPS_SMALL then - EgtErase( nNewProc) - return true + local nFacCnt = EgtSurfTmFacetCount( nNewProc) + local nFacInd, dDimMin, dDimMax, dDepth, nSurfInt + local bMakeLocSurf + if nFacCnt <= 4 then + -- ottengo le dimensioni apertura, la normale e la faccia inferiore + dDimMin, dDimMax, dDepth, _, _, nSurfInt = GetTunnelDimension( nNewProc, Proc.PartId, nAddGrpId) + if nSurfInt then + -- uso la dimensione minima anche nel caso che la cava sborda perchè la lavorazione potrebbe collidere con un pezzo limitrofo + local dMinWidth = dDimMin + nNewProc = EgtSurfTmBySewing( nAddGrpId, {nNewProc,nSurfInt} , true) + -- riordino le facce + nNewProc = ReorderFacesFromTab( nNewProc, vFace) + -- acquisisco il numero della faccia + nFacCnt = EgtSurfTmFacetCount( nNewProc) + nFacInd = nFacCnt - 1 + else + local sErr = 'Error : cannot create base surface' + EgtOutLog( sErr) + return false, sErr end - local nFacCntPre = EgtSurfTmFacetCount( nNewProc) - nNewProc = EgtSurfTmBySewing( nAddGrpId, {nNewProc,nSurfInt} , true) - -- riordino le facce - nNewProc = ReorderFaces( nNewProc, vFace) - -- acquisisco il numero della faccia - local nFacCnt = EgtSurfTmFacetCount( nNewProc) - nFacInd = nFacCnt - 1 else - local sErr = 'Error : cannot create base surface' - EgtOutLog( sErr) - return false, sErr + bMakeLocSurf = true end -- verifico se ciclo chiuso local bClosed = ( abs( vFace[1].AngPrev) > 0.1) @@ -732,16 +904,26 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw, dToolDia local tFacAdj = {} local nFace1 = vFace[i].Fac local nFace2 + -- ricavo i tre punti per eventuale superficie locale + local ptLoc1, ptLoc2, ptLoc3 + -- punto precedente (punto precedente della faccia [i]) + ptLoc3 = vFace[i].PPrev -- aggiungo geometria i = i + 1 local j = EgtIf( i <= #vFace, i, EgtIf( bAllType4, nil, 1)) nFace2 = vFace[j].Fac + -- punto in comune tra le due facce (punto precedente della faccia [j]) + ptLoc1 = vFace[j].PPrev + -- punto successivo ( precedente della faccia successiva) + j = j + 1 + local k = EgtIf( j <= #vFace, j, EgtIf( bAllType4, nil, 1)) + ptLoc2 = vFace[k].PPrev -- ricavo i punti e l'angolo interno local _, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( nNewProc, nFace1, nFace2, GDB_ID.ROOT) -- se punti validi e angolo è interno e >= 90 creo istanza if ptP1 and ptP2 and dAng < 0 and dAng > EgtIf( nTypeConeCut == 1, -(90 + 10 * GEO.EPS_SMALL), -(180-dAngleSmall + 10 * GEO.EPS_SMALL)) then local dLen = dist( ptP1, ptP2) - table.insert( tFacAdj, { nFace1, nFace2, dLen, ptP1, ptP2, dAng}) + table.insert( tFacAdj, { nFace1, nFace2, dLen, ptP1, ptP2, dAng, ptLoc1, ptLoc2, ptLoc3}) end -- se ho un elemento creo percorso o percorsi in base al tipo di cono e all'apertura dall'angolo rispetto ai 90° -- con una tolleranza di 2 gradi @@ -749,14 +931,23 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw, dToolDia if nTypeConeCut == 1 and bMakeTwinCut and (dAng + 90) > 2 then local dAngOffs = (dAng + 90) / 2 -- primo taglio - local bOk, sErr = AddMillCornerMachining( nNewProc, nFacInd, tFacAdj, nTypeConeCut, nAddGrpId, dToolDiam, dThick, sMilling, -dAngOffs, dDepthMach) + local bOk, sErr = AddMillCornerMachining( nNewProc, nFacInd, tFacAdj, nTypeConeCut, nAddGrpId, + dToolDiam, dThick, sMilling, -dAngOffs, dDepthMach, + bThruThick, dDepth, dMillDiam, dMillTotDiam, abs(dThickTool), + dMaxDepth, dMillDiamTh, dToolLength, bMakeLocSurf, vFace) if not bOk then return bOk, sErr end -- secondo taglio - bOk, sErr = AddMillCornerMachining( nNewProc, nFacInd, tFacAdj, nTypeConeCut, nAddGrpId, dToolDiam, dThick, sMilling, dAngOffs, dDepthMach) + bOk, sErr = AddMillCornerMachining( nNewProc, nFacInd, tFacAdj, nTypeConeCut, nAddGrpId, + dToolDiam, dThick, sMilling, dAngOffs, dDepthMach, + bThruThick, dDepth, dMillDiam, dMillTotDiam, abs(dThickTool), + dMaxDepth, dMillDiamTh, dToolLength, bMakeLocSurf, vFace) if not bOk then return bOk, sErr end -- altrimenti ho un solo percorso else - local bOk, sErr = AddMillCornerMachining( nNewProc, nFacInd, tFacAdj, nTypeConeCut, nAddGrpId, dToolDiam, dThick, sMilling, 0, dDepthMach) + local bOk, sErr = AddMillCornerMachining( nNewProc, nFacInd, tFacAdj, nTypeConeCut, nAddGrpId, + dToolDiam, dThick, sMilling, 0, dDepthMach, + bThruThick, dDepth, dMillDiam, dMillTotDiam, abs(dThickTool), + dMaxDepth, dMillDiamTh, dToolLength, bMakeLocSurf, vFace) if not bOk then return bOk, sErr end end end @@ -1116,11 +1307,9 @@ local function MakeByPocketing( Proc, nFacet, nRawId, b3Raw, bCheckQPar) local vFace, dMaxWidth = GetFacesData( nNewProc, false, false, dMillDiam, dMaxDepth, (dMillDiam/2), nAddGrpId, Proc.PartId) -- se abilitata la lavorazione corner con stop macchina e lavorazione precedente passante if nConeCut == 1 then - local bMcok, sMcErr = AddMillCorner( nConeCut, vFace, Proc, nRawId, b3Raw, dMillDiam, nAddGrpId, dMaxWidth, nNewProc, dDepth, dMiddleFacetLength) - if not bMcok then - EgtErase( nNewProc) - return bMcok, sMcErr - end + local bMcok, sMcErr = AddMillCorner( nConeCut, vFace, Proc, nRawId, b3Raw, + dMillDiam, nAddGrpId, dMaxWidth, nNewProc, dDepth) + if not bMcok then return bMcok, sMcErr end else EgtErase( nNewProc) end @@ -1223,10 +1412,10 @@ local function MakeTwoFaces( Proc, nRawId, b3Raw) end end -- se non inclinate o capacità di taglio non sufficiente, provo con contornatura o svuotatura - --if not sCutting or dSawMaxDepth < dDimY[1] + WD.CUT_SIC or dSawMaxDepth < dDimY[2] + WD.CUT_SIC then + if not sCutting or dSawMaxDepth < dDimY[1] + WD.CUT_SIC or dSawMaxDepth < dDimY[2] + WD.CUT_SIC then -- eseguo la svuotatura return MakeByPocketing( Proc, nFacet, nRawId, b3Raw) - --end + end end -- ordino i tagli per fare prima quello meno inclinato local nOrd = { 0, 1} diff --git a/Process.lua b/Process.lua index 1425ab3..1a51e37 100644 --- a/Process.lua +++ b/Process.lua @@ -6,7 +6,7 @@ -- Intestazioni require( 'EgtBase') _ENV = EgtProtectGlobal() -EgtEnableDebug( false) +EgtEnableDebug( true) -- Imposto direttorio libreria specializzata per Travi local sBaseDir = EgtGetSourceDir()