cc55202ec5
- primo commit con versione corrente.
1550 lines
71 KiB
Lua
1550 lines
71 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
|
|
--
|
|
-- _Strike.lua by EgalWare s.r.l. 2016.07.11
|
|
-- Autore: Filippo Monchi
|
|
-- StrikeC, 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.10.10 V1.0a6 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
|
|
-- 2024.04.12 V2.001 FM Also Consider the latch strike wide to check if it's possible do the offset
|
|
-- 2024.07.19 V2.002 FM Set note 'NotCheckDir' to pocketing and antisplint paths
|
|
|
|
-- Tavola per definizione modulo (serve ma non usata)
|
|
local StrikeC = {}
|
|
|
|
-- 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
|
|
|
|
local function DrawExternalPath( Lg, D_SS, L, LS, H, H3, IS, AS, R1, rf, nMode, H5, Dm)
|
|
|
|
local tPath = {}
|
|
local tPath2 = {}
|
|
local nPath1, nPath2
|
|
local pIni, pEnd, pCentr, pIni_c, pEnd_c
|
|
local dLS = H3 * tan(AS)
|
|
local H5r = EgtIf( H5, H5, H3)
|
|
local dLS5 = H5r * tan(AS)
|
|
local dR1 = R1 * tan((90-AS)/2)
|
|
local dR1s = dR1*sin(AS)
|
|
local dR1c = dR1*cos(AS)
|
|
|
|
-- Costruzione della geometria ( in senso orario) prima parte percorso
|
|
|
|
if nMode == 2 then
|
|
pIni = Point3d((-D_SS-dLS),(H3+(H/2)),0)
|
|
else
|
|
pIni_c = Point3d((-D_SS-dLS),(H3+(H/2)),0)
|
|
pIni = Point3d((-D_SS-dLS5),(H5r+(H/2)),0)
|
|
end
|
|
|
|
if R1 > 0 then
|
|
pEnd = Point3d((-D_SS-dR1s),((H/2)+dR1c),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
if nMode == 1 then
|
|
DrawAddLineDrawCircle( pIni_c, pEnd, Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
end
|
|
pIni = pEnd
|
|
pEnd = Point3d(-D_SS+dR1,(H/2),0)
|
|
pCentr =Point3d(-D_SS+dR1,((H/2)+R1),0)
|
|
DrawAddCircleDrawCircle( pCentr, R1,(180+AS),(90-AS), Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
if nMode == 1 then
|
|
DrawAddCircleDrawCircle( pCentr, R1,(180+AS),(90-AS), Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
end
|
|
pIni = pEnd
|
|
else
|
|
pEnd = Point3d(-D_SS,(H/2),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
if nMode == 1 then
|
|
DrawAddLineDrawCircle( pIni_c, pEnd, Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
end
|
|
pIni = pEnd
|
|
end
|
|
|
|
if rf > 0 then
|
|
pEnd = Point3d(-rf,(H/2),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
if nMode == 1 then
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
end
|
|
pIni = pEnd
|
|
pEnd = Point3d(0,(H/2)-rf,0)
|
|
pCentr = Point3d(-rf,(H/2)-rf,0)
|
|
DrawAddCircleDrawCircle( pCentr, rf, 90,-90, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
if nMode == 1 then
|
|
DrawAddCircleDrawCircle( pCentr, rf, 90,-90, Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
end
|
|
pIni = pEnd
|
|
else
|
|
pEnd = Point3d(0,(H/2),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
if nMode == 1 then
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
end
|
|
pIni = pEnd
|
|
end
|
|
|
|
if rf > 0 then
|
|
if abs((2*rf)-H) < 0.0001 then
|
|
pEnd = Point3d(-rf,-(H/2),0)
|
|
pCentr = Point3d(-rf,-(H/2)+rf,0)
|
|
DrawAddCircleDrawCircle( pCentr, rf, 0,-90, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
if nMode == 1 then
|
|
DrawAddCircleDrawCircle( pCentr, rf, 0,-90, Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
end
|
|
pIni = pEnd
|
|
else
|
|
pEnd = Point3d(0,-(H/2)+rf,0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
if nMode == 1 then
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
end
|
|
pIni = pEnd
|
|
pEnd = Point3d(-rf,-(H/2),0)
|
|
pCentr = Point3d(-rf,-(H/2)+rf,0)
|
|
DrawAddCircleDrawCircle( pCentr, rf, 0,-90, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
if nMode == 1 then
|
|
DrawAddCircleDrawCircle( pCentr, rf, 0,-90, Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
end
|
|
pIni = pEnd
|
|
end
|
|
else
|
|
pEnd = Point3d(0,-(H/2),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
if nMode == 1 then
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
end
|
|
pIni = pEnd
|
|
end
|
|
|
|
if rf > 0 then
|
|
if abs( L-rf-rf) > 0.001 then
|
|
pEnd = Point3d(-L+rf,-(H/2),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
if nMode == 1 then
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
end
|
|
pIni = pEnd
|
|
pEnd = Point3d(-L,-(H/2)+rf,0)
|
|
pCentr = Point3d(-L+rf,-(H/2)+rf,0)
|
|
DrawAddCircleDrawCircle( pCentr, rf, -90,-90, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
if nMode == 1 then
|
|
DrawAddCircleDrawCircle( pCentr, rf, -90,-90, Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
end
|
|
pIni = pEnd
|
|
else
|
|
pEnd = Point3d(-L,-(H/2)+rf,0)
|
|
pCentr = Point3d(-L+rf,-(H/2)+rf,0)
|
|
DrawAddCircleDrawCircle( pCentr, rf, -90,-90, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
if nMode == 1 then
|
|
DrawAddCircleDrawCircle( pCentr, rf, -90,-90, Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
end
|
|
pIni = pEnd
|
|
end
|
|
else
|
|
pEnd = Point3d(-L,-(H/2),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
if nMode == 1 then
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
end
|
|
pIni = pEnd
|
|
end
|
|
|
|
if rf > 0 then
|
|
if abs((2*rf)-H) < 0.0001 then
|
|
pEnd = Point3d(-L+rf,(H/2),0)
|
|
pCentr = Point3d(-L+rf,(H/2)-rf,0)
|
|
DrawAddCircleDrawCircle( pCentr, rf, 180,-90, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
if nMode == 1 then
|
|
DrawAddCircleDrawCircle( pCentr, rf, 180,-90, Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
end
|
|
pIni = pEnd
|
|
else
|
|
pEnd = Point3d(-L,(H/2)-rf,0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
if nMode == 1 then
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
end
|
|
pIni = pEnd
|
|
pEnd = Point3d(-L+rf,(H/2),0)
|
|
pCentr = Point3d(-L+rf,(H/2)-rf,0)
|
|
DrawAddCircleDrawCircle( pCentr, rf, 180,-90, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
if nMode == 1 then
|
|
DrawAddCircleDrawCircle( pCentr, rf, 180,-90, Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
end
|
|
pIni = pEnd
|
|
end
|
|
else
|
|
pEnd = Point3d(-L,(H/2),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
if nMode == 1 then
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
end
|
|
pIni = pEnd
|
|
end
|
|
|
|
if R1 > 0 then
|
|
pEnd = Point3d((-D_SS-LS-IS-dR1),(H/2),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
if nMode == 1 then
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
end
|
|
pIni = pEnd
|
|
pEnd = Point3d((-D_SS-LS-IS+dR1s),((H/2)+dR1c),0)
|
|
pCentr = Point3d((-D_SS-LS-IS-dR1),((H/2)+R1),0)
|
|
DrawAddCircleDrawCircle( pCentr, R1, -90,(90-AS), Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
if nMode == 1 then
|
|
DrawAddCircleDrawCircle( pCentr, R1, -90,(90-AS), Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
end
|
|
pIni = pEnd
|
|
else
|
|
pEnd = Point3d((-D_SS-LS-IS),(H/2),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
if nMode == 1 then
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
end
|
|
pIni = pEnd
|
|
end
|
|
|
|
-- risalita dente
|
|
pEnd = Point3d((-D_SS-LS-IS+dLS),(H3+(H/2)),0) -- punto idoneo per modo 2 o per modo 1 con doppio dente
|
|
if nMode == 1 then
|
|
pEnd_c = Point3d((-D_SS-LS-IS+dLS),(H3+(H/2)),0)
|
|
if abs(IS) < GEO.EPS_SMALL then -- se un solo dente
|
|
pEnd = Point3d((-D_SS-LS-IS+dLS5),(H5r+(H/2)),0)
|
|
end
|
|
DrawAddLineDrawCircle( pIni, pEnd_c, Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni_c = pEnd_c
|
|
end
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
|
|
if nMode == 2 then -- se modalità percorsi aperti
|
|
-- creo primo percorso
|
|
nPath1 = EgtCurveCompo( Lg, tPath, true)
|
|
pIni = Point3d((-D_SS-IS-dLS),(H3+(H/2)),0)
|
|
|
|
if IS > 0 then -- se passo per due denti
|
|
tPath = {}
|
|
end
|
|
else -- percorso chiuso
|
|
|
|
if abs(IS) > GEO.EPS_SMALL then -- se un solo dente
|
|
pEnd = Point3d((-D_SS-IS-dLS),(H3+(H/2)),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
end
|
|
|
|
pEnd_c = Point3d((-D_SS-IS-dLS),(H3+(H/2)),0)
|
|
DrawAddLineDrawCircle( pIni_c, pEnd_c, Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni_c = pEnd_c
|
|
end
|
|
|
|
if IS > 0 then -- se passo per due denti
|
|
|
|
if R1 > 0 then
|
|
pEnd = Point3d((-D_SS-IS-dR1s),((H/2)+dR1c),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
if nMode == 1 then
|
|
DrawAddLineDrawCircle( pIni_c, pEnd, Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
end
|
|
pIni = pEnd
|
|
pEnd = Point3d(-D_SS-IS+dR1,(H/2),0)
|
|
pCentr = Point3d(-D_SS-IS+dR1,((H/2)+R1),0)
|
|
DrawAddCircleDrawCircle( pCentr, R1, (180+AS),(90-AS), Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
if nMode == 1 then
|
|
DrawAddCircleDrawCircle( pCentr, R1, (180+AS),(90-AS), Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
end
|
|
pIni = pEnd
|
|
else
|
|
pEnd = Point3d(-D_SS-IS,(H/2),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
if nMode == 1 then
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
end
|
|
pIni = pEnd
|
|
end
|
|
|
|
if R1 > 0 then
|
|
pEnd = Point3d((-D_SS-LS-dR1),(H/2),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
if nMode == 1 then
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
end
|
|
pIni = pEnd
|
|
pEnd = Point3d(-D_SS-LS+dR1s,((H/2)+dR1c),0)
|
|
pCentr = Point3d(-D_SS-LS-dR1,((H/2)+R1),0)
|
|
DrawAddCircleDrawCircle( pCentr, R1, -90,(90-AS), Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
if nMode == 1 then
|
|
DrawAddCircleDrawCircle( pCentr, R1, -90,(90-AS), Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
end
|
|
pIni = pEnd
|
|
else
|
|
pEnd = Point3d((-D_SS-LS),(H/2),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
if nMode == 1 then
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
end
|
|
pIni = pEnd
|
|
end
|
|
|
|
-- risalita dente
|
|
pEnd = Point3d((-D_SS-LS+dLS),(H3+(H/2)),0)
|
|
if nMode == 1 then
|
|
pEnd_c = Point3d((-D_SS-LS+dLS),(H3+(H/2)),0)
|
|
pEnd = Point3d((-D_SS-LS+dLS5),(H5r+(H/2)),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd_c, Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni_c = pEnd_c
|
|
end
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
end
|
|
|
|
if nMode == 2 then -- se modalità percorsi aperti
|
|
-- creo primo percorso
|
|
nPath2 = EgtCurveCompo( Lg, tPath, true)
|
|
else -- percorso chiuso
|
|
|
|
pEnd_c = Point3d((-D_SS-dLS),(H3+(H/2)),0)
|
|
DrawAddLineDrawCircle( pIni_c, pEnd_c, Lg, tPath2, bPreview, Dm, 0, false, false, RED(), RED())
|
|
|
|
-- creo primo percorso
|
|
nPath1 = EgtCurveCompo( Lg, tPath, true)
|
|
-- creo secondo percorso
|
|
nPath2 = EgtCurveCompo( Lg, tPath2, true)
|
|
end
|
|
|
|
return nPath1, nPath2
|
|
end
|
|
|
|
-- Funzione di disegno
|
|
function StrikeC.Draw( EC, EM, tStrikeParam, bPreview, bRunByCompo, nDrawMach, Pz, Lg, dThickDoor)
|
|
|
|
-- Assegno le dimensioni
|
|
local L = tStrikeParam.L
|
|
local H = tStrikeParam.H
|
|
local T = tStrikeParam.T
|
|
local rf = tStrikeParam.rf
|
|
local cl = tStrikeParam.cl
|
|
local d = tStrikeParam.d
|
|
local p = tStrikeParam.p
|
|
local sf = tStrikeParam.sf
|
|
local jn = tStrikeParam.jn
|
|
local L2 = tStrikeParam.L2
|
|
local H2 = tStrikeParam.H2
|
|
local invG = tStrikeParam.invG
|
|
local est = tStrikeParam.est
|
|
local D_X = tStrikeParam.D_X
|
|
local D_Y = tStrikeParam.D_Y
|
|
local LS = tStrikeParam.LS
|
|
local HS = tStrikeParam.HS
|
|
local AS = tStrikeParam.AS
|
|
local IS = tStrikeParam.IS
|
|
local D_SS = tStrikeParam.D_SS
|
|
local R1 = tStrikeParam.rs
|
|
local d2 = tStrikeParam.da
|
|
local mkrev = tStrikeParam.mkrev
|
|
-- Assegno i nomi geometrie
|
|
local LG = tStrikeParam.LG
|
|
local LM = tStrikeParam.LM
|
|
local LA = tStrikeParam.LA
|
|
local DM = 'DUMMY'
|
|
-- variabili per messaggi e settaggi vari
|
|
local sCompoName = tStrikeParam.Nome
|
|
|
|
-- settaggio opzione per partenza ad angolo o meno
|
|
local bStartAng = true
|
|
local bStartOppo = true
|
|
|
|
-- RunByComponetInterface
|
|
local RC = true
|
|
|
|
if not bRunByCompo then -- controllo se lanciato da componente
|
|
RC = false
|
|
end
|
|
|
|
-- 0 solo geom esterna, 1 solo geom mach, 2 entrambe
|
|
if not nDrawMach then -- se non definita la setto per non creare geometria di lavorazione
|
|
nDrawMach = 0
|
|
end
|
|
|
|
-- set variabili per compatibilità con vecchi componenti
|
|
-- step face: per compatibilità con tutti i componenti, se non è definito lo setto = alla profondità cava
|
|
if not sf or abs(sf) <= GEO.EPS_SMALL then
|
|
sf = T
|
|
end
|
|
|
|
-- rf face: per compatibilità con tutti i componenti, se non è definito lo setto a 0
|
|
if not rf or abs(rf) <= GEO.EPS_SMALL then
|
|
rf = 0
|
|
end
|
|
|
|
if cl == 0 then
|
|
rf = 0
|
|
end
|
|
|
|
if not D_Y then
|
|
D_Y = 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
|
|
|
|
-- 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, hint3, hint4, hint5
|
|
local hintPk, hintAs1, hintAs2, hintAs3, hintAs4, 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 H3 = HS
|
|
local nMode = 2 -- make open/s path
|
|
local dLS = HS * tan(AS)
|
|
|
|
if est then
|
|
nMode = 1 -- make closed path
|
|
H3 = HS+(d/2)+ dExtraH
|
|
end
|
|
-- creo percorsi geometrici per eventuale chisel
|
|
hint1, hint2 = DrawExternalPath( Lg, D_SS, L, LS, H, H3, IS, AS, R1, rf, nMode, HS, Dm)
|
|
|
|
if hint1 then
|
|
if est then
|
|
EgtErase(hint1)
|
|
hint1 = nil
|
|
else
|
|
EgtModifyCurveThickness( hint1, -T)
|
|
EgtSetName( hint1, LG)
|
|
end
|
|
end
|
|
|
|
if hint2 then
|
|
EgtModifyCurveThickness( hint2, -T)
|
|
EgtSetName( hint2, LG)
|
|
end
|
|
|
|
---------------------------------------
|
|
---------------------------------------
|
|
-- Costruzione delle geometrie di lavorazione
|
|
---------------------------------------
|
|
---------------------------------------
|
|
if nDrawMach > 0 then -- se abilitata geometria lavorazione
|
|
|
|
local tPocket = {}
|
|
local tPocket_r = {}
|
|
local tPocketAs = {}
|
|
local tPocketAs_r = {}
|
|
local pIni , pEnd
|
|
local nCase1, nCase2
|
|
local nCase, nCaseNext
|
|
local dZedStart, dZedWork
|
|
local dRadius, hint_ofs, hint_ofs_c, hint_ofs_r, hint_ofs2, hint_ofs2_r, num_hint_o2, num_hint_o2_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, dCompoRadTool
|
|
|
|
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))
|
|
dCompoRadTool = (d2/2)/cos(AS)
|
|
|
|
-- linea inclinata entrante fino all'incrocio con linea discendente dislocata di 0.2
|
|
pIni = Point3d((((dEndPosY*tan(AS))-dCompoRadTool+(((d2/2)+0.2)*cos(AS))-((dEndPosY-(((d2/2)+0.2)*sin(AS))-dPosY)*tan(AS)))+dDeltaPosX)*invG, dIniPosY, dZedWork)
|
|
pEnd = Point3d(((dEndPosY*tan(AS))-dCompoRadTool+(((d2/2)+0.2)*cos(AS))-((dEndPosY-(((d2/2)+0.2)*sin(AS))-dPosY)*tan(AS)))*invG, dPosY,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
|
|
-- discesa con linea inclinata disassata di 0.2
|
|
pIni = pEnd
|
|
pEnd = Point3d(((dEndPosY*tan(AS))-dCompoRadTool+(((d2/2)+0.2)*cos(AS)))*invG, (dEndPosY-(((d2/2)+0.2)*sin(AS))),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
|
|
-- accostamento di 0.2mm sul profilo
|
|
pIni = pEnd
|
|
pEnd = Point3d(((dEndPosY*tan(AS))-dCompoRadTool+((d2/2)*cos(AS)))*invG, (dEndPosY-((d2/2)*sin(AS))),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
|
|
-- linea uscente
|
|
pIni = pEnd
|
|
pEnd = Point3d(((d2*3/4)*tan(AS))*invG, (d2*3/4),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
|
|
pIni = pEnd
|
|
pEnd = Point3d((((dEndPosY*tan(AS))-dCompoRadTool+(((d2/2)+0.2)*cos(AS))-((dEndPosY-(((d2/2)+0.2)*sin(AS))-dPosY)*tan(AS)))+dDeltaPosX)*invG, pIni:getY(), dZedWork)
|
|
|
|
if mkrev then -- se abilitato anche il percorso inverso
|
|
|
|
-- linea inclinata entrante fino all'incrocio con linea discendente dislocata di 0.2
|
|
pIni_r = Point3d(-(((dEndPosY*tan(AS))-dCompoRadTool+(((d2/2)+0.2)*cos(AS))-((dEndPosY-(((d2/2)+0.2)*sin(AS))-dPosY)*tan(AS)))+dDeltaPosX)*invG, dIniPosY,dZedWork)
|
|
pEnd_r = Point3d(-((dEndPosY*tan(AS))-dCompoRadTool+(((d2/2)+0.2)*cos(AS))-((dEndPosY-(((d2/2)+0.2)*sin(AS))-dPosY)*tan(AS)))*invG, dPosY,dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocketAs_r, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
|
|
-- discesa con linea inclinata disassata di 0.2
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(-((dEndPosY*tan(AS))-dCompoRadTool+(((d2/2)+0.2)*cos(AS)))*invG, ((dEndPosY-(((d2/2)+0.2)*sin(AS)))),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocketAs_r, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
-- accostamento di 0.2mm sul profilo
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(-((dEndPosY*tan(AS))-dCompoRadTool+((d2/2)*cos(AS)))*invG, (dEndPosY-((d2/2)*sin(AS))),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocketAs_r, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
-- linea uscente
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(-((d2*3/4)*tan(AS))*invG, (d2*3/4),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocketAs_r, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(-(((dEndPosY*tan(AS))-dCompoRadTool+(((d2/2)+0.2)*cos(AS))-((dEndPosY-(((d2/2)+0.2)*sin(AS))-dPosY)*tan(AS)))+dDeltaPosX)*invG, pIni_r:getY(),dZedWork)
|
|
end
|
|
else -- lead-in diritto
|
|
|
|
dEndPosY = -(d2/4)
|
|
dIniPosY = (d2*3/4)
|
|
dCompoRadTool = (d2/2)/cos(AS)
|
|
|
|
if nStep == 1 then
|
|
-- linea entrante in Y
|
|
pIni = Point3d((dIniPosY*tan(AS))*invG, dIniPosY,dZedWork)
|
|
pEnd = Point3d(((dEndPosY*tan(AS))-dCompoRadTool+((d2/2)*cos(AS)))*invG, (dEndPosY-((d2/2)*sin(AS))),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
else
|
|
-- linea entrante in Y distaccata di 0.2mm
|
|
pIni = Point3d(((dIniPosY*tan(AS))+(0.2/cos(AS)))*invG, dIniPosY,dZedWork)
|
|
pEnd = Point3d(((dEndPosY*tan(AS))-dCompoRadTool+(((d2/2)+0.2)*cos(AS)))*invG, (dEndPosY-(((d2/2)+0.2)*sin(AS))),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
|
|
-- accostamento sul lato profilo
|
|
pIni = pEnd
|
|
pEnd = Point3d(((dEndPosY*tan(AS))-dCompoRadTool+((d2/2)*cos(AS)))*invG, (dEndPosY-((d2/2)*sin(AS))),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
|
|
-- risalita in Y
|
|
pIni = pEnd
|
|
pEnd = Point3d(((d2*3/4)*tan(AS))*invG, (d2*3/4),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
|
|
pIni = pEnd
|
|
pEnd = Point3d(((dIniPosY*tan(AS))+(0.2/cos(AS)))*invG, pIni:getY(),dZedWork)
|
|
end
|
|
|
|
if mkrev then -- se abilitato anche il percorso inverso
|
|
|
|
if nStep == 1 then
|
|
-- linea entrante in Y
|
|
pIni_r = Point3d(-(dIniPosY*tan(AS))*invG, dIniPosY,dZedWork)
|
|
pEnd_r = Point3d(-((dEndPosY*tan(AS))-dCompoRadTool+((d2/2)*cos(AS)))*invG, (dEndPosY-((d2/2)*sin(AS))),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocketAs_r, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
else
|
|
-- linea entrante in Y distaccata di 0.2mm
|
|
pIni_r = Point3d(-((dIniPosY*tan(AS))+(0.2/cos(AS)))*invG, dIniPosY,dZedWork)
|
|
pEnd_r = Point3d(-((dEndPosY*tan(AS))-dCompoRadTool+(((d2/2)+0.2)*cos(AS)))*invG, (dEndPosY-(((d2/2)+0.2)*sin(AS))),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocketAs_r, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
|
|
-- accostamento al profilo
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(-((dEndPosY*tan(AS))-dCompoRadTool+((d2/2)*cos(AS)))*invG, (dEndPosY-((d2/2)*sin(AS))),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocketAs_r, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
|
|
-- risalita in Y
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(-((d2*3/4)*tan(AS))*invG, (d2*3/4),dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocketAs_r, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(-((dIniPosY*tan(AS))+(0.2/cos(AS)))*invG, pIni_r:getY(),dZedWork)
|
|
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)
|
|
-- muovo il percorso nella posizione corretta
|
|
if invG > 0 then
|
|
EgtMove( hintAs1, Point3d((-D_SS-LS+dLS+((d2/2)/cos(AS))),((H/2)+HS),0) - ORIG())
|
|
else
|
|
EgtMove( hintAs1, Point3d((-D_SS-dLS-((d2/2)/cos(AS))),((H/2)+HS),0) - ORIG())
|
|
end
|
|
-- faccio la copia se ha doppio dente
|
|
if IS > 0 then
|
|
hintAs3 = EgtCopyGlob( hintAs1, Lg)
|
|
EgtMove( hintAs3, Point3d(-IS,0,0) - ORIG())
|
|
end
|
|
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'))
|
|
-- muovo il percorso nella posizione corretta
|
|
if invG > 0 then
|
|
EgtMove( hintAs2, Point3d((-D_SS-dLS-((d2/2)/cos(AS))),((H/2)+HS),0) - ORIG())
|
|
else
|
|
EgtMove( hintAs2, Point3d((-D_SS-LS+dLS+((d2/2)/cos(AS))),((H/2)+HS),0) - ORIG())
|
|
end
|
|
-- faccio la copia se ha doppio dente
|
|
if IS > 0 then
|
|
hintAs4 = EgtCopyGlob( hintAs2, Lg)
|
|
EgtMove( hintAs4, Point3d(-IS,0,0) - ORIG())
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
---------------------------------------
|
|
-- geometria svuotatura giro esterno
|
|
---------------------------------------
|
|
|
|
if not est then -- se non c'è lavorazione steel
|
|
|
|
-- creo percorso per offset
|
|
H3 = HS+(d/2)+ dExtraH
|
|
local dLS = HS * tan(AS)
|
|
local H5 = HS
|
|
nMode = 1 -- make close path
|
|
hint3, hint4 = DrawExternalPath( Lg, D_SS, L, LS, H, H3, IS, AS, R1, rf, nMode, H5, Dm)
|
|
|
|
-- individuo in che caso sono considerando l'altezza dello strike
|
|
local dDimMin = H+HS
|
|
local dDimMinLs = LS
|
|
if (dDimMin-(d/2)+dExtraH) <= ( d*0.98) then -- solo passaggio di contornatura
|
|
nCase1 = 2
|
|
elseif ((dDimMin-(d/2)+dExtraH) > ( d*0.98)) and ((dDimMin-(d/2)+dExtraH) <= (d*(1+p))) then -- passaggio di contornatura + un passaggio centrale
|
|
nCase1 = 3
|
|
elseif (dDimMin-(d/2)+dExtraH) > (d*(1+p)) then -- passaggio di contornatura + passaggi offset
|
|
nCase1 = 4
|
|
end
|
|
-- individuo in che caso sono considerando la larghezza del dente dello strike
|
|
if dDimMinLs <= ( d*0.98) then -- solo passaggio di contornatura
|
|
nCase2 = 2
|
|
elseif (dDimMinLs > ( d*0.98)) and (dDimMinLs <= (d*(1+p))) then -- passaggio di contornatura + un passaggio centrale
|
|
nCase2 = 3
|
|
elseif dDimMinLs > (d*(1+p)) then -- passaggio di contornatura + passaggi offset
|
|
nCase2 = 4
|
|
end
|
|
|
|
nCase = max( nCase1, nCase2)
|
|
|
|
local nDirVers = 1
|
|
local tMVar = {}
|
|
local tMVar_r = {}
|
|
local nConEnt
|
|
local sKindVar
|
|
-- resetto contatori entità
|
|
nTotContEnt = 0
|
|
nTotContEnt_r = 0
|
|
-- calcolo il massimo tra altezza strike e larghezza dente
|
|
dRadius = max( dDimMin/2, LS/2)
|
|
nPass = 1
|
|
dZedStart = 0
|
|
nStep = ceil(T/sf) -- numero di passate
|
|
dStep = (T/nStep) -- passo ricalcolato
|
|
|
|
while nPass <= nStep do
|
|
|
|
dZedWork = dZedStart - dStep
|
|
if nPass == nStep then
|
|
dZedWork = -T
|
|
end
|
|
|
|
-- solo contornatura o contornatura + un passaggio centrale o contornatura + passaggi svuotatura
|
|
if ( nCase == 2) or ( nCase == 3) or ( nCase == 4) then
|
|
|
|
-- calcolo l'ampiezza dell'offset
|
|
dRadius = dRadius - (d/2)
|
|
|
|
-- offset sul percorso aperto per il primo giro e chiuso per gli offset successivi
|
|
hint_ofs = EgtOffsetCurveAdv( hint3, (d/2), GDB_OT.FILLET)
|
|
hint_ofs_c = EgtOffsetCurveAdv( hint4, (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 invG > 0 then
|
|
pIni = Point3d((-D_SS-LS+dLS+(d/2)+0.2)*invG,(HS+(H/2)+(d*3/4)),dZedWork)
|
|
pStartStep = pIni
|
|
-- linea in Y con centro utensile fuori
|
|
pEnd = Point3d((-D_SS-LS+dLS+(d/2)+0.2)*invG,(HS+(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((-D_SS-dLS-(d/2))*invG,(HS+(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)
|
|
-- in base all'angolo del dente, mi collego direttamente o prima scendo in Y
|
|
if AS > 0 then
|
|
-- scenso solo in Y
|
|
DrawAddLineDrawCircle( pIni, Point3d( pIni:getX(), pEnd:getY(), dZedWork), Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED())
|
|
pIni = Point3d( pIni:getX(), pEnd:getY(), dZedWork)
|
|
end
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED())
|
|
pEnd = EgtEP( hint_ofs)
|
|
else
|
|
pIni = Point3d((D_SS+dLS+(d/2)+0.2)*invG,(HS+(H/2)+(d*3/4)),dZedWork)
|
|
pStartStep = pIni
|
|
-- linea in Y con centro utensile fuori
|
|
pEnd = Point3d((D_SS+dLS+(d/2)+0.2)*invG,(HS+(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((D_SS+LS-dLS-(d/2))*invG,(HS+(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)
|
|
-- in base all'angolo del dente, mi collego direttamente o prima scendo in Y
|
|
if AS > 0 then
|
|
-- scenso solo in Y
|
|
DrawAddLineDrawCircle( pIni, Point3d( pIni:getX(), pEnd:getY(), dZedWork), Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED())
|
|
pIni = Point3d( pIni:getX(), pEnd:getY(), dZedWork)
|
|
end
|
|
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 invG > 0 then
|
|
-- prima linea entrante
|
|
pIni = Point3d((-D_SS-dLS-(d/2))*invG,(HS+(H/2)+(d*3/4)),dZedWork)
|
|
pStartStep = pIni
|
|
pEnd = EgtSP( hint_ofs)
|
|
-- in base all'angolo del dente, mi collego direttamente o prima scendo in Y
|
|
if AS > 0 then
|
|
-- scenso solo in Y
|
|
DrawAddLineDrawCircle( pIni, Point3d( pIni:getX(), pEnd:getY(), dZedWork), Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED())
|
|
pIni = Point3d( pIni:getX(), pEnd:getY(), dZedWork)
|
|
end
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED())
|
|
pEnd = EgtEP( hint_ofs)
|
|
else
|
|
-- prima linea entrante
|
|
pIni = Point3d((D_SS+LS-dLS-(d/2))*invG,(HS+(H/2)+(d*3/4)),dZedWork)
|
|
pStartStep = pIni
|
|
pEnd = EgtSP( hint_ofs)
|
|
-- in base all'angolo del dente, mi collego direttamente o prima scendo in Y
|
|
if AS > 0 then
|
|
-- scenso solo in Y
|
|
DrawAddLineDrawCircle( pIni, Point3d( pIni:getX(), pEnd:getY(), dZedWork), Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED())
|
|
pIni = Point3d( pIni:getX(), pEnd:getY(), dZedWork)
|
|
end
|
|
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 invG > 0 then
|
|
pIni_r = Point3d((-D_SS-dLS-(d/2)-0.2)*invG,(HS+(H/2)+(d*3/4)),dZedWork)
|
|
pStartStep_r = pIni_r
|
|
-- linea in Y con centro utensile fuori
|
|
pEnd_r = Point3d((-D_SS-dLS-(d/2)-0.2)*invG,(HS+(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((-D_SS-LS+dLS+(d/2))*invG,(HS+(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)
|
|
-- in base all'angolo del dente, mi collego direttamente o prima scendo in Y
|
|
if AS > 0 then
|
|
-- scenso solo in Y
|
|
DrawAddLineDrawCircle( pIni_r, Point3d( pIni_r:getX(), pEnd_r:getY(), dZedWork), Lg, tPocket_r, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, 1)
|
|
pIni_r = Point3d( pIni_r:getX(), pEnd_r:getY(), dZedWork)
|
|
end
|
|
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
|
|
pIni_r = Point3d((D_SS+LS-dLS-(d/2)-0.2)*invG,(HS+(H/2)+(d*3/4)),dZedWork)
|
|
pStartStep_r = pIni_r
|
|
-- linea in Y con centro utensile fuori
|
|
pEnd_r = Point3d((D_SS+LS-dLS-(d/2)-0.2)*invG,(HS+(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((D_SS+dLS+(d/2))*invG,(HS+(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)
|
|
-- in base all'angolo del dente, mi collego direttamente o prima scendo in Y
|
|
if AS > 0 then
|
|
-- scenso solo in Y
|
|
DrawAddLineDrawCircle( pIni_r, Point3d( pIni_r:getX(), pEnd_r:getY(), dZedWork), Lg, tPocket_r, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, 1)
|
|
pIni_r = Point3d( pIni_r:getX(), pEnd_r:getY(), dZedWork)
|
|
end
|
|
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 invG > 0 then
|
|
-- prima linea entrante
|
|
pIni_r = Point3d((-D_SS-LS+dLS+(d/2))*invG,(HS+(H/2)+(d*3/4)),dZedWork)
|
|
pStartStep_r = pIni_r
|
|
pEnd_r = EgtSP( hint_ofs_r)
|
|
-- in base all'angolo del dente, mi collego direttamente o prima scendo in Y
|
|
if AS > 0 then
|
|
-- scenso solo in Y
|
|
DrawAddLineDrawCircle( pIni_r, Point3d( pIni_r:getX(), pEnd_r:getY(), dZedWork), Lg, tPocket_r, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, 1)
|
|
pIni_r = Point3d( pIni_r:getX(), pEnd_r:getY(), dZedWork)
|
|
end
|
|
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
|
|
-- prima linea entrante
|
|
pIni_r = Point3d((D_SS+dLS+(d/2))*invG,(HS+(H/2)+(d*3/4)),dZedWork)
|
|
pStartStep_r = pIni_r
|
|
pEnd_r = EgtSP( hint_ofs_r)
|
|
-- in base all'angolo del dente, mi collego direttamente o prima scendo in Y
|
|
if AS > 0 then
|
|
-- scenso solo in Y
|
|
DrawAddLineDrawCircle( pIni_r, Point3d( pIni_r:getX(), pEnd_r:getY(), dZedWork), Lg, tPocket_r, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, 1)
|
|
pIni_r = Point3d( pIni_r:getX(), pEnd_r:getY(), dZedWork)
|
|
end
|
|
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 == 3 then -- passaggio di contornatura + un passaggio centrale
|
|
|
|
-- linea posizionamento passata centrale
|
|
pIni = pEnd
|
|
pEnd = Point3d((-D_SS-(LS/2)),(HS+(H/2)+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW())
|
|
|
|
-- linee passata centrale
|
|
pIni = pEnd
|
|
pEnd = Point3d((-D_SS-(LS/2)),0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW())
|
|
pIni = pEnd
|
|
pEnd = Point3d(-(d*3/4),0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW())
|
|
pIni = pEnd
|
|
|
|
if IS > 0 then
|
|
pEnd = Point3d((-D_SS-IS-(LS/2)),0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW())
|
|
pIni = pEnd
|
|
pEnd = Point3d((-D_SS-IS-(LS/2)),(HS+(H/2)+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW())
|
|
pIni = pEnd
|
|
pEnd = Point3d((-D_SS-IS-(LS/2)),0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW())
|
|
pIni = pEnd
|
|
end
|
|
|
|
pEnd = Point3d((-L+(d*3/4)),0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW())
|
|
pIni = pEnd
|
|
|
|
-- se non sono all'ultima passata ritorno al punto di inizio della passata centrale,
|
|
-- si perde un po' di tempo ma è l'unica per poter rifare il passo
|
|
if nPass < nStep then
|
|
|
|
pEnd = Point3d((-D_SS-(LS/2)),0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW())
|
|
pIni = pEnd
|
|
pEnd = Point3d((-D_SS-(LS/2)),(HS+(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((-D_SS-(LS/2)),(HS+(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((-D_SS-(LS/2)),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(-(d*3/4),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 IS > 0 then
|
|
pEnd_r = Point3d((-D_SS-IS-(LS/2)),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((-D_SS-IS-(LS/2)),(HS+(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
|
|
pEnd_r = Point3d((-D_SS-IS-(LS/2)),0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, 1)
|
|
pIni_r = pEnd_r
|
|
end
|
|
|
|
pEnd_r = Point3d((-L+(d*3/4)),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((-D_SS-(LS/2)),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((-D_SS-(LS/2)),(HS+(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 dDistYcentr = (d*p)
|
|
local dDistYApply = dDistYcentr
|
|
local bContinue
|
|
|
|
-- se percorso offset esiste
|
|
if hint_ofs_c and hint_ofs_c > 0 then
|
|
|
|
-- muovo la geometria in Z
|
|
EgtMove( hint_ofs_c, Point3d(0,0,dZedWork) - ORIG())
|
|
|
|
-- se flag inverso, inverto la geometria, solo qui non nelle altre copie
|
|
if invG < 0 then
|
|
EgtInvertCurve(hint_ofs_c)
|
|
end
|
|
|
|
hint5 = hint_ofs_c
|
|
|
|
-- faccio l'offset del raggio fresa
|
|
dRadius = dRadius - dDistYcentr
|
|
bContinue = dRadius > 0
|
|
local bCalcDir = true
|
|
|
|
-- se percorso offset esiste
|
|
while bContinue do
|
|
|
|
hint_ofs2, num_hint_o2 = EgtOffsetCurveAdv( hint_ofs_c, dDistYApply*invG, GDB_OT.FILLET)
|
|
|
|
if hint_ofs2 and hint_ofs2 > 0 then
|
|
|
|
pIni = pEnd
|
|
|
|
local nStartPath = hint_ofs2
|
|
local nIncIndex = 1
|
|
|
|
-- se ottengo più di una curva determino quale è più distante tra la prima e l'ultima
|
|
if bCalcDir and num_hint_o2 > 1 then
|
|
|
|
bCalcDir = false
|
|
local nFirstP = hint_ofs2
|
|
local nLastP = hint_ofs2 + ( num_hint_o2 - 1)
|
|
local nDistIni = dist( pIni, EgtSP( nFirstP))
|
|
local nDistLast = dist( pIni, EgtSP( nLastP))
|
|
-- se la prima curva è più lontana dall'inizio, inverto il valore di DX tramite il semi interasse passato
|
|
if nDistIni >= nDistLast then
|
|
nStartPath = nLastP
|
|
nIncIndex = -1
|
|
end
|
|
end
|
|
|
|
-- linea congiunzione tra offset
|
|
pEnd = EgtSP( nStartPath)
|
|
-- vado a X nuovo punto
|
|
DrawAddLineDrawCircle( pIni, Point3d( pEnd:getX(), pIni:getY(), pIni:getZ()), Lg, tPocket, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW())
|
|
-- congiungo a offset
|
|
DrawAddLineDrawCircle( Point3d( pEnd:getX(), pIni:getY(), pIni:getZ()), pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW())
|
|
pEnd = EgtEP( nStartPath)
|
|
local ntypeDom, nNumCurve = EgtCurveDomain(nStartPath)
|
|
nTotContEnt = nTotContEnt + ( nNumCurve - ntypeDom)
|
|
table.insert( tPocket, nStartPath)
|
|
|
|
-- per tutte le curve create
|
|
for i = 1, ( num_hint_o2 - 1) do
|
|
-- linea discesa a Y0
|
|
pIni = pEnd
|
|
pEnd = Point3d( pEnd:getX(), 0, pEnd:getZ())
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW())
|
|
-- linea X prossima curva
|
|
pIni = pEnd
|
|
pEnd = EgtSP( nStartPath+(i*nIncIndex))
|
|
DrawAddLineDrawCircle( pIni, Point3d( pEnd:getX(), 0, pEnd:getZ()), Lg, tPocket, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW())
|
|
-- linea congiunzione curva
|
|
pIni = Point3d( pEnd:getX(), 0, pEnd:getZ())
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW())
|
|
pEnd = EgtEP( nStartPath+(i*nIncIndex))
|
|
local ntypeDom, nNumCurve = EgtCurveDomain((nStartPath+(i*nIncIndex)))
|
|
nTotContEnt = nTotContEnt + ( nNumCurve - ntypeDom)
|
|
table.insert( tPocket, (nStartPath+(i*nIncIndex)))
|
|
end
|
|
|
|
if mkrev then -- se abilitato anche il percorso inverso
|
|
|
|
num_hint_o2_r = num_hint_o2
|
|
|
|
if nIncIndex > 0 then
|
|
nStartPath = hint_ofs2
|
|
else
|
|
nStartPath = hint_ofs2 + (num_hint_o2_r-1)
|
|
end
|
|
|
|
-- copia del percorso offsettato
|
|
hint_ofs2_r = EgtCopyGlob( nStartPath, Lg)
|
|
EgtInvertCurve(hint_ofs2_r)
|
|
|
|
-- linea congiunzione tra offset
|
|
pIni_r = pEnd_r
|
|
|
|
pEnd_r = EgtSP( hint_ofs2_r)
|
|
-- vado a X nuovo punto
|
|
DrawAddLineDrawCircle( pIni_r, Point3d( pEnd_r:getX(), pIni_r:getY(), pIni_r:getZ()), Lg, tPocket_r, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW(), nil, 1)
|
|
-- congiungo a offset
|
|
DrawAddLineDrawCircle( Point3d( pEnd_r:getX(), pIni_r:getY(), pIni_r:getZ()), 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)
|
|
|
|
for i = 1, ( num_hint_o2_r - 1) do
|
|
local nIdOf = EgtCopyGlob( (nStartPath+(i*nIncIndex)), Lg)
|
|
EgtInvertCurve(nIdOf)
|
|
-- linea discesa a Y0
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d( pEnd_r:getX(), 0, pEnd_r:getZ())
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW(), nil, 1)
|
|
-- linea X prossima curva
|
|
pIni_r = pEnd_r
|
|
pEnd_r = EgtSP( nIdOf)
|
|
DrawAddLineDrawCircle( pIni_r, Point3d( pEnd:getX(), 0, pEnd:getZ()), Lg, tPocket_r, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW(), nil, 1)
|
|
-- linea congiunzione curva
|
|
pIni_r = Point3d( pEnd_r:getX(), 0, pEnd_r:getZ())
|
|
DrawAddLineDrawCircle( pIni_r, pEnd_r, Lg, tPocket_r, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW(), nil, 1)
|
|
pEnd_r = EgtEP( nIdOf)
|
|
hint_ofs_r = nIdOf
|
|
local ntypeDom, nNumCurve = EgtCurveDomain(hint_ofs_r)
|
|
nTotContEnt_r = nTotContEnt_r + ( nNumCurve - ntypeDom)
|
|
table.insert( tPocket_r, hint_ofs_r)
|
|
end
|
|
end
|
|
|
|
-- calcolo nuovo passo in Y e indice direzione
|
|
dRadius = dRadius - dDistYcentr
|
|
dDistYApply = dDistYApply + dDistYcentr
|
|
bContinue = dRadius > 0
|
|
else
|
|
bContinue = false
|
|
end
|
|
end -- end while
|
|
if hint5 then
|
|
EgtErase(hint5)
|
|
hint5 = nil
|
|
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
|
|
if mkrev then -- se abilitato anche il percorso inverso
|
|
pIni_r = pEnd_r
|
|
end
|
|
|
|
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_Y,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE())
|
|
pIni = pEnd
|
|
end
|
|
pEnd = Point3d(((-((L2-d)/2)*invG)-(L/2)+D_X),D_Y,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_Y,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/2)+D_X),D_Y,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_Y),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE())
|
|
pIni = pEnd
|
|
end
|
|
pEnd = Point3d(((((L2-d)/2)*invG)-(L/2)+D_X),(((H2-d)/2)+D_Y),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_Y),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/2)+D_X),(((H2-d)/2)+D_Y),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
|
|
|
|
nPass = nPass + 1
|
|
dZedStart = dZedStart - dStep
|
|
dRadius = dDimMin/2
|
|
nDirVers = -nDirVers
|
|
|
|
-- se ho altri passi torno al punto di inizio
|
|
if nPass <= nStep and nCase > 1 then
|
|
|
|
pIni = pEnd
|
|
pEnd = Point3d(pStartStep:getX(),pStartStep:getY(),(dZedStart - dStep))
|
|
-- salgo in Y
|
|
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni, Point3d( pIni:getX(), pEnd:getY(), pIni:getZ()), Lg, tPocket, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW(), sMaxFeed)
|
|
table.insert( tMVar, {nTotContEnt,sKindVar})
|
|
-- congiungo al punto di inizio
|
|
pIni = Point3d( pIni:getX(), pEnd:getY(), pIni:getZ())
|
|
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW(), sMaxFeed)
|
|
table.insert( tMVar, {nTotContEnt,sKindVar})
|
|
|
|
if mkrev then -- se abilitato anche il percorso inverso
|
|
pIni_r = pEnd_r
|
|
pEnd_r = Point3d(pStartStep_r:getX(),pStartStep_r:getY(),(dZedStart - dStep))
|
|
-- salgo in Y
|
|
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni_r, Point3d( pIni_r:getX(), pEnd_r:getY(), pIni_r:getZ()), Lg, tPocket_r, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW(), sMaxFeed, 1)
|
|
table.insert( tMVar_r, {nTotContEnt_r,sKindVar})
|
|
-- congiungo al punto di inizio
|
|
pIni_r = Point3d( pIni_r:getX(), pEnd_r:getY(), pIni_r:getZ())
|
|
_, 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 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
|
|
|
|
end
|
|
-- se variabile inversione negativa inverto la direzione del percorso geometrico principale
|
|
if invG < 0 then
|
|
if hint1 then
|
|
EgtInvertCurve(hint1)
|
|
end
|
|
if hint2 then
|
|
EgtInvertCurve(hint2)
|
|
end
|
|
end
|
|
end
|
|
|
|
-- se abilitata solo geometria di lavorazione elimino il percorso di sola geometria
|
|
if nDrawMach == 1 then
|
|
if hint1 then
|
|
-- cancello il percorso
|
|
EgtErase( hint1)
|
|
hint1 = nil
|
|
end
|
|
if hint2 then
|
|
-- cancello il percorso
|
|
EgtErase( hint2)
|
|
hint2 = nil
|
|
end
|
|
end
|
|
|
|
-- cambio colore alla geometria
|
|
if bPreview then
|
|
if EC == 0 then
|
|
if hint1 then
|
|
EgtSetColor(hint1,AQUA())
|
|
end
|
|
if hint2 then
|
|
EgtSetColor(hint2,AQUA())
|
|
end
|
|
if hintAs1 then
|
|
EgtSetColor(hintAs1,AQUA())
|
|
end
|
|
if hintAs2 then
|
|
EgtSetColor(hintAs2,AQUA())
|
|
end
|
|
if hintAs3 then
|
|
EgtSetColor(hintAs3,AQUA())
|
|
end
|
|
if hintAs4 then
|
|
EgtSetColor(hintAs4,AQUA())
|
|
end
|
|
if hintPk then
|
|
EgtSetColor(hintPk,AQUA())
|
|
end
|
|
if hintPk_r then
|
|
EgtSetColor(hintPk_r,AQUA())
|
|
end
|
|
else
|
|
if hint1 then
|
|
EgtSetColor(hint1,ORANGE())
|
|
end
|
|
if hint2 then
|
|
EgtSetColor(hint2,ORANGE())
|
|
end
|
|
if hintAs1 then
|
|
EgtSetColor(hintAs1,ORANGE())
|
|
end
|
|
if hintAs2 then
|
|
EgtSetColor(hintAs2,ORANGE())
|
|
end
|
|
if hintAs3 then
|
|
EgtSetColor(hintAs3,ORANGE())
|
|
end
|
|
if hintAs4 then
|
|
EgtSetColor(hintAs4,ORANGE())
|
|
end
|
|
if hintPk then
|
|
EgtSetColor(hintPk,ORANGE())
|
|
end
|
|
if hintPk_r then
|
|
EgtSetColor(hintPk_r,ORANGE())
|
|
end
|
|
end
|
|
else -- altrimenti non Preview
|
|
-- muovo tutti i percorsi di metà lunghezza
|
|
if EC == 0 then
|
|
if hint1 then
|
|
EgtMove( hint1, Point3d((L/2),0,0) - ORIG())
|
|
end
|
|
if hint2 then
|
|
EgtMove( hint2, Point3d((L/2),0,0) - ORIG())
|
|
end
|
|
if hintAs1 then
|
|
EgtMove( hintAs1, Point3d((L/2),0,0) - ORIG())
|
|
end
|
|
if hintAs2 then
|
|
EgtMove( hintAs2, Point3d((L/2),0,0) - ORIG())
|
|
end
|
|
if hintAs3 then
|
|
EgtMove( hintAs3, Point3d((L/2),0,0) - ORIG())
|
|
end
|
|
if hintAs4 then
|
|
EgtMove( hintAs4, Point3d((L/2),0,0) - ORIG())
|
|
end
|
|
if hintPk then
|
|
EgtMove( hintPk, Point3d((L/2),0,0) - ORIG())
|
|
end
|
|
if hintPk_r then
|
|
EgtMove( hintPk_r, Point3d((L/2),0,0) - ORIG())
|
|
end
|
|
end
|
|
|
|
-- elimino i percorsi non necessari
|
|
if hint3 then EgtErase(hint3) end
|
|
if hint4 then EgtErase(hint4) end
|
|
if hint5 then EgtErase(hint5) end
|
|
|
|
-- 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 hintAs3 then
|
|
EgtSetInfo( hintAs3, 'NotCheckDir', '1')
|
|
end
|
|
if hintAs4 then
|
|
EgtSetInfo( hintAs4, 'NotCheckDir', '1')
|
|
end
|
|
if hintPk_r then
|
|
EgtSetInfo( hintPk_r, 'NotCheckDir', '1')
|
|
end
|
|
end
|
|
|
|
return hint1, hintPk, hint2, hintAs1, hintAs2, hintAs3, hintAs4, hintPk_r
|
|
end
|
|
|
|
|
|
return StrikeC
|