348cd4401a
- aggiunti parametri per smusso/raccordo in angolo interno L di Pivot (richiesta ALS).
1933 lines
91 KiB
Lua
1933 lines
91 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
|
|
--
|
|
-- _PivotL.lua by EgalWare s.r.l. 2026.03.03
|
|
-- Autore: Filippo Monchi
|
|
-- PivotL, 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.01.08 V1.0a3 FM Manage new R1 parameter to add a fillet on single corner
|
|
-- 2018.01.12 V1.0a4 FM Manage new anti splint position path when side pivot correspond to side door ( on offset and offsetintermediate type)
|
|
-- 2018.05.15 V1.0a5 FM Add manage new mode to count entity also on curvecompo path to allow assign note on connection entity
|
|
-- 2019.07.29 V1.0a6 FM Manage new differents pivot models and submodels: Centerhung pivot with submodel (1), Offset pivot with submodel (1),
|
|
-- OffsetInpermediate pivot with submodel (1) 4
|
|
-- the defalult and old one is submodel (1) for all model
|
|
-- 2019.10.18 V2.000 FM Manage use Materials
|
|
-- 2019.10.21 V2.001 FM Modify the closed path start point for steel material
|
|
-- 2020.10.20 V2.002 FM Fix error on insert fillet when L = L3
|
|
-- 2024.07.19 V2.003 FM Set note 'NotCheckDir' to pocketing and antisplint paths
|
|
-- 2026.03.03 v3.1c1 DS Added fillet/chamfer management on opposite corner to single L for Offset type.
|
|
|
|
-- Tavola per definizione modulo (serve ma non usata)
|
|
local PivotL = {}
|
|
|
|
-- 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 PivotL.Draw( EC, EM, tPivotParam, bPreview, bRunByCompo, nDrawMach, Pz, Lg, dThickDoor)
|
|
|
|
-- Assegno le dimensioni
|
|
local L = tPivotParam.L
|
|
local H = tPivotParam.H
|
|
local T = tPivotParam.T
|
|
local L3 = tPivotParam.L3
|
|
local H3 = tPivotParam.H3
|
|
local radius = tPivotParam.rad
|
|
local R1 = tPivotParam.R1
|
|
local R1i = tPivotParam.R1i
|
|
local D_SK = tPivotParam.D_SK
|
|
local D_SK2 = tPivotParam.D_SK2
|
|
local B_SK = tPivotParam.B_SK
|
|
local d = tPivotParam.d
|
|
local p = tPivotParam.p
|
|
local sf = tPivotParam.sf
|
|
local d2 = tPivotParam.d2
|
|
local jn = tPivotParam.jn
|
|
local L2 = tPivotParam.L2
|
|
local H2 = tPivotParam.H2
|
|
local D = tPivotParam.D
|
|
local D_X = tPivotParam.D_X
|
|
local invG = tPivotParam.invG
|
|
local est = tPivotParam.est
|
|
local mkrev = tPivotParam.mkrev
|
|
local stn = tPivotParam.stn
|
|
local subtype = tPivotParam.stype
|
|
local nextSub = tPivotParam.nextSub
|
|
local T2 = tPivotParam.T2 -- for subtype 4
|
|
local s = tPivotParam.s -- for subtype 4
|
|
local d3 = tPivotParam.d3 -- for subtype 4
|
|
local p3 = tPivotParam.p3 -- for subtype 4
|
|
-- Assegno i nomi geometrie
|
|
local LG = tPivotParam.LG
|
|
local LM = tPivotParam.LM
|
|
local LA = tPivotParam.LA
|
|
local DM = 'DUMMY'
|
|
-- variabili per messaggi e settaggi vari
|
|
local sCompoName = tPivotParam.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
|
|
|
|
local dPrevTh = T
|
|
|
|
-- se sottotipo 4 modifico le variabili necessarie
|
|
if subtype == 4 then
|
|
radius = 0
|
|
R1 = 0
|
|
R1i = 0
|
|
T = T2
|
|
L = 0
|
|
mkrev = false
|
|
D_SK = 0
|
|
if not jn then
|
|
d = d3
|
|
p = p3
|
|
sf = s
|
|
end
|
|
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 radius or abs(radius) <= GEO.EPS_SMALL then
|
|
radius = 0
|
|
end
|
|
|
|
-- single radius on face: per compatibilità con tutti i componenti, se non è definito lo setto a 0
|
|
if not R1 or abs(R1) <= GEO.EPS_SMALL then
|
|
R1 = 0
|
|
end
|
|
|
|
if not R1i or abs(R1i) <= GEO.EPS_SMALL then
|
|
R1i = 0
|
|
end
|
|
|
|
local nR1 = R1
|
|
if B_SK == 0 then -- se forma L opposta resetto i raccordi
|
|
R1i = 0
|
|
R1 = 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, hintPk_r
|
|
local pIni, pEnd, pCentr
|
|
|
|
-- creo lo stesso la geometria esterna perchè viene utilizzata anche per creare il percorso di lavorazione
|
|
-- se non è previsto viene eliminato dopo
|
|
|
|
local tPocket = {}
|
|
|
|
-- Costruzione della geometria ( in senso orario)
|
|
-- se abilitato material steel faccio percorso chiuso
|
|
if est then
|
|
pIni = Point3d(-((L3/2)-(d/2)-dExtraH),(H3-(H/2)+(d/2)+dExtraH),0)
|
|
if B_SK then
|
|
pEnd = Point3d(L3/2,(H3-(H/2)+(d/2)+dExtraH),0)
|
|
else
|
|
pEnd = EgtIf( stn, Point3d(((L3/2)+(d/2)+dExtraH),(H3-(H/2)+(d/2)+dExtraH),0), Point3d(L3/2,(H3-(H/2)+(d/2)+dExtraH),0))
|
|
end
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
else
|
|
if B_SK then
|
|
pIni = Point3d(L3/2,(H3-(H/2)),0)
|
|
else
|
|
pIni = EgtIf( stn, Point3d(((L3/2)+(d/2)+dExtraH),(H3-(H/2)),0), Point3d(L3/2,(H3-(H/2)),0))
|
|
end
|
|
end
|
|
|
|
if D_SK > 0 then -- se ho il knuckle centrato
|
|
if R1 > 0 and D_SK2 and D_SK2 > 0 then
|
|
-- linea discendente
|
|
pEnd = Point3d(L3/2,(H/2)+R1,0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
-- arco antiorario verso destra
|
|
pEnd = Point3d((L3/2)+R1,(H/2),0)
|
|
pCentr = Point3d((L3/2)+R1,(H/2)+R1,0)
|
|
DrawAddCircleDrawCircle( pCentr, R1, 180,90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
if D_SK > (R1+radius) then
|
|
-- linea verso destra
|
|
pEnd = Point3d((L3/2)+D_SK-radius,(H/2),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
end
|
|
if radius > 0 then
|
|
-- arco orario verso destra
|
|
pEnd = Point3d((L3/2)+D_SK,(H/2)-radius,0)
|
|
pCentr = Point3d((L3/2)+D_SK-radius,(H/2)-radius,0)
|
|
DrawAddCircleDrawCircle( pCentr, radius, 90,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
if abs((2*radius) - H) < 0.0001 then
|
|
pEnd = Point3d(((L3/2)+D_SK-radius),-(H/2),0)
|
|
pCentr = Point3d(((L3/2)+D_SK-radius),-(H/2)+radius,0)
|
|
DrawAddCircleDrawCircle( pCentr, radius, 0,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
else
|
|
pEnd = Point3d(((L3/2)+D_SK),-(H/2)+radius,0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
pEnd = Point3d(((L3/2)+D_SK-radius),-(H/2),0)
|
|
pCentr = Point3d(((L3/2)+D_SK-radius),-(H/2)+radius,0)
|
|
DrawAddCircleDrawCircle( pCentr, radius, 0,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
end
|
|
else
|
|
--linea discendente fino a parte inferiore
|
|
pEnd = Point3d((L3/2)+D_SK,-(H/2),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
end
|
|
else -- se non ho il raccordo
|
|
if stn and not B_SK then
|
|
-- linea discendente fino a parte inferiore
|
|
pEnd = Point3d(((L3/2)+(d/2)+dExtraH),-(H/2),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
else
|
|
if subtype == 4 then
|
|
-- linea discendente fino a parte inferiore
|
|
pEnd = Point3d(L3/2,-(H/2),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
else
|
|
-- linea discendente
|
|
pEnd = Point3d(L3/2,(H/2),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
|
|
if D_SK > (R1+radius) then
|
|
-- linea verso destra
|
|
pEnd = Point3d((L3/2)+D_SK-radius,(H/2),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
end
|
|
if radius > 0 then
|
|
-- arco orario verso destra
|
|
pEnd = Point3d((L3/2)+D_SK,(H/2)-radius,0)
|
|
pCentr = Point3d((L3/2)+D_SK-radius,(H/2)-radius,0)
|
|
DrawAddCircleDrawCircle( pCentr, radius, 90,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
if abs((2*radius) - H) < 0.0001 then
|
|
pEnd = Point3d(((L3/2)+D_SK-radius),-(H/2),0)
|
|
pCentr = Point3d(((L3/2)+D_SK-radius),-(H/2)+radius,0)
|
|
DrawAddCircleDrawCircle( pCentr, radius, 0,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
else
|
|
pEnd = Point3d(((L3/2)+D_SK),-(H/2)+radius,0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
pEnd = Point3d(((L3/2)+D_SK-radius),-(H/2),0)
|
|
pCentr = Point3d(((L3/2)+D_SK-radius),-(H/2)+radius,0)
|
|
DrawAddCircleDrawCircle( pCentr, radius, 0,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
end
|
|
else
|
|
--linea discendente
|
|
pEnd = Point3d((L3/2)+D_SK,-(H/2),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
end
|
|
end
|
|
end
|
|
end
|
|
else
|
|
if R1 > 0 then
|
|
-- linea discendente
|
|
pEnd = Point3d(L3/2,-(H/2)+R1,0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
pEnd = Point3d(((L3/2)+D_SK-R1),-(H/2),0)
|
|
pCentr = Point3d(((L3/2)+D_SK-R1),-(H/2)+R1,0)
|
|
DrawAddCircleDrawCircle( pCentr, R1, 0,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
else -- se non ho il raccordo
|
|
if B_SK then
|
|
pEnd = Point3d(L3/2,-(H/2),0)
|
|
else
|
|
pEnd = EgtIf( stn, Point3d(((L3/2)+(d/2)+dExtraH),-(H/2),0), Point3d(L3/2,-(H/2),0))
|
|
end
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
end
|
|
end
|
|
|
|
local dRadTemp = radius
|
|
if D_SK2 and D_SK2 == 0 then -- se forma L opposta setto il raccordo con il valore di R1
|
|
dRadTemp = nR1
|
|
end
|
|
|
|
if dRadTemp > 0 then
|
|
pEnd = Point3d(((L3/2)+D_SK-L+dRadTemp),-(H/2),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
pEnd = Point3d(((L3/2)+D_SK-L),-(H/2)+dRadTemp,0)
|
|
pCentr = Point3d(((L3/2)+D_SK-L+dRadTemp),-(H/2)+dRadTemp,0)
|
|
DrawAddCircleDrawCircle( pCentr, dRadTemp, -90,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
else
|
|
if subtype == 4 then
|
|
if stn and B_SK then
|
|
pEnd = Point3d((-(L3/2)-(d/2)-dExtraH),-(H/2),0)
|
|
else
|
|
pEnd = Point3d((-(L3/2)+D_SK),-(H/2),0)
|
|
end
|
|
else
|
|
if stn and B_SK then
|
|
pEnd = Point3d(((L3/2)+D_SK-L-(d/2)-dExtraH),-(H/2),0)
|
|
else
|
|
pEnd = Point3d(((L3/2)+D_SK-L),-(H/2),0)
|
|
end
|
|
end
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
end
|
|
|
|
dRadTemp = radius
|
|
if D_SK2 and D_SK2 == 0 then -- se forma L opposta resetto i raccordi
|
|
dRadTemp = 0
|
|
R1i = 0
|
|
end
|
|
|
|
if dRadTemp > 0 then
|
|
if (L3+D_SK-L) < -dRadTemp then
|
|
if abs((2*dRadTemp) - H) < 0.0001 then
|
|
pEnd = Point3d(((L3/2)+D_SK-L+dRadTemp),(H/2),0)
|
|
pCentr = Point3d(((L3/2)+D_SK-L+dRadTemp),-(H/2)+dRadTemp,0)
|
|
DrawAddCircleDrawCircle( pCentr, dRadTemp, 180,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
else
|
|
pEnd = Point3d(((L3/2)+D_SK-L),(H/2)-dRadTemp,0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
pEnd = Point3d(((L3/2)+D_SK-L+dRadTemp),(H/2),0)
|
|
pCentr = Point3d(((L3/2)+D_SK-L+dRadTemp),(H/2)-dRadTemp,0)
|
|
DrawAddCircleDrawCircle( pCentr, dRadTemp, 180,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
end
|
|
else -- se non ho spazio per il secondo salgo diritto
|
|
pEnd = Point3d(((L3/2)+D_SK-L),(H/2),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
end
|
|
else
|
|
if subtype < 4 then
|
|
if not D_SK2 or (D_SK2 and D_SK2 > 0) then
|
|
pEnd = Point3d(((L3/2)+D_SK-L),(H/2),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
end
|
|
end
|
|
end
|
|
|
|
if dRadTemp > 0 then
|
|
if D_SK > 0 then
|
|
if R1i > 0 then
|
|
if abs( L-D_SK-L3-dRadTemp-R1i) > 0.001 then
|
|
-- linea fino al raccordo R1i
|
|
pEnd = Point3d(-(L3/2)-R1i,(H/2),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
end
|
|
-- arco antiorario verso l'alto
|
|
pEnd = Point3d(-(L3/2),(H/2)+R1i,0)
|
|
pCentr = Point3d(-(L3/2)-R1i,(H/2)+R1i,0)
|
|
DrawAddCircleDrawCircle( pCentr, R1i, 270,90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
else
|
|
if abs( L-D_SK-L3-dRadTemp) > 0.001 then
|
|
pEnd = Point3d(-(L3/2),(H/2),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
end
|
|
end
|
|
else
|
|
if abs( L-L3-dRadTemp) > 0.001 then
|
|
pEnd = Point3d(-(L3/2),(H/2),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
end
|
|
end
|
|
else
|
|
if D_SK > 0 then
|
|
if R1i > 0 then
|
|
if abs( L-D_SK-L3-dRadTemp-R1i) > 0.001 then
|
|
-- linea fino al raccordo R1i
|
|
pEnd = Point3d(-(L3/2)-R1i,(H/2),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
end
|
|
-- arco antiorario verso l'alto
|
|
pEnd = Point3d(-(L3/2),(H/2)+R1i,0)
|
|
pCentr = Point3d(-(L3/2)-R1i,(H/2)+R1i,0)
|
|
DrawAddCircleDrawCircle( pCentr, R1i, 270,90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
else
|
|
if abs( L-D_SK-L3-dRadTemp) > 0.001 then
|
|
pEnd = Point3d(-(L3/2),(H/2),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
end
|
|
end
|
|
else
|
|
if subtype < 4 then
|
|
pEnd = Point3d(-(L3/2),(H/2),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
end
|
|
end
|
|
end
|
|
|
|
if stn and B_SK then
|
|
if subtype == 4 then
|
|
pEnd = Point3d(-((L3/2)+(d/2)+dExtraH),H3-(H/2),0)
|
|
else
|
|
pEnd = Point3d(((L3/2)+D_SK-L-(d/2)-dExtraH),(H3-(H/2)+EgtIf( est, (d/2)+dExtraH, 0)),0)
|
|
end
|
|
else
|
|
pEnd = Point3d(-(L3/2),(H3-(H/2)+EgtIf( est, (d/2)+dExtraH, 0)),0)
|
|
end
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
|
|
-- Eventuale raccordo/smusso su unico angolo interno di L
|
|
local dRd1 = tPivotParam.Dr2R or 0
|
|
local dRd2 = tPivotParam.Dr2D or 0
|
|
if dRd1 > 100 * GEO.EPS_SMALL then
|
|
local nCLpId = tPocket[#tPocket-1]
|
|
local nCLcId = tPocket[#tPocket]
|
|
local dCLp = EgtCurveLength( nCLpId)
|
|
local dCLc = EgtCurveLength( nCLcId)
|
|
if dRd2 < 100 * GEO.EPS_SMALL then
|
|
local dRad = min( dRd1, dCLp - 100 * GEO.EPS_SMALL, dCLc - 100 * GEO.EPS_SMALL)
|
|
local nFltId = EgtCurveFillet( Lg, nCLpId, EgtMP( nCLpId), nCLcId, EgtMP( nCLcId), dRad, true, GDB_RT.LOC)
|
|
if nFltId then table.insert( tPocket, #tPocket, nFltId) end
|
|
else
|
|
local dCoeff1 = min( ( dCLp - 100 * GEO.EPS_SMALL) / dRd1, 1)
|
|
local dCoeff2 = min( ( dCLc - 100 * GEO.EPS_SMALL) / dRd2, 1)
|
|
local dCoeff = min( dCoeff1, dCoeff2)
|
|
local dDist1 = dCoeff * dRd1
|
|
local dDist2 = dCoeff * dRd2
|
|
if dDist1 > 100 * GEO.EPS_SMALL and dDist2 > 100 * GEO.EPS_SMALL then
|
|
EgtInvertCurve( nCLpId)
|
|
EgtTrimCurveStartAtLen( nCLpId, dDist1)
|
|
EgtInvertCurve( nCLpId)
|
|
EgtTrimCurveStartAtLen( nCLcId, dDist2)
|
|
local nChmId = EgtLine( Lg, EgtEP( nCLpId), EgtSP( nCLcId), GDB_RT.LOC)
|
|
if nChmId then table.insert( tPocket, #tPocket, nChmId) end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- se abilitato material steel chiudo il percorso
|
|
if est then
|
|
pEnd = Point3d(-((L3/2)-(d/2)-dExtraH),(H3-(H/2)+(d/2)+dExtraH),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
end
|
|
|
|
hint = EgtCurveCompo( Lg, tPocket, true)
|
|
if hint then
|
|
EgtModifyCurveThickness( hint, -T)
|
|
EgtSetName( hint, LG or '')
|
|
if est then
|
|
EgtSetInfo( hint, 'StartFromExt', 1)
|
|
end
|
|
end
|
|
|
|
---------------------------------------
|
|
---------------------------------------
|
|
-- Costruzione delle geometrie di lavorazione
|
|
---------------------------------------
|
|
---------------------------------------
|
|
if nDrawMach > 0 and not est then -- se abilitata geometria lavorazione
|
|
|
|
local tPocket = {}
|
|
local tPocket_r = {}
|
|
local tPocketAs = {}
|
|
local tPocketAs_r = {}
|
|
local pIni , pEnd
|
|
local nCase, nCaseNext, nCaseH
|
|
local dZedStart, dZedWork
|
|
local nRadius, hint_ofs, hint_ofs_r, hint_ofs2, hint_ofs2_r
|
|
local pIni_r, pEnd_r
|
|
local nStep
|
|
local dStep
|
|
local nPass
|
|
local pStartStep
|
|
local pStartStep_r
|
|
|
|
if not Lg then
|
|
Lg = EgtGroup(Pz,GDB_RT.LOC)
|
|
EgtSetName(Lg,sCompoName)
|
|
end
|
|
|
|
-- 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 tMVar_r = {}
|
|
local nConEnt
|
|
local sKindVar
|
|
local dPosY, dEndPosY, dIniPosY, dDeltaPosX
|
|
|
|
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
|
|
|
|
dEndPosY = -(d2/4)
|
|
dPosY = dEndPosY + (d2/8)
|
|
dIniPosY = dPosY + (d2*7/8)
|
|
dDeltaPosX = ( (d2*7/8) / tan(30))
|
|
|
|
if ( not B_SK and ( not stn or ( stn and invG > 0))) or
|
|
( B_SK and not( stn and invG > 0)) then -- se il pivot non sborda
|
|
|
|
-- linea entrante inclinata
|
|
pIni = Point3d((-((L3-d2)/2) + 0.2 + dDeltaPosX)*invG, (H3-(H/2)+dIniPosY),dZedWork)
|
|
pEnd = Point3d((-((L3-d2)/2) + 0.2)*invG, (H3-(H/2)+dPosY),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
|
|
-- linea entrante in Y
|
|
pIni = pEnd
|
|
pEnd = Point3d((-((L3-d2)/2) + 0.2)*invG, (H3-(H/2)+dEndPosY),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
-- linee tangente al percorso
|
|
pIni = pEnd
|
|
pEnd = Point3d(-((L3-d2)/2)*invG, (H3-(H/2)+dEndPosY),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
-- linea di uscita
|
|
pIni = pEnd
|
|
pEnd = Point3d(-((L3-d2)/2)*invG,(H3-(H/2)+(d2*3/4)),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
pIni = pEnd
|
|
pEnd = Point3d((-((L3-d2)/2) + 0.2 + dDeltaPosX)*invG, pIni:getY(), dZedWork)
|
|
else -- se il pivot sborda faccio geomtria ruotata
|
|
|
|
-- linea entrante inclinata
|
|
pIni = Point3d(-((L3/2)+dIniPosY)*invG, (-((H-d2)/2) + 0.2 + dDeltaPosX),dZedWork)
|
|
pEnd = Point3d(-((L3/2)+dPosY)*invG, (-((H-d2)/2) + 0.2),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
|
|
-- linea entrante in X
|
|
pIni = pEnd
|
|
pEnd = Point3d(-((L3/2)+dEndPosY)*invG, (-((H-d2)/2) + 0.2),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
-- linee tangente al percorso
|
|
pIni = pEnd
|
|
pEnd = Point3d(-((L3/2)+dEndPosY)*invG, -((H-d2)/2),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
-- linea di uscita
|
|
pIni = pEnd
|
|
pEnd = Point3d(-((L3/2)+(d2*3/4))*invG,-((H-d2)/2),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 + dDeltaPosX), dZedWork)
|
|
end
|
|
|
|
if mkrev then -- se abilitato anche il percorso inverso
|
|
|
|
if not stn or ( stn and invG < 0) then -- se il pivot non sborda
|
|
|
|
-- linea entrante inclinata
|
|
pIni_r = Point3d((((L3-d2)/2) - 0.2 - dDeltaPosX)*invG, (H3-(H/2)+dIniPosY),dZedWork)
|
|
pEnd_r = Point3d((((L3-d2)/2) - 0.2)*invG, (H3-(H/2)+dPosY),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocketAs_r, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
|
|
-- linea entrante in Y
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d((((L3-d2)/2) - 0.2)*invG, (H3-(H/2)+dEndPosY),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocketAs_r, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
-- linee tangente al percorso
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(((L3-d2)/2)*invG, (H3-(H/2)+dEndPosY),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocketAs_r, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
-- linea di uscita
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(((L3-d2)/2)*invG,(H3-(H/2)+(d2*3/4)),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocketAs_r, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d((((L3-d2)/2) - 0.2 - dDeltaPosX)*invG, pIni_r:getY(), dZedWork)
|
|
else -- se il pivot sborda faccio geometria ruotata
|
|
|
|
-- linea entrante inclinata
|
|
pIni_r = Point3d(((L3/2)+dIniPosY)*invG, (-((H-d2)/2) + 0.2 + dDeltaPosX),dZedWork)
|
|
pEnd_r = Point3d(((L3/2)+dPosY)*invG, (-((H-d2)/2) + 0.2),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocketAs_r, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
|
|
-- linea entrante in X
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(((L3/2)+dEndPosY)*invG, (-((H-d2)/2) + 0.2),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocketAs_r, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
-- linee tangente al percorso
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(((L3/2)+dEndPosY)*invG, -((H-d2)/2),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocketAs_r, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
-- linea di uscita
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(((L3/2)+(d2*3/4))*invG,-((H-d2)/2),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocketAs_r, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(pIni_r:getX(), (-((H-d2)/2) + 0.2 + dDeltaPosX), dZedWork)
|
|
end
|
|
end
|
|
else -- lead-in diritto
|
|
|
|
dEndPosY = -(d2/4)
|
|
dIniPosY = (d2*3/4)
|
|
|
|
if ( not B_SK and ( not stn or ( stn and invG > 0))) or
|
|
( B_SK and not( stn and invG > 0)) then -- se il pivot non sborda
|
|
|
|
if nStep == 1 then
|
|
pIni = Point3d(-((L3-d2)/2)*invG, (H3-(H/2)+dIniPosY),dZedWork)
|
|
pEnd = Point3d(-((L3-d2)/2)*invG, (H3-(H/2)+dEndPosY),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
else
|
|
pIni = Point3d((-((L3-d2)/2) + 0.2)*invG, (H3-(H/2)+dIniPosY),dZedWork)
|
|
pEnd = Point3d((-((L3-d2)/2) + 0.2)*invG, (H3-(H/2)+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(-((L3-d2)/2)*invG, (H3-(H/2)+dEndPosY), dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
pIni = pEnd
|
|
pEnd = Point3d( pIni:getX(), (H3-(H/2)+dIniPosY), dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
pIni = pEnd
|
|
pEnd = Point3d((-((L3-d2)/2) + 0.2)*invG, pIni:getY(), dZedWork)
|
|
end
|
|
else -- se il pivot sborda faccio geometria ruotata
|
|
|
|
if nStep == 1 then
|
|
pIni = Point3d(-((L3/2)+dIniPosY)*invG, -((H-d2)/2),dZedWork)
|
|
pEnd = Point3d(-((L3/2)+dEndPosY)*invG, -((H-d2)/2),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
else
|
|
pIni = Point3d(-((L3/2)+dIniPosY)*invG, -((H-d2)/2)+0.2,dZedWork)
|
|
pEnd = Point3d(-((L3/2)+dEndPosY)*invG, -((H-d2)/2)+0.2,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(-((L3/2)+dEndPosY)*invG, -((H-d2)/2),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
pIni = pEnd
|
|
pEnd = Point3d(-((L3/2)+dIniPosY)*invG, 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, dZedWork)
|
|
end
|
|
end
|
|
|
|
if mkrev then -- se abilitato anche il percorso inverso
|
|
|
|
if not stn or ( stn and invG < 0) then -- se il pivot non sborda
|
|
|
|
if nStep == 1 then
|
|
pIni_r = Point3d(((L3-d2)/2)*invG, (H3-(H/2)+dIniPosY),dZedWork)
|
|
pEnd_r = Point3d(((L3-d2)/2)*invG, (H3-(H/2)+dEndPosY),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocketAs_r, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
else
|
|
pIni_r = Point3d((((L3-d2)/2) - 0.2)*invG, (H3-(H/2)+dIniPosY),dZedWork)
|
|
pEnd_r = Point3d((((L3-d2)/2) - 0.2)*invG, (H3-(H/2)+dEndPosY),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocketAs_r, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
|
|
-- faccio il ritorno alla posizione di partenza
|
|
pIni_r = pEnd
|
|
pEnd_r = Point3d(((L3-d2)/2)*invG, (H3-(H/2)+dEndPosY), dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocketAs_r, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d( pIni_r:getX(), (H3-(H/2)+dIniPosY), dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocketAs_r, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d((((L3-d2)/2) - 0.2)*invG, pIni_r:getY(), dZedWork)
|
|
end
|
|
else -- se il pivot sborda faccio geomtria ruotata
|
|
|
|
if nStep == 1 then
|
|
pIni_r = Point3d(((L3/2)+dIniPosY)*invG, -((H-d2)/2),dZedWork)
|
|
pEnd_r = Point3d(((L3/2)+dEndPosY)*invG, -((H-d2)/2),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocketAs_r, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
else
|
|
pIni_r = Point3d(((L3/2)+dIniPosY)*invG, -((H-d2)/2)+0.2,dZedWork)
|
|
pEnd_r = Point3d(((L3/2)+dEndPosY)*invG, -((H-d2)/2)+0.2,dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocketAs_r, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
|
|
-- faccio il ritorno alla posizione di partenza
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(((L3/2)+dEndPosY)*invG, -((H-d2)/2),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocketAs_r, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(((L3/2)+dIniPosY)*invG, pIni_r:getY(), dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocketAs_r, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(pIni_r:getX(), -((H-d2)/2)+0.2, dZedWork)
|
|
end
|
|
end
|
|
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 mkrev then -- se abilitato anche il percorso inverso
|
|
pIniLoc = pEnd_r
|
|
pEnd_r = Point3d(pIniLoc:getX(), pIniLoc:getY(), (dZedStart - dStep))
|
|
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocketAs_r, bPreview, Dm, (d2/2), false, true,
|
|
ORANGE(), ORANGE(), sMaxFeed)
|
|
table.insert( tMVar_r, {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 ( #tPocketAs_r > 0) then
|
|
hintAs2 = EgtCurveCompo( Lg, tPocketAs_r, 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, #tMVar_r do
|
|
sListEnt = sListEnt .. '{ ent=' .. EgtNumToString( tMVar_r[i][1], 0) .. ', ' .. 'code=' .. tMVar_r[i][2] .. '}'
|
|
if i < #tMVar_r then
|
|
sListEnt = sListEnt .. ','
|
|
end
|
|
end -- end for
|
|
if string.len( sListEnt) > 0 then EgtSetInfo( hintAs2, 'MVar', sListEnt) end
|
|
end
|
|
EgtSetName(hintAs2,(LA..'_R'))
|
|
end
|
|
end
|
|
end
|
|
|
|
---------------------------------------
|
|
-- geometria svuotatura giro esterno
|
|
---------------------------------------
|
|
|
|
-- individuo in che caso sono
|
|
local dDimMax = max( H, EgtIf( stn, L3+(d/2)+dExtraH,L3))
|
|
local dDimMin = H
|
|
-- controllo con la distanza massima
|
|
if abs(dDimMax-d) < 0.03 then -- solo 1 passaggio in centro
|
|
nCase = 1
|
|
elseif (dDimMax-d) <= ( d*0.98) then -- solo passaggio di contornatura
|
|
nCase = 2
|
|
elseif ((dDimMax-d) > ( d*0.98)) and ( (dDimMax-d) <= (d*(1+p))) then -- passaggio di contornatura + un passaggio centrale
|
|
nCase = 3
|
|
elseif (dDimMax-d) > (d*(1+p)) then -- passaggio di contornatura + passaggi offset
|
|
nCase = 4
|
|
end
|
|
-- controllo con la distanza minima
|
|
if abs(dDimMin-d) < 0.03 then -- solo 1 passaggio in centro
|
|
nCaseH = 1
|
|
elseif (dDimMin-d) <= ( d*0.98) then -- solo passaggio di contornatura
|
|
nCaseH = 2
|
|
elseif ((dDimMin-d) > ( d*0.98)) and ( (dDimMin-d) <= (d*(1+p))) then -- passaggio di contornatura + un passaggio centrale
|
|
nCaseH = 3
|
|
elseif (dDimMin-d) > (d*(1+p)) then -- passaggio di contornatura + passaggi offset
|
|
nCaseH = 4
|
|
end
|
|
|
|
local nDirVers = 1
|
|
local tMVar = {}
|
|
local tMVar_r = {}
|
|
local nConEnt
|
|
local sKindVar
|
|
|
|
-- resetto contatori entità
|
|
nTotContEnt = 0
|
|
nTotContEnt_r = 0
|
|
nRadius = dDimMax/2
|
|
nPass = 1
|
|
if jn and subtype == 4 then -- svuotature unite calcolo il numero di passi in Z
|
|
dZedStart = -dPrevTh
|
|
nStep = ceil((T2-dPrevTh)/sf) -- numero di passate
|
|
dStep = ((T2-dPrevTh)/nStep) -- passo ricalcolato
|
|
jn = false
|
|
else
|
|
dZedStart = 0
|
|
nStep = ceil(T/sf) -- numero di passate
|
|
dStep = (T/nStep) -- passo ricalcolato
|
|
end
|
|
|
|
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
|
|
|
|
-- se primo passo con seconda cava faccio linea di discesa
|
|
if nPass == 1 and not jn and subtype == 4 then
|
|
pIni = Point3d(0,(H3-(H/2)+(d*3/4)),dZedStart)
|
|
pStartStep = pIni
|
|
pEnd = Point3d(0,(H3-(H/2)+(d*3/4)),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED())
|
|
pIni = pEnd
|
|
else
|
|
pIni = Point3d(0,(H3-(H/2)+(d*3/4)),dZedWork)
|
|
pStartStep = pIni
|
|
end
|
|
|
|
pEnd = Point3d(0,0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED())
|
|
pIni = pEnd
|
|
|
|
if not stn and D_SK > 0 then
|
|
pEnd = Point3d(((L3/2)+D_SK-(d/2)),0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED())
|
|
pIni = pEnd
|
|
end
|
|
|
|
if subtype < 4 then
|
|
pEnd = Point3d(((L3/2)+D_SK-L+(d/2)),0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED())
|
|
pIni = pEnd
|
|
end
|
|
|
|
-- se non sono all'ultima passata scendo in Z
|
|
if nPass < nStep then
|
|
pEnd = Point3d(pIni:getX(),0,(dZedWork-dStep))
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED())
|
|
end
|
|
|
|
if mkrev then -- se abilitato anche il percorso inverso
|
|
|
|
pIni_r = Point3d(0,(H3-(H/2)+(d*3/4)),dZedWork)
|
|
pStartStep_r = pIni_r
|
|
pEnd_r = Point3d(0,0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, 1)
|
|
pIni_r = pEnd_r
|
|
|
|
if not stn and D_SK > 0 then
|
|
pEnd_r = Point3d(((L3/2)+D_SK-(d/2)),0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), false, true, RED(), RED(), nil, 1)
|
|
pIni_r = pEnd_r
|
|
end
|
|
|
|
pEnd_r = Point3d(((L3/2)+D_SK-L+(d/2)),0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), false, true, RED(), RED(), nil, 1)
|
|
pIni_r = pEnd_r
|
|
|
|
-- se non sono all'ultima passata scendo in Z
|
|
if nPass < nStep then
|
|
pEnd_r = Point3d(((L3/2)+D_SK-L+(d/2)),0,(dZedWork-dStep))
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), false, true, RED(), RED(), nil, 1)
|
|
end
|
|
end
|
|
else -- altrimenti passata di ritorno
|
|
|
|
if subtype == 4 then
|
|
if not stn and D_SK > 0 then
|
|
pIni = Point3d(((L3/2)+D_SK-(d/2)),0,dZedWork)
|
|
pEnd = Point3d(0,0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED())
|
|
pIni = pEnd
|
|
else
|
|
pIni = Point3d(0,0,dZedWork)
|
|
end
|
|
pEnd = Point3d(0,(H3-(H/2)+(d*3/4)),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED())
|
|
else
|
|
pIni = Point3d(((L3/2)+D_SK-L+(d/2)),0,dZedWork)
|
|
|
|
if not stn and D_SK > 0 then
|
|
pEnd = Point3d(((L3/2)+D_SK-(d/2)),0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED())
|
|
pIni = pEnd
|
|
end
|
|
|
|
pEnd = Point3d(0,0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED())
|
|
pIni = pEnd
|
|
pEnd = Point3d(0,(H3-(H/2)+(d*3/4)),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED())
|
|
end
|
|
|
|
-- se non sono all'ultima passata scendo in Z
|
|
if nPass < nStep then
|
|
pIni = pEnd
|
|
pEnd = Point3d(0,(H3-(H/2)+(d*3/4)),(dZedWork-dStep))
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED())
|
|
end
|
|
|
|
if mkrev then -- se abilitato anche il percorso inverso
|
|
|
|
pIni_r = Point3d(((L3/2)+D_SK-L+(d/2)),0,dZedWork)
|
|
|
|
if not stn and D_SK > 0 then
|
|
pEnd_r = Point3d(((L3/2)+D_SK-(d/2)),0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, 1)
|
|
pIni_r = pEnd_r
|
|
end
|
|
|
|
pEnd_r = Point3d(0,0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, 1)
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(0,(H3-(H/2)+(d*3/4)),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), false, true, RED(), RED(), nil, 1)
|
|
|
|
-- se non sono all'ultima passata scendo in Z
|
|
if nPass < nStep then
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(0,(H3-(H/2)+(d*3/4)),(dZedWork-dStep))
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), false, true, RED(), RED(), nil, 1)
|
|
end
|
|
end
|
|
end
|
|
|
|
if nPass == nStep then
|
|
|
|
if jn then -- se uso un solo utensile mi porto in posizione di partenza per la prossima geometria
|
|
|
|
-- calcolo 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
|
|
|
|
-- se ho fatto passata ritorno scendo alla Y del punto join
|
|
if nDirVers == 1 then -- se fatta passata di andata
|
|
|
|
if nextSub == 4 then -- se il percorso successivo è ancora una forma pivot torno al punto di inizio
|
|
pEnd = Point3d(pStartStep:getX(),pIni:getY(),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE())
|
|
pIni = pEnd
|
|
pEnd = Point3d(pStartStep:getX(),pStartStep:getY(),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE())
|
|
else
|
|
if ( nCaseNext == 1) then -- se solo passaggio in centro parto dalla parte opposta
|
|
pEnd = Point3d(((-((L2-d)/2)*invG)-((L-L3)/2)+D_X),D,dZedWork)
|
|
else
|
|
pEnd = Point3d(((((L2-d)/2)*invG)-((L-L3)/2)+D_X),(((H2-d)/2)+D),dZedWork)
|
|
end
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE())
|
|
end
|
|
else -- altrimenti già tornato
|
|
|
|
if nextSub == 4 then -- se il percorso successivo è ancora una forma pivot torno al punto di inizio
|
|
pEnd = Point3d(pIni:getX(),pStartStep:getY(),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE())
|
|
pIni = pEnd
|
|
pEnd = Point3d(pStartStep:getX(),pStartStep:getY(),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE())
|
|
else
|
|
-- linea discendente
|
|
if ( nCaseNext == 1) then -- se solo passaggio in centro parto dalla parte opposta
|
|
pEnd = Point3d(pIni:getX(),D,dZedWork)
|
|
else
|
|
pEnd = Point3d(pIni:getX(),(((H2-d)/2)+D),dZedWork)
|
|
end
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE())
|
|
pIni = pEnd
|
|
|
|
if ( nCaseNext == 1) then -- se solo passaggio in centro parto dalla parte opposta
|
|
pEnd = Point3d(((-((L2-d)/2)*invG)-((L-L3)/2)+D_X),D,dZedWork)
|
|
else
|
|
pEnd = Point3d(((((L2-d)/2)*invG)-((L-L3)/2)+D_X),(((H2-d)/2)+D),dZedWork)
|
|
end
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE())
|
|
end
|
|
end
|
|
|
|
if mkrev then -- se abilitato anche il percorso inverso
|
|
|
|
pIni_r = pEnd_r
|
|
|
|
-- se ho fatto passata ritorno scendo alla Y del punto join
|
|
if nDirVers == 1 then -- se passata di andata
|
|
|
|
if ( nCaseNext == 1) then -- se solo passaggio in centro parto dalla parte opposta
|
|
pEnd_r = Point3d(((((L2-d)/2)*invG)-((L-L3)/2)+D_X),D,dZedWork)
|
|
else
|
|
pEnd_r = Point3d(((-((L2-d)/2)*invG)-((L-L3)/2)+D_X),(((H2-d)/2)+D),dZedWork)
|
|
end
|
|
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE(), nil, 1)
|
|
else
|
|
|
|
-- linea discendente
|
|
if ( nCaseNext == 1) then -- se solo passaggio in centro parto dalla parte opposta
|
|
pEnd_r = Point3d(pIni_r:getX(),D,dZedWork)
|
|
else
|
|
pEnd_r = Point3d(pIni_r:getX(),(((H2-d)/2)+D),dZedWork)
|
|
end
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE(), nil, 1)
|
|
|
|
pIni_r = pEnd_r
|
|
|
|
if ( nCaseNext == 1) then -- se solo passaggio in centro parto dalla parte opposta
|
|
pEnd_r = Point3d(((((L2-d)/2)*invG)-((L-L3)/2)+D_X),D,dZedWork)
|
|
else
|
|
pEnd_r = Point3d(((-((L2-d)/2)*invG)-((L-L3)/2)+D_X),(((H2-d)/2)+D),dZedWork)
|
|
end
|
|
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE(), nil, 1)
|
|
end
|
|
end
|
|
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
|
|
|
|
if mkrev then -- se abilitato anche il percorso inverso
|
|
-- copia del percorso offsettato
|
|
hint_ofs_r = EgtCopyGlob( hint_ofs, Lg)
|
|
end
|
|
|
|
-- 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
|
|
|
|
if ( not B_SK and ( not stn or ( stn and invG > 0))) or
|
|
( B_SK and not( stn and invG > 0)) then -- se il pivot non sborda
|
|
|
|
-- se primo passo con seconda cava faccio linea di discesa
|
|
if nPass == 1 and not jn and subtype == 4 then
|
|
pIni = Point3d((-((L3-d)/2) + 0.2)*invG,(H3-(H/2)+(d*3/4)),dZedStart)
|
|
pStartStep = pIni
|
|
pEnd = Point3d((-((L3-d)/2) + 0.2)*invG,(H3-(H/2)+(d*3/4)),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED())
|
|
pIni = pEnd
|
|
else
|
|
pIni = Point3d((-((L3-d)/2) + 0.2)*invG,(H3-(H/2)+(d*3/4)),dZedWork)
|
|
pStartStep = pIni
|
|
end
|
|
|
|
-- linea in Y con centro utensile fuori
|
|
pEnd = Point3d((-((L3-d)/2) + 0.2)*invG,(H3-(H/2)+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(((L3-d)/2)*invG,(H3-(H/2)+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, 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)
|
|
else -- se il pivot sborda faccio geometria ruotata
|
|
|
|
-- se primo passo con seconda cava faccio linea di discesa
|
|
if nPass == 1 and not jn and subtype == 4 then
|
|
pIni = Point3d(-((L3/2)+(d*3/4))*invG,(-((H-d)/2)+0.2),dZedStart)
|
|
pStartStep = pIni
|
|
pEnd = Point3d(-((L3/2)+(d*3/4))*invG,(-((H-d)/2)+0.2),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED())
|
|
pIni = pEnd
|
|
else
|
|
pIni = Point3d(-((L3/2)+(d*3/4))*invG,(-((H-d)/2)+0.2),dZedWork)
|
|
pStartStep = pIni
|
|
end
|
|
|
|
-- linea in X con centro utensile fuori
|
|
pEnd = Point3d(-((L3/2)+dExtraH)*invG,(-((H-d)/2)+0.2),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED())
|
|
-- linee traverse in Y e poi X per andare sul vecchio punto iniziale (in X)
|
|
pIni = pEnd
|
|
pEnd = Point3d(-((L3/2)+dExtraH)*invG,(H3-(H/2)+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED())
|
|
pIni = pEnd
|
|
pEnd = Point3d(((L3-d)/2)*invG,(H3-(H/2)+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, 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)
|
|
end
|
|
local ntypeDom, nNumCurve = EgtCurveDomain(hint_ofs)
|
|
nTotContEnt = nTotContEnt + ( nNumCurve - ntypeDom)
|
|
table.insert( tPocket, hint_ofs)
|
|
else
|
|
if ( not B_SK and ( not stn or ( stn and invG > 0))) or
|
|
( B_SK and not( stn and invG > 0)) then -- se il pivot non sborda
|
|
|
|
-- se primo passo con seconda cava faccio linea di discesa
|
|
if nPass == 1 and not jn and subtype == 4 then
|
|
pIni = Point3d(((L3-d)/2)*invG,(H3-(H/2)+(d*3/4)),dZedStart)
|
|
pStartStep = pIni
|
|
pEnd = Point3d(((L3-d)/2)*invG,(H3-(H/2)+(d*3/4)),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED())
|
|
pIni = pEnd
|
|
else
|
|
pIni = Point3d(((L3-d)/2)*invG,(H3-(H/2)+(d*3/4)),dZedWork)
|
|
pStartStep = pIni
|
|
end
|
|
|
|
-- prima linea entrante
|
|
pEnd = EgtSP( hint_ofs)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED())
|
|
pEnd = EgtEP( hint_ofs)
|
|
else -- se il pivot sborda faccio geomtria ruotata
|
|
|
|
-- se primo passo con seconda cava faccio linea di discesa
|
|
if nPass == 1 and not jn and subtype == 4 then
|
|
pIni = Point3d(-((L3/2)+(d*3/4))*invG,(-((H-d)/2)+0.2),dZedStart)
|
|
pStartStep = pIni
|
|
pEnd = Point3d(-((L3/2)+(d*3/4))*invG,(-((H-d)/2)+0.2),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED())
|
|
pIni = pEnd
|
|
else
|
|
pIni = Point3d(-((L3/2)+(d*3/4))*invG,(-((H-d)/2)+0.2),dZedWork)
|
|
pStartStep = pIni
|
|
end
|
|
|
|
-- prima linea entrante
|
|
pEnd = Point3d(-((L3/2)+dExtraH)*invG,(-((H-d)/2)+0.2),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED())
|
|
-- linee traverse in Y e poi X per andare sul vecchio punto iniziale (in X)
|
|
pIni = pEnd
|
|
pEnd = Point3d(-((L3/2)+dExtraH)*invG,(H3-(H/2)+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED())
|
|
pIni = pEnd
|
|
pEnd = Point3d(((L3-d)/2)*invG,(H3-(H/2)+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED())
|
|
pIni = pEnd
|
|
pEnd = EgtSP( hint_ofs)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED())
|
|
pEnd = EgtEP( hint_ofs)
|
|
end
|
|
local ntypeDom, nNumCurve = EgtCurveDomain(hint_ofs)
|
|
nTotContEnt = nTotContEnt + ( nNumCurve - ntypeDom)
|
|
table.insert( tPocket, hint_ofs)
|
|
end
|
|
|
|
if mkrev then -- se abilitato anche il percorso inverso
|
|
|
|
-- muovo la geometria in Z
|
|
EgtMove( hint_ofs_r, Point3d(0,0,dZedWork) - ORIG())
|
|
|
|
-- se flag non inverso, inverto la geometria, solo qui non nelle altre copie
|
|
if invG > 0 then
|
|
EgtInvertCurve(hint_ofs_r)
|
|
end
|
|
|
|
if bStartOppo then
|
|
if not stn or ( stn and invG < 0) then -- se il pivot non sborda
|
|
pIni_r = Point3d((((L3-d)/2) - 0.2)*invG,(H3-(H/2)+(d*3/4)),dZedWork)
|
|
pStartStep_r = pIni_r
|
|
-- linea in Y con centro utensile fuori
|
|
pEnd_r = Point3d((((L3-d)/2) - 0.2)*invG,(H3-(H/2)+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, 1)
|
|
-- linea traversa in X per andare sul vecchio punto iniziale (in X)
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(-((L3-d)/2)*invG,(H3-(H/2)+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, 1)
|
|
-- linea entrante a prendere il percorso di offset
|
|
pIni_r = pEnd_r
|
|
pEnd_r = EgtSP( hint_ofs_r)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, 1)
|
|
pEnd_r = EgtEP( hint_ofs_r)
|
|
else -- se il pivot sborda faccio geomtria ruotata
|
|
pIni_r = Point3d(((L3/2)+(d*3/4))*invG,(-((H-d)/2)+0.2),dZedWork)
|
|
pStartStep_r = pIni_r
|
|
-- linea in X con centro utensile fuori
|
|
pEnd_r = Point3d(((L3/2)+dExtraH)*invG,(-((H-d)/2)+0.2),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, 1)
|
|
-- linee traverse in Y e poi X per andare sul vecchio punto iniziale (in X)
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(((L3/2)+dExtraH)*invG,(H3-(H/2)+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, 1)
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(-((L3-d)/2)*invG,(H3-(H/2)+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, 1)
|
|
-- linea entrante a prendere il percorso di offset
|
|
pIni_r = pEnd_r
|
|
pEnd_r = EgtSP( hint_ofs_r)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, 1)
|
|
pEnd_r = EgtEP( hint_ofs_r)
|
|
end
|
|
local ntypeDom, nNumCurve = EgtCurveDomain(hint_ofs_r)
|
|
nTotContEnt_r = nTotContEnt_r + ( nNumCurve - ntypeDom)
|
|
table.insert( tPocket_r, hint_ofs_r)
|
|
else
|
|
if not stn or ( stn and invG < 0) then -- se il pivot non sborda
|
|
-- prima linea entrante
|
|
pIni_r = Point3d(-((L3-d)/2)*invG,(H3-(H/2)+(d*3/4)),dZedWork)
|
|
pStartStep_r = pIni_r
|
|
pEnd_r = EgtSP( hint_ofs_r)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, 1)
|
|
pEnd_r = EgtEP( hint_ofs_r)
|
|
else -- se il pivot sborda faccio geomtria ruotata
|
|
-- prima linea entrante
|
|
pIni_r = Point3d(((L3/2)+(d*3/4))*invG,(-((H-d)/2)+0.2),dZedWork)
|
|
pStartStep_r = pIni_r
|
|
pEnd_r = Point3d(((L3/2)+dExtraH)*invG,(-((H-d)/2)+0.2),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, 1)
|
|
-- linee traverse in Y e poi X per andare sul vecchio punto iniziale (in X)
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(((L3/2)+dExtraH)*invG,(H3-(H/2)+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, 1)
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(-((L3-d)/2)*invG,(H3-(H/2)+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, 1)
|
|
pIni_r = pEnd_r
|
|
pEnd_r = EgtSP( hint_ofs_r)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, 1)
|
|
pEnd_r = EgtEP( hint_ofs_r)
|
|
end
|
|
local ntypeDom, nNumCurve = EgtCurveDomain(hint_ofs_r)
|
|
nTotContEnt_r = nTotContEnt_r + ( nNumCurve - ntypeDom)
|
|
table.insert( tPocket_r, hint_ofs_r)
|
|
end
|
|
end
|
|
end
|
|
|
|
if nCase == 2 and R1 > 0 and p >= 0.8 then -- passaggio di contornatura con il raccordo sullo spigolo
|
|
|
|
-- linea posizionamento passata centrale
|
|
pIni = pEnd
|
|
pEnd = Point3d(0,(H3-(H/2)+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW())
|
|
|
|
-- linee passata centrale
|
|
pIni = pEnd
|
|
pEnd = Point3d(0,0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW())
|
|
pIni = pEnd
|
|
|
|
if subtype < 4 then
|
|
if nCaseH >= 2 then
|
|
pEnd = Point3d(((L3/2)-(d/2)-dExtraH),0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW())
|
|
pIni = pEnd
|
|
end
|
|
end
|
|
|
|
if subtype < 4 then
|
|
if nCaseH >= 2 then -- se forma a L e la parte lunga è abbastanza larga
|
|
pEnd = Point3d(-((L3/2)-(d/2)-dExtraH)*EgtIf(B_SK,-1,1),0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW())
|
|
pIni = pEnd
|
|
end
|
|
end
|
|
|
|
-- 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
|
|
if subtype < 4 then
|
|
pEnd = Point3d(0,0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW())
|
|
pIni = pEnd
|
|
end
|
|
pEnd = Point3d(0,(H3-(H/2)+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW())
|
|
pIni = pEnd
|
|
end
|
|
elseif nCase == 3 then -- passaggio di contornatura + un passaggio centrale
|
|
|
|
-- linea posizionamento passata centrale
|
|
pIni = pEnd
|
|
pEnd = Point3d(0,(H3-(H/2)+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW())
|
|
|
|
-- linee passata centrale
|
|
pIni = pEnd
|
|
pEnd = Point3d(0,0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW())
|
|
pIni = pEnd
|
|
|
|
if not stn and D_SK > 0 and not B_SK then
|
|
if nCaseH > 2 then
|
|
pEnd = Point3d(((L3/2)+D_SK-(d*3/4)),0,dZedWork)
|
|
else
|
|
pEnd = Point3d(((L3/2)-(d/2)-dExtraH),0,dZedWork)
|
|
end
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW())
|
|
pIni = pEnd
|
|
end
|
|
|
|
if subtype < 4 then
|
|
if nCaseH > 2 then -- se forma a L e la parte lunga è abbastanza larga
|
|
if B_SK then
|
|
pEnd = Point3d(((L3/2)+D_SK-(d*3/4)),0,dZedWork)
|
|
else
|
|
if D_SK == 0 or ( D_SK2 and D_SK2 > 0) then
|
|
pEnd = Point3d(((L3/2)+D_SK-L+(d*3/4)),0,dZedWork)
|
|
end
|
|
end
|
|
else
|
|
pEnd = Point3d(-((L3/2)-(d/2)-dExtraH)*EgtIf(B_SK,-1,1),0,dZedWork)
|
|
end
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW())
|
|
pIni = pEnd
|
|
end
|
|
|
|
-- 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
|
|
if subtype < 4 then
|
|
pEnd = Point3d(0,0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW())
|
|
pIni = pEnd
|
|
end
|
|
pEnd = Point3d(0,(H3-(H/2)+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW())
|
|
pIni = pEnd
|
|
end
|
|
|
|
if mkrev then -- se abilitato anche il percorso inverso
|
|
|
|
-- linea posizionamento passata centrale
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(0,(H3-(H/2)+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, 1)
|
|
|
|
-- linee passata centrale
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(0,0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, 1)
|
|
pIni_r = pEnd_r
|
|
|
|
if not stn and D_SK > 0 then
|
|
if nCaseH > 2 then
|
|
pEnd_r = Point3d(((L3/2)+D_SK-(d*3/4)),0,dZedWork)
|
|
else
|
|
pEnd_r = Point3d(((L3/2)-(d/2)-dExtraH),0,dZedWork)
|
|
end
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, 1)
|
|
pIni_r = pEnd_r
|
|
end
|
|
|
|
if nCaseH > 2 then
|
|
pEnd_r = Point3d(((L3/2)+D_SK-L+(d*3/4)),0,dZedWork)
|
|
else
|
|
pEnd_r = Point3d(-((L3/2)-(d/2)-dExtraH),0,dZedWork)
|
|
end
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, 1)
|
|
pIni_r = pEnd_r
|
|
|
|
-- 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_r = Point3d(0,0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, 1)
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(0,(H3-(H/2)+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, 1)
|
|
pIni_r = pEnd_r
|
|
end
|
|
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
|
|
nCountOfs = 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
|
|
|
|
nCountOfs = nCountOfs + 1
|
|
|
|
-- 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)
|
|
|
|
if mkrev then -- se abilitato anche il percorso inverso
|
|
|
|
-- copia del percorso offsettato
|
|
hint_ofs2_r = EgtCopyGlob( hint_ofs2, Lg)
|
|
EgtInvertCurve(hint_ofs2_r)
|
|
-- linea congiunzione tra osset
|
|
pIni_r = pEnd_r
|
|
pEnd_r = EgtSP( hint_ofs2_r)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW(), nil, 1)
|
|
pEnd_r = EgtEP( hint_ofs2_r)
|
|
hint_ofs_r = hint_ofs2_r
|
|
local ntypeDom, nNumCurve = EgtCurveDomain(hint_ofs_r)
|
|
nTotContEnt_r = nTotContEnt_r + ( nNumCurve - ntypeDom)
|
|
table.insert( tPocket_r, hint_ofs_r)
|
|
end
|
|
|
|
-- calcolo nuovo passo in Y e indice direzione
|
|
nRadius = nRadius - nDistYcentr
|
|
bContinue = nRadius > 0
|
|
else
|
|
bContinue = false
|
|
end
|
|
end -- end while
|
|
|
|
if not stn then -- se non sborda
|
|
|
|
-- se ho knuckle aggiungo passaggio centrale
|
|
if D_SK > 0 then
|
|
|
|
-- linea posizionamento passata centrale
|
|
pIni = pEnd
|
|
pEnd = Point3d(0,(H3-(H/2)+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW())
|
|
|
|
-- linee passata centrale
|
|
pIni = pEnd
|
|
pEnd = Point3d(0,0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW())
|
|
pIni = pEnd
|
|
|
|
pEnd = Point3d(((L3/2)+D_SK-(nDistYcentr*nCountOfs)-d),0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW())
|
|
pIni = pEnd
|
|
|
|
if subtype < 4 then
|
|
pEnd = Point3d(((L3/2)+D_SK-L+(nDistYcentr*nCountOfs)+d),0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW())
|
|
pIni = pEnd
|
|
end
|
|
|
|
-- 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(0,0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW())
|
|
pIni = pEnd
|
|
pEnd = Point3d(0,(H3-(H/2)+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW())
|
|
pIni = pEnd
|
|
end
|
|
|
|
if mkrev then -- se abilitato anche il percorso inverso
|
|
|
|
-- linea posizionamento passata centrale
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(0,(H3-(H/2)+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, 1)
|
|
|
|
-- linee passata centrale
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(0,0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, 1)
|
|
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(((L3/2)+D_SK-(nDistYcentr*nCountOfs)-d),0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, 1)
|
|
pIni_r = pEnd_r
|
|
|
|
pEnd_r = Point3d(((L3/2)+D_SK-L+(nDistYcentr*nCountOfs)+d),0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, 1)
|
|
pIni_r = pEnd_r
|
|
|
|
-- 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_r = Point3d(0,0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, 1)
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(0,(H3-(H/2)+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, 1)
|
|
pIni_r = pEnd_r
|
|
end
|
|
end
|
|
end
|
|
elseif p > 0.6 then -- se sborda ma la percentuale di sovrapposizione è alta
|
|
|
|
-- linea posizionamento passata centrale
|
|
pIni = pEnd
|
|
pEnd = Point3d(0,(H3-(H/2)+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW())
|
|
|
|
-- linee passata centrale
|
|
pIni = pEnd
|
|
pEnd = Point3d(0,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(0,(H3-(H/2)+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW())
|
|
pIni = pEnd
|
|
end
|
|
|
|
if mkrev then -- se abilitato anche il percorso inverso
|
|
|
|
-- linea posizionamento passata centrale
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(0,(H3-(H/2)+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, 1)
|
|
|
|
-- linee passata centrale
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(0,0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, 1)
|
|
pIni_r = pEnd_r
|
|
|
|
-- 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_r = Point3d(0,(H3-(H/2)+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, 1)
|
|
pIni_r = pEnd_r
|
|
end
|
|
end
|
|
end
|
|
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 mkrev then -- se abilitato anche il percorso inverso
|
|
pIni_r = pEnd_r
|
|
end
|
|
|
|
if nextSub == 4 then -- se il percorso successivo è ancora una forma pivot torno al punto di inizio
|
|
|
|
if nCase == 3 then -- passaggio di contornatura + un passaggio centrale, torno indietro
|
|
pEnd = Point3d(0,0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW())
|
|
pIni = pEnd
|
|
end
|
|
pEnd = Point3d(pIni:getX(),pStartStep:getY(),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE())
|
|
pIni = pEnd
|
|
pEnd = Point3d(pStartStep:getX(),pStartStep:getY(),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE())
|
|
else
|
|
|
|
if ( nCaseNext == 1) then -- se solo passaggio in centro parto dalla parte opposta
|
|
if nCase ~= 3 then -- posso trovarmi in una Y alta e per raggiungere la mortasa taglio il percorso
|
|
local nx = pIni:getX()
|
|
pEnd = Point3d(nx,D,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE())
|
|
pIni = pEnd
|
|
end
|
|
pEnd = Point3d(((-((L2-d)/2)*invG)-((L-L3)/2)+D_X),D,dZedWork)
|
|
|
|
if mkrev then -- se abilitato anche il percorso inverso
|
|
|
|
if nCase ~= 3 then -- posso trovarmi in una Y alta e per raggiungere la mortasa taglio il percorso
|
|
local nx = pIni_r:getX()
|
|
pEnd_r = Point3d(nx,D,dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE(), nil, 1)
|
|
pIni_r = pEnd_r
|
|
end
|
|
pEnd_r = Point3d(((((L2-d)/2)*invG)-((L-L3)/2)+D_X),D,dZedWork)
|
|
end
|
|
else
|
|
if nCase ~= 3 then -- posso trovarmi in una Y alta e per raggiungere la mortasa taglio il percorso
|
|
local nx = pIni:getX()
|
|
pEnd = Point3d(nx,(((H2-d)/2)+D),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE())
|
|
pIni = pEnd
|
|
end
|
|
pEnd = Point3d(((((L2-d)/2)*invG)-((L-L3)/2)+D_X),(((H2-d)/2)+D),dZedWork)
|
|
|
|
if mkrev then -- se abilitato anche il percorso inverso
|
|
if nCase ~= 3 then -- posso trovarmi in una Y alta e per raggiungere la mortasa taglio il percorso
|
|
local nx = pIni_r:getX()
|
|
pEnd_r = Point3d(nx,(((H2-d)/2)+D),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE(), nil, 1)
|
|
pIni_r = pEnd_r
|
|
end
|
|
pEnd_r = Point3d(((-((L2-d)/2)*invG)-((L-L3)/2)+D_X),(((H2-d)/2)+D),dZedWork)
|
|
end
|
|
end
|
|
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE())
|
|
if mkrev then -- se abilitato anche il percorso inverso
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE(), nil, 1)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
nPass = nPass + 1
|
|
dZedStart = dZedStart - dStep
|
|
nRadius = dDimMax/2
|
|
nDirVers = -nDirVers
|
|
|
|
-- se ho altri passi torno al punto di inizio
|
|
if nPass <= nStep and nCase > 1 then
|
|
|
|
pIni = pEnd
|
|
if ( not B_SK and ( not stn or ( stn and invG > 0))) or
|
|
( B_SK and not( stn and invG > 0)) then -- se il pivot non sborda
|
|
pEnd = Point3d(pStartStep:getX(),pStartStep:getY(),dZedStart)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW())
|
|
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})
|
|
else -- se il pivot sborda faccio geometria ruotata
|
|
pEnd = Point3d(pStartStep:getX(),pIni:getY(),dZedStart)
|
|
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW(), sMaxFeed)
|
|
table.insert( tMVar, {nTotContEnt,sKindVar})
|
|
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
|
|
|
|
if mkrev then -- se abilitato anche il percorso inverso
|
|
pIni_r = pEnd_r
|
|
if not stn or ( stn and invG < 0) then -- se il pivot non sborda
|
|
pEnd_r = Point3d(pStartStep_r:getX(),pStartStep_r:getY(),dZedStart)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW(), nil, 1)
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(pStartStep_r:getX(),pStartStep_r:getY(),(dZedStart - dStep))
|
|
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW(), sMaxFeed, 1)
|
|
table.insert( tMVar_r, {nTotContEnt_r,sKindVar})
|
|
else -- se il pivot sborda faccio geomtria ruotata
|
|
pEnd_r = Point3d(pStartStep_r:getX(),pIni_r:getY(),dZedStart)
|
|
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW(), sMaxFeed, 1)
|
|
table.insert( tMVar_r, {nTotContEnt_r,sKindVar})
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(pStartStep_r:getX(),pStartStep_r:getY(),(dZedStart - dStep))
|
|
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW(), sMaxFeed, 1)
|
|
table.insert( tMVar_r, {nTotContEnt_r,sKindVar})
|
|
end
|
|
end
|
|
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
|
|
|
|
if ( #tPocket_r > 0) then
|
|
hintPk_r = EgtCurveCompo( Lg, tPocket_r, true)
|
|
if hintPk_r then
|
|
EgtModifyCurveThickness(hintPk_r, 0)
|
|
-- assegno nota con la lista delle entità di variazione
|
|
local sListEnt = ''
|
|
for i = 1, #tMVar_r do
|
|
sListEnt = sListEnt .. '{ ent=' .. EgtNumToString( tMVar_r[i][1], 0) .. ', ' .. 'code=' .. tMVar_r[i][2] .. '}'
|
|
if i < #tMVar_r then
|
|
sListEnt = sListEnt .. ','
|
|
end
|
|
end -- end for
|
|
if string.len( sListEnt) > 0 then EgtSetInfo( hintPk_r, 'MVar', sListEnt) end
|
|
EgtSetName(hintPk_r,(LM..'_R'))
|
|
end
|
|
end
|
|
|
|
-- se variabile inversione negativa inverto la direzione del percorso geomerico principale
|
|
if invG < 0 then
|
|
EgtInvertCurve(hint)
|
|
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 hintAs2 then
|
|
EgtSetColor(hintAs2,AQUA())
|
|
end
|
|
if hintPk then
|
|
EgtSetColor(hintPk,AQUA())
|
|
end
|
|
if hintPk_r then
|
|
EgtSetColor(hintPk_r,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
|
|
if hintPk_r then
|
|
EgtSetColor(hintPk_r,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 hintPk then
|
|
EgtSetInfo( hintPk, 'NotCheckDir', '1')
|
|
end
|
|
if hintAs1 then
|
|
EgtSetInfo( hintAs1, 'NotCheckDir', '1')
|
|
end
|
|
if hintAs2 then
|
|
EgtSetInfo( hintAs2, 'NotCheckDir', '1')
|
|
end
|
|
if hintPk_r then
|
|
EgtSetInfo( hintPk_r, 'NotCheckDir', '1')
|
|
end
|
|
end
|
|
|
|
return hint, hintPk, hintAs1, hintAs2, hintPk_r
|
|
end
|
|
|
|
return PivotL
|