-- -- EEEEEEEEEE GGGGGG wwww wwww -- EEEEEEEEEE GGGGGGGGGG wwww wwww -- EEEE GGGG GGGG wwww wwww wwww -- EEEE GGGG wwww wwww wwww -- EEEEEEE GGGG GGGGGGG wwww wwwwww wwww -- EEEEEEE GGGG GGGGGGG wwww wwwwww wwww -- EEEE GGGG GGGG wwww wwwwwwww wwww -- EEEE GGGG GGGG wwww wwww wwww wwww -- EEEEEEEEEE GGGGGGGGGG wwwwwwww wwwwwwww -- EEEEEEEEEE GGGGGG wwwwwww wwwwwww -- -- _LatchCorner.lua by EgalWare s.r.l. 2016.07.11 -- Autore: Filippo Monchi -- Latch corner, componente di secondo livello, non può essere chiamato direttamente da un lua dei -- componenti di interfaccia -- 2017.09.05 V1.0a2 FM Manage lead-in on opposite side and anti-splint path V lead-in -- 2018.05.15 V1.0a3 FM Add manage new mode to count entity also on curvecompo path to allow assign note on connection entity -- 2019.10.11 V1.0a4 FM Manage steel option (disable to generate pocket paths and antisplint path, make closed and extend face path) -- 2019.10.18 V2.000 FM Manage use Materials -- 2019.10.21 V2.001 FM Modify the closed path start point for steel material -- 2024.07.19 V2.002 FM Set note 'NotCheckDir' to pocketing and antisplint paths -- Tavola per definizione modulo (serve ma non usata) local _LatchCorner = {} -- Intestazioni require( 'EgtBase') EgtEnableDebug( false) -- Valori limite local dExtraH = 0.5 local sMaxFeed = 'MaxFeed' local sRapid = 'Rapid' -- contatori local nTotContEnt = 0 local nTotContEnt_r = 0 local function DrawAddLineDrawCircle( pInitial, pFinal, nGroup, idTable, bPrev, nGroupCirc, nRad, bDrawFirst, bDrawLast, cColor1, cColor2, sMVar, nCounter_r) local nLine = EgtLine(nGroup, pInitial, pFinal, GDB_RT.LOC) local nNumLine -- serve per il conteggio delle entità in caso di concatenamento con curvecompo if nCounter_r then nTotContEnt_r = nTotContEnt_r + 1 else nTotContEnt = nTotContEnt + 1 end if idTable then table.insert( idTable, nLine) -- se devo inserire una variazione nell'entità if sMVar then nNumLine = #idTable end end if bPrev then if bDrawFirst then local nCircle1 = EgtCircle( nGroupCirc, pInitial, nRad , GDB_RT.LOC) EgtSetColor( nCircle1, cColor1) end if bDrawLast then local nCircle2 = EgtCircle( nGroupCirc, pFinal, nRad , GDB_RT.LOC) EgtSetColor( nCircle2, cColor2) end end return nLine, nNumLine, sMVar end local function DrawAddCircleDrawCircle( pCenter, dRadius, dAngIni, dAngCen, nGroup, idTable, bPrev, nGroupCirc, nRad, bDrawFirst, bDrawLast, cColor1, cColor2, sMVar, nCounter_r) local nCircle = EgtArc( nGroup, pCenter, dRadius, dAngIni, dAngCen, 0, GDB_RT.LOC) local nNumCircle -- serve per il conteggio delle entità in caso di concatenamento con curvecompo if nCounter_r then nTotContEnt_r = nTotContEnt_r + 1 else nTotContEnt = nTotContEnt + 1 end if idTable then table.insert( idTable, nCircle) -- se devo inserire una variazione nell'entità if sMVar then nNumCircle = #idTable end end if bPrev then if bDrawFirst then local nCircle1 = EgtCircle( nGroupCirc, EgtSP( nCircle), nRad , GDB_RT.LOC) EgtSetColor( nCircle1, cColor1) end if bDrawLast then local nCircle2 = EgtCircle( nGroupCirc, EgtEP( nCircle), nRad , GDB_RT.LOC) EgtSetColor( nCircle2, cColor2) end end return nCircle, nNumCircle, sMVar end -- Funzione di disegno function _LatchCorner.Draw( EC, EM, tLatchParam, bPreview, bRunByCompo, nDrawMach, Pz, Lg, dThickDoor) -- Assegno le dimensioni local L = tLatchParam.L local H = tLatchParam.H local T = tLatchParam.T local d = tLatchParam.d local p = tLatchParam.p local sf = tLatchParam.sf local rf = tLatchParam.rf local d2 = tLatchParam.d2 local jn = tLatchParam.jn local L2 = tLatchParam.L2 local H2 = tLatchParam.H2 local cl = tLatchParam.cl local D_X = tLatchParam.D_X local est = tLatchParam.est local invG = tLatchParam.invG -- Assegno i nomi geometrie local LG = tLatchParam.LG local LM = tLatchParam.LM local LA = tLatchParam.LA local DM = 'DUMMY' -- variabili per messaggi e settaggi vari local sCompoName = tLatchParam.Nome -- settaggio opzione per partenza ad angolo o meno local bStartAng = true local bStartOppo = true -- RunByComponetInterface local RC = true if not bRunByCompo then -- controllo se lanciato da componente RC = false end -- 0 solo geom esterna, 1 solo geom mach, 2 entrambe if not nDrawMach then -- se non definita la setto per non creare geometria di lavorazione nDrawMach = 0 end -- set variabili per compatibilità con vecchi componenti -- step face: per compatibilità con tutti i componenti, se non è definito lo setto = alla profondità cava if not sf or abs(sf) <= GEO.EPS_SMALL then sf = T end -- radius face: per compatibilità con tutti i componenti, se non è definito lo setto a 0 if not rf or abs(rf) <= GEO.EPS_SMALL then rf = 0 end -- Layer local Dm if not Lg then Lg = EgtGroup(Pz,GDB_RT.LOC) -- layer della figura principale EgtSetName( Lg, sCompoName) end if nDrawMach > 0 then -- se abilitata geometria lavorazione Dm = EgtGroup( Pz, GDB_RT.LOC) -- layer disegni cerchi rappresentatte il diametro utensile EgtSetName(Dm,DM) end local tHint = {} local hint1, hint2, hint3, hint4, hint5, hint5 local hint, hintPk, hintAs1 local pIni, pEnd, pCen, pStartStep local nRadius = 0 -- se altezza supera lo spessore porta la riporto allo stesso valore if H > dThickDoor then H = dThickDoor end -- creo lo stesso la geometria esterna perché viene utilizzata anche per creare il percorso di lavorazione -- se non è previsto viene eliminato dopo -- Costruzione della geometria ( in senso orario) if LG and (cl == 3 or cl == 2) and rf > GEO.EPS_SMALL then -- se cava arrotondata da entrambe i lati o a destra if est then pIni = Point3d(-((d/2)+dExtraH),-((H/2)-(d/2)-dExtraH),0) pEnd = Point3d(-((d/2)+dExtraH),H/2,0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED()) pIni = pEnd else pIni = Point3d(0,H/2,0) end pEnd = Point3d((L-rf),H/2,0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED()) pIni = pEnd pCen = Point3d((L-rf),((H/2)-rf),0) pEnd = Point3d(L,((H/2)-rf),0) DrawAddCircleDrawCircle( pCen, rf, 90,-90, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED()) pIni = pEnd if abs(rf - (H/2)) > GEO.EPS_SMALL then -- se due raccordi pEnd = Point3d(L,(-(H/2)+rf),0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED()) pIni = pEnd end pCen = Point3d((L-rf),(-(H/2)+rf),0) pEnd = Point3d((L-rf),-(H/2),0) DrawAddCircleDrawCircle( pCen, rf, 0,-90, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED()) pIni = pEnd if est then pEnd = Point3d(-((d/2)+dExtraH),-H/2,0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED()) pIni = pEnd pEnd = Point3d(-((d/2)+dExtraH),-((H/2)-(d/2)-dExtraH),0) else pEnd = Point3d(0,-H/2,0) end DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED()) elseif LG then -- altrimenti cava squadrata if est then DrawAddLineDrawCircle( Point3d(-((d/2)+dExtraH),-((H/2)-(d/2)-dExtraH),0), Point3d(-((d/2)+dExtraH),H/2,0), Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED()) DrawAddLineDrawCircle( Point3d(-((d/2)+dExtraH),H/2,0), Point3d(L,H/2,0), Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED()) DrawAddLineDrawCircle( Point3d(L,H/2,0), Point3d(L,-H/2,0), Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED()) DrawAddLineDrawCircle( Point3d(L,-H/2,0), Point3d(-((d/2)+dExtraH),-H/2,0), Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED()) DrawAddLineDrawCircle( Point3d(-((d/2)+dExtraH),-H/2,0), Point3d(-((d/2)+dExtraH),-((H/2)-(d/2)-dExtraH),0), Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED()) else DrawAddLineDrawCircle( Point3d(0,H/2,0), Point3d(L,H/2,0), Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED()) DrawAddLineDrawCircle( Point3d(L,H/2,0), Point3d(L,-H/2,0), Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED()) DrawAddLineDrawCircle( Point3d(L,-H/2,0), Point3d(0,-H/2,0), Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED()) end end -- trasformo in geometria composita i/il percorsi/o di contorno if ( #tHint > 0) then hint = EgtCurveCompo( Lg, tHint, true) if hint then EgtModifyCurveThickness( hint, -T) EgtSetName( hint, LG) if est then EgtSetInfo( hint, 'StartFromExt', 1) end end end --------------------------------------- --------------------------------------- -- Costruzione delle geometrie di lavorazione --------------------------------------- --------------------------------------- if nDrawMach > 0 then -- se abilitata geometria lavorazione if not Lg then Lg = EgtGroup(Pz,GDB_RT.LOC) EgtSetName(Lg,sCompoName) end local tPocketAs = {} local nCaseNext local dZedStart local dZedWork local nStep local dStep local nPass local pStartStep local nCase, nCaseNext -- geometria antischeggia if d2 then -- se parametro valido if sf >= T then -- se passo unico local dPosX, dEndPosX, dIniPosX, dDeltaPosY if bStartAng then -- se lead-in con angolo if (L-nRadius) >= (d2*3/4) then dEndPosX = (d2/4) else if nRadius >= (d2/2) then -- se raggio >= raggio fresa dEndPosX = (L-nRadius) else dEndPosX = (L-(d2/2)) end end dPosX = dEndPosX - (d2/8) dIniPosX = dPosX - (d2*7/8) dDeltaPosY = ( (d2*7/8) / tan(30)) -- linea entrante inclinata pIni = Point3d( dIniPosX, (-((H-d2)/2) + 0.2 + dDeltaPosY)*invG,0) pEnd = Point3d(dPosX, (-((H-d2)/2) + 0.2)*invG,0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE()) -- linea entrante in X pIni = pEnd pEnd = Point3d(dEndPosX, (-((H-d2)/2) + 0.2)*invG,0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE()) -- linee tangente al percorso pIni = pEnd pEnd = Point3d(dEndPosX, -((H-d2)/2)*invG,0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE()) -- linea di uscita pIni = pEnd pEnd = Point3d(-(d2*3/4),-((H-d2)/2)*invG,0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE()) else -- lead-in diritto if (L-nRadius) >= (d2*3/4) then dEndPosX = (d2/4) else if nRadius >= (d2/2) then -- se raggio >= raggio fresa dEndPosX = (L-nRadius) else dEndPosX = (L-(d2/2)) end end dIniPosX = -(d2*3/4) pIni = Point3d(dIniPosX,-((H-d2)/2)*invG,0) pEnd = Point3d(dEndPosX,-((H-d2)/2)*invG,0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE()) end -- trasformo in geometria composita if ( #tPocketAs > 0) then hintAs1 = EgtCurveCompo( Lg, tPocketAs, true) if hintAs1 then EgtModifyCurveThickness(hintAs1, -T) EgtSetName(hintAs1,LA) end end else -- altrimenti più passate nStep = ceil(T/sf) -- numero di passate dStep = (T/nStep) -- passo ricalcolato nPass = 1 dZedStart = 0 local tMVar = {} local tMVar2 = {} local nConEnt local sKindVar local dPosX, dEndPosX, dIniPosX, dDeltaPosY while nPass <= nStep do dZedWork = dZedStart - dStep if nPass == nStep then dZedWork = -T end if bStartAng then -- se lead-in con angolo if (L-nRadius) >= (d2*3/4) then dEndPosX = (d2/4) else if nRadius >= (d2/2) then -- se raggio >= raggio fresa dEndPosX = (L-nRadius) else dEndPosX = (L-(d2/2)) end end dPosX = dEndPosX - (d2/8) dIniPosX = dPosX - (d2*7/8) dDeltaPosY = ( (d2*7/8) / tan(30)) -- linea entrante inclinata pIni = Point3d( dIniPosX, (-((H-d2)/2) + 0.2 + dDeltaPosY)*invG,dZedWork) pEnd = Point3d(dPosX, (-((H-d2)/2) + 0.2)*invG,dZedWork) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE()) -- linea entrante in X pIni = pEnd pEnd = Point3d(dEndPosX, (-((H-d2)/2) + 0.2)*invG,dZedWork) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE()) -- linee tangente al percorso pIni = pEnd pEnd = Point3d(dEndPosX, -((H-d2)/2)*invG,dZedWork) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE()) -- linea di uscita pIni = pEnd pEnd = Point3d(-(d2*3/4),-((H-d2)/2)*invG,dZedWork) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE()) pIni = pEnd pEnd = Point3d( pIni:getX(), (-((H-d2)/2) + 0.2 + dDeltaPosY)*invG, dZedWork) else -- lead-in diritto if (L-nRadius) >= (d2*3/4) then dEndPosX = (d2/4) else if nRadius >= (d2/2) then -- se raggio >= raggio fresa dEndPosX = (L-nRadius) else dEndPosX = (L-(d2/2)) end end dIniPosX = -(d2*3/4) pIni = Point3d(dIniPosX,(-((H-d2)/2) + 0.2)*invG,dZedWork) pEnd = Point3d(dEndPosX,(-((H-d2)/2) + 0.2)*invG,dZedWork) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE()) -- faccio il ritorno alla posizione di partenza pIni = pEnd pEnd = Point3d(dEndPosX, -((H-d2)/2)*invG, dZedWork) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE()) pIni = pEnd pEnd = Point3d(dIniPosX, pIni:getY(), dZedWork) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE()) pIni = pEnd pEnd = Point3d(pIni:getX(),(-((H-d2)/2) + 0.2)*invG, dZedWork) end nPass = nPass + 1 dZedStart = dZedWork -- se ho altri passi scendo in z if nPass <= nStep then local pIniLoc = pEnd pEnd = Point3d(pIniLoc:getX(), pIniLoc:getY(), (dZedStart - dStep)) _, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE(), sMaxFeed) table.insert( tMVar, {nConEnt,sKindVar}) end end -- end while -- trasformo in geometria composita if ( #tPocketAs > 0) then hintAs1 = EgtCurveCompo( Lg, tPocketAs, true) if hintAs1 then EgtModifyCurveThickness( hintAs1, 0) -- assegno nota con la lista delle entità di variazione local sListEnt = '' for i = 1, #tMVar do sListEnt = sListEnt .. '{ ent=' .. EgtNumToString( tMVar[i][1], 0) .. ', ' .. 'code=' .. tMVar[i][2] .. '}' if i < #tMVar then sListEnt = sListEnt .. ',' end end -- end for if string.len( sListEnt) > 0 then EgtSetInfo( hintAs1, 'MVar', sListEnt) end EgtSetName(hintAs1,LA) end end end end --------------------------------------- -- geometria svuotatura giro esterno --------------------------------------- if not est then -- se non c'è lavorazione steel -- individuo in che caso sono if abs(H-d) < 0.03 then -- solo 1 passaggio in centro nCase = 1 elseif (H-d) <= ( d*0.98) then -- solo passaggio di contornatura nCase = 2 elseif ((H-d) > ( d*0.98)) and ( (H-d) <= (d*(1+p))) then -- passaggio di contornatura + un passaggio centrale nCase = 3 elseif (H-d) > (d*(1+p)) then -- passaggio di contornatura + passaggi offset nCase = 4 end local nDirVers = 1 local tPocket = {} local tMVar = {} local nConEnt local sKindVar -- resetto contatori entità nTotContEnt = 0 nTotContEnt_r = 0 nRadius = H/2 nPass = 1 dZedStart = 0 nStep = ceil(T/sf) -- numero di passate dStep = (T/nStep) -- passo ricalcolato while nPass <= nStep do dZedWork = dZedStart - dStep if nPass == nStep then dZedWork = -T end if nCase == 1 then -- solo 1 passaggio in centro if nDirVers == 1 then -- se passata di andata pIni = Point3d(-(d*3/4),0,dZedWork) pStartStep = pIni pEnd = Point3d((L-(d/2)),0,dZedWork) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED()) -- se non sono all'ultima passata scendo in Z if nPass < nStep then pIni = pEnd pEnd = Point3d((L-(d/2)),0,(dZedWork-dStep)) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED()) end else -- altrimenti passata di ritorno pIni = Point3d((L-(d/2)),0,dZedWork) pEnd = Point3d(-(d*3/4),0,dZedWork) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED()) -- se non sono all'ultima passata scendo in Z if nPass < nStep then pIni = pEnd pEnd = Point3d(-(d*3/4),0,(dZedWork-dStep)) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED()) end end if nPass == nStep then if jn then -- se uso un solo utensile mi porto in posizione di partenza per la prossima geometria pIni = pEnd pEnd = Point3d((L2-(d/2))+D_X,0,dZedWork) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE()) end end -- solo contornatura or contornatura + un passaggio centrale or contornatura + passaggi svuotatura elseif ( nCase == 2) or ( nCase == 3) or ( nCase == 4) then -- calcolo l'ampiezza dell'offset nRadius = nRadius - (d/2) -- offset hint_ofs = EgtOffsetCurveAdv( hint, (d/2), GDB_OT.FILLET) if hint_ofs and hint_ofs > 0 then -- muovo la geometria in Z EgtMove( hint_ofs, Point3d(0,0,dZedWork) - ORIG()) -- se flag inverso, inverto la geometria, solo qui non nelle altre copie if invG < 0 then EgtInvertCurve(hint_ofs) end if bStartOppo then pIni = Point3d(-(d*3/4),(-((H-d)/2) + 0.2)*invG,dZedWork) pStartStep = pIni -- linea in X con centro utensile fuori pEnd = Point3d(-dExtraH,(-((H-d)/2) + 0.2)*invG,dZedWork) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED()) -- linea traversa in Y per andare sul vecchio punto iniziale (in Y) pIni = pEnd pEnd = Point3d(-dExtraH,((H-d)/2)*invG,dZedWork) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED()) -- linea entrante a prendere il percorso di offset pIni = pEnd pEnd = EgtSP( hint_ofs) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED()) pEnd = EgtEP( hint_ofs) local ntypeDom, nNumCurve = EgtCurveDomain(hint_ofs) nTotContEnt = nTotContEnt + ( nNumCurve - ntypeDom) table.insert( tPocket, hint_ofs) else -- prima linea entrante pIni = Point3d(-(d*3/4),((H-d)/2)*invG,dZedWork) pStartStep = pIni pEnd = EgtSP( hint_ofs) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED()) pEnd = EgtEP( hint_ofs) local ntypeDom, nNumCurve = EgtCurveDomain(hint_ofs) nTotContEnt = nTotContEnt + ( nNumCurve - ntypeDom) table.insert( tPocket, hint_ofs) end end if nCase == 3 then -- passaggio di contornatura + un passaggio centrale -- linea posizionamento passata centrale pIni = pEnd pEnd = Point3d(-dExtraH,0,dZedWork) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW()) -- linee passata centrale pIni = pEnd pEnd = Point3d((L-(d*3/4)),0,dZedWork) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW()) pIni = pEnd -- se non sono all'ultima passata ritorno al punto di inizio della passata centrale, -- si perde un po' di tempo ma è l'unica per poter rifare il passo if nPass < nStep then pEnd = Point3d(-dExtraH,0,dZedWork) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW()) pIni = pEnd end elseif nCase == 4 then -- passaggio di contornatura + passaggi svuotatura local nDistYcentr = (d*p) local bContinue -- se percorso offset esiste if hint_ofs and hint_ofs > 0 then -- faccio l'offset del raggio fresa nRadius = nRadius - nDistYcentr bContinue = nRadius > 0 -- se percorso offset esiste while bContinue do hint_ofs2 = EgtOffsetCurveAdv( hint_ofs, nDistYcentr*invG, GDB_OT.FILLET) if hint_ofs2 and hint_ofs2 > 0 then -- linea congiunzione tra osset pIni = pEnd pEnd = EgtSP( hint_ofs2) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW()) pEnd = EgtEP( hint_ofs2) hint_ofs = hint_ofs2 local ntypeDom, nNumCurve = EgtCurveDomain(hint_ofs) nTotContEnt = nTotContEnt + ( nNumCurve - ntypeDom) table.insert( tPocket, hint_ofs) -- calcolo nuovo passo in Y e indice direzione nRadius = nRadius - nDistYcentr bContinue = nRadius > 0 else bContinue = false end end -- end while end end if nPass == nStep then if jn then -- se uso un solo utensile mi porto in posizione di partenza per la prossima geometria -- carcolo in che caso sono con la prossima geometria if abs(H2-d) < 0.03 then -- solo 1 passaggio in centro nCaseNext = 1 else nCaseNext = 0 end pIni = pEnd if ( nCaseNext == 1) then -- se solo passaggio in centro parto dalla parte opposta pEnd = Point3d((L2-(d/2))+D_X,0,dZedWork) else pEnd = Point3d((-(d*3/4))+D_X,((H2-d)/2)*invG,dZedWork) end DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE()) end end end nPass = nPass + 1 dZedStart = dZedStart - dStep nRadius = H/2 nDirVers = -nDirVers -- se ho altri passi torno al punto di inizio if nPass <= nStep and nCase > 1 then pIni = pEnd pEnd = Point3d(pStartStep:getX(),pStartStep:getY(),(dZedStart - dStep)) _, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW(), sMaxFeed) table.insert( tMVar, {nTotContEnt,sKindVar}) end end -- end while -- trasformo in geometria composita if ( #tPocket > 0) then hintPk = EgtCurveCompo( Lg, tPocket, true) if hintPk then EgtModifyCurveThickness(hintPk, 0) -- assegno nota con la lista delle entità di variazione local sListEnt = '' for i = 1, #tMVar do sListEnt = sListEnt .. '{ ent=' .. EgtNumToString( tMVar[i][1], 0) .. ', ' .. 'code=' .. tMVar[i][2] .. '}' if i < #tMVar then sListEnt = sListEnt .. ',' end end -- end for if string.len( sListEnt) > 0 then EgtSetInfo( hintPk, 'MVar', sListEnt) end EgtSetName(hintPk,LM) end end end end -- se abilitata solo geometria di lavorazione elimino il percorso di sola geometria if nDrawMach == 1 then if hint then -- cancello il percorso EgtErase( hint) end end -- cambio colore alla geometria if bPreview then if EC == 0 then if hint then EgtSetColor(hint,AQUA()) end if hintAs1 then EgtSetColor(hintAs1,AQUA()) end if hintPk then EgtSetColor(hintPk,AQUA()) end else if hint then EgtSetColor(hint,ORANGE()) end if hintAs1 then EgtSetColor(hintAs1,ORANGE()) end if hintPk then EgtSetColor(hintPk,ORANGE()) end end else -- altrimenti non Preview -- cancello le parti ausiliarie se disegnate if Dm then EgtErase(Dm) end -- assegno nota su percorsi antisplint e svuotatura if hintAs1 then EgtSetInfo( hintAs1, 'NotCheckDir', '1') end if hintPk then EgtSetInfo( hintPk, 'NotCheckDir', '1') end end return hint, hintPk, hintAs1 end return _LatchCorner