diff --git a/LuaLibs/WMachiningLib.lua b/LuaLibs/WMachiningLib.lua index 22dc65d..208dedc 100644 --- a/LuaLibs/WMachiningLib.lua +++ b/LuaLibs/WMachiningLib.lua @@ -51,7 +51,7 @@ function WMachiningLib.FindCutting( sType, dDepth, nTool_ID) end --------------------------------------------------------------------- -function WMachiningLib.FindMilling( sType, dDepth, sTuuid, nTool_ID) +function WMachiningLib.FindMilling( sType, dDepth, sTuuid, nTool_ID, dMaxDiam) for i = 1, #Millings do local Milling = Millings[i] if Milling.On and Milling.Type == sType and SetCurrMachiningAndTool( Milling.Name) then @@ -64,6 +64,7 @@ function WMachiningLib.FindMilling( sType, dDepth, sTuuid, nTool_ID) if nMchType == MCH_MY.MILLING and ( not sTuuid or sTuuid == sMyTuuid) and ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and + ( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and ( not nTool_ID or nTool_ID == 0 or nTool_ID == nMyTool_ID) then return Milling.Name, dTMaxDepth, dTMaxMat, dTDiam end diff --git a/LuaLibs/WProcessDrill.lua b/LuaLibs/WProcessDrill.lua index 217a839..8222098 100644 --- a/LuaLibs/WProcessDrill.lua +++ b/LuaLibs/WProcessDrill.lua @@ -1,4 +1,4 @@ --- WProcessDrill.lua by Egaltech s.r.l. 2021/11/09 +-- WProcessDrill.lua by Egaltech s.r.l. 2021/11/11 -- Gestione calcolo forature per Pareti -- 2021/08/29 DS Se foratura di fianco setto flag per farla dopo i tagli. @@ -106,7 +106,7 @@ function WPD.FlipClassify( Proc, b3Part) -- verifico se e' lavorabile da fliped: cambio segno al versore nFlip1 = EgtIf( -dVtExtrZ >= WD.DRILL_VZ_MIN, 100, 0) return nFlip0, nFlip1 --- -- altrimenti foro pasante +-- -- altrimenti foro passante -- else -- -- verifico orientamento della normale rispetto ad angolo massimo -- if abs( vtExtr:getX()) <= WD.DRILL_VX_MAX then @@ -163,6 +163,29 @@ function WPD.RotateClassify( Proc, ValidRotations) end +--------------------------------------------------------------------- +-- Verifica se da lavorare in due metà +function WPD.Split( Proc, b3Raw) + -- recupero e verifico l'entità foro + local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0 + if AuxId then AuxId = AuxId + Proc.Id end + if not AuxId or EgtGetType( AuxId) ~= GDB_TY.CRV_ARC then + return false + end + -- recupero i dati del foro + local dDiam = 2 * EgtArcRadius( AuxId) + local dLen = abs( EgtCurveThickness( AuxId)) + local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) + local bOpen = ( Proc.Fcs ~= 0 and Proc.Fce ~= 0) + -- verifico se foro orizzontale in Y da lavorare in due metà + if WD.HOR_DRILL_Y_SPLIT and bOpen and AreSameOrOppositeVectorApprox( vtExtr, Y_AX()) and + Proc.Box:getMin():getY() < WD.HOR_DRILL_Y_SPLIT - 10 and Proc.Box:getMax():getY() > WD.HOR_DRILL_Y_SPLIT + 10 then + return true + else + return false + end +end + --------------------------------------------------------------------- -- Applicazione della lavorazione function WPD.Make( Proc, nRawId, b3Raw) @@ -186,20 +209,31 @@ function WPD.Make( Proc, nRawId, b3Raw) EgtOutLog( sErr) return false, sErr end + -- se foro da fare dall'altra parte forzo inversione + if Proc.Flg == -2 then bToInvert = true end + -- se foro chiuso sulla partenza forzo inversione if Proc.Fcs == 0 then bToInvert = true end + -- se richiesta inversione, inverto versore di riferimento if bToInvert then vtExtr = - vtExtr end -- recupero la lavorazione local sDrilling, nType + local sHead if dDiam < 200 then - local sHead - if AreSameVectorApprox( vtExtr, Y_AX()) then + if AreSameVectorApprox( vtExtr, Y_AX()) or + ( bOpen and abs( Proc.Flg) ~= 2 and AreSameVectorApprox( vtExtr, -Y_AX())) then sHead = 'H5' elseif AreSameVectorApprox( vtExtr, -Y_AX()) then sHead = 'H6' end sDrilling, nType = WM.FindDrilling( dDiam, dLen, sHead) + if not sDrilling then + sDrilling, nType = WM.FindDrilling( dDiam, nil, sHead) + end if sHead and not sDrilling then sDrilling, nType = WM.FindDrilling( dDiam, dLen) + if not sDrilling then + sDrilling, nType = WM.FindDrilling( dDiam) + end end else sDrilling = WM.FindMilling( 'FreeContour', dLen) @@ -225,6 +259,20 @@ function WPD.Make( Proc, nRawId, b3Raw) dDiamTh = EgtTdbGetCurrToolThDiam() end end + -- aggiusto massimo affondamento per fori lungo Y con teste speciali + if sHead == 'H5' then + local dMaxY = WD.HOR_DRILL_Y_SPLIT + WD.HOR_DRILL_Y_TABLE / 2 + local dDeltaY = dMaxY - Proc.Box:getMax():getY() + if dDeltaY > 0 then + dMaxDepth = dMaxDepth - dDeltaY + end + elseif sHead == 'H6' then + local dMinY = WD.HOR_DRILL_Y_SPLIT - WD.HOR_DRILL_Y_TABLE / 2 + local dDeltaY = Proc.Box:getMin():getY() - dMinY + if dDeltaY > 0 then + dMaxDepth = dMaxDepth - dDeltaY + end + end -- se foro intermedio e inclinato, limito il massimo affondamento if not ( ( Proc.Fcs == 5 or Proc.Fcs == 6) or ( bToInvert and ( Proc.Fce == 5 or Proc.Fce == 6))) then local CosB = abs( vtExtr:getX()) @@ -245,7 +293,7 @@ function WPD.Make( Proc, nRawId, b3Raw) end EgtSetInfo( nMchId, 'Part', Proc.PartId) -- se foratura di fianco setto la nota per spostarla dopo i tagli di lama - if vtExtr:getZ() < WD.NZ_MINA then + if vtExtr:getZ() < WD.NZ_MINA and not sHead then EgtSetInfo( nMchId, 'MOVE_AFTER', 1) end -- aggiungo geometria @@ -278,9 +326,11 @@ function WPD.Make( Proc, nRawId, b3Raw) local sMyWarn local dDepth = dLen if dDepth > dMaxDepth + 10 * GEO.EPS_SMALL then - sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')' dDepth = dMaxDepth - EgtOutLog( sMyWarn .. ' (process ' .. tostring( Proc.Id) .. ')') + if abs( Proc.Flg) ~= 2 then + sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dLen, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')' + EgtOutLog( sMyWarn .. ' (process ' .. tostring( Proc.Id) .. ')') + end end EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) -- Note utente diff --git a/LuaLibs/WProcessDtMortise.lua b/LuaLibs/WProcessDtMortise.lua index 69968cb..811e74a 100644 --- a/LuaLibs/WProcessDtMortise.lua +++ b/LuaLibs/WProcessDtMortise.lua @@ -101,7 +101,7 @@ function WPDM.Make( Proc, nRawId, b3Raw) return false, sErr end -- recupero la lavorazione : seconda ricerca con tipologia e diametro massimo - sMilling = WM.FindMilling( sMillType, nil, nil, 2 * dMinRad) + sMilling = WM.FindMilling( sMillType, nil, nil, nil, 2 * dMinRad) if not sMilling then local sErr = 'Radius too small : Error on DtMortise ' .. tostring( Proc.Id) EgtOutLog( sErr) diff --git a/LuaLibs/WProcessFreeContour.lua b/LuaLibs/WProcessFreeContour.lua index 93c3710..6ccfd6d 100644 --- a/LuaLibs/WProcessFreeContour.lua +++ b/LuaLibs/WProcessFreeContour.lua @@ -1,5 +1,6 @@ --- ProcessFreeContour.lua by Egaltech s.r.l. 2021/11/04 +-- ProcessFreeContour.lua by Egaltech s.r.l. 2021/11/15 -- Gestione calcolo profilo libero per Pareti +-- 2021/11/15 Penna e chiodature sono sempre riportate sulla faccia sopra anche se nel progetto sono sotto. -- Tabella per definizione modulo local WPF = {} @@ -42,6 +43,8 @@ function WPF.Classify( Proc, b3Raw) if not AuxId then return false end AuxId = AuxId + Proc.Id local vtN = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) + -- recupero il tipo di lavorazione + local nCntType = EgtGetInfo( Proc.Id, 'CNT_TYPE', 'i') or 0 -- se tasca if bPocket then local bDown = ( vtN:getZ() < - 0.5) @@ -49,6 +52,9 @@ function WPF.Classify( Proc, b3Raw) -- se altrimenti profilo orizzontale elseif abs( vtN:getZ()) < 0.5 then return false + -- se penna o chiodatura va sempre bene (vengono sempre riportati sopra) + elseif nCntType == 10 or nCntType == 20 then + return true -- se altrimenti profilo verticale che non interessa tutta la sezione elseif Proc.Box:getMax():getZ() < b3Raw:getMax():getZ() - 2 then return false diff --git a/LuaLibs/WProcessLapJoint.lua b/LuaLibs/WProcessLapJoint.lua index 5e360f0..3fab0aa 100644 --- a/LuaLibs/WProcessLapJoint.lua +++ b/LuaLibs/WProcessLapJoint.lua @@ -1329,10 +1329,10 @@ local function MakeByMill( Proc, nFacet, nOthFac, nRawId, b3Raw, dSideDist) EgtSetMachiningGeometry( {{ Proc.Id, nFacet}}) -- sistemo i parametri di attacco e uscita local dAddLen = ( WD.MID_GAP or 50) - ( WD.MID_SIC or 5) - EgtSetMachiningParam( MCH_MP.STARTADDLEN, -dMillDiam/2 + dAddLen) + EgtSetMachiningParam( MCH_MP.STARTADDLEN, 0) -- -dMillDiam/2 + dAddLen) EgtSetMachiningParam( MCH_MP.LITANG, 0) EgtSetMachiningParam( MCH_MP.LIPERP, dSideDist + WD.CUT_SIC) - EgtSetMachiningParam( MCH_MP.ENDADDLEN, -dMillDiam/2 + dAddLen) + EgtSetMachiningParam( MCH_MP.ENDADDLEN, 0) -- -dMillDiam/2 + dAddLen) EgtSetMachiningParam( MCH_MP.LOTANG, 0) EgtSetMachiningParam( MCH_MP.LOPERP, dSideDist + WD.CUT_SIC) -- imposto posizione braccio porta testa diff --git a/LuaLibs/WProcessMortise.lua b/LuaLibs/WProcessMortise.lua index b10098a..860e751 100644 --- a/LuaLibs/WProcessMortise.lua +++ b/LuaLibs/WProcessMortise.lua @@ -88,11 +88,7 @@ end function WPM.Make( Proc, nRawId, b3Raw) -- recupero e verifico l'entità curva local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') - local bForceOneSide - local bRevertSide - if AuxId then - AuxId = AuxId + Proc.Id - end + if AuxId then AuxId = AuxId + Proc.Id end if not AuxId or ( EgtGetType( AuxId) & GDB_FY.GEO_CURVE) == 0 then local sErr = 'Error : missing profile geometry' EgtOutLog( sErr) @@ -155,6 +151,8 @@ function WPM.Make( Proc, nRawId, b3Raw) -- creo superficie chiusa local nFlat = EgtSurfTmByFlatContour( EgtGetParent( AuxId), AuxId, 0.05) if nFlat then + -- la superficie deve sempre essere rivolta verso l'alto + local vtNN = EgtSurfTmFacetNormVersor( nFlat, 0, GDB_ID.ROOT) frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( nFlat, 0, GDB_ID.ROOT) ptC = frMor:getOrigin() vtN = frMor:getVersZ() @@ -163,12 +161,13 @@ function WPM.Make( Proc, nRawId, b3Raw) local bxMax = b3Aux:getMax() local b3Mor = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frMor) local bxMin = b3Mor:getMin() - local dMove = bxMin:getZ()-bxMax:getZ() + local dMove = bxMin:getZ() - bxMax:getZ() + if vtNN:getZ() < 0.1 then dMove = -dMove end -- se il percorso ausiliario è esterno al grezzo, lo riavvicino if abs( dMove) > GEO.EPS_SMALL then - AuxId = EgtCopyGlob( AuxId, WL.GetAddGroup(nPartId)) - EgtMove( AuxId, Vector3d(0,0,-dMove)) - EgtMove( nFlat, Vector3d(0,0,-dMove)) + AuxId = EgtCopyGlob( AuxId, WL.GetAddGroup( Proc.PartId)) + EgtMove( AuxId, Vector3d( 0, 0, dMove), GDB_RT.GLOB) + EgtMove( nFlat, Vector3d( 0, 0, dMove), GDB_RT.GLOB) frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( nFlat, 0, GDB_ID.ROOT) ptC = frMor:getOrigin() vtN = frMor:getVersZ() @@ -180,6 +179,8 @@ function WPM.Make( Proc, nRawId, b3Raw) -- scrivo info nel log EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3) -- Se mortasa chiusa + local bForceOneSide + local bRevertSide if bClosedBtm then -- verifico che la mortasa non sia orientata verso il basso (limite -5 deg) if vtN:getZ() < WD.NZ_MINA then @@ -203,7 +204,7 @@ function WPM.Make( Proc, nRawId, b3Raw) local b3Mor = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frMor) local dMorH = b3Mor:getDimZ() -- elevazione del punto centro - local _, dCenElev = WL.GetPointDirDepth( nPartId, ptC, vtN) + local _, dCenElev = WL.GetPointDirDepth( Proc.PartId, ptC, vtN) dMorH = max( dMorH, dCenElev or 0) -- determino larghezza della mortasa if dL < dW then dL, dW = dW, dL end diff --git a/LuaLibs/WallExec.lua b/LuaLibs/WallExec.lua index 5b864fa..dd1fbfd 100644 --- a/LuaLibs/WallExec.lua +++ b/LuaLibs/WallExec.lua @@ -163,10 +163,32 @@ function WallExec.CollectFeatures( PartId, b3Raw) Proc.TaskId = nTaskId Proc.Box = EgtGetBBoxGlob( ProcId, GDB_BB.STANDARD) if Proc.Box and not Proc.Box:isEmpty() then - if Drill.Identify( Proc) then - Proc.Diam, Proc.Fcs, Proc.Fce = Drill.GetData( Proc, b3Raw) - end table.insert( vProc, Proc) + -- se foro + if Drill.Identify( Proc) then + -- assegno diametro e facce di ingresso e uscita (dati tabelle sempre per riferimento) + Proc.Diam, Proc.Fcs, Proc.Fce = Drill.GetData( Proc, b3Raw) + -- verifico se necessaria seconda lavorazione da parte opposta per foro più lungo della punta + if Drill.Split( Proc, b3Raw) then + -- aggiorno flags prima parte foro (dati tabelle sempre per riferimento) + Proc.Flg = 2 + -- definisco dati seconda parte + local Proc2 = {} + Proc2.PartId = PartId + Proc2.Id = ProcId + Proc2.Grp = nGrp + Proc2.Prc = nPrc + Proc2.Flg = -2 + Proc2.Box = BBox3d( Proc.Box) + Proc2.Fct = Proc.Fct + Proc2.Diam = Proc.Diam + Proc2.Fcs = Proc.Fce + Proc2.Fce = Proc.Fcs + Proc2.CutId = Proc.CutId + Proc2.TaskId = Proc.TaskId + table.insert( vProc, Proc2) + end + end else EgtOutLog( ' Feature ' .. tostring( Proc.Id) .. ' is empty (no geometry)') end diff --git a/NestProcess.lua b/NestProcess.lua index f0c979b..1737c59 100644 --- a/NestProcess.lua +++ b/NestProcess.lua @@ -134,28 +134,15 @@ local function NewMachGroupName() return nMaxMachGroup + 1 end --- Funzione che crea -local function CreateToolRectangle( ptP1, ptP2, vtFace, nOutlineGrp) - -- da inserire in WallData - local MILL_DIAM = 350 - - local vtX = ptP2 - ptP1 - vtX:normalize() - -- creo il rettangolo della lavorazione - ptP1 = ptP1 - vtX * 9000 - ptP2 = ptP2 + vtX * ( MILL_DIAM / 2 + 100 * GEO.EPS_SMALL) - ptP2 = ptP2 + vtFace * ( MILL_DIAM + 100 * GEO.EPS_SMALL) - local nId = EgtRectangle2P( nOutlineGrp, Point3d(ptP2:getX(), ptP2:getY(), 0), Point3d( ptP1:getX(), ptP1:getY(), 0)) - - return nId - -end - - -- Funzione che crea le regioni occupate dalle lavorazioni -local function ComputeToolOutlines( nPartId) - +local function CreateToolOutlines( nPartId, b3Raw) + + -- da inserire in WallData + local MILL_DIAM = 350 + local MILL_MAX_MAT = 115 + ------------------------------------- + local ToolOutlineId = {} -- recupero il gruppo con gli outlines degli utensili @@ -179,27 +166,50 @@ local function ComputeToolOutlines( nPartId) if ( vtN[1]:getZ() <= - 0.95 or vtN[2]:getZ() <= - 0.95) then local vtFace = EgtIf( vtN[1]:getZ() <= -0.95, vtN[2], vtN[1]) local bAdj, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT) + local vtX = ptP2 - ptP1 + vtX:normalize() -- creo il rettangolo della lavorazione - local nId = CreateToolRectangle( ptP1, ptP2, vtFace, nOutlineGrp) + ptP1 = ptP1 - vtX * 9000 + ptP2 = ptP2 + vtX * ( MILL_DIAM / 2 + 100 * GEO.EPS_SMALL) + ptP2 = ptP2 + vtFace * ( MILL_DIAM + 100 * GEO.EPS_SMALL) + local nId = EgtRectangle2P( nOutlineGrp, Point3d(ptP2:getX(), ptP2:getY(), 0), Point3d( ptP1:getX(), ptP1:getY(), 0)) if nId ~= GDB_ID.NULL then table.insert(ToolOutlineId, nId) end end end - if Proc.Fct == 3 then - local nFacInd, dElev = WL.GetFaceWithMostAdj( Proc.Id, Proc.PartId) - if nFacInd ~= -2 then - local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT) - if not AreSameOrOppositeVectorApprox( vtN, Z_AX()) then - local nOtherFace = EgtIf( nFacInd == 0, 1, 0) - local bAdj, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, nFacInd, nOtherFace, GDB_ID.ROOT) - if abs( ptP1:getZ() - ptP2:getZ()) < GEO.EPS_SMALL then - local nId = CreateToolRectangle( ptP1, ptP2, vtN, nOutlineGrp) - if nId ~= GDB_ID.NULL then table.insert(ToolOutlineId, nId) end - end + if Proc.Fct >= 3 then + LapJoint.Classify( Proc, b3Raw) + 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 e lavorabile con fresa + if vtN:getZ() < WD.NZ_MINA and dElev < MILL_DIAM / 2 - 30 and MILL_MAX_MAT >= min( dH, dV) + 20 * GEO.EPS_SMALL then + local nOtherFace + for nInd = 0, Proc.Fct - 1 do + local vt = EgtSurfTmFacetNormVersor( Proc.Id, nInd, GDB_ID.ROOT) + if abs( vt:getZ()) > 0.8 then nOtherFace = nInd end + end + local bAdj, ptP1, ptP2 = EgtSurfTmFacetsContact( Proc.Id, nFacInd, nOtherFace or GDB_ID.NULL, GDB_ID.ROOT) + if bAdj then + local vtX = ptP2 - ptP1 + vtX:normalize() + -- creo il rettangolo della lavorazione + ptP1 = ptP1 - vtX * ( MILL_DIAM / 2 + 100 * GEO.EPS_SMALL) + ptP2 = ptP2 + vtX * ( MILL_DIAM / 2 + 100 * GEO.EPS_SMALL) + ptP2 = ptP2 + vtN * 9000 + local nId = EgtRectangle2P( nOutlineGrp, Point3d(ptP2:getX(), ptP2:getY(), 0), Point3d( ptP1:getX(), ptP1:getY(), 0)) + if nId ~= GDB_ID.NULL then table.insert(ToolOutlineId, nId) end + end end - end - end - + end + + end end end @@ -207,6 +217,7 @@ local function ComputeToolOutlines( nPartId) end + -- Funzione che sposta e aggiunge pezzi per nesting local function AddRawParts(RawParts) -- creo tabella dei grezzi @@ -249,6 +260,7 @@ local function AddParts(RawParts) nPartIndex = nPartIndex + 1 -- calcolo bbox pezzo per rotazioni local b3Part = EgtGetBBoxGlob( nPartId, GDB_BB.STANDARD) + local b3Raw = b3Part local vPartProc = WE.CollectFeatures( nPartId, b3Raw) -- verifico se possibile flip parete -- recupero stati di flip delle feature di lavorazione della parete @@ -345,8 +357,8 @@ local function AddParts(RawParts) local dPartL = b3Part:getDimX() local dPartW = b3Part:getDimY() - local nOut0 = 0 -- numero di grezzi che non conterrebbero il pezzo ruotato di 0°/180° - local nOut90 = 0 -- numero di grezzi che non conterrebbero il pezzo ruotato di 90°/270° + local nOut0 = 0 -- grezzi che non conterrebbero il pezzo ruotato di 0°/180° + local nOut90 = 0 -- grezzi che non conterrebbero il pezzo ruotato di 90°/270° for nInd = 1, #RawParts do if ( dPartL > RawParts[nInd]["Len"] or dPartW > RawParts[nInd]["Width"]) then nOut0 = nOut0 + 1 end if ( dPartW > RawParts[nInd]["Len"] or dPartL > RawParts[nInd]["Width"]) then nOut90 = nOut90 + 1 end @@ -431,7 +443,6 @@ local function AddParts(RawParts) else nRotate = 0 end - -- eseguo rotazione se necessario if nRotate > 0 then EgtRotate( nPartId, b3Part:getCenter(), Z_AX(), nRotate, GDB_RT.GLOB) @@ -465,6 +476,7 @@ local function AddParts(RawParts) table.insert( PartStates, { PartId = tonumber(nPartId), Flip = bFlip, Rotate = nRotate}) + -- local bFtDown = false -- local vPartProc = WE.CollectFeatures( nPartId, b3Raw) -- for nInd = 1, #vPartProc do @@ -685,18 +697,14 @@ local function AddParts(RawParts) end ]]-- - - - - if nOutline then -- aggiungo pezzo al nesting - EgtAutoNestAddPart( nPartId, nOutline, false, bRotNest, nStepRotNest, 0, nCount) + EgtAutoNestAddPart( nPartId, nOutline, false, bRotNest, nStepRotNest, 0, nCount) -- EgtAutoNestAddPart( PartId, OutlineId, bCanFlip, bCanRotate, dRotStep, nPriority, nCount) end -- aggiungo aree di lavorazione del pezzo - local nToolOutlineIds = ComputeToolOutlines( nPartId) + local nToolOutlineIds = CreateToolOutlines( nPartId, b3Raw) for nInd = 1, #nToolOutlineIds do EgtAutoNestAddToolOutlineToPart( nPartId, nToolOutlineIds[nInd]) end @@ -755,7 +763,7 @@ if bOk then EgtAutoNestSetInterpartGap(NEST.OFFSET) -- Impostazione corner di inizio del nesting (NST_CORNER.BL, TL, BR, TR) - EgtAutoNestSetStartCorner( NST_CORNER.BR) + EgtAutoNestSetStartCorner( NST_CORNER.TL) -- imposto tempo di nesting e lo avvio EgtAutoNestCompute(true, NEST.TIME) @@ -807,6 +815,9 @@ if bNestingOk then EgtSetInfo(nMachGroup, "PANELWIDTH", RawParts[nIndex].Width) EgtSetInfo(nMachGroup, "MATERIAL", RawParts[nIndex].Material) EgtSetInfo(nMachGroup, "AUTONEST", 1) + -- scrivo dati per variabili P di comunicazione con la macchina in gruppo di lavorazione + EgtSetInfo( nMachGroup, "PRODID", NEST.PRODID) + EgtSetInfo( nMachGroup, "PATTID", nMachGroup) end end nPartCount = 0 @@ -819,7 +830,6 @@ if bNestingOk then local nPartDuploId = EgtDuploNew( nId) -- applico flip e rotazioni fatte durante verifica posizionamento pezzo local b3Part = EgtGetBBoxGlob( nPartDuploId, GDB_BB.STANDARD) - local nPartInd for nInd = 1, #PartStates do if PartStates[nInd].PartId == nId then if PartStates[nInd].Flip then @@ -828,7 +838,6 @@ if bNestingOk then if PartStates[nInd].Rotate and PartStates[nInd].Rotate > 0 then EgtRotate( nPartDuploId, b3Part:getCenter(), Z_AX(), PartStates[nInd].Rotate, GDB_RT.GLOB) end - nPartInd = nInd end end -- applico rotazione e traslazione pezzo da nesting @@ -836,11 +845,11 @@ if bNestingOk then EgtMove( nPartDuploId, Vector3d( dX, dY, 0), GDB_RT.GLOB) local PartBBox = EgtGetBBoxGlob( nPartDuploId, GDB_BB.STANDARD) local ptPos = Point3d( PartBBox:getMin():getX(), PartBBox:getMin():getY(), 0) - EgtSetInfo( nMachGroup, "PART" .. nPartCount, nPartDuploId .. "," .. EgtNumToString( ptPos:getX(), 3) .. "," .. EgtNumToString( ptPos:getY(), 3) .. "," .. 0 .."," .. 0) + EgtSetInfo( nMachGroup, "PART" .. nPartCount, nPartDuploId .. "," .. EgtNumToString( ptPos:getX(), 3) .. "," .. EgtNumToString( ptPos:getY(), 3) .. "," .. 0 .. "," .. 0) EgtSetInfo( nPartDuploId, "POSX", ptPos:getX()) EgtSetInfo( nPartDuploId, "POSY", ptPos:getY()) - EgtSetInfo( nPartDuploId, "ROT", dAngRot + PartStates[nPartInd].Rotate) - EgtSetInfo( nPartDuploId, "FLIP", PartStates[nPartInd].Flip) + EgtSetInfo( nPartDuploId, "ROT", dAngRot) + EgtSetInfo( nPartDuploId, "FLIP", 0) end end end @@ -872,11 +881,10 @@ end EgtResetCurrMachGroup() - -- cancello rettangolo del materiale per nesting - for RawPartId = 1, #RawParts do +for RawPartId = 1, #RawParts do EgtErase(RawParts[RawPartId].PartId) - end +end local nOutlineGrp = EgtGetFirstNameInGroup(GDB_ID.ROOT, "ToolOutlines") if nOutlineGrp and nOutlineGrp ~= GDB_ID.NULL then EgtErase( nOutlineGrp) end