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

3529 lines
163 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
--
-- _OPivot.lua by EgalWare s.r.l. 2019.06.04
-- Autore: Filippo Monchi
-- _OPivot, componente di secondo livello, non può essere chiamato direttamente da un lua dei
-- componenti di interfaccia
-- 2019.06.04 V1.001 FM First version
-- 2019.07.29 V1.002 FM Manage new differents pivot models and submodels: Offset pivot with submodel 2 3 4,
-- OffsetInpermediate with submodel 3
-- the defalult and old one is submodel (1) for all model
-- 2019.10.18 V2.000 FM Manage use Materials
-- 2024.07.19 V2.001 FM Set note 'NotCheckDir' to pocketing and antisplint paths
-- Tavola per definizione modulo (serve ma non usata)
local OPivot = {}
-- 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, sReference)
local nReference = GDB_RT.LOC
if sReference and sReference == 'grid' then
nReference = GDB_RT.GRID
end
local nLine = EgtLine(nGroup, pInitial, pFinal, nReference)
local nNumLine
-- serve per il conteggio delle entità in caso di concatenamento con curvecompo
if nCounter_r and nLine then
nTotContEnt_r = nTotContEnt_r + 1
elseif nLine then
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 , nReference)
EgtSetColor( nCircle1, cColor1)
end
if bDrawLast then
local nCircle2 = EgtCircle( nGroupCirc, pFinal, nRad , nReference)
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, sReference)
local nReference = GDB_RT.LOC
if sReference and sReference == 'grid' then
nReference = GDB_RT.GRID
end
local nCircle = EgtArc( nGroup, pCenter, dRadius, dAngIni, dAngCen, 0, nReference)
local nNumCircle
-- serve per il conteggio delle entità in caso di concatenamento con curvecompo
if nCounter_r and nCircle then
nTotContEnt_r = nTotContEnt_r + 1
elseif nCircle then
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 , nReference)
EgtSetColor( nCircle1, cColor1)
end
if bDrawLast then
local nCircle2 = EgtCircle( nGroupCirc, EgtEP( nCircle), nRad , nReference)
EgtSetColor( nCircle2, cColor2)
end
end
return nCircle, nNumCircle, sMVar
end
local function DrawSingleAntiSplintPath( bRotHor, tTableRef, dLevelX, dD, dDeltaPosX,
invG, dLevelY, dPosY, dIniPosY, dEndPosY,
dZedWork, Lg, Dm, bPreview, dLevelYRot,
nInvX, nInvY, bStartAng, nStep)
local pIni, pEnd
if bStartAng then
if bRotHor then -- se antisplint ruotato
-- linea entrante inclinata
pIni = Point3d(-((dLevelX/2)+dIniPosY)*invG*nInvX, -(((dLevelYRot-dD)/2) - 0.2 - dDeltaPosX)*nInvY,dZedWork)
pEnd = Point3d(-((dLevelX/2)+dPosY)*invG*nInvX, -(((dLevelYRot-dD)/2) - 0.2)*nInvY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tTableRef, bPreview, Dm, (dD/2), true, true, ORANGE(), ORANGE(), nil, nil, 'grid')
-- linea entrante in X
pIni = pEnd
pEnd = Point3d(-((dLevelX/2)+dEndPosY)*invG*nInvX, -(((dLevelYRot-dD)/2) - 0.2)*nInvY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tTableRef, bPreview, Dm, (dD/2), false, true, ORANGE(), ORANGE(), nil, nil, 'grid')
-- linee tangente al percorso
pIni = pEnd
pEnd = Point3d(-((dLevelX/2)+dEndPosY)*invG*nInvX, -((dLevelYRot-dD)/2)*nInvY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tTableRef, bPreview, Dm, (dD/2), false, true, ORANGE(), ORANGE(), nil, nil, 'grid')
-- linea di uscita
pIni = pEnd
pEnd = Point3d(-((dLevelX/2)+(dD*3/4))*invG*nInvX,-((dLevelYRot-dD)/2)*nInvY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tTableRef, bPreview, Dm, (dD/2), false, true, ORANGE(), ORANGE(), nil, nil, 'grid')
pIni = pEnd
pEnd = Point3d(pIni:getX(), -(((dLevelYRot-dD)/2) - 0.2 - dDeltaPosX)*nInvY, dZedWork)
else -- antisplint normale
-- linea entrante inclinata
pIni = Point3d(-(((dLevelX-dD)/2) - 0.2 - dDeltaPosX)*invG*nInvX, (dLevelY+dIniPosY)*nInvY,dZedWork)
pEnd = Point3d(-(((dLevelX-dD)/2) - 0.2)*invG*nInvX, (dLevelY+dPosY)*nInvY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tTableRef, bPreview, Dm, (dD/2), true, true, ORANGE(), ORANGE(), nil, nil, 'grid')
-- linea entrante in Y
pIni = pEnd
pEnd = Point3d(-(((dLevelX-dD)/2) - 0.2)*invG*nInvX, (dLevelY+dEndPosY)*nInvY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tTableRef, bPreview, Dm, (dD/2), false, true, ORANGE(), ORANGE(), nil, nil, 'grid')
-- linea a tangere il percorso
pIni = pEnd
pEnd = Point3d(-((dLevelX-dD)/2)*invG*nInvX, (dLevelY+dEndPosY)*nInvY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tTableRef, bPreview, Dm, (dD/2), false, true, ORANGE(), ORANGE(), nil, nil, 'grid')
-- linea di uscita
pIni = pEnd
pEnd = Point3d(-((dLevelX-dD)/2)*invG*nInvX,(dLevelY+(dD*3/4))*nInvY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tTableRef, bPreview, Dm, (dD/2), false, true, ORANGE(), ORANGE(), nil, nil, 'grid')
pIni = pEnd
pEnd = Point3d(-(((dLevelX-dD)/2) - 0.2 - dDeltaPosX)*invG*nInvX, pIni:getY(), dZedWork)
end
else -- se entrata singola
if bRotHor then -- se antisplint ruotato
if nStep == 1 then
pIni = Point3d(-((dLevelX/2)+dIniPosY)*invG*nInvX, -((dLevelYRot-dD)/2)*nInvY,dZedWork)
pEnd = Point3d(-((dLevelX/2)+dEndPosY)*invG*nInvX, -((dLevelYRot-dD)/2)*nInvY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tTableRef, bPreview, Dm, (dD/2), true, true, ORANGE(), ORANGE())
else
pIni = Point3d(-((dLevelX/2)+dIniPosY)*invG*nInvX, (-((dLevelYRot-dD)/2)+0.2)*nInvY,dZedWork)
pEnd = Point3d(-((dLevelX/2)+dEndPosY)*invG*nInvX, (-((dLevelYRot-dD)/2)+0.2)*nInvY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tTableRef, bPreview, Dm, (dD/2), true, true, ORANGE(), ORANGE())
-- faccio il ritorno alla posizione di partenza
pIni = pEnd
pEnd = Point3d(-((dLevelX/2)+dEndPosY)*invG*nInvX, -((dLevelYRot-dD)/2)*nInvY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tTableRef, bPreview, Dm, (dD/2), false, true, ORANGE(), ORANGE())
pIni = pEnd
pEnd = Point3d(-((dLevelX/2)+dIniPosY)*invG*nInvX, pIni:getY(), dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tTableRef, bPreview, Dm, (dD/2), false, true, ORANGE(), ORANGE())
pIni = pEnd
pEnd = Point3d(pIni:getX(), (-((dLevelYRot-dD)/2)+0.2)*nInvY, dZedWork)
end
else -- antisplint normale
if nStep == 1 then
pIni = Point3d(-((dLevelX-dD)/2)*invG*nInvX, (dLevelY+dIniPosY)*nInvY,dZedWork)
pEnd = Point3d(-((dLevelX-dD)/2)*invG*nInvX, (dLevelY+dEndPosY)*nInvY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tTableRef, bPreview, Dm, (dD/2), true, true, ORANGE(), ORANGE(), nil, nil, 'grid')
else
pIni = Point3d(-(((dLevelX-dD)/2) - 0.2)*invG*nInvX, (dLevelY+dIniPosY)*nInvY,dZedWork)
pEnd = Point3d(-(((dLevelX-dD)/2) - 0.2)*invG*nInvX, (dLevelY+dEndPosY)*nInvY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tTableRef, bPreview, Dm, (dD/2), true, true, ORANGE(), ORANGE(), nil, nil, 'grid')
-- faccio il ritorno alla posizione di partenza
pIni = pEnd
pEnd = Point3d(-((dLevelX-dD)/2)*invG*nInvX, (dLevelY+dEndPosY)*nInvY, dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tTableRef, bPreview, Dm, (dD/2), false, true, ORANGE(), ORANGE(), nil, nil, 'grid')
pIni = pEnd
pEnd = Point3d( pIni:getX(), (dLevelY+dIniPosY)*nInvY, dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tTableRef, bPreview, Dm, (dD/2), false, true, ORANGE(), ORANGE(), nil, nil, 'grid')
pIni = pEnd
pEnd = Point3d(-(((dLevelX-dD)/2) - 0.2)*invG*nInvX, pIni:getY(), dZedWork)
end
end
end
return tTableRef, pIni, pEnd
end
local function DrawAddAntiSplintPath( dD, dTh, subtype, dLen, dHei,
dHeiHor, bStartAng, stn, invG, Lg,
bPreview, Dm, bEqualTh, sLabel, sLabelR,
dStp, dMainZedStart, bOpzFour, B_SK, bOnKnuckle)
local nStep
local dStep
local nPass
local dZedWork, dZedStart
local tPocketAs = {}
local tPocketAs_r = {}
local tPocketAs2 = {}
local tPocketAs2_r = {}
local pIni, pIni2, pEnd, pEnd2
local pIni_r, pIni2_r, pEnd_r, pEnd2_r
local tMVar = {}
local tMVar2 = {}
local tMVar_r = {}
local tMVar2_r = {}
local nConEnt
local sKindVar
local dPosY, dEndPosY, dIniPosY, dDeltaPosX
local dLevelX, dLevelY, dLevelYRot
local hintAs1, hintAs2, hintAs3, hintAs4
nStep = ceil(dTh/dStp) -- numero di passate
dStep = (dTh/nStep) -- passo ricalcolato
nPass = 1
dZedStart = dMainZedStart
while nPass <= nStep do
dZedWork = dZedStart - dStep
if nPass == nStep then
if nStep == 1 then
dZedWork = dZedStart
else
dZedWork = dMainZedStart-dTh
end
end
if subtype == 2 or subtype == 3 then
dLevelX = dLen
dLevelY = dHei
dLevelYRot = dHeiHor
else
if bOpzFour then
dLevelX = dLen
dLevelY = 0
dLevelYRot = dHeiHor
else
dLevelX = dLen
dLevelY = dHei-(dHeiHor/2)
dLevelYRot = dHeiHor
end
end
if bStartAng then -- se lead-in con angolo
dEndPosY = -(dD/4)
dPosY = dEndPosY + (dD/8)
dIniPosY = dPosY + (dD*7/8)
dDeltaPosX = ( (dD*7/8) / tan(30))
local nInvX, nInvY
if not stn or ( stn and invG > 0) then -- se il pivot non sborda
local bRotGeom = false
if bOnKnuckle then
if B_SK then
nInvX = -1
nInvY = -1
else
nInvX = 1
nInvY = 1
end
else
nInvX = 1
nInvY = 1
if B_SK and stn then
bRotGeom = true
end
end
tPocketAs, pIni, pEnd = DrawSingleAntiSplintPath( bRotGeom, tPocketAs, dLevelX, dD, dDeltaPosX,
invG, dLevelY, dPosY, dIniPosY, dEndPosY,
dZedWork, Lg, Dm, bPreview, dLevelYRot,
nInvX, nInvY, bStartAng, nStep)
-- se il percorso è altro come spessore porta
if bEqualTh and not stn then
if bOnKnuckle then
if B_SK then
nInvX = 1
nInvY = 1
else
nInvX = -1
nInvY = -1
end
else
nInvX = -1
nInvY = -1
end
tPocketAs2, pIni2, pEnd2 = DrawSingleAntiSplintPath( false, tPocketAs2, dLevelX, dD, dDeltaPosX,
invG, dLevelY, dPosY, dIniPosY, dEndPosY,
dZedWork, Lg, Dm, bPreview, dLevelYRot,
nInvX, nInvY, bStartAng, nStep)
end
else -- se il pivot sborda
local bRotGeom = false
if bEqualTh then -- se il pivot è passante
if bOnKnuckle then
if B_SK then
nInvX = 1
nInvY = 1
else
nInvX = -1
nInvY = -1
end
else
nInvX = -1
nInvY = -1
end
tPocketAs2, pIni2, pEnd2 = DrawSingleAntiSplintPath( bRotGeom, tPocketAs2, dLevelX, dD, dDeltaPosX,
invG, dLevelY, dPosY, dIniPosY, dEndPosY,
dZedWork, Lg, Dm, bPreview, dLevelYRot,
nInvX, nInvY, bStartAng, nStep)
else -- altrimenti il pivot non è passante, faccio geometria ruotata
bRotGeom = true -- setto per ruotare geometria
if bOnKnuckle then
if B_SK then
nInvX = -1
nInvY = 1
else
nInvX = 1
nInvY = 1
end
else
nInvX = 1
nInvY = 1
if B_SK then
bRotGeom = false
end
end
tPocketAs, pIni, pEnd = DrawSingleAntiSplintPath( bRotGeom, tPocketAs, dLevelX, dD, dDeltaPosX,
invG, dLevelY, dPosY, dIniPosY, dEndPosY,
dZedWork, Lg, Dm, bPreview, dLevelYRot,
nInvX, nInvY, bStartAng, nStep)
end
end
if mkrev then -- se abilitato anche il percorso inverso
end
else -- lead-in diritto
dEndPosY = -(dD/4)
dIniPosY = (dD*3/4)
if not stn or ( stn and invG > 0) then -- se il pivot non sborda
local bRotGeom = false
if bOnKnuckle then
if B_SK then
nInvX = -1
nInvY = -1
else
nInvX = 1
nInvY = 1
end
else
nInvX = 1
nInvY = 1
if B_SK and stn then
bRotGeom = true
end
end
tPocketAs, pIni, pEnd = DrawSingleAntiSplintPath( bRotGeom, tPocketAs, dLevelX, dD, dDeltaPosX,
invG, dLevelY, dPosY, dIniPosY, dEndPosY,
dZedWork, Lg, Dm, bPreview, dLevelYRot,
nInvX, nInvY, bStartAng, nStep)
-- se il percorso è altro come spessore porta
if bEqualTh and not stn then
if bOnKnuckle then
if B_SK then
nInvX = 1
nInvY = 1
else
nInvX = -1
nInvY = -1
end
else
nInvX = -1
nInvY = -1
end
tPocketAs2, pIni2, pEnd2 = DrawSingleAntiSplintPath( false, tPocketAs2, dLevelX, dD, dDeltaPosX,
invG, dLevelY, dPosY, dIniPosY, dEndPosY,
dZedWork, Lg, Dm, bPreview, dLevelYRot,
nInvX, nInvY, bStartAng, nStep)
end
else -- se il pivot sborda
local bRotGeom = false
if bEqualTh then -- se il pivot è passante
if bOnKnuckle then
if B_SK then
nInvX = 1
nInvY = 1
else
nInvX = -1
nInvY = -1
end
else
nInvX = -1
nInvY = -1
end
tPocketAs2, pIni2, pEnd2 = DrawSingleAntiSplintPath( bRotGeom, tPocketAs2, dLevelX, dD, dDeltaPosX,
invG, dLevelY, dPosY, dIniPosY, dEndPosY,
dZedWork, Lg, Dm, bPreview, dLevelYRot,
nInvX, nInvY, bStartAng, nStep)
else -- altrimenti il pivot non è passante, faccio geometria ruotata
bRotGeom = true -- setto per ruotare geometria
if bOnKnuckle then
if B_SK then
nInvX = -1
nInvY = 1
else
nInvX = 1
nInvY = 1
end
else
nInvX = 1
nInvY = 1
if B_SK then
bRotGeom = false
end
end
tPocketAs, pIni, pEnd = DrawSingleAntiSplintPath( bRotGeom, tPocketAs, dLevelX, dD, dDeltaPosX,
invG, dLevelY, dPosY, dIniPosY, dEndPosY,
dZedWork, Lg, Dm, bPreview, dLevelYRot,
nInvX, nInvY, bStartAng, nStep)
end
end
if mkrev then -- se abilitato anche il percorso inverso
end
end
nPass = nPass + 1
dZedStart = dZedWork
-- se ho altri passi scendo in z
if nPass <= nStep then
local pIniLoc
if #tPocketAs > 0 then
pIniLoc = pEnd
pEnd = Point3d(pIniLoc:getX(), pIniLoc:getY(), (dZedStart - dStep))
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (dD/2), false, true,
ORANGE(), ORANGE(), sMaxFeed, nil, 'grid')
table.insert( tMVar, {nConEnt,sKindVar})
end
if bEqualTh and #tPocketAs2 > 0 then
pIniLoc = pEnd2
pEnd2 = Point3d(pIniLoc:getX(), pIniLoc:getY(), (dZedStart - dStep))
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (dD/2), false, true,
ORANGE(), ORANGE(), sMaxFeed, nil, 'grid')
table.insert( tMVar2, {nConEnt,sKindVar})
end
if mkrev then -- se abilitato anche il percorso inverso
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, -dTh)
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, sLabel)
end
end
if ( #tPocketAs2 > 0) then
hintAs3 = EgtCurveCompo( Lg, tPocketAs2, true)
if hintAs3 then
if nStep == 1 then
EgtModifyCurveThickness(hintAs3, -dTh)
else
EgtModifyCurveThickness( hintAs3, 0)
-- assegno nota con la lista delle entità di variazione
local sListEnt = ''
for i = 1, #tMVar2 do
sListEnt = sListEnt .. '{ ent=' .. EgtNumToString( tMVar2[i][1], 0) .. ', ' .. 'code=' .. tMVar2[i][2] .. '}'
if i < #tMVar2 then
sListEnt = sListEnt .. ','
end
end -- end for
if string.len( sListEnt) > 0 then EgtSetInfo( hintAs3, 'MVar', sListEnt) end
end
EgtSetName(hintAs3, sLabel)
end
end
if ( #tPocketAs_r > 0) then
hintAs2 = EgtCurveCompo( Lg, tPocketAs_r, true)
if hintAs2 then
if nStep == 1 then
EgtModifyCurveThickness(hintAs2, -dTh)
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, sLabelR)
end
end
if ( #tPocketAs2_r > 0) then
hintAs4 = EgtCurveCompo( Lg, tPocketAs2_r, true)
if hintAs4 then
if nStep == 1 then
EgtModifyCurveThickness(hintAs4, -dTh)
else
EgtModifyCurveThickness( hintAs4, 0)
-- assegno nota con la lista delle entità di variazione
local sListEnt = ''
for i = 1, #tMVar2_r do
sListEnt = sListEnt .. '{ ent=' .. EgtNumToString( tMVar2_r[i][1], 0) .. ', ' .. 'code=' .. tMVar2_r[i][2] .. '}'
if i < #tMVar2_r then
sListEnt = sListEnt .. ','
end
end -- end for
if string.len( sListEnt) > 0 then EgtSetInfo( hintAs4, 'MVar', sListEnt) end
end
EgtSetName(hintAs4, sLabelR)
end
end
return hintAs1, hintAs2, hintAs3, hintAs4
end
local function CkeckRadiusRemain( dLenghtX, dLengthY, dDiam, dOffsVal, nOffsMade)
local dRemainX, rRemainY
dRemainX = ((dLenghtX/2)-(dDiam/2)-(dOffsVal*nOffsMade))
rRemainY = ( dLengthY -(dDiam/2)-(dOffsVal*nOffsMade))
return dRemainX, rRemainY
end
-- Funzione di disegno
function OPivot.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 T3 = tPivotParam.T3
local radius = tPivotParam.rad
local D_SK = tPivotParam.D_SK
local B_SK = tPivotParam.B_SK
local d = tPivotParam.d
local p = tPivotParam.p
local p3 = tPivotParam.p3
local sf = tPivotParam.sf
local s3 = tPivotParam.s3
local d2 = tPivotParam.d2
local d3 = tPivotParam.d3
local d4 = tPivotParam.d4
local jn = tPivotParam.jn
local L2 = tPivotParam.L2
local H2 = tPivotParam.H2
local invG = tPivotParam.invG
local mkrev = tPivotParam.mkrev
local stn = tPivotParam.stn
local stnb = tPivotParam.stnb
local ech = tPivotParam.ech
local ptype = tPivotParam.type
local subtype = tPivotParam.stype
local bEqualTh = tPivotParam.bETh
-- Assegno i nomi geometrie
local LG = tPivotParam.LG
local LM = tPivotParam.LM
local LA = tPivotParam.LA
local LGV = tPivotParam.LGV
local LMV = tPivotParam.LMV
local LAV = tPivotParam.LAV
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
-- 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
-- se tipo intermediate e sottotipo 3, lo risetto perchè le geometrie sono come quelle del sottotipo 2
if ptype == 2 and subtype == 3 then
subtype = 2
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
-- variabili geometrie restituite in uscita
local hint -- disegno geometrie principale (o del knuckle)
local hintPk -- disegno svuotatura principale (o del knuckle)
local hintAs1 -- percorso antischeggia normale ( o sul knuckle)
local hintAs2 -- percorso antischeggia reverso ( o sul knuckle)
local hintPk_r -- disegno svuotatura principale reverso (o del knuckle)
local hintAs3 -- secondo percorso anticheggia normale su spessore passante del knuckle
local hintAs4 -- secondo percorso anticheggia reverso su spessore passante del knuckle
local hint2 -- disegno geometrie body
local hintPk2 -- disegno svuotatura body
local hintAs1b -- percorso antischeggia normale ( o sul knuckle)
local hintAs2b -- percorso antischeggia reverso ( o sul knuckle)
local hintPk2_r -- disegno svuotatura reverso body
local hintAs3b -- secondo percorso anticheggia normale su spessore passante del knuckle
local hintAs4b -- secondo percorso anticheggia reverso su spessore passante del knuckle
-- variabili punto
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 = {}
-- stn = false
-- stnb = false
-- setto la griglia top
EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP))
-- Costruzione della geometria del knuckle pivot ( in senso orario)
if T3 and LG then
if subtype == 2 or subtype == 3 then
if stn then
if invG < 0 then
if B_SK then
-- mezza linea verso destra
-- pIni = Point3d(0,H3+dExtraH,0)
-- pEnd = Point3d((L3/2),H3+dExtraH,0)
-- DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
-- pIni = pEnd
pIni = Point3d((L3/2),H3+dExtraH,0)
pEnd = Point3d((L3/2),-(H3+(d3/2)+dExtraH),0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
pEnd = Point3d(-((L3/2)+(d3/2)+dExtraH),-(H3+(d3/2)+dExtraH),0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
pEnd = Point3d(-((L3/2)+(d3/2)+dExtraH),H3+dExtraH,0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- pEnd = Point3d(0,H3+dExtraH,0)
-- DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
-- pIni = pEnd
else
-- mezza linea verso sinistra
-- pIni = Point3d(0,-(H3+dExtraH),0)
-- pEnd = Point3d(-(L3/2),-(H3+dExtraH),0)
-- DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
-- pIni = pEnd
pIni = Point3d(-(L3/2),-(H3+dExtraH),0)
pEnd = Point3d(-(L3/2),(H3+(d3/2)+dExtraH),0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
pEnd = Point3d(((L3/2)+(d3/2)+dExtraH),(H3+(d3/2)+dExtraH),0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
pEnd = Point3d(((L3/2)+(d3/2)+dExtraH),-(H3+dExtraH),0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- pEnd = Point3d(0,-(H3+dExtraH,0)
-- DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
-- pIni = pEnd
end
else
if B_SK then
-- mezza linea verso sinistra
-- pIni = Point3d(0,-(H3+dExtraH),0)
-- pEnd = Point3d(-((L3/2)+(d3/2)+dExtraH),-(H3+dExtraH),0)
-- DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
-- pIni = pEnd
pIni = Point3d(-((L3/2)+(d3/2)+dExtraH),-(H3+dExtraH),0)
pEnd = Point3d(-((L3/2)+(d3/2)+dExtraH),(H3+(d3/2)+dExtraH),0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
pEnd = Point3d((L3/2),(H3+(d3/2)+dExtraH),0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
pEnd = Point3d((L3/2),-(H3+dExtraH),0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- pEnd = Point3d(0,-(H3+dExtraH),0)
-- DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
-- pIni = pEnd
else
-- mezza linea verso destra
-- pIni = Point3d(0,H3+dExtraH,0)
-- pEnd = Point3d(((L3/2)+(d3/2)+dExtraH),H3+dExtraH,0)
-- DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
-- pIni = pEnd
pIni = Point3d(((L3/2)+(d3/2)+dExtraH),H3+dExtraH,0)
pEnd = Point3d(((L3/2)+(d3/2)+dExtraH),-(H3+(d3/2)+dExtraH),0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
pEnd = Point3d(-(L3/2),-(H3+(d3/2)+dExtraH),0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
pEnd = Point3d(-(L3/2),H3+dExtraH,0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- pEnd = Point3d(0,H3+dExtraH,0)
-- DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
-- pIni = pEnd
end
end
else
-- mezza linea verso destra
-- pIni = Point3d(0,H3+dExtraH,0)
-- pEnd = EgtIf( stn, Point3d(((L3/2)+(d3/2)+dExtraH),H3+dExtraH,0), Point3d((L3/2),H3+dExtraH,0))
-- DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
-- pIni = pEnd
pIni = EgtIf( stn, Point3d(((L3/2)+(d3/2)+dExtraH),H3+dExtraH,0), Point3d((L3/2),H3+dExtraH,0))
pEnd = EgtIf( stn, Point3d(((L3/2)+(d3/2)+dExtraH),-(H3+(d3/2)+dExtraH),0), Point3d((L3/2),-(H3+(d3/2)+dExtraH),0))
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
pEnd = Point3d(-(L3/2),-(H3+(d3/2)+dExtraH),0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
pEnd = Point3d(-(L3/2),H3+dExtraH,0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- pEnd = Point3d(0,H3,0)
-- DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
-- pIni = pEnd
end
else -- sottotipo 4
-- -- linea verso destra
-- pIni = Point3d(0,(H3-(H/2)),0)
-- if ech then
-- pEnd = EgtIf( stn, Point3d(((L3/2)+(d3/2)),(H3-(H/2)),0), Point3d((L3/2)-dExtraH,(H3-(H/2)),0))
-- else
-- pEnd = EgtIf( stn, Point3d(((L3/2)+(d3/2)+dExtraH),(H3-(H/2)),0), Point3d(L3/2,(H3-(H/2)),0))
-- end
-- DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
-- pIni = pEnd
-- if ech then
-- arco orario verso destra
-- pEnd = EgtIf( stn, Point3d(((L3/2)+(d3/2)+dExtraH),(H3-(H/2)-dExtraH),0), Point3d((L3/2),(H3-(H/2)-dExtraH),0))
-- pCentr = EgtIf( stn, Point3d(((L3/2)+(d3/2)),(H3-(H/2)-dExtraH),0), Point3d((L3/2)-dExtraH,(H3-(H/2)-dExtraH),0))
-- DrawAddCircleDrawCircle( pCentr, dExtraH, 90,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
-- pIni = pEnd
-- end
pIni = EgtIf( stn, Point3d((((L3+d3)/2)+dExtraH),(H3-(H/2))+dExtraH,0), Point3d((L3/2),(H3-(H/2))+dExtraH,0))
if ech then
pEnd = EgtIf( stn, Point3d(((L3/2)+(d3/2)+dExtraH),-(H/2)+dExtraH,0), Point3d((L3/2),-(H/2)+dExtraH,0))
else
pEnd = EgtIf( stn, Point3d(((L3/2)+(d3/2)+dExtraH),-(H/2),0), Point3d((L3/2),-(H/2),0))
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
if ech then
-- arco orario verso sinistra
pEnd = EgtIf( stn, Point3d(((L3/2)+(d3/2)),-(H/2),0), Point3d((L3/2)-dExtraH,-(H/2),0))
pCentr = EgtIf( stn, Point3d(((L3/2)+(d3/2)),-(H/2)+dExtraH,0), Point3d((L3/2)-dExtraH,-(H/2)+dExtraH,0))
DrawAddCircleDrawCircle( pCentr, dExtraH, 0,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
end
pEnd = Point3d(-(L3/2),-(H/2),0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- if ech then
-- pEnd = Point3d(-(L3/2),(H3-(H/2)-dExtraH),0)
-- else
pEnd = Point3d(-(L3/2),(H3-(H/2))+dExtraH,0)
-- end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- if ech then
-- -- arco orario verso destra
-- pEnd = Point3d(-(L3/2)+dExtraH,(H3-(H/2)),0)
-- pCentr = Point3d(-(L3/2)+dExtraH,(H3-(H/2)-dExtraH),0)
-- DrawAddCircleDrawCircle( pCentr, dExtraH, 180,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
-- pIni = pEnd
-- end
-- pEnd = Point3d(0,(H3-(H/2)),0)
-- DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
-- pIni = pEnd
end
hint = EgtCurveCompo( Lg, tPocket, true)
EgtModifyCurveThickness( hint, -T3)
EgtSetName( hint, LG)
end
tPocket = {}
local stx
-- Costruzione della geometria del corpo pivot ( in senso orario)
if T and LGV then
if subtype == 2 or subtype == 3 then
EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.FRONT))
else
EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.RIGHT))
end
if subtype == 2 or subtype == 3 then
if not H3 then H3 = DGD.dT end
if not L3 then L3 = 0 end
local dXval
local dXdim
if subtype == 2 then
dXdim = L3
-- dXval = -((L-L3)/2)
dXval = dXdim/2
stx = stn
else
-- dXval = 0
dXval = H/2
dXdim = H
stx = stnb
end
if stx then
-- pIni = Point3d(dXval, dExtraH,H3)
pIni = EgtIf( B_SK, Point3d( dXval, dExtraH,H3), Point3d( (dXval+(d/2)+dExtraH), dExtraH,H3))
-- mezza linea verso destra
-- if ech then
-- pEnd = EgtIf( B_SK, Point3d((dXdim/2)-dExtraH,0,H3), Point3d(((dXdim+d)/2),0,H3))
-- else
-- pEnd = EgtIf( B_SK, Point3d((dXdim/2),0,H3), Point3d((((dXdim+d)/2)+dExtraH),0,H3))
-- end
-- DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
-- pIni = pEnd
-- if ech then
-- arco orario verso destra
-- pEnd = EgtIf( B_SK, Point3d((dXdim/2),-dExtraH,H3), Point3d(((dXdim/2)+(d/2)+dExtraH),-dExtraH,H3))
-- pCentr = EgtIf( B_SK, Point3d((dXdim/2)-dExtraH,-dExtraH,H3), Point3d(((dXdim/2)+(d/2)),-dExtraH,H3))
-- DrawAddCircleDrawCircle( pCentr, dExtraH, 90,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
-- pIni = pEnd
-- end
local dYval
if subtype == 2 then
dYval = H
else
dYval = L
end
if B_SK then
if radius > 0 then
pEnd = Point3d((dXdim/2),-dYval+radius,H3)
else
pEnd = Point3d((dXdim/2),-dYval,H3)
end
else
if ech then
pEnd = Point3d(((dXdim/2)+(d/2)+dExtraH),-dYval+dExtraH,H3) -- considero un raccordino seguente
else
pEnd = Point3d(((dXdim/2)+(d/2)+dExtraH),-dYval,H3)
end
end
-- linea discendente
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- arco orario verso sinistra
if B_SK then
if radius > 0 then
pEnd = Point3d((dXdim/2)-radius,-dYval,H3)
pCentr = Point3d((dXdim/2)-radius,-dYval+radius,H3)
DrawAddCircleDrawCircle( pCentr, radius, 0,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
end
else
if ech then
pEnd = Point3d(((dXdim/2)+(d/2)),-dYval,H3)
pCentr = Point3d(((dXdim/2)+(d/2)),-dYval+dExtraH,H3)
DrawAddCircleDrawCircle( pCentr, dExtraH, 0,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
end
end
if subtype == 2 then
dXval = (dXdim/2)-L
else
dXval = -(dXdim/2)
end
-- linea verso sinistra
if B_SK then
if ech then
pEnd = Point3d( dXval-(d/2),-dYval,H3)
else
pEnd = Point3d( dXval-(d/2)-dExtraH,-dYval,H3)
end
else
if radius > 0 then
pEnd = Point3d( dXval+radius,-dYval,H3)
else
pEnd = Point3d( dXval,-dYval,H3)
end
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- arco orario verso sinistra
if B_SK then
if ech then
pEnd = Point3d( dXval-(d/2)-dExtraH,-dYval+dExtraH,H3)
pCentr = Point3d( dXval-(d/2),-dYval+dExtraH,H3)
DrawAddCircleDrawCircle( pCentr, dExtraH, -90,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
end
else
if radius > 0 then
pEnd = Point3d( dXval,-dYval+radius,H3)
pCentr = Point3d( dXval+radius,-dYval+radius,H3)
DrawAddCircleDrawCircle( pCentr, radius, -90,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
end
end
-- linea risale in Y
if B_SK then
-- if ech then
-- pEnd = Point3d( dXval-(d/2)-dExtraH,-dExtraH,H3)
-- else
-- pEnd = Point3d( dXval-(d/2)-dExtraH,0,H3)
-- end
pEnd = Point3d( dXval-(d/2)-dExtraH,dExtraH,H3)
else
-- if ech then
-- pEnd = Point3d( dXval,-dExtraH,H3)
-- else
-- pEnd = Point3d( dXval,0,H3)
-- end
pEnd = Point3d( dXval,dExtraH,H3)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
if B_SK then
-- if ech then
-- pEnd = Point3d( dXval-(d/2),dExtraH,H3)
-- pCentr = Point3d( dXval-(d/2), 0,H3)
-- DrawAddCircleDrawCircle( pCentr, dExtraH, 180,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
-- pIni = pEnd
-- end
-- if subtype == 2 then
-- pEnd = Point3d(-((L-dXdim)/2),0,H3)
-- else
-- pEnd = Point3d(0,0,H3)
-- end
else
-- if ech then
-- pEnd = Point3d( dXval+dExtraH,0,H3)
-- pCentr = Point3d( dXval+dExtraH,-dExtraH,H3)
-- DrawAddCircleDrawCircle( pCentr, dExtraH, 180,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
-- pIni = pEnd
-- end
-- if subtype == 2 then
-- pEnd = Point3d(-((L-dXdim)/2),0,H3)
-- else
-- pEnd = Point3d(0,0,H3)
-- end
end
-- DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
-- pIni = pEnd
else
-- pIni = Point3d(dXval, dExtraH,H3)
pIni = Point3d( dXval, dExtraH,H3)
-- mezza linea verso destra
-- if ech then
-- pEnd = Point3d((dXdim/2)-dExtraH,0,H3)
-- else
-- pEnd = Point3d((dXdim/2),0,H3)
-- end
-- DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
-- pIni = pEnd
-- if ech then
-- arco orario verso destra
-- pEnd = Point3d((dXdim/2),-dExtraH,H3)
-- pCentr = Point3d((dXdim/2)-dExtraH,-dExtraH,H3)
-- DrawAddCircleDrawCircle( pCentr, dExtraH, 90,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
-- pIni = pEnd
-- end
local dYval
if subtype == 2 then
dYval = H
else
dYval = L
end
if radius > 0 then
pEnd = Point3d((dXdim/2),-dYval+radius,H3)
else
pEnd = Point3d((dXdim/2),-dYval,H3)
end
-- linea discendente
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- arco orario verso sinistra
if radius > 0 then
pEnd = Point3d((dXdim/2)-radius,-dYval,H3)
pCentr = Point3d((dXdim/2)-radius,-dYval+radius,H3)
DrawAddCircleDrawCircle( pCentr, radius, 0,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
end
if subtype == 2 then
dXval = (dXdim/2)-L
else
dXval = -(dXdim/2)
end
-- linea verso sinistra
if radius > 0 then
pEnd = Point3d( dXval+radius,-dYval,H3)
else
pEnd = Point3d( dXval,-dYval,H3)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- arco orario verso sinistra
if radius > 0 then
pEnd = Point3d( dXval,-dYval+radius,H3)
pCentr = Point3d( dXval+radius,-dYval+radius,H3)
DrawAddCircleDrawCircle( pCentr, radius, -90,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
end
-- linea risale in Y
-- if ech then
-- pEnd = Point3d( dXval,-dExtraH,H3)
-- else
-- pEnd = Point3d( dXval,0,H3)
-- end
pEnd = Point3d( dXval,dExtraH,H3)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- if ech then
-- pEnd = Point3d( dXval+dExtraH,0,H3)
-- pCentr = Point3d( dXval+dExtraH,-dExtraH,H3)
-- DrawAddCircleDrawCircle( pCentr, dExtraH, 180,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
-- pIni = pEnd
-- end
-- if subtype == 2 then
-- pEnd = Point3d(-((L-dXdim)/2),0,H3)
-- else
-- pEnd = Point3d(0,0,H3)
-- end
-- DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
-- pIni = pEnd
end
else -- sottotipo 4
stx = stnb
pIni = EgtIf( stnb, Point3d((H/2)+(d/2)+dExtraH,dExtraH,(L3/2)), Point3d((H/2),dExtraH,(L3/2)))
-- pIni = Point3d(0,0,(L3/2))
-- mezza linea verso destra
-- if ech then
-- pEnd = EgtIf( stnb, Point3d((H/2)+(d/2),0,(L3/2)), Point3d((H/2)-dExtraH,0,(L3/2)))
-- else
-- pEnd = EgtIf( stnb, Point3d((H/2)+(d/2)+dExtraH,0,(L3/2)), Point3d((H/2),0,(L3/2)))
-- end
-- DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
-- pIni = pEnd
-- if ech then
-- pEnd = EgtIf( stnb, Point3d((H/2)+(d/2)+dExtraH,-dExtraH,(L3/2)), Point3d((H/2),-dExtraH,(L3/2)))
-- pCentr = EgtIf( stnb, Point3d((H/2)+(d/2),-dExtraH,(L3/2)), Point3d((H/2)-dExtraH,-dExtraH,(L3/2)))
-- DrawAddCircleDrawCircle( pCentr, dExtraH, 90,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
-- pIni = pEnd
-- end
-- linea discesa in Y
if stnb then
if ech then
pEnd = Point3d((H/2)+(d/2)+dExtraH,-L+dExtraH,(L3/2))
else
pEnd = Point3d((H/2)+(d/2)+dExtraH,-L,(L3/2))
end
else
if radius > 0 then
pEnd = Point3d((H/2),-L+radius,(L3/2))
else
pEnd = Point3d((H/2),-L,(L3/2))
end
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- arco orario verso sinistra
if stnb then
if ech then
pEnd = Point3d((H/2)+(d/2),-L,(L3/2))
pCentr = Point3d((H/2)+(d/2),-L+dExtraH,(L3/2))
DrawAddCircleDrawCircle( pCentr, dExtraH, 0,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
end
else
if radius > 0 then
pEnd = Point3d((H/2)-radius,-L,(L3/2))
pCentr = Point3d((H/2)-radius,-L+radius,(L3/2))
DrawAddCircleDrawCircle( pCentr, radius, 0,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
end
end
-- linea verso sinistra
if radius > 0 then
pEnd = Point3d(-(H/2)+radius,-L,(L3/2))
else
pEnd = Point3d(-(H/2),-L,(L3/2))
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- arco orario verso sinistra
if radius > 0 then
pEnd = Point3d(-(H/2),-(L-radius),(L3/2))
pCentr = Point3d(-(H/2)+radius,-(L-radius),(L3/2))
DrawAddCircleDrawCircle( pCentr, radius, -90,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
end
-- linea risalita in Y
-- if ech then
-- pEnd = Point3d(-(H/2),-dExtraH,(L3/2))
-- else
-- pEnd = Point3d(-(H/2),0,(L3/2))
-- end
pEnd = Point3d(-(H/2),dExtraH,(L3/2))
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- if ech then
-- pEnd = Point3d(-(H/2)+dExtraH,0,(L3/2))
-- pCentr = Point3d(-(H/2)+dExtraH,-dExtraH,(L3/2))
-- DrawAddCircleDrawCircle( pCentr, dExtraH, 180,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
-- pIni = pEnd
-- end
-- ultima mezza linea verso destra
-- pEnd = Point3d(0,0,(L3/2))
-- DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED(), nil, nil, 'grid')
-- pIni = pEnd
end
hint2 = EgtCurveCompo( Lg, tPocket, true)
EgtModifyCurveThickness( hint2, -T)
EgtSetName( hint2, LGV)
EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP))
end
-- debug
-- nDrawMach = 0
----------------------------------------------
----------------------------------------------
-- Costruzione delle geometrie di lavorazione
----------------------------------------------
----------------------------------------------
if nDrawMach > 0 then -- se abilitata geometria lavorazione
if not Lg then
Lg = EgtGroup(Pz,GDB_RT.LOC)
EgtSetName(Lg,sCompoName)
end
local bOnKnuckle = true
-- geometria antischeggia percorso principale o knuckle
if d4 and hint then -- se parametro valido
hintAs1, hintAs2, hintAs3, hintAs4 = DrawAddAntiSplintPath( d4, T3, subtype, L3, H3,
H, bStartAng, stn, invG, Lg,
bPreview, Dm, bEqualTh, LA, (LA..'_R'),
s3, 0, nil, B_SK, bOnKnuckle)
end
-- geometria antischeggia percorso body
if d2 and hint2 then -- se parametro valido
local dLocXStart, dLocYStart, dLocZStart, dLocYAmp
local bOpzFour
if subtype == 2 or subtype == 3 then
EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.FRONT))
if subtype == 2 then
if invG > 0 then
dLocXStart = (L*2)-L3
else
dLocXStart = L3
end
dLocYAmp = H*2
else
dLocXStart = H
dLocYAmp = L*2
end
dLocYStart = 0
dLocZStart = H3
else
EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.RIGHT))
dLocXStart = H -- larghezza cava (posizione z globale)
dLocYStart = H/2 -- partenza Y (posizione y globale)
dLocYAmp = L*2
dLocZStart = L3/2
bOpzFour = true
end
bOnKnuckle = false
hintAs1b, hintAs2b, hintAs3b, hintAs4b = DrawAddAntiSplintPath( d2, T, subtype, dLocXStart, dLocYStart,
dLocYAmp, bStartAng, stnb, invG, Lg,
bPreview, Dm, false, LAV, (LAV..'_R'),
sf, dLocZStart, bOpzFour, B_SK, bOnKnuckle)
EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP))
end
---------------------------------------
-- geometria svuotatura giro esterno
---------------------------------------
local tPocket = {}
local tPocket_r = {}
local tPocket2 = {}
local tPocket2_r = {}
local tMVar = {}
local tMVar2 = {}
local tMVar_r = {}
local tMVar2_r = {}
local pIni, pIni2, pEnd, pEnd2
local nCase, nCaseNext
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
------------------------------------
-- se è presente geometria knuckle
------------------------------------
if d3 and hint then
local dDimMin
local dDimMin2
if subtype == 2 or subtype == 3 then
-- individuo in che caso sono
if L3 > (H3*2) then
local dLenComp = EgtIf( stn, L3+(d3/2)+dExtraH,L3)
dDimMin = max( ((H3*2)+(d3/2)+dExtraH), dLenComp)
dDimMin2 = min( ((H3*2)+(d3/2)+dExtraH), dLenComp)
dDimMin2 = dDimMin2 * 2
else -- se larghezza più stretta dell'altezza
dDimMin2 = min( ((H3*2)+(d3/2)+dExtraH), EgtIf( stn, L3+(d3/2)+dExtraH,L3))
dDimMin = dDimMin2
end
else
-- individuo in che caso sono
dDimMin = max( H3, EgtIf( stn, L3+(d3/2)+dExtraH,L3))
dDimMin2 = min( H3, EgtIf( stn, L3+(d3/2)+dExtraH,L3))
-- se il minimo è sull'altezza cava che sborda sempre sul lato dell'altezza lo raddoppio
if abs( dDimMin2 - H3) < GEO.EPS_SMALL then
dDimMin2 = dDimMin2 * 2
end
end
if abs(dDimMin-d3) < 0.03 then -- solo 1 passaggio in centro
nCase = 1
elseif (dDimMin-d3) <= ( d3*0.98) then -- solo passaggio di contornatura
nCase = 2
elseif ((dDimMin-d3) > ( d3*0.98)) and ( (dDimMin-d3) <= (d3*(1+p3))) then -- passaggio di contornatura + un passaggio centrale
nCase = 3
elseif (dDimMin-d3) > (d3*(1+p3)) then -- passaggio di contornatura + passaggi offset
nCase = 4
end
local nDirVers = 1
local nConEnt
local sKindVar
local dLocPosY
local dLocPosX
-- resetto contatori entità
nTotContEnt = 0
nTotContEnt_r = 0
nRadius = dDimMin2/2
nPass = 1
dZedStart = 0
nStep = ceil(T3/s3) -- numero di passate
dStep = (T3/nStep) -- passo ricalcolato
while nPass <= nStep do
dZedWork = dZedStart - dStep
if nPass == nStep then
dZedWork = -T3
end
if nCase == 1 then -- solo 1 passaggio in centro
if nDirVers == 1 then -- se passata di andata
if subtype == 2 or subtype == 3 then
dLocPosY = (H3+(d3*3/4))
else
dLocPosY = (H3-(H/2)+(d3*3/4))
end
pIni = Point3d( EgtIf( stn, (((d3/2)+dExtraH)/2), 0), dLocPosY, dZedWork)
pStartStep = pIni
if subtype == 4 then
dLocPosY = ((H-d3)/2)
end
pEnd = Point3d( EgtIf( stn, (((d3/2)+dExtraH)/2), 0), -dLocPosY, dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- se non sono all'ultima passata scendo in Z
if nPass < nStep then
pEnd = Point3d( pIni:getX(), pIni:getY(), (dZedWork-dStep))
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), false, true, RED(), RED(), nil, nil, 'grid')
end
if mkrev then -- se abilitato anche il percorso inverso
end
else -- altrimenti passata di ritorno
if subtype == 2 or subtype == 3 then
dLocPosY = (H3+(d3*3/4))
else
dLocPosY = ((H-d3)/2)
end
pIni = Point3d( EgtIf( stn, (((d3/2)+dExtraH)/2), 0), -dLocPosY, dZedWork)
if subtype == 4 then
dLocPosY = (H3-(H/2)+(d3*3/4))
end
pEnd = Point3d( EgtIf( stn, (((d3/2)+dExtraH)/2), 0), dLocPosY, dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), false, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- se non sono all'ultima passata scendo in Z
if nPass < nStep then
pEnd = Point3d( pIni:getX(), pIni:getY(), (dZedWork-dStep))
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), false, true, RED(), RED(), nil, nil, 'grid')
end
if mkrev then -- se abilitato anche il percorso inverso
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 - (d3/2)
-- offset
hint_ofs = EgtOffsetCurveAdv( hint, (d3/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 stn or ( stn and invG > 0) then -- se il pivot non sborda
if subtype == 2 or subtype == 3 then
if B_SK then
if not stn then
dLocPosY = (H3+(d3*3/4))
else
dLocPosY = -(H3+(d3*3/4))
end
else
dLocPosY = (H3+(d3*3/4))
end
if B_SK then
if not stn then
pIni = Point3d(-((L3-d3)/2)*invG, dLocPosY,dZedWork)
else
pIni = Point3d((((L3-d3)/2) - 0.2)*invG, dLocPosY,dZedWork)
end
else
pIni = Point3d(-(((L3-d3)/2) - 0.2)*invG, dLocPosY,dZedWork)
end
pStartStep = pIni
-- linea in Y con centro utensile fuori
if B_SK then
if not stn then
dLocPosY = H3+dExtraH
else
dLocPosY = -(H3+dExtraH)
end
else
dLocPosY = H3+dExtraH
end
if B_SK then
if not stn then
pEnd = Point3d(-((L3-d3)/2)*invG, dLocPosY,dZedWork)
else
pEnd = Point3d((((L3-d3)/2) - 0.2)*invG, dLocPosY,dZedWork)
end
else
pEnd = Point3d(-(((L3-d3)/2) - 0.2)*invG, dLocPosY,dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- linea traversa in X per andare sul vecchio punto iniziale (in X)
if B_SK then
if not stn then
dLocPosX = -((L3-d3)/2)*invG
else
dLocPosX = -((L3/2)+dExtraH)*invG
end
else
dLocPosX = ((L3-d3)/2)*invG
end
pEnd = Point3d( dLocPosX, dLocPosY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, RED(), RED(), nil, nil, 'grid')
-- linea entrante a prendere il percorso di offset
pIni = pEnd
pEnd = EgtSP( hint_ofs, GDB_RT.GRID)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, RED(), RED(), nil, nil, 'grid')
pEnd = EgtEP( hint_ofs, GDB_RT.GRID)
else -- altro sottotipo
dLocPosY = (H3-(H/2)+(d3*3/4))
pIni = Point3d(-(((L3-d3)/2) - 0.2)*invG, dLocPosY,dZedWork)
pStartStep = pIni
-- linea in Y con centro utensile fuori
dLocPosY = (H3-(H/2))+dExtraH
pEnd = Point3d(-(((L3-d3)/2) - 0.2)*invG, dLocPosY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- linea traversa in X per andare sul vecchio punto iniziale (in X)
if stn then -- se è aperto dall'altro lato
dLocPosX = ((L3/2)+dExtraH)*invG
else
dLocPosX = ((L3-d3)/2)*invG
end
pEnd = Point3d( dLocPosX, dLocPosY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, RED(), RED(), nil, nil, 'grid')
-- linea entrante a prendere il percorso di offset
pIni = pEnd
pEnd = EgtSP( hint_ofs, GDB_RT.GRID)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, RED(), RED(), nil, nil, 'grid')
pEnd = EgtEP( hint_ofs, GDB_RT.GRID)
end
else -- se il pivot sborda faccio geometria opposta o ruotata in base al sottotipo
if subtype == 2 or subtype == 3 then -- inserimento opposto
if B_SK then
pIni = Point3d(-(((L3-d3)/2) - 0.2)*invG, (H3+(d3*3/4)),dZedWork)
pStartStep = pIni
-- linea in Y opposta con centro utensile fuori
pEnd = Point3d(-(((L3-d3)/2) - 0.2)*invG, (H3+dExtraH),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- linea in X opposta con centro utensile fuori
pEnd = Point3d(((L3/2)+dExtraH)*invG, (H3+dExtraH),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
else
pIni = Point3d((((L3-d3)/2) - 0.2)*invG, -(H3+(d3*3/4)),dZedWork)
pStartStep = pIni
-- linea in Y opposta con centro utensile fuori
pEnd = Point3d((((L3-d3)/2) - 0.2)*invG, -(H3+dExtraH),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- linea in X opposta con centro utensile fuori
pEnd = Point3d(-((L3-d3)/2)*invG, -(H3+dExtraH),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
end
-- linea entrante a prendere il percorso di offset
pEnd = EgtSP( hint_ofs, GDB_RT.GRID)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, RED(), RED(), nil, nil, 'grid')
pEnd = EgtEP( hint_ofs, GDB_RT.GRID)
else -- altro tipo: inserimento sul fianco
pIni = Point3d(-((L3/2)+(d3*3/4))*invG, (-((H-d3)/2)+0.2),dZedWork)
pStartStep = pIni
-- linea in X con centro utensile fuori
pEnd = Point3d(-((L3/2)+dExtraH)*invG,(-((H-d3)/2)+0.2),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, RED(), RED(), nil, nil, 'grid')
-- 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, (d3/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
pEnd = Point3d(((L3-d3)/2)*invG,(H3-(H/2)+dExtraH),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, RED(), RED(), nil, nil, 'grid')
-- linea entrante a prendere il percorso di offset
pIni = pEnd
pEnd = EgtSP( hint_ofs, GDB_RT.GRID)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pEnd = EgtEP( hint_ofs, GDB_RT.GRID)
end
end
local ntypeDom, nNumCurve = EgtCurveDomain(hint_ofs)
nTotContEnt = nTotContEnt + ( nNumCurve - ntypeDom)
table.insert( tPocket, hint_ofs)
else -- se attacco al vecchio punto
if not stn or ( stn and invG > 0) then -- se il pivot non sborda
-- prima linea entrante
if subtype == 2 or subtype == 3 then
dLocPosY = (H3+(d3*3/4))
dLocPosX = ((L3-d3)/2)*invG
else
dLocPosY = (H3-(H/2)+(d3*3/4))
if stn then -- se è aperto dall'altro lato
dLocPosX = ((L3/2)+dExtraH)*invG
else
dLocPosX = ((L3-d3)/2)*invG
end
end
pIni = Point3d( dLocPosX, dLocPosY,dZedWork)
pStartStep = pIni
pEnd = EgtSP( hint_ofs, GDB_RT.GRID)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, RED(), RED(), nil, nil, 'grid')
pEnd = EgtEP( hint_ofs, GDB_RT.GRID)
else -- se il pivot sborda faccio geometria opposta o ruotata in base al sottotipo
if subtype == 2 or subtype == 3 then -- inserimento opposto
pIni = Point3d((((L3-d3)/2) - 0.2)*invG, -(H3+(d3*3/4)),dZedWork)
pStartStep = pIni
-- linea in Y opposta con centro utensile fuori
pEnd = Point3d((((L3-d3)/2) - 0.2)*invG, -(H3+dExtraH),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- linea in X opposta con centro utensile fuori
pEnd = Point3d(-((L3-d3)/2)*invG, -(H3+dExtraH),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- linea entrante a prendere il percorso di offset
pEnd = EgtSP( hint_ofs, GDB_RT.GRID)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, RED(), RED(), nil, nil, 'grid')
pEnd = EgtEP( hint_ofs, GDB_RT.GRID)
else -- inserimento sul fianco
-- prima linea entrante
pIni = Point3d(-((L3/2)+(d3*3/4))*invG,(-((H-d3)/2)+0.2),dZedWork)
pStartStep = pIni
pEnd = Point3d(-((L3/2)+dExtraH)*invG,(-((H-d3)/2)+0.2),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, RED(), RED(), nil, nil, 'grid')
-- 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, (d3/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
pEnd = Point3d(((L3-d3)/2)*invG,(H3-(H/2)+dExtraH),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- linea entrante a prendere il percorso di offset
pEnd = EgtSP( hint_ofs, GDB_RT.GRID)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, RED(), RED(), nil, nil, 'grid')
pEnd = EgtEP( hint_ofs, GDB_RT.GRID)
end
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
end
end
if nCase == 3 then -- passaggio di contornatura + un passaggio centrale
if not stn or ( stn and invG > 0) then -- se il pivot non sborda
if subtype == 2 or subtype == 3 then
-- linea posizionamento passata centrale
if B_SK then
if not stn then
dLocPosY = H3+dExtraH
else
dLocPosY = -(H3+dExtraH)
end
else
dLocPosY = H3+dExtraH
end
pIni = pEnd
if B_SK then
if not stn then
pEnd = Point3d( EgtIf( stn, (((d3/2)+dExtraH)/2), 0), dLocPosY,dZedWork)
else
pEnd = Point3d( EgtIf( stn, -(((d3/2)+dExtraH)/2), 0), dLocPosY,dZedWork)
end
else
pEnd = Point3d( EgtIf( stn, (((d3/2)+dExtraH)/2), 0), dLocPosY,dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
-- linee passata centrale
if B_SK then
if not stn then
dLocPosY = (H3+dExtraH)
else
dLocPosY = -(H3+dExtraH)
end
else
dLocPosY = (H3+dExtraH)
end
if B_SK then
if not stn then
pEnd = Point3d( EgtIf( stn, (((d3/2)+dExtraH)/2), 0), -dLocPosY,dZedWork)
else
pEnd = Point3d( EgtIf( stn, -(((d3/2)+dExtraH)/2), 0), -dLocPosY,dZedWork)
end
else
pEnd = Point3d( EgtIf( stn, (((d3/2)+dExtraH)/2), 0), -dLocPosY,dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
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
if B_SK then
if not stn then
dLocPosY = H3+dExtraH
else
dLocPosY = -(H3+dExtraH)
end
else
dLocPosY = H3+dExtraH
end
if B_SK then
if not stn then
pEnd = Point3d( EgtIf( stn, (((d3/2)+dExtraH)/2), 0), dLocPosY,dZedWork)
else
pEnd = Point3d( EgtIf( stn, -(((d3/2)+dExtraH)/2), 0), dLocPosY,dZedWork)
end
else
pEnd = Point3d( EgtIf( stn, (((d3/2)+dExtraH)/2), 0), dLocPosY,dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
end
if mkrev then -- se abilitato anche il percorso inverso
end
else
-- linea posizionamento passata centrale
dLocPosY = (H3-(H/2))+dExtraH
pIni = pEnd
pEnd = Point3d( EgtIf( stn, (((d3/2)+dExtraH)/2), 0), dLocPosY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
-- linee passata centrale
dLocPosY = ((H-d3)/2)-0.2
pEnd = Point3d( EgtIf( stn, (((d3/2)+dExtraH)/2), 0), -dLocPosY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
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
dLocPosY = (H3-(H/2))+dExtraH
pEnd = Point3d( EgtIf( stn, (((d3/2)+dExtraH)/2), 0), dLocPosY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
end
if mkrev then -- se abilitato anche il percorso inverso
end
end
else -- il pivot sborda, inserimento opposto
if subtype == 2 or subtype == 3 then
-- linea posizionamento passata centrale
if B_SK then
dLocPosY = -(H3+dExtraH)
else
dLocPosY = H3+dExtraH
end
pIni = pEnd
if B_SK then
pEnd = Point3d( EgtIf( stn, -(((d3/2)+dExtraH)/2), 0), -dLocPosY,dZedWork)
else
pEnd = Point3d( EgtIf( stn, (((d3/2)+dExtraH)/2), 0), -dLocPosY,dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
-- linee passata centrale
pEnd = Point3d( pIni:getX(), dLocPosY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
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( pIni:getX(), -dLocPosY+dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
end
if mkrev then -- se abilitato anche il percorso inverso
end
else -- altrimenti altro sottotipo
-- linea posizionamento passata centrale
dLocPosY = (H3-(H/2))
pIni = pEnd
pEnd = Point3d( EgtIf( stn, (((d3/2)+dExtraH)/2), 0), dLocPosY+dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
-- linee passata centrale
dLocPosY = ((H-d3)/2)-0.2
pEnd = Point3d( EgtIf( stn, (((d3/2)+dExtraH)/2), 0), -dLocPosY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
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
dLocPosY = (H3-(H/2))
pEnd = Point3d( EgtIf( stn, (((d3/2)+dExtraH)/2), 0), dLocPosY+dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
end
if mkrev then -- se abilitato anche il percorso inverso
end
end
end
elseif nCase == 4 then -- passaggio di contornatura + passaggi svuotatura
local nDistYcentr = (d3*p3)
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
local nInvOffs = 1
local bFailOfs = false
local dCompareX = L3
local dCompareY = H3
local dRemX, dRemY
if stn then
dCompareX = L3+(d3/2)+dExtraH
end
if subtype == 2 or subtype == 3 then
dCompareY = H3*2
end
-- se percorso offset esiste
while bContinue do
hint_ofs2 = EgtOffsetCurveAdv( hint_ofs, nDistYcentr*invG*nInvOffs, GDB_OT.FILLET)
if hint_ofs2 and hint_ofs2 > 0 then
nCountOfs = nCountOfs + 1
-- linea congiunzione tra offset
pIni = pEnd
-- inverto il percorso
EgtInvertCurve(hint_ofs2)
pEnd = EgtSP( hint_ofs2, GDB_RT.GRID)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), false, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pEnd = EgtEP( hint_ofs2, GDB_RT.GRID)
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
end
-- calcolo nuovo passo in Y e indice direzione
nRadius = nRadius - nDistYcentr
if nRadius > 0 then
dRemX, dRemY = CkeckRadiusRemain( dCompareX, dCompareY, d3, nDistYcentr, (nCountOfs+1))
if (dRemX and dRemX > (d3/4)) or ( dRemY and dRemY > d3) then
bContinue = true
else
bContinue = false
end
else
bContinue = false
end
nInvOffs = -nInvOffs
else
bContinue = false
bFailOfs = true
end
end -- end while
if p > 0.75 then -- se la percentuale di sovrapposizione è alta
local nMakeExtraPass = 0
-- ricalcolo le rimanenze
dRemX, dRemY = CkeckRadiusRemain( dCompareX, dCompareY, d3, nDistYcentr, nCountOfs)
-- calcolo in quale direzione ha collassato
if dRemX > dRemY then -- se larghezza risultante maggiore
if dRemY > d3 then -- se la passata precedente è maggiore del diametro utensile
nMakeExtraPass = 2 -- passata orizzontale
end
else -- altezza risultante maggiore della larghezza
if dRemX > (d3/2.02) then -- se la passata precedente è maggiore del raggio utensile
nMakeExtraPass = 1 -- passata verticale
end
end
if nMakeExtraPass == 1 then -- se passata verticale
if subtype == 2 or subtype == 3 then
-- linea posizionamento passata centrale
if B_SK then
if invG > 0 then
dLocPosY = -(H3+dExtraH)
else
dLocPosY = (H3+dExtraH)
end
else
dLocPosY = H3+dExtraH
end
pIni = pEnd
if B_SK then
if invG > 0 then
pEnd = Point3d( EgtIf( stn, -(((d3/2)+dExtraH)/2), 0), dLocPosY,dZedWork)
else
pEnd = Point3d( EgtIf( stn, -(((d3/2)+dExtraH)/2), 0), dLocPosY,dZedWork)
end
else
pEnd = Point3d( EgtIf( stn, (((d3/2)+dExtraH)/2), 0), dLocPosY,dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
-- linee passata centrale
pEnd = Point3d( pIni:getX(), -dLocPosY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
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( pIni:getX(), dLocPosY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
end
if mkrev then -- se abilitato anche il percorso inverso
end
else -- altrimenti atro sottotipo
-- linea posizionamento passata centrale
dLocPosY = (H3-(H/2))+dExtraH
pIni = pEnd
pEnd = Point3d( EgtIf( stn, (((d3/2)+dExtraH)/2), 0), dLocPosY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
-- linee passata centrale
dLocPosY = ((H-d3)/2)-0.2
pEnd = Point3d( pIni:getX(), -dLocPosY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
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
dLocPosY = (H3-(H/2))+dExtraH
pEnd = Point3d( pIni:getX(), dLocPosY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
end
if mkrev then -- se abilitato anche il percorso inverso
end
end
elseif nMakeExtraPass == 2 then -- se passata orizzontale
if subtype == 2 or subtype == 3 then
-- linea posizionamento passata orizzontale
pIni = pEnd
if B_SK then
if invG > 0 then
dLocPosY = -(H3+dExtraH)
else
dLocPosY = (H3+dExtraH)
end
pEnd = Point3d( EgtIf( stn, -((L3+(d3/2)+dExtraH)/2), -((L3/2)-(d3*3/4))), dLocPosY,dZedWork)
else
dLocPosY = (H3+dExtraH)
pEnd = Point3d( EgtIf( stn, ((L3+(d3/2)+dExtraH)/2), ((L3/2)-(d3*3/4))), dLocPosY,dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
-- linea posizionamento in Y
if B_SK then
if invG > 0 then
dLocPosY = (H3-(d3/2))
else
dLocPosY = -(H3-(d3/2))
end
else
dLocPosY = -(H3-(d3/2))
end
pEnd = Point3d( pIni:getX(), dLocPosY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
-- linea attraversamento in X
if B_SK then
if invG > 0 then
pEnd = Point3d( ((L3/2)-(d3*3/4)), pIni:getY(),dZedWork)
else
pEnd = Point3d( -((L3/2)-(d3*3/4)), pIni:getY(),dZedWork)
end
else
pEnd = Point3d( -((L3/2)-(d3*3/4)), pIni:getY(),dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
-- risalgo in Y fuori dalla svuotatura
if B_SK then
if invG > 0 then
dLocPosY = -(H3+(d3*3/4))
else
dLocPosY = (H3+(d3*3/4))
end
else
dLocPosY = (H3+(d3*3/4))
end
pEnd = Point3d( pIni:getX(), dLocPosY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
if mkrev then -- se abilitato anche il percorso inverso
end
else
dLocPosY = (H3-(H/2))
-- linea posizionamento passata orizzontale
pIni = pEnd
pEnd = Point3d( EgtIf( stn, (((L3+d3)/2)+dExtraH)-(d3*3/4), (L3/2)-(d3*3/4)), dLocPosY+dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
-- linea posizionamento in Y
pEnd = Point3d( pIni:getX(), dLocPosY-(d3/2),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
-- linea attraversamento in X
pEnd = Point3d( -((L3/2)-(d3*3/4)), pIni:getY(),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
-- risalgo in Y fuori dalla svuotatura
pEnd = Point3d( pIni:getX(), dLocPosY+(d3*3/4),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
if mkrev then -- se abilitato anche il percorso inverso
end
end
end
end
end
end
end
nPass = nPass + 1
dZedStart = dZedStart - dStep
nRadius = dDimMin2/2
nDirVers = -nDirVers
-- se ho altri passi torno al punto di inizio
if nPass <= nStep and nCase > 1 then
pIni = pEnd
if not stn or ( stn and invG > 0) then -- se il pivot non sborda
pEnd = Point3d(pIni:getX(),pStartStep:getY(),dZedStart)
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), false, true, YELLOW(), YELLOW(), sMaxFeed, nil, 'grid')
table.insert( tMVar, {nTotContEnt,sKindVar})
pIni = pEnd
pEnd = Point3d(pStartStep:getX(),pStartStep:getY(),(dZedStart - dStep))
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), false, true, YELLOW(), YELLOW(), sMaxFeed, nil, 'grid')
table.insert( tMVar, {nTotContEnt,sKindVar})
else -- se il pivot sborda faccio geometria opposta o ruotata in base al sottotipo
if subtype == 2 or subtype == 3 then -- inserimento opposto
pEnd = Point3d(pIni:getX(),pStartStep:getY(),dZedStart)
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), false, true, YELLOW(), YELLOW(), sMaxFeed, nil, 'grid')
table.insert( tMVar, {nTotContEnt,sKindVar})
pIni = pEnd
pEnd = Point3d(pStartStep:getX(),pStartStep:getY(),(dZedStart - dStep))
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), false, true, YELLOW(), YELLOW(), sMaxFeed, nil, 'grid')
table.insert( tMVar, {nTotContEnt,sKindVar})
else -- inserimento sul fianco
pEnd = Point3d(pStartStep:getX(),pIni:getY(),dZedStart)
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), false, true, YELLOW(), YELLOW(), sMaxFeed, nil, 'grid')
table.insert( tMVar, {nTotContEnt,sKindVar})
pIni = pEnd
pEnd = Point3d(pStartStep:getX(),pStartStep:getY(),(dZedStart - dStep))
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d3/2), false, true, YELLOW(), YELLOW(), sMaxFeed, nil, 'grid')
table.insert( tMVar, {nTotContEnt,sKindVar})
end
end
if mkrev then -- se abilitato anche il percorso inverso
end
end
end -- end while
end
-------------------------------------
-- se è presente la geometria body
-------------------------------------
if d and hint2 then
local dDimMin
local dDimMin2
local nDirVers = 1
local nConEnt
local sKindVar
local dLocXStart, dLocYStart, dLocZStart, dLocXAmp, dLocYAmp
if subtype == 2 or subtype == 3 then
EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.FRONT))
dLocZStart = H3
if subtype == 2 then
dLocXAmp = L
dLocYAmp = H
else
dLocXAmp = H
dLocYAmp = L
end
-- individuo in che caso sono
if dLocXAmp > dLocYAmp then
local dLenComp = EgtIf( stx, dLocXAmp+(d/2)+dExtraH,dLocXAmp)
dDimMin = max( dLocYAmp, dLenComp)
dDimMin2 = min( dLocYAmp, dLenComp)
dDimMin2 = dDimMin2 * 2
else -- se larghezza più stretta dell'altezza
local dLenComp = EgtIf( stx, dLocXAmp+(d/2)+dExtraH,dLocXAmp)
dDimMin2 = min( dLocYAmp, dLenComp)
dDimMin = dDimMin2
if abs( dDimMin2 - dLocYAmp) < GEO.EPS_SMALL then -- se il minimo è sull'altezza
if dLenComp/dDimMin2 >= 2 then -- se lunghezza è più del doppio dell'altezza
dDimMin2 = dDimMin2 * 2
end
end
end
else
EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.RIGHT))
dLocZStart = L3/2
-- individuo in che caso sono
dLocXAmp = L
dLocYAmp = H
dDimMin = min( L, EgtIf( stx, H+(d/2)+dExtraH,H))
dDimMin2 = dDimMin
end
if abs(dDimMin-d) < 0.03 then -- solo 1 passaggio in centro
nCase = 1
elseif (dDimMin-d) <= ( d*0.98) then -- solo passaggio di contornatura
nCase = 2
elseif ((dDimMin-d) > ( d*0.98)) and ( (dDimMin-d) <= (d*(1+p))) then -- passaggio di contornatura + un passaggio centrale
nCase = 3
elseif (dDimMin-d) > (d*(1+p)) then -- passaggio di contornatura + passaggi offset
nCase = 4
end
-- resetto contatori entità
nTotContEnt = 0
nTotContEnt_r = 0
nRadius = dDimMin2/2
nPass = 1
dZedStart = dLocZStart
nStep = ceil(T/sf) -- numero di passate
dStep = (T/nStep) -- passo ricalcolato
while nPass <= nStep do
dZedWork = dZedStart - dStep
if nPass == nStep then
-- if nStep == 1 then
-- dZedWork = dZedStart
-- else
dZedWork = dLocZStart-T
-- end
end
if nCase == 1 then -- solo 1 passaggio in centro
if nDirVers == 1 then -- se passata di andata
if subtype == 2 then
if bStartOppo then
if invG > 0 then
pIni = Point3d((((L3+d)/2) - L), (d*3/4),dZedWork)
pStartStep = pIni
pEnd = Point3d((((L3+d)/2) - L), -H+(d/2), dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
if stx then
pEnd = Point3d(((L3/2)+(d*3/4)),-H+(d/2),dZedWork)
else
pEnd = Point3d(((L3-d)/2),-H+(d/2),dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), false, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- se non sono all'ultima passata scendo in Z
if nPass < nStep then
pEnd = Point3d( pIni:getX(), pIni:getY(), (dZedWork-dStep))
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), false, true, RED(), RED(), nil, nil, 'grid')
end
if mkrev then -- se abilitato anche il percorso inverso
end
else
if stx then
pIni = Point3d(((L3/2)+(d*3/4)),-H+(d/2),dZedWork)
else
pIni = Point3d(((L3-d)/2),(d*3/4),dZedWork)
end
pStartStep = pIni
if stx then
pEnd = Point3d((((L3+d)/2) - L), -H+(d/2), dZedWork)
else
pEnd = Point3d(((L3-d)/2),-H+(d/2),dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
if stx then
pEnd = Point3d((((L3+d)/2) - L), (d*3/4),dZedWork)
else
pEnd = Point3d((((L3+d)/2) - L), -H+(d/2),dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), false, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- se non sono all'ultima passata scendo in Z
if nPass < nStep then
pEnd = Point3d( pIni:getX(), pIni:getY(), (dZedWork-dStep))
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), false, true, RED(), RED(), nil, nil, 'grid')
end
if mkrev then -- se abilitato anche il percorso inverso
end
end
else -- codice vetusto: da verificare
if invG > 0 then
if stx then
pIni = Point3d(((L3/2)+(d*3/4)),-H+(d/2), dZedWork)
else
pIni = Point3d(((L3-d)/2),(d*3/4), dZedWork)
end
pStartStep = pIni
if stx then
pEnd = Point3d((((L3+d)/2) - L), -H+(d/2), dZedWork)
else
pEnd = Point3d(((L3-d)/2), -H+(d/2), dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
if stx then
pEnd = Point3d((((L3+d)/2) - L), (d*3/4),dZedWork)
else
pEnd = Point3d((((L3+d)/2) - L), -H+(d/2),dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), false, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- se non sono all'ultima passata scendo in Z
if nPass < nStep then
pEnd = Point3d( pIni:getX(), pIni:getY(), (dZedWork-dStep))
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), false, true, RED(), RED(), nil, nil, 'grid')
end
if mkrev then -- se abilitato anche il percorso inverso
end
else
pIni = Point3d((((L3+d)/2) - L), (d*3/4), dZedWork)
pStartStep = pIni
pEnd = Point3d((((L3+d)/2) - L), -H+(d/2), dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
if stx then
pEnd = Point3d(((L3/2)+(d*3/4)),-H+(d/2),dZedWork)
else
pEnd = Point3d(((L3-d)/2),-H+(d/2),dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), false, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- se non sono all'ultima passata scendo in Z
if nPass < nStep then
pEnd = Point3d( pIni:getX(), pIni:getY(), (dZedWork-dStep))
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), false, true, RED(), RED(), nil, nil, 'grid')
end
if mkrev then -- se abilitato anche il percorso inverso
end
end
end
elseif subtype == 3 then
pIni = Point3d( EgtIf( stx, -((d/2)+dExtraH)*invG, 0), (d*3/4), dZedWork)
pStartStep = pIni
pEnd = Point3d( EgtIf( stx, -((d/2)+dExtraH)*invG, 0), -L+(d/2), dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- se non sono all'ultima passata scendo in Z
if nPass < nStep then
pEnd = Point3d( pIni:getX(), pIni:getY(), (dZedWork-dStep))
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), false, true, RED(), RED(), nil, nil, 'grid')
end
if mkrev then -- se abilitato anche il percorso inverso
end
elseif subtype == 4 then
pIni = Point3d( EgtIf( stx, ((d/2)+dExtraH), 0)*invG, (d*3/4), dZedWork)
pStartStep = pIni
pEnd = Point3d( EgtIf( stx, ((d/2)+dExtraH), 0)*invG, -(L-(d/2)), dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- se non sono all'ultima passata scendo in Z
if nPass < nStep then
pEnd = Point3d( pIni:getX(), pIni:getY(), (dZedWork-dStep))
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), false, true, RED(), RED(), nil, nil, 'grid')
end
if mkrev then -- se abilitato anche il percorso inverso
end
end
else -- altrimenti passata di ritorno
if subtype == 2 then
if bStartOppo then
if invG > 0 then
if stx then
pIni = Point3d(((L3/2)+(d*3/4)),-H+(d/2),dZedWork)
else
pIni = Point3d(((L3-d)/2), -H+(d/2), dZedWork)
end
pEnd = Point3d((((L3+d)/2) - L),-H+(d/2), dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
pEnd = Point3d((((L3+d)/2) - L), (d*3/4),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), false, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- se non sono all'ultima passata scendo in Z
if nPass < nStep then
pEnd = Point3d( pIni:getX(), pIni:getY(), (dZedWork-dStep))
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), false, true, RED(), RED(), nil, nil, 'grid')
end
if mkrev then -- se abilitato anche il percorso inverso
end
else
if stx then
pIni = Point3d((((L3+d)/2) - L), (d*3/4),dZedWork)
pEnd = Point3d((((L3+d)/2) - L), -H+(d/2), dZedWork)
else
pIni = Point3d((((L3+d)/2) - L), -H+(d/2),dZedWork)
pEnd = Point3d(((L3-d)/2),-H+(d/2),dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
if stx then
pEnd = Point3d(((L3/2)+(d*3/4)),-H+(d/2),dZedWork)
else
pEnd = Point3d(((L3-d)/2),(d*3/4),dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), false, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- se non sono all'ultima passata scendo in Z
if nPass < nStep then
pEnd = Point3d( pIni:getX(), pIni:getY(), (dZedWork-dStep))
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), false, true, RED(), RED(), nil, nil, 'grid')
end
if mkrev then -- se abilitato anche il percorso inverso
end
end
else -- codice vetusto, da verificare
if invG > 0 then
if stx then
pIni = Point3d((((L3+d)/2) - L), (d*3/4),dZedWork)
pEnd = Point3d((((L3+d)/2) - L), -H+(d/2), dZedWork)
else
pIni = Point3d((((L3+d)/2) - L), -H+(d/2),dZedWork)
pEnd = Point3d(((L3-d)/2),-H+(d/2),dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
if stx then
pEnd = Point3d(((L3/2)+(d*3/4)),-H+(d/2),dZedWork)
else
pEnd = Point3d(((L3-d)/2),(d*3/4),dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), false, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- se non sono all'ultima passata scendo in Z
if nPass < nStep then
pEnd = Point3d( pIni:getX(), pIni:getY(), (dZedWork-dStep))
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), false, true, RED(), RED(), nil, nil, 'grid')
end
if mkrev then -- se abilitato anche il percorso inverso
end
else
if stx then
pIni = Point3d(((L3/2)+(d*3/4)),-H+(d/2),dZedWork)
else
pIni = Point3d(((L3-d)/2), -H+(d/2), dZedWork)
end
pEnd = Point3d((((L3+d)/2) - L),-H+(d/2), dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
pEnd = Point3d((((L3+d)/2) - L), (d*3/4),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), false, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- se non sono all'ultima passata scendo in Z
if nPass < nStep then
pEnd = Point3d( pIni:getX(), pIni:getY(), (dZedWork-dStep))
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), false, true, RED(), RED(), nil, nil, 'grid')
end
if mkrev then -- se abilitato anche il percorso inverso
end
end
end
elseif subtype == 3 then
pIni = Point3d( EgtIf( stx, -((d/2)+dExtraH)*invG, 0), -L+(d/2), dZedWork)
pEnd = Point3d( EgtIf( stx, -((d/2)+dExtraH)*invG, 0), (d*3/4), dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- se non sono all'ultima passata scendo in Z
if nPass < nStep then
pEnd = Point3d( pIni:getX(), pIni:getY(), (dZedWork-dStep))
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), false, true, RED(), RED(), nil, nil, 'grid')
end
if mkrev then -- se abilitato anche il percorso inverso
end
elseif subtype == 4 then
pIni = Point3d( EgtIf( stx, ((d/2)+dExtraH), 0)*invG, -(L-(d/2)), dZedWork)
pEnd = Point3d( EgtIf( stx, ((d/2)+dExtraH), 0)*invG, (d*3/4), dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- se non sono all'ultima passata scendo in Z
if nPass < nStep then
pEnd = Point3d( pIni:getX(), pIni:getY(), (dZedWork-dStep))
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), false, true, RED(), RED(), nil, nil, 'grid')
end
if mkrev then -- se abilitato anche il percorso inverso
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( hint2, (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-dLocZStart) - ORIG(), GDB_RT.GRID)
-- se flag inverso, inverto la geometria, solo qui non nelle altre copie
if invG < 0 then
EgtInvertCurve(hint_ofs)
end
if bStartOppo then
if subtype == 2 then
if invG > 0 then
if B_SK and stx then -- se knuckle è opposto e sborda faccio geometria ruotata
pIni = Point3d( ((L3/2) - L - (d*3/4)), -(H-(d/2)-0.2),dZedWork)
pStartStep = pIni
pEnd = Point3d(((L3/2) - L - dExtraH), -(H-(d/2)-0.2),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- linee traverse in Y e poi X per andare sul vecchio punto iniziale (in X)
pEnd = Point3d(((L3/2) - L - dExtraH), dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
if stx then
pEnd = Point3d( (((L3+d)/2) - L), dExtraH,dZedWork)
else
pEnd = Point3d( (((L3-d)/2) - L), dExtraH,dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
else -- altrimenti diritta
pIni = Point3d((((L3+d)/2) - L + 0.2), (d*3/4),dZedWork)
pStartStep = pIni
-- linea in Y con centro utensile fuori
pEnd = Point3d((((L3+d)/2) - L + 0.2), dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- linea traversa in X per andare sul vecchio punto iniziale (in X)
if stx then
pEnd = Point3d(((L3/2)+dExtraH),dExtraH,dZedWork)
else
pEnd = Point3d(((L3-d)/2), dExtraH,dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
end
-- linea entrante a prendere il percorso di offset
pEnd = EgtSP( hint_ofs, GDB_RT.GRID)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pEnd = EgtEP( hint_ofs, GDB_RT.GRID)
else
if stx and not B_SK then -- se il pivot sborda e il knukle non è opposto, faccio geometria ruotata
pIni = Point3d(((L3/2)+(d*3/4)), -(H-(d/2)-0.2),dZedWork)
pStartStep = pIni
pEnd = Point3d(((L3/2) + dExtraH), -(H-(d/2)-0.2),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- linee traverse in Y e poi X per andare sul vecchio punto iniziale (in X)
pEnd = Point3d(((L3/2) + dExtraH), dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
pEnd = Point3d(((L3-d)/2), dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
else -- altrimenti geometria dritta
pIni = Point3d(((L3-d)/2),(d*3/4),dZedWork)
pStartStep = pIni
pEnd = Point3d(((L3-d)/2), dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
end
-- linea entrante a prendere il percorso di offset
pEnd = EgtSP( hint_ofs, GDB_RT.GRID)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pEnd = EgtEP( hint_ofs, GDB_RT.GRID)
end
elseif subtype == 3 then
if not stx or ( stx and invG > 0) then -- se il pivot non sborda
pIni = Point3d(-(((H-d)/2) - 0.2)*invG, (d*3/4),dZedWork)
pStartStep = pIni
-- linea in Y con centro utensile fuori
pEnd = Point3d(-(((H-d)/2) - 0.2)*invG, dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- linea traversa in X per andare sul vecchio punto iniziale (in X)
pEnd = Point3d(((H-d)/2)*invG, dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- linea entrante a prendere il percorso di offset
pEnd = EgtSP( hint_ofs, GDB_RT.GRID)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pEnd = EgtEP( hint_ofs, GDB_RT.GRID)
else -- se il pivot sborda faccio geometria ruotata
pIni = Point3d(-((H/2)+(d*3/4))*invG, -(L-(d/2)-0.2),dZedWork)
pStartStep = pIni
-- linea in X con centro utensile fuori
pEnd = Point3d(-((H/2)+dExtraH)*invG, -(L-(d/2)-0.2),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- linee traverse in Y e poi X per andare sul vecchio punto iniziale (in X)
pEnd = Point3d(-((H/2)+dExtraH)*invG, dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
pEnd = Point3d(((H-d)/2)*invG, dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- linea entrante a prendere il percorso di offset
pEnd = EgtSP( hint_ofs, GDB_RT.GRID)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pEnd = EgtEP( hint_ofs, GDB_RT.GRID)
end
elseif subtype == 4 then
if not stx or ( stx and invG > 0) then -- se il pivot non sborda
pIni = Point3d(-(((H-d)/2)-0.2)*invG, (d*3/4),dZedWork)
pStartStep = pIni
-- linea in Y con centro utensile fuori
pEnd = Point3d(-(((H-d)/2)-0.2)*invG, dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- linea traversa in X per andare sul vecchio punto iniziale (in X)
pEnd = Point3d(((H-d)/2)*invG,dExtraH, dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- linea entrante a prendere il percorso di offset
pEnd = EgtSP( hint_ofs, GDB_RT.GRID)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pEnd = EgtEP( hint_ofs, GDB_RT.GRID)
else -- se il pivot sborda faccio geometria ruotata
pIni = Point3d(-((H/2)+(d*3/4))*invG,-(L-(d/2)-0.2), dZedWork)
pStartStep = pIni
-- linea in X con centro utensile fuori
pEnd = Point3d(-((H/2)+dExtraH)*invG,-(L-(d/2)-0.2),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- linee traverse in Y e poi X per andare sul vecchio punto iniziale (in X)
pEnd = Point3d( -((H/2)+dExtraH)*invG, dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
pEnd = Point3d(((H-d)/2)*invG, dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- linea entrante a prendere il percorso di offset
pEnd = EgtSP( hint_ofs, GDB_RT.GRID)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pEnd = EgtEP( hint_ofs, GDB_RT.GRID)
end
end
local ntypeDom, nNumCurve = EgtCurveDomain(hint_ofs)
nTotContEnt = nTotContEnt + ( nNumCurve - ntypeDom)
table.insert( tPocket2, hint_ofs)
else -- se attacco al vecchio punto, codice vetusto: da verificare
if subtype == 2 then
if not stx or ( stx and invG > 0) then -- se il pivot non sborda
-- prima linea entrante
pIni = Point3d(((L3-d)/2)*invG, (d*3/4),dZedWork)
pStartStep = pIni
pEnd = EgtSP( hint_ofs, GDB_RT.GRID)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pEnd = EgtEP( hint_ofs, GDB_RT.GRID)
else
pIni = Point3d(((L3/2) - L - (d*3/4))*invG, -(H-(d/2)-0.2),dZedWork)
pStartStep = pIni
-- linea in X con centro utensile fuori
pEnd = Point3d(((L3/2) - L - dExtraH)*invG, -(H-(d/2)-0.2),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- linee traverse in Y e poi X per andare sul vecchio punto iniziale (in X)
pEnd = Point3d(((L3/2) - L - dExtraH)*invG, dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
pEnd = Point3d(((L3-d)/2)*invG, dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- linea entrante a prendere il percorso di offset
pEnd = EgtSP( hint_ofs, GDB_RT.GRID)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pEnd = EgtEP( hint_ofs, GDB_RT.GRID)
end
elseif subtype == 3 then
if not stx or ( stx and invG > 0) then -- se il pivot non sborda
-- prima linea entrante
pIni = Point3d(((H-d)/2)*invG, (d*3/4),dZedWork)
pStartStep = pIni
pEnd = EgtSP( hint_ofs, GDB_RT.GRID)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pEnd = EgtEP( hint_ofs, GDB_RT.GRID)
else
pIni = Point3d(-((H/2)+(d*3/4))*invG, -(L-(d/2)-0.2),dZedWork)
pStartStep = pIni
-- linea in X con centro utensile fuori
pEnd = Point3d(-((H/2)+dExtraH)*invG, -(L-(d/2)-0.2),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- linee traverse in Y e poi X per andare sul vecchio punto iniziale (in X)
pEnd = Point3d(-((H/2)+dExtraH)*invG, dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
pEnd = Point3d(((H-d)/2)*invG, dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- linea entrante a prendere il percorso di offset
pEnd = EgtSP( hint_ofs, GDB_RT.GRID)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pEnd = EgtEP( hint_ofs, GDB_RT.GRID)
end
elseif subtype == 4 then
if not stx or ( stx and invG > 0) then -- se il pivot non sborda
pIni = Point3d(-(d*3/4), ((H-d)/2)*invG,dZedWork)
pStartStep = pIni
-- prima linea entrante
pEnd = EgtSP( hint_ofs, GDB_RT.GRID)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pEnd = EgtEP( hint_ofs, GDB_RT.GRID)
else
pIni = Point3d( L-(d/2)-0.2, -((H/2)+(d*3/4))*invG,dZedWork)
pStartStep = pIni
-- linea in Y con centro utensile fuori
pEnd = Point3d( L-(d/2)-0.2,-((H/2)+dExtraH)*invG,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- linee traverse in X e poi Y per andare sul vecchio punto iniziale (in Y)
pEnd = Point3d( -dExtraH,-((H/2)+dExtraH)*invG,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
pEnd = Point3d(-dExtraH,((H-d)/2)*invG,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pIni = pEnd
-- linea entrante a prendere il percorso di offset
pEnd = EgtSP( hint_ofs, GDB_RT.GRID)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, RED(), RED(), nil, nil, 'grid')
pEnd = EgtEP( hint_ofs, GDB_RT.GRID)
end
end
local ntypeDom, nNumCurve = EgtCurveDomain(hint_ofs)
nTotContEnt = nTotContEnt + ( nNumCurve - ntypeDom)
table.insert( tPocket2, hint_ofs)
end
if mkrev then -- se abilitato anche il percorso inverso
end
end
if nCase == 3 then -- passaggio di contornatura + un passaggio centrale
if subtype == 2 then
local nMakeExtraPass = 0
local dRemX = L
local dRemY = H
if stx then
dRemX = dRemX + (d/2)
end
-- calcolo in quale direzione ha collassato
if dRemX > dRemY then -- se larghezza risultante maggiore
nMakeExtraPass = 2 -- passata orizzontale
else -- altezza risultante maggiore della larghezza
nMakeExtraPass = 1 -- passata verticale
end
if nMakeExtraPass == 1 then -- se passata verticale
-- linea posizionamento passata centrale
pIni = pEnd
if B_SK then
pEnd = Point3d( EgtIf( stx, -((L - (L3 - (d/2) - dExtraH))/2), -((L-L3)/2)), dExtraH, dZedWork)
else
pEnd = Point3d( EgtIf( stx, ((L3 - (L - (d/2) - dExtraH))/2), ((L3-L)/2)), dExtraH, dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
-- linee passata centrale
if B_SK then
pEnd = Point3d( EgtIf( stx, -((L - (L3 - (d/2) - dExtraH))/2), -((L-L3)/2)), -(H-(d/2)-dExtraH), dZedWork)
else
pEnd = Point3d( EgtIf( stx, ((L3 - (L - (d/2) - dExtraH))/2), ((L3-L)/2)), -(H-(d/2)-dExtraH), dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
-- se non sono all'ultima passata ritorno al punto di inizio della svuotatura
if nPass < nStep then
if B_SK then
pEnd = Point3d( EgtIf( stx, -((L - (L3 - (d/2) - dExtraH))/2), -((L-L3)/2)), (d*3/4), dZedWork)
else
pEnd = Point3d( EgtIf( stx, ((L3 - (L - (d/2) - dExtraH))/2), ((L3-L)/2)), (d*3/4), dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
end
if mkrev then -- se abilitato anche il percorso inverso
end
elseif nMakeExtraPass == 2 then -- se passata orizzontale
-- linea posizionamento passata centrale
pIni = pEnd
if B_SK then
pEnd = Point3d( EgtIf( stx, -((L3+(d/2)+dExtraH)/2), -(L3-d)/2), dExtraH, dZedWork)
else
pEnd = Point3d( EgtIf( stx, ((L3+(d/2)+dExtraH)/2), (L3-d)/2), dExtraH, dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
-- linee passata centrale
if B_SK then
pEnd = Point3d( EgtIf( stx, -((L3+(d/2)+dExtraH)/2), -(L3-d)/2), -(H/2), dZedWork)
else
pEnd = Point3d( EgtIf( stx, ((L3+(d/2)+dExtraH)/2), (L3-d)/2), -(H/2), dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
if B_SK then
pEnd = Point3d( -((L3/2)-L+(d/2)), -(H/2), dZedWork)
else
pEnd = Point3d( (L3/2)-L+(d/2), -(H/2), dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
-- se non sono all'ultima passata ritorno al punto di inizio della svuotatura
if nPass < nStep then
if B_SK then
pEnd = Point3d( -((L3/2)-L+(d/2)), (d*3/4), dZedWork)
else
pEnd = Point3d( (L3/2)-L+(d/2), (d*3/4), dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
end
if mkrev then -- se abilitato anche il percorso inverso
end
end
elseif subtype == 3 then
-- linea posizionamento passata centrale
pIni = pEnd
pEnd = Point3d( EgtIf( stx, (((d/2)+dExtraH)/2), 0), dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
-- linee passata centrale
pEnd = Point3d( EgtIf( stx, (((d/2)+dExtraH)/2), 0), -(L-(d/2)-0.2),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
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( EgtIf( stx, (((d/2)+dExtraH)/2), 0), dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
end
if mkrev then -- se abilitato anche il percorso inverso
end
elseif subtype == 4 then
-- linea posizionamento passata centrale
pIni = pEnd
pEnd = Point3d( EgtIf( stx, (((d/2)+dExtraH)/2), 0), dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
-- linee passata centrale
pEnd = Point3d( EgtIf( stx, (((d/2)+dExtraH)/2), 0), -(L-(d/2)-0.2), dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
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( EgtIf( stx, (((d/2)+dExtraH)/2), 0), dExtraH, dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
end
if mkrev then -- se abilitato anche il percorso inverso
end
end
elseif nCase == 4 then -- passaggio di contornatura + passaggi svuotatura
local nDistYcentr = (d*p)
local nDistYcentrRad
local bContinue
if subtype == 2 or subtype == 3 then
nDistYcentrRad = nDistYcentr
else
if L > H then -- la lunghezza L è sulla X e la H sulla Y
nDistYcentrRad = nDistYcentr
else
nDistYcentrRad = nDistYcentr/2
end
end
-- se percorso offset esiste
if hint_ofs and hint_ofs > 0 then
-- faccio l'offset del raggio fresa
nRadius = nRadius - nDistYcentrRad
bContinue = nRadius > 0
nCountOfs = 0
local nInvOffs = 1
local bFailOfs = false
local dCompareX = dLocXAmp
local dCompareY = dLocYAmp
local dRemX, dRemY
if stx then
dCompareX = dLocXAmp+(d/2)+dExtraH
end
-- se percorso offset esiste
while bContinue do
hint_ofs2 = EgtOffsetCurveAdv( hint_ofs, nDistYcentr*invG*nInvOffs, GDB_OT.FILLET)
if hint_ofs2 and hint_ofs2 > 0 then
nCountOfs = nCountOfs + 1
-- linea congiunzione tra offset
pIni = pEnd
-- inverto il percorso
EgtInvertCurve(hint_ofs2)
pEnd = EgtSP( hint_ofs2, GDB_RT.GRID)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pEnd = EgtEP( hint_ofs2, GDB_RT.GRID)
hint_ofs = hint_ofs2
local ntypeDom, nNumCurve = EgtCurveDomain(hint_ofs)
nTotContEnt = nTotContEnt + ( nNumCurve - ntypeDom)
table.insert( tPocket2, hint_ofs)
if mkrev then -- se abilitato anche il percorso inverso
end
-- calcolo nuovo passo in Y e indice direzione
nRadius = nRadius - nDistYcentrRad
if nRadius > 0 then
dRemX, dRemY = CkeckRadiusRemain( dCompareX, dCompareY, d, nDistYcentrRad, (nCountOfs+1))
if (dRemX and dRemX > (d/4)) or ( dRemY and dRemY > d) then
bContinue = true
else
bContinue = false
end
else
bContinue = false
end
nInvOffs = -nInvOffs
else
bContinue = false
bFailOfs = true
end
end -- end while
if subtype == 2 or subtype == 3 then
if p > 0.75 then -- se la percentuale di sovrapposizione è alta
local nMakeExtraPass = 0
-- ricalcolo le rimanenze
dRemX, dRemY = CkeckRadiusRemain( dCompareX, dCompareY, d, nDistYcentrRad, nCountOfs)
-- calcolo in quale direzione ha collassato
if dRemX > dRemY then -- se larghezza risultante maggiore
if dRemY > d then -- se la passata precedente è maggiore del diametro utensile
nMakeExtraPass = 2 -- passata orizzontale
end
else -- altezza risultante maggiore della larghezza
if dRemX > (d/2.03) then -- se la passata precedente è maggiore del raggio utensile
nMakeExtraPass = 1 -- passata verticale
end
end
if nMakeExtraPass == 1 then -- se passata verticale
-- linea posizionamento passata centrale
pIni = pEnd
if subtype == 2 then
if B_SK then
pEnd = Point3d( EgtIf( stx, (((L3-dLocXAmp)-((d/2)+dExtraH))/2), ((L3-dLocXAmp)/2)), dExtraH,dZedWork)
else
pEnd = Point3d( EgtIf( stx, (((L3-dLocXAmp)+((d/2)+dExtraH))/2), ((L3-dLocXAmp)/2)), dExtraH,dZedWork)
end
else
pEnd = Point3d( EgtIf( stx, (((d/2)+dExtraH)/2), 0), dExtraH,dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
-- linee passata centrale
pEnd = Point3d( pIni:getX(), -(dLocYAmp-(d/2)-0.2),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
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( pIni:getX(), dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
end
if mkrev then -- se abilitato anche il percorso inverso
end
elseif nMakeExtraPass == 2 then -- se passata orizzontale
-- linea posizionamento passata orizzontale
pIni = pEnd
if subtype == 2 then
pEnd = Point3d( EgtIf( stx, ((L3+(d/2)+dExtraH)/2), (L3/2)-(d*3/4)), dExtraH,dZedWork)
else
pEnd = Point3d( EgtIf( stx, ((dLocXAmp+(d/2)+dExtraH)/2), (dLocXAmp/2)-(d*3/4)), dExtraH,dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
pEnd = Point3d( pIni:getX(), -(d/2),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
if subtype == 2 then
pEnd = Point3d( ((L3/2)-L+(d*3/4)), pIni:getY(),dZedWork)
else
pEnd = Point3d( -((dLocXAmp/2)-(d*3/4)), pIni:getY(),dZedWork)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
-- risalgo in Y fuori dalla svuotatura
pEnd = Point3d( pIni:getX(), (d*3/4),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), true, true, YELLOW(), YELLOW(), nil, nil, 'grid')
pIni = pEnd
if mkrev then -- se abilitato anche il percorso inverso
end
end
end
elseif subtype == 4 then
end
end
end
end
nPass = nPass + 1
dZedStart = dZedStart - dStep
nRadius = dDimMin2/2
nDirVers = -nDirVers
-- se ho altri passi torno al punto di inizio
if nPass <= nStep and nCase > 1 then
pIni = pEnd
if not stx or ( stx and invG > 0) then -- se il pivot non sborda
if B_SK and stx then -- se il knuckle è opposto faccio come se sborda (attacco ruotato)
pEnd = Point3d(pStartStep:getX(),pIni:getY(),dZedStart)
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW(), sMaxFeed, nil, 'grid')
table.insert( tMVar2, {nTotContEnt,sKindVar})
pIni = pEnd
pEnd = Point3d(pStartStep:getX(),pStartStep:getY(),(dZedStart - dStep))
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW(), sMaxFeed, nil, 'grid')
table.insert( tMVar2, {nTotContEnt,sKindVar})
else -- altrimenti non sborda (attacco normale)
pEnd = Point3d(pIni:getX(),pStartStep:getY(),dZedStart)
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW(), sMaxFeed, nil, 'grid')
table.insert( tMVar2, {nTotContEnt,sKindVar})
pIni = pEnd
pEnd = Point3d(pStartStep:getX(),pStartStep:getY(),(dZedStart - dStep))
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW(), sMaxFeed, nil, 'grid')
table.insert( tMVar2, {nTotContEnt,sKindVar})
end
else -- se il pivot sborda faccio geometria ruotata
if B_SK then -- se il knuckle è opposto faccio come se non sborda (attacco normale)
pEnd = Point3d(pIni:getX(),pStartStep:getY(),dZedStart)
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW(), sMaxFeed, nil, 'grid')
table.insert( tMVar2, {nTotContEnt,sKindVar})
pIni = pEnd
pEnd = Point3d(pStartStep:getX(),pStartStep:getY(),(dZedStart - dStep))
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW(), sMaxFeed, nil, 'grid')
table.insert( tMVar2, {nTotContEnt,sKindVar})
else -- altrimenti sborda (attacco ruotato)
pEnd = Point3d(pStartStep:getX(),pIni:getY(),dZedStart)
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW(), sMaxFeed, nil, 'grid')
table.insert( tMVar2, {nTotContEnt,sKindVar})
pIni = pEnd
pEnd = Point3d(pStartStep:getX(),pStartStep:getY(),(dZedStart - dStep))
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket2, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW(), sMaxFeed, nil, 'grid')
table.insert( tMVar2, {nTotContEnt,sKindVar})
end
end
if mkrev then -- se abilitato anche il percorso inverso
end
end
end -- end while
EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP))
end
-- 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 ( #tPocket2 > 0) then
hintPk2 = EgtCurveCompo( Lg, tPocket2, true)
if hintPk2 then
EgtModifyCurveThickness(hintPk2, 0)
-- assegno nota con la lista delle entità di variazione
local sListEnt = ''
for i = 1, #tMVar2 do
sListEnt = sListEnt .. '{ ent=' .. EgtNumToString( tMVar2[i][1], 0) .. ', ' .. 'code=' .. tMVar2[i][2] .. '}'
if i < #tMVar2 then
sListEnt = sListEnt .. ','
end
end -- end for
if string.len( sListEnt) > 0 then EgtSetInfo( hintPk2, 'MVar', sListEnt) end
EgtSetName(hintPk2,LMV)
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
if ( #tPocket2_r > 0) then
hintPk2_r = EgtCurveCompo( Lg, tPocket2_r, true)
if hintPk2_r then
EgtModifyCurveThickness(hintPk2_r, 0)
-- assegno nota con la lista delle entità di variazione
local sListEnt = ''
for i = 1, #tMVar2_r do
sListEnt = sListEnt .. '{ ent=' .. EgtNumToString( tMVar2_r[i][1], 0) .. ', ' .. 'code=' .. tMVar2_r[i][2] .. '}'
if i < #tMVar2_r then
sListEnt = sListEnt .. ','
end
end -- end for
if string.len( sListEnt) > 0 then EgtSetInfo( hintPk2_r, 'MVar', sListEnt) end
EgtSetName(hintPk2_r,(LMV..'_R'))
end
end
-- se variabile inversione negativa inverto la direzione del percorso geometrico principale
if invG < 0 then
if hint then
EgtInvertCurve(hint)
end
if hint2 then
EgtInvertCurve(hint2)
end
end
end
-- se c'è lo spostamento opposto del percorso body
if D_SK > 0 then
if hint2 then
EgtMove( hint2, Point3d(D_SK,0,0) - ORIG())
end
if hintPk2 then
EgtMove( hintPk2, Point3d(D_SK,0,0) - ORIG())
end
if hintAs1b then
EgtMove( hintAs1b, Point3d(D_SK,0,0) - ORIG())
end
if hintAs2b then
EgtMove( hintAs2b, Point3d(D_SK,0,0) - ORIG())
end
if hintPk2_r then
EgtMove( hintPk2_r, Point3d(D_SK,0,0) - ORIG())
end
if hintAs3b then
EgtMove( hintAs3b, Point3d(D_SK,0,0) - ORIG())
end
-- DEBUG
-- EgtSaveFile( sNgeFile)
-- EgtMove(DGD.PZ, Point3d(0,0,nil) - ORIG())
if hintAs4b then
EgtMove( hintAs4b, Point3d(D_SK,0,0) - ORIG())
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
if hint2 then
-- cancello il percorso
EgtErase( hint2)
end
end
-- cambio colore alla geometria
if bPreview then
if EC == 0 then
-- geometrie knuckle
if hint then
EgtSetColor(hint,AQUA())
end
if hintPk then
EgtSetColor(hintPk,AQUA())
end
if hintAs1 then
EgtSetColor(hintAs1,AQUA())
end
if hintAs2 then
EgtSetColor(hintAs2,AQUA())
end
if hintPk_r then
EgtSetColor(hintPk_r,AQUA())
end
if hintAs3 then
EgtSetColor(hintAs3,AQUA())
end
if hintAs4 then
EgtSetColor(hintAs4,AQUA())
end
-- geometrie body
if hint2 then
EgtSetColor(hint2,AQUA())
end
if hintPk2 then
EgtSetColor(hintPk2,AQUA())
end
if hintAs1b then
EgtSetColor(hintAs1b,AQUA())
end
if hintAs2b then
EgtSetColor(hintAs2b,AQUA())
end
if hintPk2_r then
EgtSetColor(hintPk2_r,AQUA())
end
if hintAs3b then
EgtSetColor(hintAs3b,AQUA())
end
if hintAs4b then
EgtSetColor(hintAs4b,AQUA())
end
else
-- geometrie knuckle
if hint then
EgtSetColor(hint,ORANGE())
end
if hintPk then
EgtSetColor(hintPk,ORANGE())
end
if hintAs1 then
EgtSetColor(hintAs1,ORANGE())
end
if hintAs2 then
EgtSetColor(hintAs2,ORANGE())
end
if hintPk_r then
EgtSetColor(hintPk_r,ORANGE())
end
if hintAs3 then
EgtSetColor(hintAs3,ORANGE())
end
if hintAs4 then
EgtSetColor(hintAs4,ORANGE())
end
-- geometrie body
if hint2 then
EgtSetColor(hint2,ORANGE())
end
if hintPk2 then
EgtSetColor(hintPk2,ORANGE())
end
if hintAs1b then
EgtSetColor(hintAs1b,ORANGE())
end
if hintAs2b then
EgtSetColor(hintAs2b,ORANGE())
end
if hintPk2_r then
EgtSetColor(hintPk2_r,ORANGE())
end
if hintAs3b then
EgtSetColor(hintAs3b,ORANGE())
end
if hintAs4b then
EgtSetColor(hintAs4b,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
if hintAs3 then
EgtSetInfo( hintAs3, 'NotCheckDir', '1')
end
if hintAs4 then
EgtSetInfo( hintAs4, 'NotCheckDir', '1')
end
if hintPk2 then
EgtSetInfo( hintPk2, 'NotCheckDir', '1')
end
if hintAs1b then
EgtSetInfo( hintAs1b, 'NotCheckDir', '1')
end
if hintAs2b then
EgtSetInfo( hintAs2b, 'NotCheckDir', '1')
end
if hintPk2_r then
EgtSetInfo( hintPk2_r, 'NotCheckDir', '1')
end
if hintAs3b then
EgtSetInfo( hintAs3b, 'NotCheckDir', '1')
end
if hintAs4b then
EgtSetInfo( hintAs4b, 'NotCheckDir', '1')
end
end
return hint, hintPk, hintAs1, hintAs2, hintPk_r, hintAs3, hintAs4,
hint2, hintPk2, hintAs1b, hintAs2b, hintPk2_r, hintAs3b, hintAs4b
end
return OPivot