-- WProcessLapJoint.lua by Egaltech s.r.l. 2021/01/20 -- Gestione calcolo mezzo-legno per Pareti -- Tabella per definizione modulo local WPL = {} -- Include require( 'EgtBase') local WL = require( 'WallLib') local FreeContour = require( 'WProcessFreeContour') EgtOutLog( ' WProcessLapJoint started', 1) -- Dati local WD = require( 'WallData') local WM = require( 'WMachiningLib') local WHISK_OFFS = 0.1 local WHISK_SAFE = 5 local MIN_LEN_CUT = 30 -- variabili assegnazione parametri Q local sTypeCornerCut = 'Q05' -- i -- variabile settaggio doppia lavorazione su angoo > 90 local bMakeTwinCut = true -- angolo sottosquadra ammesso per fresa cono 30° local dAngleSmall = 70 --------------------------------------------------------------------- -- Riconoscimento della feature function WPL.Identify( Proc) return ( ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 16) or ( ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 17) or ( ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 20) or ( ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 30) or ( ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 32) or ( ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 34) or ( ( Proc.Grp == 4) and Proc.Prc == 39) end --------------------------------------------------------------------- -- Classificazione della feature function WPL.Classify( Proc, b3Raw) -- se 1 faccia if Proc.Fct == 1 then -- dati della faccia local vtN = EgtSurfTmFacetNormVersor( Proc.Id, 0, GDB_ID.ROOT) -- verifico se è lavorabile da sopra return vtN:getZ() >= WD.NZ_MINA -- se 2 facce elseif Proc.Fct == 2 then -- dati delle facce local vtN = {} vtN[1] = EgtSurfTmFacetNormVersor( Proc.Id, 0, GDB_ID.ROOT) vtN[2] = EgtSurfTmFacetNormVersor( Proc.Id, 1, GDB_ID.ROOT) -- verifico se è lavorabile da sopra o di fianco return ( vtN[1]:getZ() >= - 0.01 or vtN[2]:getZ() >= - 0.01) -- se più di 2 facce else local nFacInd, dElev, nFacInd2, dElev2 = WL.GetFaceWithMostAdj( Proc.Id, Proc.PartId) -- se trovata faccia di fondo if nFacInd >= 0 then -- determino componente Z della normale più diretta verso il basso local dMinNz = 1 for i = 1, Proc.Fct do local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT) if vtN:getZ() < dMinNz then dMinNz = vtN:getZ() end end -- dati della faccia local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT) local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT) -- verifico se la faccia è lavorabile da sopra o di fianco if ( vtN:getZ() >= WD.NZ_MINA or ( dMinNz < -0.866 and Proc.Fct >= 3 and vtN:getZ() > - 0.01)) then Proc.Stype = 1 return true -- altrimenti verifico la eventuale seconda faccia elseif nFacInd2 then -- dati della faccia local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd2, GDB_ID.ROOT) local _, dH2, dV2 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd2, GDB_ID.ROOT) -- restituisco se faccia lavorabile Proc.Stype = 2 return ( vtN2:getZ() >= WD.NZ_MINA or ( dMinNz < -0.866 and Proc.Fct >= 3 and vtN2:getZ() > - 0.01)) -- se tre facce elseif Proc.Fct == 3 then -- verifico se U da sopra -- dati della faccia local nFac2 = EgtIf( nFacInd == 0, 1, 0) local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, nFac2, GDB_ID.ROOT) Proc.Stype = 3 return ( abs( ( vtN ^ vtN2) * Z_AX()) >= WD.NZ_MINA) -- altrimenti non lavorabile else return false end -- se altrimenti tunnel elseif nFacInd == -1 then -- dati delle prime tre facce local vtN = {} vtN[1] = EgtSurfTmFacetNormVersor( Proc.Id, 0, GDB_ID.ROOT) vtN[2] = EgtSurfTmFacetNormVersor( Proc.Id, 1, GDB_ID.ROOT) vtN[3] = EgtSurfTmFacetNormVersor( Proc.Id, 2, GDB_ID.ROOT) -- verifico se è lavorabile da sopra local vtAxN = vtN[1] ^ vtN[2] if vtAxN:isSmall() then vtAxN = vtN[1] ^ vtN[3] end Proc.Stype = 4 return ( abs( vtAxN:getZ()) >= WD.NZ_MINA) -- altrimenti non lavorabile else return false end end end --------------------------------------------------------------------- local function TestElleShape3( nIdGeom, nNumFacet) -- valida solo nel caso di tre facce if nNumFacet ~= 3 then return false end -- determino se L con una faccia terminale o U con tre facce local bIsL = true for i = 1, 3 do local vFacAdj = EgtSurfTmFacetAdjacencies( nIdGeom, i - 1)[1] -- le conto local nCount = 0 for j = 1, #vFacAdj do if vFacAdj[j] >= 0 then nCount = nCount + 1 end end if nCount == 1 then bIsL = false break end end return bIsL end --------------------------------------------------------------------- local function TestElleShape4( nIdGeom, nNumFacet) -- valida solo nel caso di quattro facce if nNumFacet ~= 4 then return false end -- determino se L con due facce terminali o O local nFac3Adj = 0 local dMinArea3 = GEO.INFINITO * GEO.INFINITO local dMaxArea2 = 0 for i = 1, 4 do local vFacAdj = EgtSurfTmFacetAdjacencies( nIdGeom, i - 1)[1] -- le conto local nCount = 0 for j = 1, #vFacAdj do if vFacAdj[j] >= 0 then nCount = nCount + 1 end end local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( nIdGeom, i - 1, GDB_ID.ROOT) local dArea = dH * dV if nCount == 2 then dMaxArea2 = max( dMaxArea2, dArea) elseif nCount == 3 then dMinArea3 = min( dMinArea3, dArea) nFac3Adj = nFac3Adj + 1 end end if nFac3Adj ~= 2 then return false end -- verifico se L profonda oppure lunga if dMinArea3 < dMaxArea2 then return 1 else return 2 end end --------------------------------------------------------------------- local function VerifyCornerType( Proc) local nConeCut = 0 -- verifico il tipo di lavorazione su angolo. 0 : nessuna ripresa corner; 1: ripresa corner con pausa; -- 2: ripresa corner senza pausa; 3: scarico corner local nParamValue = EgtGetInfo( Proc.Id, sTypeCornerCut, 'i') or nConeCut -- se tipo di lavorazione con fesa conica 60° con pausa nConeCut = nParamValue return nConeCut end --------------------------------------------------------------------- local function GetOtherRegions( nPartId) local vOthers = {} local nOtherId = EgtGetFirstPartInRawPart( EgtGetFirstRawPart() or GDB_ID.NULL) while nOtherId do local nRegId = EgtGetFirstInGroup( EgtGetFirstNameInGroup( nOtherId, 'Outline') or GDB_ID.NULL) while nRegId do local vtN = EgtSurfFrNormVersor( nRegId, GDB_ID.ROOT) if EgtExistsInfo( nRegId, 'REGION') and vtN and AreSameVectorApprox( vtN, Z_AX()) then local b3Reg = EgtGetBBoxGlob( nRegId, GDB_BB.STANDARD) if b3Reg then table.insert( vOthers, { PartId = nOtherId, RegId = nRegId, Box = b3Reg}) end end nRegId = EgtGetNext( nRegId) end nOtherId = EgtGetNextPartInRawPart( nOtherId) end 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) -- copio la superfice nel gruppo ausiliario 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 local bAdj, _, _, _ = EgtSurfTmFacetsContact( nNewProc, i-1, i, GDB_ID.ROOT) -- se non ho adiacenza if not bAdj then for j = i+1, nNumFacet do bAdj, _, _, _ = EgtSurfTmFacetsContact( nNewProc, i-1, j-1, GDB_ID.ROOT) -- se ho adiacenza scambio le facce if bAdj then EgtSurfTmSwapFacets( nNewProc, i, (j-1)) break end end end end ]]-- return nNewProc, nNumFacet end --------------------------------------------------------------------- local function GetFacesData( nNewProc, bOpposite, bCalclForBlade, dToolDiam, dToolMaxDepth, dToolThick, nAddGrpId, nPartId) local nNumFacet = EgtSurfTmFacetCount( nNewProc) local vFace = {} -- recupero i dati di tutte le facce for i = 1, nNumFacet do -- indice faccia corrente e precedente local nFac = EgtIf( bOpposite, nNumFacet - i, i - 1) local nPrecFac if bOpposite then nPrecFac = EgtIf( i == 1, 0, nFac + 1) else nPrecFac = EgtIf( i == 1, nNumFacet - 1, i - 2) end -- recupero centro e normale della faccia local ptCen, vtN = EgtSurfTmFacetCenter( nNewProc, nFac, GDB_ID.ROOT) -- recupero le dimensioni della faccia local _, dLen, dWidth = WL.GetFaceHvRefDim( nNewProc, nFac) -- recupero l'angolo con la faccia precedente 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 for i = 1, #vFace do -- aggiorno la massima larghezza if vFace[i].Width > dMaxWidth then dMaxWidth = vFace[i].Width end -- verifico l'affondamento local dDepth = WD.CUT_EXTRA if vFace[i].Width + WD.CUT_EXTRA > dToolMaxDepth then dDepth = dToolMaxDepth - vFace[i].Width end -- lunghezza baffo local dElev = vFace[i].Width + dDepth local dWhisk = EgtIf( bCalclForBlade, ( dElev * sqrt( dToolDiam / dElev - 1) + WHISK_SAFE) , (dToolDiam/2) + WHISK_SAFE) -- determino la lunghezza del taglio passante e il tipo di attacco e uscita local dLen = vFace[i].Len local nType = 0 if vFace[i].AngPrev < -0.1 then dLen = dLen - EgtIf( bCalclForBlade, dWhisk, 0) nType = nType + 1 end if vFace[EgtIf( i < nNumFacet, i + 1, 1)].AngPrev < -0.1 then dLen = dLen - EgtIf( bCalclForBlade, dWhisk, 0) nType = nType + 2 end -- se lunghezza non significativa, non va inserito il taglio if dLen < MIN_LEN_CUT then nType = 4 end vFace[i].Depth = dDepth vFace[i].Whisk = dWhisk vFace[i].Type = nType end -- recupero le regioni degli altri pezzi local vOthers = GetOtherRegions( nPartId) -- verifico i baffi sporgenti dei tagli rispetto alle altre regioni for i = 1, #vFace do -- verifico il baffo iniziale if vFace[i].Type ~= 4 and ( vFace[i].Type & 1) == 0 then -- creo il rettangolo del baffo local vtOrt = Vector3d( vFace[i].Norm:getX(), vFace[i].Norm:getY(), 0) ; vtOrt:normalize() local vtDir = Vector3d( vtOrt) ; vtDir:rotate( Z_AX(), -90) local vtUp = Vector3d( vtDir) ; vtUp:rotate( vFace[i].Norm, -90) local ptIni = vFace[i].Cen + vFace[i].Width / 2 * vtUp + ( vFace[i].Len / 2 + WHISK_OFFS) * vtDir + WHISK_OFFS * vtOrt local ptDir = ptIni + ( vFace[i].Whisk - WHISK_OFFS) * vtDir local ptCross = ptDir + ( dToolThick - WHISK_OFFS) * vtOrt local WhId = EgtSurfFrRectangle3P( nAddGrpId, ptIni, ptCross, ptDir, GDB_RT.GLOB) local b3Wh = EgtGetBBoxGlob( WhId or GDB_ID.NULL, GDB_BB.STANDARD) -- verifico se interferisce con gli altri pezzi for j = 1, #vOthers do if OverlapsXY( b3Wh, vOthers[j].Box) then local nClass = EgtSurfFrChunkSimpleClassify( WhId, 0, vOthers[j].RegId, 0) if nClass ~= GDB_RC.OUT then local dLen = vFace[i].Len - vFace[i].Whisk + EgtIf( ( vFace[i].Type & 2) ~= 0, -vFace[i].Whisk, 0) if dLen >= MIN_LEN_CUT then vFace[i].Type = vFace[i].Type + 1 else vFace[i].Type = 4 end break end end end EgtErase( WhId) end -- verifico il baffo finale if vFace[i].Type ~= 4 and ( vFace[i].Type & 2) == 0 then -- creo il rettangolo del baffo local vtOrt = Vector3d( vFace[i].Norm:getX(), vFace[i].Norm:getY(), 0) ; vtOrt:normalize() local vtDir = Vector3d( vtOrt) ; vtDir:rotate( Z_AX(), 90) local vtUp = Vector3d( vtDir) ; vtUp:rotate( vFace[i].Norm, 90) local ptIni = vFace[i].Cen + vFace[i].Width / 2 * vtUp + ( vFace[i].Len / 2 + WHISK_OFFS) * vtDir + WHISK_OFFS * vtOrt local ptDir = ptIni + ( vFace[i].Whisk - WHISK_OFFS) * vtDir local ptCross = ptDir + ( dToolThick - WHISK_OFFS) * vtOrt local WhId = EgtSurfFrRectangle3P( nAddGrpId, ptIni, ptCross, ptDir, GDB_RT.GLOB) local b3Wh = EgtGetBBoxGlob( WhId or GDB_ID.NULL, GDB_BB.STANDARD) -- verifico se interferisce con gli altri pezzi for j = 1, #vOthers do if OverlapsXY( b3Wh, vOthers[j].Box) then local nClass = EgtSurfFrChunkSimpleClassify( WhId, 0, vOthers[j].RegId, 0) if nClass ~= GDB_RC.OUT then local dLen = vFace[i].Len - vFace[i].Whisk + EgtIf( ( vFace[i].Type & 1) ~= 0, -vFace[i].Whisk, 0) if dLen >= MIN_LEN_CUT then vFace[i].Type = vFace[i].Type + 2 else vFace[i].Type = 4 end break end end end EgtErase( WhId) end end -- eventuali stampe for i = 1, #vFace do local Face = vFace[i] local sOut = 'Face '..tostring( Face.Fac)..' C'..tostring( Face.Cen)..' N'..tostring( Face.Norm).. ' L='..EgtNumToString( Face.Len, 1)..' W='..EgtNumToString( Face.Width, 1)..' Ap='..EgtNumToString( Face.AngPrev, 1).. ' D='..EgtNumToString( Face.Depth, 1)..' B='..EgtNumToString( Face.Whisk, 1)..' T='..tostring( Face.Type) EgtOutLog( sOut) end return vFace, dMaxWidth, nNewProc end --------------------------------------------------------------------- local function GetTunnelDimension( nId, nPartId, nAddGrpId) -- ottengo i versori delle 4 facce e ottengo l'orientamento del tunnel -- recupero il numero di facce local nFacCnt = EgtSurfTmFacetCount( nId) -- recupero l'ingombro della trave local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) -- variabili dimensioni fessura e id faccia lunga local dDimMin local dDimMax local nLongIdFace = 0 local bNegFace local bOppoFace = false -- ottengo il versore ortogonale local ptN1, vtN1 = EgtSurfTmFacetCenter( nId, 0, GDB_ID.ROOT) local _, vtN2 = EgtSurfTmFacetCenter( nId, 1, GDB_ID.ROOT) local vtOrtho = vtN1 ^ vtN2 if vtOrtho:isSmall() then _, vtN2 = EgtSurfTmFacetCenter( nId, 2, GDB_ID.ROOT) vtOrtho = vtN1 ^ vtN2 bOppoFace = true end if vtOrtho:getZ() < -0.5 then vtOrtho = -vtOrtho bNegFace = true end -- ottengo il boundingBox e prendo le dimensioni lungo la normale (Z locale) che rappresenta la profondità della fessura local frFc = Frame3d( ptN1, vtOrtho) ; local bBoxLoc = EgtGetBBoxRef( nId, GDB_BB.STANDARD, frFc) local dDepth = bBoxLoc:getDimZ() -- mi assicuro che la Z del punto utilizzato per creare la superficie sia alla Z inferiore del bounding box locale local ptN2 = Point3d(ptN1) ptN2:toLoc(frFc) ptN2 = Point3d( ptN2:getX(), ptN2:getY(), bBoxLoc:getMin():getZ() + 2*GEO.EPS_SMALL) ptN2:toGlob(frFc) -- creo superficie intermedia local nSurfInt = EgtSurfTmPlaneInBBox( nAddGrpId, ptN2, vtOrtho, b3Solid, GDB_ID.ROOT) -- ritaglio la superficie con le facce della fessura for i = 1, nFacCnt do local ptN, vtN = EgtSurfTmFacetCenter( nId, i - 1, GDB_ID.ROOT) EgtCutSurfTmPlane( nSurfInt, ptN, -vtN, false, GDB_ID.ROOT) end -- sposto la geometria trovata sulla Z minima (era su di 2 * GEO.EPS_SMALL) EgtMove( nSurfInt, Point3d(0,0,-2*GEO.EPS_SMALL) - ORIG(), GDB_RT.GLOB) -- mi faccio dare il contorno della superfice e la ricreo in modo più corretto local nIdCont, nIdNum = EgtExtractSurfTmLoops( nSurfInt, nAddGrpId) -- elimino le entità allineate dello stesso tipo EgtMergeCurvesInCurveCompo( nIdCont, 2*GEO.EPS_SMALL) EgtErase(nSurfInt) nSurfInt = EgtSurfTmByFlatContour( nAddGrpId, nIdCont, 2*GEO.EPS_SMALL) -- elimino il contorno EgtErase(nIdCont) -- se normale negativa inverto _, vtN1 = EgtSurfTmFacetCenter( nSurfInt, 0, GDB_ID.ROOT) if vtN1:getZ() < -0.5 then EgtInvertSurf( nSurfInt) end local _, DimH, DimV = EgtSurfTmFacetMinAreaRectangle( nSurfInt, 0, GDB_ID.ROOT) dDimMin = min( DimH, DimV) dDimMax = max( DimH, DimV) _, DimH, DimV = EgtSurfTmFacetMinAreaRectangle( nId, nFacCnt-1, GDB_ID.ROOT) -- se faccia pari alla larghezza fessura if abs(DimH - dDimMax) < GEO.EPS_SMALL or abs(DimV - dDimMax) < GEO.EPS_SMALL then nLongIdFace = nFacCnt-1 -- altrimenti verifico anche con la faccia precedente else local nFaceToCheck = EgtIf( bOppoFace, nFacCnt-3, nFacCnt-2) -- prendo le dimensioni della faccia e poi confronto con il minimo _, DimH, DimV = EgtSurfTmFacetMinAreaRectangle( nId, nFaceToCheck, GDB_ID.ROOT) -- se trovato con il minimo, questa seconda faccia non è la più lunga if abs(DimH - dDimMin) < GEO.EPS_SMALL or abs(DimV - dDimMin) < GEO.EPS_SMALL then nLongIdFace = nFacCnt-1 else nLongIdFace = nFaceToCheck end end if not dDimMax then return dDimMin, dDimMax, dDepth, nil, nil end return dDimMin, dDimMax, dDepth, vtOrtho, nLongIdFace, nSurfInt end --------------------------------------------------------------------- local function ReorderFacesFromTab( nIdSurf, vFace) local nFacCnt = EgtSurfTmFacetCount( nIdSurf) for i = 1, #vFace do for j = 1, nFacCnt do -- ottengo punto iniziale e versore della faccia local ptC, vtN = EgtSurfTmFacetCenter( nIdSurf, (j-1), GDB_ID.ROOT) -- se versore e posizione coincidono e non corrispondono al numero faccia, faccio lo swap if AreSameVectorExact( vFace[i].Norm, vtN) and AreSamePointEpsilon( vFace[i].Cen, ptC, 50*GEO.EPS_SMALL) then if (j-1) ~= vFace[i].Fac then EgtSurfTmSwapFacets( nIdSurf, vFace[i].Fac, (j-1)) end break end end end return nIdSurf end --------------------------------------------------------------------- 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( 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( 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 if ( dist( ptLocP1, tFacAdj[1][4]) < GEO.EPS_SMALL) or ( dist( ptLocP2, tFacAdj[1][4]) < GEO.EPS_SMALL) then nIdEndPoint = 4 nIdIniPoint = 5 elseif ( dist( ptLocP1, tFacAdj[1][5]) < GEO.EPS_SMALL) or ( dist( ptLocP2, tFacAdj[1][5]) < GEO.EPS_SMALL) then nIdEndPoint = 5 nIdIniPoint = 4 end end -- versore direzione local vtExtr = tFacAdj[1][nIdIniPoint] - tFacAdj[1][nIdEndPoint] vtExtr:normalize() -- versore direzione di uscita local vtExtrExit -- inserisco le prime tre linee if nIdIniPoint and nIdEndPoint then -- se fresatura da sotto salto la lavorazione if vtExtr:getZ() < WD.DRILL_VZ_MIN then local sErr = 'Error : clean corner milling from bottom impossible' EgtOutLog( sErr) return false, sErr end -- sommo i tre versori per avere una direzione media vtExtrExit = vtN2 + vtN3 vtExtrExit:normalize() -- se tipo 1 calcolo angolo tilt di 45° if nTypeConeCut == 1 then vtExtr = vtExtrExit + Z_AX() -- altrimenti tipo 2, calcolo angolo tilt di 33° (dalla verticale) else 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° if nTypeConeCut == 1 then -- se offset angolare valido e/o negativo creo il baffo precedente if dOffsAng < ( 100 * GEO.EPS_SMALL) 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 ptApPoint = ptLocP2 else ptApPoint = ptLocP1 end nAuxId = EgtLine( nAddGrpId, tFacAdj[1][nIdEndPoint] + Point3d( 0, 0, -dDepthMach), ptApPoint + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB) local dLenTrimExt = dist( tFacAdj[1][nIdEndPoint], ptApPoint) - (( dToolDiam/2) + 2) -- se la distanza dei due punti della linea è maggiore dal raggio fresa + delta, trimmo al raggio fresa + delta if dLenTrimExt > 10 * GEO.EPS_SMALL then EgtTrimExtendCurveByLen( nAuxId , -dLenTrimExt, ptApPoint + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB) -- se ho l'offset angolare ruoto la linea per compensare la rotazione che verrà applicata if abs(dOffsAng) > 100 * GEO.EPS_SMALL then EgtRotate( nAuxId, tFacAdj[1][nIdEndPoint], Z_AX(), -dOffsAng, GDB_RT.GLOB) end -- prendo il nuovo punto finale ptApPoint = EgtEP( nAuxId, GDB_RT.GLOB) + Point3d( 0, 0, dDepthMach) else -- se ho l'offset angolare ruoto la linea per compensare la rotazione che verrà applicata if abs(dOffsAng) > 100 * GEO.EPS_SMALL then EgtRotate( nAuxId, tFacAdj[1][nIdEndPoint], Z_AX(), -dOffsAng, GDB_RT.GLOB) end end table.insert( pAuxId, nAuxId) -- creo linea di ritorno nAuxId = EgtLine( nAddGrpId, ptApPoint + Point3d( 0, 0, -dDepthMach), tFacAdj[1][nIdEndPoint] + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB) table.insert( pAuxId, nAuxId) end end end -- inserisco le ultime tre linee -- trovo il secondo punto sulla superfice di riferimento 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 ptApPoint = ptLocP2 else ptApPoint = ptLocP1 end -- se uso utensile cono 60° if nTypeConeCut == 1 then -- se offset angolare valido e/o negativo creo il baffo precedente if dOffsAng > -( 100 * GEO.EPS_SMALL) then nAuxId = EgtLine( nAddGrpId, tFacAdj[1][nIdEndPoint] + Point3d( 0, 0, -dDepthMach), ptApPoint + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB) local dLenTrimExt = dist( tFacAdj[1][nIdEndPoint], ptApPoint) - (( dToolDiam/2) + 2) -- se la distanza dei due punti della linea è maggiore dal raggio fresa + delta, trimmo al raggio fresa + delta if dLenTrimExt > 10 * GEO.EPS_SMALL then EgtTrimExtendCurveByLen( nAuxId , -dLenTrimExt, ptApPoint + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB) -- se ho l'offset angolare ruoto la linea per compensare la rotazione che verrà applicata if abs(dOffsAng) > 100 * GEO.EPS_SMALL then EgtRotate( nAuxId, tFacAdj[1][nIdEndPoint], Z_AX(), -dOffsAng, GDB_RT.GLOB) end -- prendo il nuovo punto finale ptApPoint = EgtEP( nAuxId, GDB_RT.GLOB) + Point3d( 0, 0, dDepthMach) else -- se ho l'offset angolare ruoto la linea per compensare la rotazione che verrà applicata if abs(dOffsAng) > 100 * GEO.EPS_SMALL then EgtRotate( nAuxId, tFacAdj[1][nIdEndPoint], Z_AX(), -dOffsAng, GDB_RT.GLOB) end end table.insert( pAuxId, nAuxId) -- creo linea di ritorno nAuxId = EgtLine( nAddGrpId, ptApPoint + Point3d( 0, 0, -dDepthMach), tFacAdj[1][nIdEndPoint] + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB) table.insert( pAuxId, nAuxId) end -- ultima linea di distacco (5mm in direzione utensile) local pEnd = tFacAdj[1][nIdEndPoint] + Point3d( 0, 0, -dDepthMach) + ( 5 * vtExtr) nAuxId = EgtLine( nAddGrpId, tFacAdj[1][nIdEndPoint] + Point3d( 0, 0, -dDepthMach), pEnd, GDB_RT.GLOB) table.insert( pAuxId, nAuxId) else -- linea di distacco (2mm in direzione utensile) local pEnd = tFacAdj[1][nIdEndPoint] + ( 2 * vtExtr) nAuxId = EgtLine( nAddGrpId, tFacAdj[1][nIdEndPoint], pEnd, GDB_RT.GLOB) table.insert( pAuxId, nAuxId) -- ultima linea di risalita in Z local pIni = pEnd pEnd = pIni + ( dThick * Z_AX()) nAuxId = EgtLine( nAddGrpId, pIni, pEnd, GDB_RT.GLOB) table.insert( pAuxId, nAuxId) end end -- trasformo in percorso if #pAuxId > 0 then AuxId = EgtCurveCompo( nAddGrpId, pAuxId, true) end -- se non c'é il percorso do errore if not AuxId then local sErr = 'Error : impossible make clean corner path' EgtOutLog( sErr) return false, sErr end -- modifico versore direzione EgtModifyCurveExtrusion( AuxId, vtExtr, GDB_RT.GLOB) -- se ho un offset angolare ruoto il percorso if abs(dOffsAng) > 100 * GEO.EPS_SMALL then EgtRotate( AuxId, tFacAdj[1][nIdEndPoint], Z_AX(), dOffsAng, GDB_RT.GLOB) end -- inserisco la lavorazione local sName = 'Clean_' .. ( EgtGetName( nNewProc) or tostring( nNewProc)) local nMchId = EgtAddMachining( sName, sMilling) if not nMchId then local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling EgtOutLog( sErr) return false, sErr end -- se flag lavorazione spessore passante setto la nota per spostarla dopo i tagli di lama if bThruThick and nTypeConeCut == 1 then EgtSetInfo( nMchId, 'MOVE_AFTER', 1) 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) EgtSetMachiningParam( MCH_MP.LEADINTYPE, 0) EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, 4) -- allungo inizio e fine di 10mm EgtSetMachiningParam( MCH_MP.STARTADDLEN, 10) EgtSetMachiningParam( MCH_MP.ENDADDLEN, 10) -- setto affondamento 0 EgtSetMachiningParam( MCH_MP.DEPTH, 0) -- Note utente con dichiarazione nessuna generazione sfridi per Vmill local sUserNotes = 'VMRS=0;' -- aggiungo alle note massima elevazione -- sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( dMaxDepth, 1) .. ';' sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( 0.0, 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( nMchId, false) return false, sWarn end end return true, '' end --------------------------------------------------------------------- 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 if nTypeConeCut == 1 then -- recupero la lavorazione di fresatura sMilling, dMaxDepth = WM.FindMilling( 'CleanCorner60') if not sMilling then local sErr = 'Error : CleanCorner 60 not found in library' EgtOutLog( sErr) return false, sErr end -- se ripresa angolo con fresa cono piccola senza ripresa else sMilling, dMaxDepth = WM.FindMilling( 'CleanCorner30') if not sMilling then local sErr = 'Error : CleanCorner 30 not found in library' EgtOutLog( sErr) 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 local dSideAng = 0 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 dSideAng = EgtTdbGetCurrToolParam( MCH_TP.SIDEANG) or dSideAng 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 -- calcolo il secondo diametro del cono dMillTotDiam = dMillDiam + ( abs(dThickTool) * tan(dSideAng)) * 2 end end -- copio la feature nel layer di appoggio local nNewProc if nMasterNewProc then nNewProc = nMasterNewProc else nNewProc = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL end 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 bMakeLocSurf = true end -- verifico se ciclo chiuso local bClosed = ( abs( vFace[1].AngPrev) > 0.1) -- ciclo di inserimento delle fresate sulle facce del contorno in esame local i = 1 -- se faccia finale con fine non lavorato, forzo partenza da prima faccia non tutta saltata (tipo 4) if bClosed and ( vFace[#vFace].Type == 4 or ( vFace[#vFace].Type & 2) ~= 0) then while i <= #vFace and vFace[i].Type == 4 do i = i + 1 end end -- se facce tutte da saltare, parto dall'inizio local bAllType4 = ( i > #vFace) if bAllType4 then i = 1 end while i <= #vFace do -- se tutta la faccia o la sua fine senza taglio, inserisco una fresatura if ( vFace[i].Type & 2) ~= 0 or vFace[i].Type == 4 then -- variabili costruzione geometria 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, 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 if #tFacAdj > 0 then 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, 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, 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, bThruThick, dDepth, dMillDiam, dMillTotDiam, abs(dThickTool), dMaxDepth, dMillDiamTh, dToolLength, bMakeLocSurf, vFace) if not bOk then return bOk, sErr end end end else i = i + 1 end end -- cancello la copia della superfice if nNewProc then EgtErase(nNewProc) end return true end --------------------------------------------------------------------- local function MakeByChainSaw( Proc, nFacet, nRawId, b3Raw, dElev, dH, dV) local sWarn -- dati della faccia local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacet, GDB_ID.ROOT) -- Recupero le facce adiacenti alla principale local vAdj = EgtSurfTmFacetAdjacencies( Proc.Id, nFacet)[1] if not vAdj or #vAdj == 0 then local sErr = 'Error : main face without adjacencies' EgtOutLog( sErr) return false, sErr end EgtOutLog( 'Adjac=' .. table.concat( vAdj, ','), 3) -- Cerco una faccia adiacente alla principale sul lato più lungo local nFacAdj local dMaxLen = 0 for i = 1, #vAdj do if vAdj[i] >= 0 then local _, ptP1, ptP2, _ = EgtSurfTmFacetsContact( Proc.Id, nFacet, vAdj[i], GDB_ID.ROOT) local dLen = dist( ptP1, ptP2) local vtAdjN = EgtSurfTmFacetNormVersor( Proc.Id, vAdj[i], GDB_ID.ROOT) if dLen > dMaxLen - 1 and vtAdjN:getZ() > -0.1 then nFacAdj = vAdj[i] dMaxLen = dLen EgtOutLog( string.format( 'Adjac=%d Len=%.3f H=%.3f V=%.3f', vAdj[i], dLen, dH, dV), 3) end end end if not nFacAdj then local sErr = 'Error : long adjacent face not found' EgtOutLog( sErr) return false, sErr end -- Recupero la lavorazione local sSawing = WM.FindSawing( 'Sawing') if not sSawing then local sErr = 'Error : chainsawing not found in library' EgtOutLog( sErr) return false, sErr, 'MNF' end -- Recupero i dati dell'utensile local dSawWidth = 75 local dSawThick = 8 local dMaxDepth = 200 if EgtMdbSetCurrMachining( sSawing) then local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then dSawWidth = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawWidth dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth end end if dSawThick > dV + 10 * GEO.EPS_SMALL then local sErr = 'Error : chainsaw too thick' EgtOutLog( sErr) return false, sErr end -- Calcolo uso faccia local nFaceUse = WL.GetNearestParalOpposite( vtN) -- Calcolo angolo 3° asse rot (da direz. utensile) local d3RotAng = 180 -- Lati chiusi local bOpenStart = false local bOpenEnd = false -- Verifico se necessarie più passate local nStep = ceil( ( dV - 10 * GEO.EPS_SMALL) / dSawThick) local dStep = 0 if nStep > 1 then dStep = ( dV - dSawThick) / ( nStep - 1) end for i = 1, nStep do -- Applico la lavorazione con sega a catena a questa faccia local sName = 'Csaw_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( i) local nMchFId = EgtAddMachining( sName, sSawing) if not nMchFId then local sErr = 'Error adding machining ' .. sName .. '-' .. sSawing EgtOutLog( sErr) return false, sErr end -- aggiungo geometria EgtSetMachiningGeometry( {{ Proc.Id, nFacAdj}}) -- imposto uso faccia EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) -- imposto accorciamento iniziale/finale per estremi aperti/chiusi EgtSetMachiningParam( MCH_MP.STARTADDLEN, EgtIf( bOpenStart, 0, - dSawWidth / 2)) EgtSetMachiningParam( MCH_MP.ENDADDLEN, EgtIf( bOpenEnd, 0, - dSawWidth / 2)) -- imposto angolo 3° asse rot EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, 'A1=' .. EgtNumToString( d3RotAng)) -- imposto offset radiale local dOffs = ( i - 1) * dStep EgtSetMachiningParam( MCH_MP.OFFSR, dOffs) -- se necessario, limito l'affondamento if dElev > dMaxDepth + 10 * GEO.EPS_SMALL then sWarn = 'Warning in LapJoint : elevation (' .. EgtNumToString( dElev, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')' dDepth = dMaxDepth - dElev EgtOutLog( sWarn) EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH '..EgtNumToString( dDepth, 1)) end -- imposto elevazione local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 2) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) -- eseguo if not EgtApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr elseif EgtIsMachiningEmpty() then _, sWarn = EgtGetMachMgrWarning( 0) EgtSetOperationMode( nMchFId, false) return false, sWarn end end return true end --------------------------------------------------------------------- local function MakeByMill( Proc, nFacet, nOthFac, nRawId, b3Raw) -- dati della faccia e dell'altra local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacet, GDB_ID.ROOT) local dElev = WL.GetFaceElevation( Proc.Id, nFacet, nRawId) local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacet, GDB_ID.ROOT) local dDiam = min( dH, dV) local _, vtRef = EgtSurfTmFacetCenter( Proc.Id, nOthFac, GDB_ID.ROOT) -- recupero la lavorazione local sMilling = WM.FindMilling( 'Side') if not sMilling then return false end -- recupero i dati dell'utensile local dMillDiam = 20 local dMillLen = 10 local dMillTotLen = 30 local dMaxDepth = 0 local dThDiam = 100 if EgtMdbSetCurrMachining( sMilling) then local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam dMillLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dMillLen dMillTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) or dMillTotLen dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth dThDiam = EgtTdbGetCurrToolThDiam() or dThDiam end end if dMillDiam < dDiam or dMaxDepth < dElev then local sErr = 'Error : Side Elevation too big' EgtOutLog( sErr) return false, sErr end local dMillExtra = dMillTotLen - dMillLen if Proc.Box:getMin():getZ() - dMillExtra < b3Raw:getMin():getZ() - 10 * GEO.EPS_SMALL then local sErr = 'Error : Tool collide with table' EgtOutLog( sErr) return false, sErr end -- inserisco la lavorazione di contornatura local sName = 'Mill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local nMchFId = EgtAddMachining( sName, sMilling) if not nMchFId then local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling EgtOutLog( sErr) return false, sErr end -- aggiungo geometria EgtSetMachiningGeometry( {{ Proc.Id, nFacet}}) -- imposto posizione braccio porta testa local nSCC = MCH_SCC.ADIR_ZP if AreSameVectorApprox( vtN, Z_AX()) then nSCC = EgtIf( Proc.Box:getDimX() >= Proc.Box:getDimY(), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_XP) end EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- imposto modo di lavorare la faccia local nFaceUse = WL.GetNearestOrthoOpposite( vtRef, vtN) EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) -- eseguo if not EgtApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtRemoveOperation( nMchFId) return false, sErr end return true end --------------------------------------------------------------------- local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw) -- dati della faccia local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacet, GDB_ID.ROOT) local dElev = WL.GetFaceElevation( Proc.Id, nFacet, nRawId) local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacet, GDB_ID.ROOT) local dThick = min( dH, dV) -- recupero la lavorazione local sMilling = WM.FindMilling( 'SideGroove') if not sMilling then local sErr = 'Error : SideGroove not found in library' EgtOutLog( sErr) return false, sErr end -- recupero i dati dell'utensile local dMillDiam = 20 local dMillLen = 10 local dMillTotLen = 30 local dMaxMat = 0 if EgtMdbSetCurrMachining( sMilling) then local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam dMillLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dMillLen dMillTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) or dMillTotLen dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat end end if dElev > dMillDiam / 2 - 30 then local sErr = 'Error : Side Elevation too big' EgtOutLog( sErr) return false, sErr end local dMillExtra = dMillTotLen - dMillLen if Proc.Box:getMin():getZ() - dMillExtra < b3Raw:getMin():getZ() - 10 * GEO.EPS_SMALL then local sErr = 'Error : Tool collide with table' EgtOutLog( sErr) return false, sErr end -- inserisco la lavorazione di contornatura local sName = 'Mill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local nMchFId = EgtAddMachining( sName, sMilling) if not nMchFId then local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling EgtOutLog( sErr) return false, sErr end -- aggiungo geometria EgtSetMachiningGeometry( {{ Proc.Id, nFacet}}) -- imposto posizione braccio porta testa local nSCC = MCH_SCC.ADIR_ZP if AreSameVectorApprox( vtN, Z_AX()) then nSCC = EgtIf( Proc.Box:getDimX() >= Proc.Box:getDimY(), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_XP) end EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- imposto modo di lavorare la faccia local nFaceUse = WL.GetNearestParalOpposite( Z_AX(), vtN) EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) -- imposto elevazione e step local dStep = EgtGetMachiningParam( MCH_MP.STEP) if dStep < GEO.EPS_SMALL then dStep = dMaxMat end local nStep = ceil( ( dThick - dMaxMat) / dStep) dStep = ( dThick - dMaxMat) / nStep local dMaxElev = ( nStep + 1) * dStep - GEO.EPS_SMALL EgtSetMachiningParam( MCH_MP.STEP, dStep) EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxElev, 3) .. ';') -- eseguo if not EgtApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtRemoveOperation( nMchFId) return false, sErr end return true end --------------------------------------------------------------------- local function MakeByPocketing( Proc, nFacet, nRawId, b3Raw, bCheckQPar) -- dati della faccia local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacet, GDB_ID.ROOT) local dElev = WL.GetFaceElevation( Proc.Id, nFacet, nRawId) local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacet, GDB_ID.ROOT) local dDiam = min( dH, dV) -- gruppo ausiliario local nAddGrpId = WL.GetAddGroup( Proc.PartId) local nNewProc, nNumFacet = RemoveBottomFaceAndReorder( Proc, nAddGrpId, nFacet) -- se ho forma a L local bIsL = ( nNumFacet == 2 or TestElleShape3( nNewProc, nNumFacet) or TestElleShape4( nNewProc, nNumFacet) == 2) -- verifico se U local bIsU = ( nNumFacet == 3 and not TestElleShape3( nNewProc, nNumFacet)) local dMiddleFacetLength = 0 if bIsU then local _, dH2, dV2 = EgtSurfTmFacetMinAreaRectangle( nNewProc, 1, GDB_ID.ROOT) -- prendo la linea di base if abs( dElev - dH2) < 1 and abs ( dElev - dV2) > 1 then dMiddleFacetLength = dV2 elseif abs( dElev - dV2) < 1 and abs ( dElev - dH2) > 1 then dMiddleFacetLength = dH2 end end if Proc.Fct < 5 and (( bIsL and not bIsU) or ( bIsU and dMiddleFacetLength > dDiam * 2)) then dDiam = dDiam * 2 end -- recupero la lavorazione local sPocketing = WM.FindPocketing( 'Pocket', dDiam, dElev) if not sPocketing then sPocketing = WM.FindPocketing( 'Pocket', dDiam) if not sPocketing then local sErr = 'Error : pocketing not found in library' EgtOutLog( sErr) return false, sErr end end -- recupero i dati dell'utensile local dMillDiam = 20 local dMaxDepth = 0 local dThDiam = 100 if EgtMdbSetCurrMachining( sPocketing) then local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth dThDiam = EgtTdbGetCurrToolThDiam() or dThDiam end end -- inserisco la lavorazione di svuotatura local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local nMchFId = EgtAddMachining( sName, sPocketing) if not nMchFId then local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing EgtOutLog( sErr) return false, sErr end -- aggiungo geometria EgtSetMachiningGeometry( {{ Proc.Id, nFacet}}) -- imposto posizione braccio porta testa local nSCC = MCH_SCC.ADIR_ZP if AreSameVectorApprox( vtN, Z_AX()) then nSCC = EgtIf( Proc.Box:getDimX() >= Proc.Box:getDimY(), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_XP) end EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente local dThElev = dThDiam / 2 * sqrt( vtN:getX() * vtN:getX() + vtN:getY() * vtN:getY()) local dDepth = 0 local sWarn = '' if dElev + dThElev > dMaxDepth + 10 * GEO.EPS_SMALL then dDepth = dMaxDepth - dElev - dThElev sWarn = 'Warning : elevation bigger than max tool depth' EgtOutLog( sWarn) end EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) -- imposto elevazione EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( min( dElev, dMaxDepth), 1) .. ';') -- eseguo if not EgtApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr end -- verifica parametro Q per pulitura spigoli if bCheckQPar then -- lettura parametri (probabile/i parametro/i Q) local nConeCut = VerifyCornerType( Proc) -- recupero i dati di tutte le facce 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) if not bMcok then return bMcok, sMcErr end else EgtErase( nNewProc) end else EgtErase( nNewProc) end return true, sWarn end --------------------------------------------------------------------- local function MakeOneFace( Proc, nRawId, b3Raw) -- dati della faccia local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) -- dimensioni della faccia local _, dDimH, dDimV = WL.GetFaceHvRefDim( Proc.Id, 0) -- recupero la lavorazione di taglio con lama e i suoi parametri local sCutting, dSawDiam, dSawThick, dSawMaxDepth = WM.FindCutting( 'Standard') -- se non inclinata o capacità di taglio non sufficiente, provo con svuotatura if not sCutting or vtN:getZ() > 0.95 or dSawMaxDepth < dDimV + WD.CUT_SIC then -- faccio con svuotatura local nFacet = 0 return MakeByPocketing( Proc, nFacet, nRawId, b3Raw) end -- eseguo il taglio di lama local sName = 'Cut_' .. ( EgtGetName( Proc.PartId) or tostring( Proc.PartId)) .. '_' .. tostring( Proc.Id) local nMchId = EgtAddMachining( sName, sCutting) if not nMchId then local sErr = 'Error adding machining ' .. sName .. '-' .. sCutting EgtOutLog( sErr) return false, sErr end -- aggiungo geometria EgtSetMachiningGeometry( { { Proc.Id, 0}}) -- percorso da non invertire EgtSetMachiningParam( MCH_MP.INVERT, false) -- assegno affondamento EgtSetMachiningParam( MCH_MP.DEPTH, 0) -- assegno il lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) -- assegno l'attacco e l'uscita EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_SAW_LI.CENT) EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_SAW_LO.CENT) -- nessun criterio per il braccio è necessario EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.NONE) -- eseguo if not EgtApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr end return true end --------------------------------------------------------------------- local function MakeTwoFaces( Proc, nRawId, b3Raw) -- dati delle facce local ptC = {} local vtN = {} ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT) -- determino l'intersezione tra le due facce local bAdj, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT) if not bAdj then return false, 'Feature with two faces not adjacentes' end -- versore della linea di intersezione local vtX = ptP2 - ptP1 ; vtX:normalize() -- larghezza delle facce ortogonalmente all'intersezione local dDimY = {} for i = 1, 2 do local vtY = vtN[i] ^ vtX ; vtY:normalize() local frRef = Frame3d( ptC[i], ptC[i] + 100 * vtX, ptC[i] + 100 * vtY) local b3Ref = EgtSurfTmGetFacetBBoxRef( Proc.Id, i - 1, GDB_BB.STANDARD, frRef) dDimY[i] = b3Ref:getDimY() end -- recupero la lavorazione di taglio con lama e i suoi parametri local sCutting, dSawDiam, dSawThick, dSawMaxDepth = WM.FindCutting( 'Standard') -- se di fianco in basso if vtN[1]:getZ() < -0.95 or vtN[2]:getZ() < -0.95 then -- cerco la faccia orizzontale local nFacet = EgtIf( abs( vtN[1]:getZ()) < 0.1, 0, 1) -- se vicino al bordo del grezzo e non troppo larga, provo con fresatura di fianco local ptMid = ( ptP1 + ptP2) / 2 if abs( ptMid:getX() - b3Raw:getMin():getX()) < 300 or abs( ptMid:getX() - b3Raw:getMax():getX()) < 300 or abs( ptMid:getY() - b3Raw:getMin():getY()) < 300 or abs( ptMid:getY() - b3Raw:getMax():getY()) < 300 then return MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw) end -- se altrimenti di fianco in alto elseif vtN[1]:getZ() > 0.95 or vtN[2]:getZ() > 0.95 then -- cerco la faccia con il maggior numero di adiacenze (e minor elevazione) local nFacInd, _, nFacInd2 = WL.GetFaceWithMostAdj( Proc.Id, Proc.PartId) local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT) local nFacet = EgtIf( vtN:getZ() >= WD.NZ_MINA, nFacInd, nFacInd2) -- se vicino al bordo del grezzo e non troppo larga, provo con fresatura di fianco local ptMid = ( ptP1 + ptP2) / 2 if abs( ptMid:getX() - b3Raw:getMin():getX()) < 300 or abs( ptMid:getX() - b3Raw:getMax():getX()) < 300 or abs( ptMid:getY() - b3Raw:getMin():getY()) < 300 or abs( ptMid:getY() - b3Raw:getMax():getY()) < 300 then if MakeByMill( Proc, nFacet, 1 - nFacet, nRawId, b3Raw) then return true 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 -- eseguo la svuotatura return MakeByPocketing( Proc, nFacet, nRawId, b3Raw) end end -- ordino i tagli per fare prima quello meno inclinato local nOrd = { 0, 1} if vtN[2]:getZ() > vtN[1]:getZ() then nOrd = { 1, 0} end -- eseguo i tagli di lama for i = 1, 2 do -- inserisco la lavorazione local sName = 'Cut_' .. ( EgtGetName( Proc.PartId) or tostring( Proc.PartId)) .. '_' .. tostring( Proc.Id) .. '_' .. tostring( i) local nMchId = EgtAddMachining( sName, sCutting) if not nMchId then local sErr = 'Error adding machining ' .. sName .. '-' .. sCutting EgtOutLog( sErr) return false, sErr end -- aggiungo geometria EgtSetMachiningGeometry( { { Proc.Id, nOrd[i]}}) -- percorso da non invertire EgtSetMachiningParam( MCH_MP.INVERT, false) -- assegno affondamento EgtSetMachiningParam( MCH_MP.DEPTH, 0) -- assegno il lato di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) -- assegno l'attacco e l'uscita EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_SAW_LI.CENT) EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_SAW_LO.CENT) -- nessun criterio per il braccio è necessario EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.NONE) -- eseguo if not EgtApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchId, false) return false, sErr end end return true end --------------------------------------------------------------------- local function MakeMoreFaces( Proc, nRawId, b3Raw) -- con una faccia di fondo valida if Proc.Stype == 1 or Proc.Stype == 2 then -- cerco la faccia con il maggior numero di adiacenze local nFacInd, dElev, nFacInd2, dElev2 = WL.GetFaceWithMostAdj( Proc.Id, Proc.PartId) -- se necessario scambio le facce if Proc.Stype == 2 then nFacInd, dElev, nFacInd2, dElev2 = nFacInd2, dElev2, nFacInd, dElev end local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT) local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT) -- se di fianco if Proc.Fct >= 3 and vtN:getZ() < WD.NZ_MINA then -- fresatura if dElev < 200 then return MakeSideGrooveByMill( Proc, nFacInd, nRawId, b3Raw) -- altrimenti sega a catena else return MakeByChainSaw( Proc, nFacInd, nRawId, b3Raw, dElev, dH, dV) end end local nFacet = EgtIf( vtN:getZ() >= WD.NZ_MINA, nFacInd, nFacInd2) -- eseguo la svuotatura return MakeByPocketing( Proc, nFacet, nRawId, b3Raw, true) -- fessura verticale elseif Proc.Stype == 3 then -- riordino le facce come contorno libero da lavorare a destra (sono una U) -- porto la faccia centrale in seconda posizione (indice 1) local nFacInd = WL.GetFaceWithMostAdj( Proc.Id, Proc.PartId) if nFacInd ~= 1 then EgtSurfTmSwapFacets( Proc.Id, 1, nFacInd) end -- verifico se la prima (indice 0) la deve precedere o seguire local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) local bAdj, ptAdj, _, _ = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT) if bAdj and ( vtN ^ ( ptAdj - ptC)) * Z_AX() < 0 then EgtSurfTmSwapFacets( Proc.Id, 0, 2) end -- applico lavorazione di contorno libero return FreeContour.Make( Proc, nRawId, b3Raw) -- tunnel elseif Proc.Stype == 4 then -- riordino le facce come contorno libero da lavorare a destra (formano un anello chiuso e quindi posso partire da una qualunque) for i = 1, Proc.Fct - 2 do local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, i - 1, GDB_ID.ROOT) for j = i + 1, Proc.Fct do local bAdj, ptAdj, _, _ = EgtSurfTmFacetsContact( Proc.Id, i - 1, j - 1, GDB_ID.ROOT) if bAdj and ( vtN ^ ( ptAdj - ptC)) * Z_AX() > 0 then if i ~= j - 1 then EgtSurfTmSwapFacets( Proc.Id, i, j - 1) end break end end end -- applico lavorazione di contorno libero return FreeContour.Make( Proc, nRawId, b3Raw) end end --------------------------------------------------------------------- -- Applicazione della lavorazione function WPL.Make( Proc, nRawId, b3Raw) if Proc.Fct == 1 then return MakeOneFace( Proc, nRawId, b3Raw) elseif Proc.Fct == 2 then return MakeTwoFaces( Proc, nRawId, b3Raw) else return MakeMoreFaces( Proc, nRawId, b3Raw) end end --------------------------------------------------------------------- return WPL