diff --git a/LuaLibs/WProcessFreeContour.lua b/LuaLibs/WProcessFreeContour.lua index 482f28e..2e31524 100644 --- a/LuaLibs/WProcessFreeContour.lua +++ b/LuaLibs/WProcessFreeContour.lua @@ -777,9 +777,9 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp -- creo superfice locale o esco local nSurfToAdd = MakeLocalSurf( tFacAdj[7], tFacAdj[8], tFacAdj[9], nAddGrpId) if nSurfToAdd then - local nFacCntPre = EgtSurfTmFacetCount( nNewProc) + local nFacCntPre = EgtSurfTmFacetCount( nNewProc.Id) -- creo copia del percorso principale e gli aggiungo la nuova faccia - nNewProcLoc = EgtCopyGlob( nNewProc, nAddGrpId) + nNewProcLoc = EgtCopyGlob( nNewProc.Id, nAddGrpId) nNewProcLoc = EgtSurfTmBySewing( nAddGrpId, {nNewProcLoc,nSurfToAdd} , true) -- riordino le facce ReorderFacesFromTab( nNewProcLoc, vFace) @@ -790,7 +790,7 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp return true, '' end else - nNewProcLoc = nNewProc + nNewProcLoc = nNewProc.Id end -- prendo il primo versore local _, vtN1 = EgtSurfTmFacetCenter( nNewProcLoc, nFacInd, GDB_ID.ROOT) @@ -847,7 +847,7 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp vtCheck:rotate( Z_AX(), dOffsAng) end -- controllo se c'è collisione con le facce della superfice - if nTypeConeCut == 1 and CalcInterference( nNewProc, vtCheck, tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), dDiam1, dDiam2, + if nTypeConeCut == 1 and CalcInterference( nNewProc.Id, vtCheck, tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), dDiam1, dDiam2, dTall1, dTall2, dDiam3, dTall3) then local sErr = 'Collision detect from clean corner tool and surface' EgtOutLog( sErr) @@ -944,6 +944,8 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp -- trasformo in percorso if #pAuxId > 0 then AuxId = EgtCurveCompo( nAddGrpId, pAuxId, true) + EgtSetInfo( AuxId, 'TASKID', nNewProc.TaskId) + EgtSetInfo( AuxId, 'CUTID', nNewProc.CutId) end -- se non c'é il percorso do errore if not AuxId then @@ -958,8 +960,8 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp EgtRotate( AuxId, tFacAdj[nIdEndPoint], Z_AX(), dOffsAng, GDB_RT.GLOB) end -- inserisco la lavorazione - local sName = 'Clean_' .. ( EgtGetName( nNewProc) or tostring( nNewProc)) - local nMchId = WM.AddMachining( nNewProc, sName, sMilling) + local sName = 'Clean_' .. ( EgtGetName( nNewProc.Id) or tostring( nNewProc.Id)) + local nMchId = WM.AddMachining( nNewProc.Id, sName, sMilling) if not nMchId then local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling EgtOutLog( sErr) @@ -1052,26 +1054,26 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw, -- verifico se ciclo chiuso local bClosed = ( abs( vFace[1].PrevAng) > 0.1) -- copio la feature nel layer di appoggio - local nNewProc + local nNewProc = { CutId = Proc.CutId, TaskId = Proc.TaskId} if nMasterNewProc then - nNewProc = nMasterNewProc + nNewProc.Id = nMasterNewProc else - nNewProc = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL + nNewProc.Id = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL end - local nFacCnt = EgtSurfTmFacetCount( nNewProc) + local nFacCnt = EgtSurfTmFacetCount( nNewProc.Id) local nFacInd, dDepth, nSurfInt local bMakeLocSurf -- RIMUOVERE if false and nFacCnt <= 4 then -- recupero profondità e faccia di fondo - _, _, dDepth, _, _, nSurfInt = GetTunnelDimension( nNewProc, Proc.PartId, nAddGrpId, bClosed) + _, _, dDepth, _, _, nSurfInt = GetTunnelDimension( nNewProc.Id, Proc.PartId, nAddGrpId, bClosed) if nSurfInt then -- aggiungo la faccia di fondo appena calcolata - nNewProc = EgtSurfTmBySewing( nAddGrpId, { nNewProc, nSurfInt}, true) + nNewProc.Id = EgtSurfTmBySewing( nAddGrpId, { nNewProc.Id, nSurfInt}, true) -- riordino le facce - ReorderFacesFromTab( nNewProc, vFace) + ReorderFacesFromTab( nNewProc.Id, vFace) -- aggiorno numero di facce e assegno indice di quella di fondo (sempre ultima) - nFacCnt = EgtSurfTmFacetCount( nNewProc) + nFacCnt = EgtSurfTmFacetCount( nNewProc.Id) nFacInd = nFacCnt - 1 else return true @@ -1119,7 +1121,7 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw, ptLoc2 = vFace[k].PPrev end -- ricavo i punti e l'angolo interno - local _, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( nNewProc, nFace1, nFace2, GDB_ID.ROOT) + local _, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( nNewProc.Id, nFace1, nFace2, GDB_ID.ROOT) -- se punti validi e angolo è interno e non è quasi piatto e >= 90 creo istanza local tFacAdj = {} if ptP1 and ptP2 and dAng < 0 and dAng < -6 and dAng > EgtIf( nTypeConeCut == 1, -(90 + 10 * GEO.EPS_SMALL), -(180-dAngleSmall + 10 * GEO.EPS_SMALL)) then @@ -1157,8 +1159,8 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw, i = i + 1 end -- cancello la copia della superfice - if nNewProc then - EgtErase( nNewProc) + if nNewProc.Id then + EgtErase( nNewProc.Id) end return true end diff --git a/LuaLibs/WProcessLapJoint.lua b/LuaLibs/WProcessLapJoint.lua index 95e736d..4cb147b 100644 --- a/LuaLibs/WProcessLapJoint.lua +++ b/LuaLibs/WProcessLapJoint.lua @@ -760,9 +760,9 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp -- creo superfice locale o esco local nSurfToAdd = MakeLocalSurf( tFacAdj[7], tFacAdj[8], tFacAdj[9], nAddGrpId) if nSurfToAdd then - local nFacCntPre = EgtSurfTmFacetCount( nNewProc) + local nFacCntPre = EgtSurfTmFacetCount( nNewProc.Id) -- creo copia del percorso principale e gli aggiungo la nuova faccia - nNewProcLoc = EgtCopyGlob( nNewProc, nAddGrpId) + nNewProcLoc = EgtCopyGlob( nNewProc.Id, nAddGrpId) nNewProcLoc = EgtSurfTmBySewing( nAddGrpId, {nNewProcLoc,nSurfToAdd} , true) -- riordino le facce nNewProcLoc = ReorderFacesFromTab( nNewProcLoc, vFace) @@ -775,7 +775,7 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp return true, '' end else - nNewProcLoc = nNewProc + nNewProcLoc = nNewProc.Id end -- prendo il primo versore local _, vtN1 = EgtSurfTmFacetCenter( nNewProcLoc, nFacInd, GDB_ID.ROOT) @@ -829,7 +829,7 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp vtCheck:rotate( Z_AX(), dOffsAng) end -- controllo se c'è collisione con le facce della superfice - if nTypeConeCut == 1 and CalcInterference( nNewProc, vtCheck, tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), dDiam1, dDiam2, + if nTypeConeCut == 1 and CalcInterference( nNewProc.Id, vtCheck, tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), dDiam1, dDiam2, dTall1, dTall2, dDiam3, dTall3) then local sErr = 'Collision detect from clean corner tool and surface' EgtOutLog( sErr) @@ -926,6 +926,8 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp -- trasformo in percorso if #pAuxId > 0 then AuxId = EgtCurveCompo( nAddGrpId, pAuxId, true) + EgtSetInfo( AuxId, 'TASKID', nNewProc.TaskId) + EgtSetInfo( AuxId, 'CUTID', nNewProc.CutId) end -- se non c'é il percorso do errore if not AuxId then @@ -940,8 +942,8 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp EgtRotate( AuxId, tFacAdj[nIdEndPoint], Z_AX(), dOffsAng, GDB_RT.GLOB) end -- inserisco la lavorazione - local sName = 'Clean_' .. ( EgtGetName( nNewProc) or tostring( nNewProc)) - local nMchId = WM.AddMachining( nNewProc, sName, sMilling) + local sName = 'Clean_' .. ( EgtGetName( nNewProc.Id) or tostring( nNewProc.Id)) + local nMchId = WM.AddMachining( nNewProc.Id, sName, sMilling) if not nMchId then local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling EgtOutLog( sErr) @@ -1035,27 +1037,27 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw, end end -- copio la feature nel layer di appoggio - local nNewProc + local nNewProc = { CutId = Proc.CutId, TaskId = Proc.TaskId} if nMasterNewProc then - nNewProc = nMasterNewProc + nNewProc.Id = nMasterNewProc else - nNewProc = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL + nNewProc.Id = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL end - local nFacCnt = EgtSurfTmFacetCount( nNewProc) + local nFacCnt = EgtSurfTmFacetCount( nNewProc.Id) local nFacInd, dDimMin, dDimMax, dDepth, nSurfInt local bMakeLocSurf -- RIMUOVERE if false and nFacCnt <= 4 then -- ottengo le dimensioni apertura, la normale e la faccia inferiore - dDimMin, dDimMax, dDepth, _, _, nSurfInt = GetTunnelDimension( nNewProc, Proc.PartId, nAddGrpId) + dDimMin, dDimMax, dDepth, _, _, nSurfInt = GetTunnelDimension( nNewProc.Id, 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) + nNewProc.Id = EgtSurfTmBySewing( nAddGrpId, {nNewProc.Id,nSurfInt} , true) -- riordino le facce - nNewProc = ReorderFacesFromTab( nNewProc, vFace) + nNewProc.Id = ReorderFacesFromTab( nNewProc.Id, vFace) -- acquisisco il numero della faccia - nFacCnt = EgtSurfTmFacetCount( nNewProc) + nFacCnt = EgtSurfTmFacetCount( nNewProc.Id) nFacInd = nFacCnt - 1 else local sErr = 'Error : cannot create base surface' @@ -1107,7 +1109,7 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw, ptLoc2 = vFace[k].PPrev end -- ricavo i punti e l'angolo interno - local _, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( nNewProc, nFace1, nFace2, GDB_ID.ROOT) + local _, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( nNewProc.Id, nFace1, nFace2, GDB_ID.ROOT) -- se punti validi e angolo è interno e non è quasi piatto e >= 90 creo istanza local tFacAdj = {} if ptP1 and ptP2 and dAng < 0 and dAng < -6 and dAng > EgtIf( nTypeConeCut == 1, -(90 + 10 * GEO.EPS_SMALL), -(180-dAngleSmall + 10 * GEO.EPS_SMALL)) then @@ -1145,8 +1147,8 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw, i = i + 1 end -- cancello la copia della superfice - if nNewProc then - EgtErase(nNewProc) + if nNewProc.Id then + EgtErase( nNewProc.Id) end return true end