Files
Dario Sassi cc55202ec5 DataDoors 2.7c1 :
- primo commit con versione corrente.
2025-03-18 17:02:20 +01:00

754 lines
28 KiB
Lua

--
-- 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
--
-- _LatchStrike.lua by EgalWare s.r.l. 2016.07.11
-- Autore: Filippo Monchi
-- Latch strike, componente di secondo livello, non può essere chiamato direttamente da un lua dei
-- componenti di interfaccia
-- 2017.02.20 V1.0a1 FM Manage step face and radius face features
-- 2017.09.05 V1.0a2 FM Manage lead-in on opposite side and anti-splint path V lead-in
-- 2019.10.11 V1.0a3 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 LatchStrike = {}
-- Intestazioni
require( 'EgtBase')
EgtEnableDebug( false)
-- Valori limite
local dExtraH = 0.5
local sMaxFeed = 'MaxFeed'
local sRapid = 'Rapid'
local function DrawAddLineDrawCircle( pInitial, pFinal, nGroup, idTable, bPrev, nGroupCirc,
nRad, bDrawFirst, bDrawLast, cColor1, cColor2, sMVar)
local nLine = EgtLine(nGroup, pInitial, pFinal, GDB_RT.LOC)
local nNumLine
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)
local nCircle = EgtArc( nGroup, pCenter, dRadius, dAngIni, dAngCen, 0, GDB_RT.LOC)
local nNumCircle
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 LatchStrike.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 R = tLatchParam.rf
local d2 = tLatchParam.d2
local jn = tLatchParam.jn
local L2 = tLatchParam.L2
local H2 = tLatchParam.H2
local D = tLatchParam.D
local D_X = tLatchParam.D_X
local invG = tLatchParam.invG
local est = tLatchParam.est
-- 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 = tLatchParam.staro
if bStartOppo == nil then
bStartOppo = true
end
-- 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 R or abs(R) <= GEO.EPS_SMALL then
R = 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 hint1, hint2
local hint, hintPk, hintAs1, hintAs2
local pIni, pEnd, pCen
local bThD
-- se altezza supera lo spessore porta la riporto allo stesso valore e resetto eventuale raccordo
if H >= dThickDoor then
H = dThickDoor
R = 0
bThD = true
end
if nDrawMach ~= 1 then -- se abilitata geometria esterna
local tHint = {}
-- Costruzione della geometria ( in senso orario)
if est then
pIni = Point3d(-((L/2)-(d/2)-dExtraH)*invG,((d/2)+dExtraH),0)
pEnd = Point3d((L/2*invG),((d/2)+dExtraH),0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
pIni = pEnd
else
pIni = Point3d((L/2*invG),0,0)
end
if R > 0 then
pEnd = Point3d(L/2*invG,(-H+R),0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
pIni = pEnd
pEnd = Point3d(((L/2)-R)*invG,-H,0)
pCen =Point3d(((L/2)-R)*invG,(-H+R),0)
DrawAddCircleDrawCircle( pCen, R, EgtIf( invG > 0, 0, 180),-90*invG, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
pIni = pEnd
else
if est and bThD then
pEnd = Point3d(L/2*invG,-(H+(d/2)+dExtraH),0)
else
pEnd = Point3d(L/2*invG,-H,0)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
pIni = pEnd
end
if R > 0 then
pEnd = Point3d((-(L/2)+R)*invG,-H,0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
pIni = pEnd
pEnd = Point3d(-(L/2)*invG,(-H+R),0)
pCen =Point3d((-(L/2)+R)*invG,(-H+R),0)
DrawAddCircleDrawCircle( pCen, R, -90,-90*invG, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
pIni = pEnd
else
if est and bThD then
pEnd = Point3d(-(L/2)*invG,-(H+(d/2)+dExtraH),0)
else
pEnd = Point3d(-(L/2)*invG,-H,0)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
pIni = pEnd
end
if est then
pEnd = Point3d(-L/2*invG,((d/2)+dExtraH),0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
pIni = pEnd
pEnd = Point3d(-((L/2)-(d/2)-dExtraH)*invG,((d/2)+dExtraH),0)
else
pEnd = Point3d(-L/2*invG,0,0)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
pIni = pEnd
hint = EgtCurveCompo( Lg, tHint, true)
EgtModifyCurveThickness( hint, -T)
EgtSetName( hint, LG)
if est then
EgtSetInfo( hint, 'StartFromExt', 1)
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 tPocketAs2 = {}
local pIni2
local pEnd2
local nCaseNext
local dZedStart
local dZedWork
local nStep
local dStep
local nPass
local pStartStep
-- geometria antischeggia
if d2 then -- se parametro valido
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 dPosY, dEndPosY, dIniPosY, dDeltaPosX
local dPosY2, dEndPosY2, dIniPosY2
while nPass <= nStep do
dZedWork = dZedStart - dStep
if nPass == nStep then
if nStep == 1 then
dZedWork = 0
else
dZedWork = -T
end
end
if bStartAng then -- se lead-in con angolo
if H >= (d2*3/4) then
if (H-R) > (d2/4) then
dEndPosY = -(d2/4)
dEndPosY2 = -(H-(d2/4))
else
dEndPosY = -(H-R)
end
else
dEndPosY = -H+(d2/2)
end
dPosY = dEndPosY + (d2/8)
dPosY2 = dEndPosY2 - (d2/8)
dIniPosY = dPosY + (d2*7/8)
dIniPosY2 = dPosY2 - (d2*7/8)
dDeltaPosX = ( (d2*7/8) / tan(30))
-- linea entrante inclinata
pIni = Point3d((-((L-d2)/2) + 0.2 + dDeltaPosX)*invG, dIniPosY, dZedWork)
pEnd = Point3d((-((L-d2)/2) + 0.2)*invG, dPosY, dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
-- linea entrante in Y
pIni = pEnd
pEnd = Point3d((-((L-d2)/2) + 0.2)*invG, dEndPosY, dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
-- linee tangente al percorso
pIni = pEnd
pEnd = Point3d(-((L-d2)/2)*invG, dEndPosY, dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
-- linea di uscita
pIni = pEnd
pEnd = Point3d(-((L-d2)/2)*invG,(d2*3/4), dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
pIni = pEnd
pEnd = Point3d((-((L-d2)/2) + 0.2 + dDeltaPosX)*invG, pIni:getY(), dZedWork)
if H == dThickDoor and dEndPosY2 then
-- linea entrante inclinata
pIni2 = Point3d((((L-d2)/2) - 0.2 - dDeltaPosX)*invG, dIniPosY2,dZedWork)
pEnd2 = Point3d((((L-d2)/2) - 0.2)*invG, dPosY2,dZedWork)
DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
-- linea entrante in Y
pIni2 = pEnd2
pEnd2 = Point3d((((L-d2)/2) - 0.2)*invG, dEndPosY2,dZedWork)
DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
-- linee tangente al percorso
pIni2 = pEnd2
pEnd2 = Point3d(((L-d2)/2)*invG, dEndPosY2,dZedWork)
DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
-- linea di uscita
pIni2 = pEnd2
pEnd2 = Point3d(((L-d2)/2)*invG,-(H+(d2*3/4)),dZedWork)
DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
pIni2 = pEnd2
pEnd2 = Point3d((((L-d2)/2) - 0.2 - dDeltaPosX)*invG, pIni2:getY(), dZedWork)
end
else -- lead-in diritto
if H >= (d2*3/4) then
if (H-R) > (d2/4) then
dEndPosY = -(d2/4)
dEndPosY2 = -(H-(d2/4))
else
dEndPosY = -(H-R)
end
else
dEndPosY = -H+(d2/2)
end
dIniPosY = (d2*3/4)
dIniPosY2 = -(H+(d2*3/4))
pIni = Point3d((-((L-d2)/2) + 0.2)*invG, dIniPosY, dZedWork)
pEnd = Point3d((-((L-d2)/2) + 0.2)*invG, dEndPosY, 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(-((L-d2)/2)*invG, dEndPosY, dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
pIni = pEnd
pEnd = Point3d( pIni:getX(), dIniPosY, dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
pIni = pEnd
pEnd = Point3d((-((L-d2)/2) + 0.2)*invG, pIni:getY(), dZedWork)
if H == dThickDoor and dEndPosY2 then
pIni2 = Point3d((((L-d2)/2) - 0.2)*invG, dIniPosY2, dZedWork)
pEnd2 = Point3d((((L-d2)/2) - 0.2)*invG, dEndPosY2, dZedWork)
DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
-- faccio il ritorno alla posizione di partenza
pIni2 = pEnd2
pEnd2 = Point3d(((L-d2)/2)*invG, dEndPosY2, dZedWork)
DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
pIni2 = pEnd2
pEnd2 = Point3d( pIni2:getX(), dIniPosY2, dZedWork)
DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
pIni2 = pEnd2
pEnd2 = Point3d((((L-d2)/2) - 0.2)*invG, pIni2:getY(), dZedWork)
end
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})
if H == dThickDoor then
pIniLoc = pEnd2
pEnd2 = Point3d(pIniLoc:getX(), pIniLoc:getY(), (dZedStart - dStep))
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true,
ORANGE(), ORANGE(), sMaxFeed)
table.insert( tMVar2, {nConEnt,sKindVar})
end
end
end -- end while
-- trasformo in geometria composita
if ( #tPocketAs > 0) then
hintAs1 = EgtCurveCompo( Lg, tPocketAs, true)
if hintAs1 then
if nStep == 1 then
EgtModifyCurveThickness(hintAs1, -T)
else
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
end
EgtSetName(hintAs1,LA)
end
end
if ( #tPocketAs2 > 0) then
hintAs2 = EgtCurveCompo( Lg, tPocketAs2, true)
if hintAs2 then
if nStep == 1 then
EgtModifyCurveThickness(hintAs2, -T)
else
EgtModifyCurveThickness( hintAs2, 0)
-- assegno nota con la lista delle entità di variazione
local sListEnt = ''
for i = 1, #tMVar2 do
sListEnt = sListEnt .. '{ ent=' .. EgtNumToString( tMVar2[i][1], 0) .. ', ' .. 'code=' .. tMVar2[i][2] .. '}'
if i < #tMVar2 then
sListEnt = sListEnt .. ','
end
end -- end for
if string.len( sListEnt) > 0 then EgtSetInfo( hintAs2, 'MVar', sListEnt) end
end
EgtSetName(hintAs2,LA)
end
end
end
---------------------------------------
-- geometria svuotatura giro esterno
---------------------------------------
if not est then -- se non c'è lavorazione steel
local tPocket = {}
local tMVar = {}
local nConEnt
local sKindVar
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 bStartOppo then
pIni = Point3d((-((L-d)/2) + 0.2)*invG,(d*3/4),dZedWork)
pStartStep = pIni -- memorizzo punto per ritorno e reiniziare nuovo step
-- linea in Y con centro utensile fuori
pEnd = Point3d((-((L-d)/2) + 0.2)*invG,dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED())
-- linea traversa in X per andare sul vecchio punto iniziale (in X)
pIni = pEnd
pEnd = Point3d(((L-d)/2)*invG,dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED())
pIni = pEnd
else
pIni = Point3d(((L-d)/2)*invG,(d*3/4),dZedWork)
pStartStep = pIni -- memorizzo punto per ritorno e reiniziare nuovo step
end
local bDrawCircle = EgtIf( bStartOppo, false, true)
if ( H <= (d/2) or ( L <= (d*2))) then -- se cava troppo bassa o stretta
-- linea entrante in Y
pEnd = Point3d(((L-d)/2)*invG,-H+(d/2),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), bDrawCircle, true, RED(), RED())
-- linea traversa in X
pIni = pEnd
pEnd = Point3d(-((L-d)/2)*invG,-H+(d/2),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED())
-- linea di risalita in Y
pIni = pEnd
pEnd = Point3d(-((L-d)/2)*invG,(d*3/4),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED())
pIni = pEnd
else
if H == dThickDoor then
pEnd = Point3d(((L-d)/2)*invG,-H-dExtraH,dZedWork)
else
if R > (d/2) then
pEnd = Point3d(((L-d)/2)*invG,(-H+R),dZedWork)
else
pEnd = Point3d(((L-d)/2)*invG,-H+(d/2),dZedWork)
end
end
-- linea entrante in Y
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), bDrawCircle, true, RED(), RED())
pIni = pEnd
if H == dThickDoor then
pEnd = Point3d(-((L-d)/2)*invG,-H-dExtraH,dZedWork)
else
if R > (d/2) then
-- raccordo 1
pEnd = Point3d(((L/2)-R)*invG,-H+(d/2),dZedWork)
pCen = Point3d(((L/2)-R)*invG,(-H+R),dZedWork)
DrawAddCircleDrawCircle( pCen, (R-(d/2)), EgtIf( invG > 0,0,180),-90*invG, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED())
pIni = pEnd
pEnd = Point3d(-((L/2)-R)*invG,-H+(d/2),dZedWork)
else
pEnd = Point3d(-((L-d)/2)*invG,-H+(d/2),dZedWork)
end
end
-- linea traversa in X
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED())
pIni = pEnd
if R > (d/2) then
-- raccordo 2
pEnd = Point3d(-((L-d)/2)*invG,(-H+R),dZedWork)
pCen = Point3d(-((L/2)-R)*invG,(-H+R),dZedWork)
DrawAddCircleDrawCircle( pCen, (R-(d/2)), -90,-90*invG, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED())
pIni = pEnd
end
-- linea di risalita in Y
pEnd = Point3d(-((L-d)/2)*invG,dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED())
pIni = pEnd
-- linea di riposizionamento in X
if bStartOppo then
pEnd = Point3d(-(((L*2)-(d*3))/4)*invG,dExtraH,dZedWork)
else
pEnd = Point3d((((L*2)-(d*3))/4)*invG,dExtraH,dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW())
pIni = pEnd
local nDirVers = EgtIf( bStartOppo, 1, -1)
local nDistYcentr = (d*p)
local nPosYcentr = nDistYcentr - dExtraH
local bContinue
local nDeltaXPk = 0
if H == dThickDoor then
bContinue = nPosYcentr < H
else
bContinue = nPosYcentr < ( H -(d/2))
end
-- se c'è il raggio e la coordinata Y è entrata nell'influenza del raccordo ne calcolo il delta in x
if bContinue and R > (d/2) and nPosYcentr > (H-R) then
local nDeltaY = nPosYcentr - (H-R)
nDeltaXPk = (R-(d/2)) - sqrt( ((R-(d/2))*(R-(d/2))) - (nDeltaY*nDeltaY))
end
-- ciclo passate svuotatura
while bContinue do
pEnd = Point3d((-nDirVers * ((((L*2)-(d*3))/4)-nDeltaXPk)*invG),-nPosYcentr,dZedWork)
-- linea affondamento in Y
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW())
pIni = pEnd
-- linea passata in X
pEnd = Point3d((nDirVers * ((((L*2)-(d*3))/4)-nDeltaXPk)*invG),-nPosYcentr,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW())
-- calcolo nuovo passo in Y e indice direzione
nPosYcentr = nPosYcentr + nDistYcentr
if H == dThickDoor then
bContinue = nPosYcentr < H
else
bContinue = nPosYcentr < ( H -(d/2))
end
-- calcolo il delta x relativo alla presenza del raccordo
if bContinue and R > (d/2) and nPosYcentr > (H-R) then
local nDeltaY = nPosYcentr - (H-R)
nDeltaXPk = (R-(d/2)) - sqrt( ((R-(d/2))*(R-(d/2))) - (nDeltaY*nDeltaY))
end
-- calcolo prossimo punto solo se sono ancora dentro l'area
if bContinue then
nDirVers = -nDirVers
-- ricalcolo punti per linea successiva
pIni = pEnd
end
end -- end while
-- se più passi o non ho concatenamenti seguenti, aggiungo linea di risalita in Y
if ( nStep > 1 and (nPass + 1) <= nStep) or not jn then
pIni = pEnd
pEnd = Point3d(pIni:getX(), (d*3/4), dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW()) -- linea di ritorno in Y
end
end
nPass = nPass + 1
dZedStart = dZedWork
-- se ho altri passi torno al punto di inizio
if nPass <= nStep 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, {nConEnt,sKindVar})
end
end -- end while
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)*invG)+D_X),-(D+(H2/2)),dZedWork)
else
pEnd = Point3d(((((L2-d)/2)*invG)+D_X),-(D+(d/2)),dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE())
end
-- trasformo in geometria composita
if ( #tPocket > 0) then
hintPk = EgtCurveCompo( Lg, tPocket, true)
if hintPk then
EgtModifyCurveThickness(hintPk, 0)
if sf < T then -- se passi multipli
-- 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
end
EgtSetName(hintPk,LM)
end
end
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 hintAs2 then
EgtSetColor(hintAs2,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 hintAs2 then
EgtSetColor(hintAs2,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 hintAs2 then
EgtSetInfo( hintAs2, 'NotCheckDir', '1')
end
if hintPk then
EgtSetInfo( hintPk, 'NotCheckDir', '1')
end
end
return hint, hintPk, hintAs1, hintAs2
end
return LatchStrike