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

1459 lines
62 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
--
-- _OverHeadArm.lua by EgalWare s.r.l. 2016.06.29
-- Autore: Filippo Monchi
-- Over Head Arm dati i valori 'L' e 'H' e 'T' e 'd' e 'p' e 'DS' e con nomi attributi
-- 2016.09.21 V1.0a1 FM Add warning messages
-- 2017.09.05 V1.0a2 FM Manage lead-in on opposite side and anti-splint path V lead-in
-- 2018.12.10 V1.0a3 FM Add geometry for calculate box without Arm volume (when strike)
-- 2019.10.16 V1.0a4 FM Manage steel option
-- 2019.10.18 V2.000 FM Manage use Materials
-- 2019.10.21 V2.001 FM Modify the closed path start point for steel material
-- 2019.12.17 V2.002 FM Fix error on draw exit line in particular case (arm height allow only single passage)
-- 2020.05.25 V2.003 FM Manage geometries for calculate region when frame(jamb) is disposed on wide side
-- 2021.11.24 V2.004 FM Manage side probe option if variable DGC.Pms > 2
-- 2024.07.19 V2.005 FM Set note 'NotCheckDir' to pocketing and antisplint paths
-- Tavola per definizione modulo (serve ma non usata)
local _OverHeadArm = {}
-- Intestazioni
require( 'EgtBase')
EgtEnableDebug( false)
-- per messaggi
-- EgtAddToPackagePath( EgtGetSourceDir() .. '?.lua')
-- EgtAddToPackagePath( DGD.BASEDIR .. '?.lua')
-- Valori limite
local dExtraH = 0.5
local dExtraL = 1.0
local sMaxFeed = 'MaxFeed'
local sRapid = 'Rapid'
local function DrawAddLineDrawCircle( pInitial, pFinal, nGroup, idTable, bPrev, nGroupCirc,
nRad, bDrawFirst, bDrawLast, cColor1, cColor2, sMVar)
local nLine = EgtLine(nGroup, pInitial, pFinal, GDB_RT.LOC)
local nNumLine
if idTable then
table.insert( idTable, nLine)
-- se devo inserire una variazione nell'entità
if sMVar then
nNumLine = #idTable
end
end
if bPrev then
if bDrawFirst then
local nCircle1 = EgtCircle( nGroupCirc, pInitial, nRad , GDB_RT.LOC)
EgtSetColor( nCircle1, cColor1)
end
if bDrawLast then
local nCircle2 = EgtCircle( nGroupCirc, pFinal, nRad , GDB_RT.LOC)
EgtSetColor( nCircle2, cColor2)
end
end
return nLine, nNumLine, sMVar
end
local function DrawAddCircleDrawCircle( pCenter, dRadius, dAngIni, dAngCen, nGroup, idTable, bPrev, nGroupCirc,
nRad, bDrawFirst, bDrawLast, cColor1, cColor2, sMVar)
local nCircle = EgtArc( nGroup, pCenter, dRadius, dAngIni, dAngCen, 0, GDB_RT.LOC)
local nNumCircle
if idTable then
table.insert( idTable, nCircle)
-- se devo inserire una variazione nell'entità
if sMVar then
nNumCircle = #idTable
end
end
if bPrev then
if bDrawFirst then
local nCircle1 = EgtCircle( nGroupCirc, EgtSP( nCircle), nRad , GDB_RT.LOC)
EgtSetColor( nCircle1, cColor1)
end
if bDrawLast then
local nCircle2 = EgtCircle( nGroupCirc, EgtEP( nCircle), nRad , GDB_RT.LOC)
EgtSetColor( nCircle2, cColor2)
end
end
return nCircle, nNumCircle, sMVar
end
-- Funzione di disegno
function _OverHeadArm.Draw( EC, EM, tOHArm, bPreview, bRunByCompo, nDrawMach, Pz, Lg, dThickDoor)
-- Assegno le dimensioni
local L = tOHArm.L
local H = tOHArm.H
local T = tOHArm.T
local R = tOHArm.rf
local d = tOHArm.d
local p = tOHArm.p
local s = tOHArm.sf
local d2 = tOHArm.d2
local DS = tOHArm.DS
local OS = tOHArm.OS
local est = tOHArm.est
local bEqualTh = tOHArm.bETh
local smr = tOHArm.smr
local kbs = tOHArm.kbs -- keep backset/thickness (0: none, 1: only face, 2: all)
local pbs = tOHArm.pbs
local fhb = tOHArm.fhb
local drf = tOHArm.drf
local dws = tOHArm.Dws
-- Assegno i nomi geometrie
local LG = tOHArm.LG
local LM = tOHArm.LM
local LA = tOHArm.LA
local DM = 'DUMMY'
-- variabili per messaggi e settaggi vari
local sCompoName = tOHArm.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 s or abs(s) <= GEO.EPS_SMALL then
s = T
end
-- radius face: per compatibilità con tutti i componenti, se non è definito lo setto a 0
if not R or abs(R) <= GEO.EPS_SMALL then
R = 0
end
if not smr then
smr = 0
end
local Dm, Dor
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)
Dor = EgtGroup( Pz, GDB_RT.LOC) -- layer disegni cerchi rappresentatte l'origine
EgtSetName( Dor, DM)
end
local hint1, hint2, hint, hintPk, hintAs, hintAs2
local pIni, pEnd, pCen
local pIni2, pEnd2, pCentr2
local nIdSideBoxUp
-- disegno cerchio origine
if Dor then
local nCircleOri = EgtCircle( Dor, Point3d(0,0,0), d/4 , GDB_RT.LOC)
EgtSetColor( nCircleOri, NAVY())
end
if nDrawMach ~= 1 then -- se abilitata geometria esterna
local tHint = {}
-- Costruzione della geometria ( in senso orario)
if bEqualTh then -- se cava alta come lo spessore porta disegno un contorno chiuso
if est then
pIni = Point3d(-((L/2)-(d/2)-dExtraH),((d/2)+dExtraH),0)
if OS > 0 then -- se cava aperta a destra
pEnd = Point3d(((L/2)+(d/2)+dExtraH),((d/2)+dExtraH),0)
else
pEnd = Point3d(L/2,((d/2)+dExtraH),0)
end
else
pIni = Point3d(0,0,0)
pEnd = Point3d(L/2,0,0)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
pIni = pEnd
if est then
if OS > 0 then -- se cava aperta a destra
pEnd = Point3d(((L/2)+(d/2)+dExtraH),-(H+(d/2)+dExtraH),0)
else
pEnd = Point3d(L/2,-(H+(d/2)+dExtraH),0)
end
else
pEnd = Point3d(L/2,-H,0)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
pIni = pEnd
if est then
if OS < 0 then -- se cava aperta a sinistra
pEnd = Point3d(-((L/2)+(d/2)+dExtraH),-(H+(d/2)+dExtraH),0)
else
pEnd = Point3d(-(L/2),-(H+(d/2)+dExtraH),0)
end
else
pEnd = Point3d(-(L/2),-H,0)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
pIni = pEnd
if est then
if OS < 0 then -- se cava aperta a sinistra
pEnd = Point3d(-((L/2)+(d/2)+dExtraH),((d/2)+dExtraH),0)
else
pEnd = Point3d(-L/2,((d/2)+dExtraH),0)
end
else
pEnd = Point3d(-L/2,0,0)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
pIni = pEnd
if est then
pEnd = Point3d(-((L/2)-(d/2)-dExtraH),((d/2)+dExtraH),0)
else
pEnd = Point3d(0,0,0)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
pIni = pEnd
else -- altrimenti contorno aperto
if est then -- se altro materiale faccio percorso chiuso
pIni = Point3d(-((L/2)-(d/2)-dExtraH),((d/2)+dExtraH),0)
if OS > 0 then -- se cava aperta a destra
pEnd = Point3d(((L/2)+(d/2)+dExtraH),((d/2)+dExtraH),0)
else
pEnd = Point3d(L/2,((d/2)+dExtraH),0)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
pIni = pEnd
else
pIni = Point3d(L/2,0,0)
end
if R > 0 and OS <= 0 then -- se raggio esiste e cava non aperta a destra
pEnd = Point3d(L/2,(-H+R),0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
pIni = pEnd
pEnd = Point3d(((L/2)-R),-H,0)
pCen =Point3d(((L/2)-R),(-H+R),0)
DrawAddCircleDrawCircle( pCen, R, 0,-90, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
pIni = pEnd
else -- nessun raccordo o cava aperta a destra
if OS > 0 and smr ~= 0 then -- se cava aperta a destra e chisel abilitato
pEnd = Point3d(L/2,-H+0.5,0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
pIni = pEnd
pCen = Point3d((L/2)-0.5,-H+0.5,0)
pEnd = Point3d((L/2)-0.5,-H,0)
DrawAddCircleDrawCircle( pCen, 0.5, 0,-90, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
elseif OS > 0 then -- se cava aperta a destra
if est then -- se altro materiale faccio percorso chiuso
pEnd = Point3d(((L/2)+(d/2)+dExtraH),-H,0)
else
pEnd = Point3d(L/2,-H,0)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
else
pEnd = Point3d(L/2,-H,0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
end
pIni = pEnd
end
if R > 0 and OS >= 0 then -- se raggio esiste e cava non aperta a sinistra
pEnd = Point3d((-(L/2)+R),-H,0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
pIni = pEnd
pEnd = Point3d(-(L/2),(-H+R),0)
pCen =Point3d((-(L/2)+R),(-H+R),0)
DrawAddCircleDrawCircle( pCen, R, -90,-90, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
pIni = pEnd
else -- nessun raccordo o cava aperta a sinistra
if OS < 0 and smr ~= 0 then -- se cava aperta a sinistra e chisel abilitato
pEnd = Point3d(-(L/2)+0.5,-H,0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
pCen = Point3d(-(L/2)+0.5,-H+0.5,0)
pEnd = Point3d(-(L/2),-H+0.5,0)
DrawAddCircleDrawCircle( pCen, 0.5, -90,-90, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
elseif OS < 0 then -- se cava aperta a sinistra
if est then -- se altro materiale faccio percorso chiuso
pEnd = Point3d(-((L/2)+(d/2)+dExtraH),-H,0)
else
pEnd = Point3d(-(L/2),-H,0)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
else
pEnd = Point3d(-(L/2),-H,0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
end
pIni = pEnd
end
if est then -- se altro materiale faccio percorso chiuso
if OS < 0 then -- se cava aperta a sinistra
pEnd = Point3d(-((L/2)+(d/2)+dExtraH),((d/2)+dExtraH),0)
else
pEnd = Point3d(-L/2,((d/2)+dExtraH),0)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
pIni = pEnd
pEnd = Point3d(-((L/2)-(d/2)-dExtraH),((d/2)+dExtraH),0)
else
pEnd = Point3d(-L/2,0,0)
end
DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
pIni = pEnd
end
hint = EgtCurveCompo( Lg, tHint, true)
if hint then
EgtModifyCurveThickness( hint, -T)
EgtSetName( hint, LG)
-- muovo la geometria verso sinistra del valore di L/2 + DS
EgtMove( hint, Point3d(-((L/2)+DS),0,0) - ORIG())
EgtSetInfo( hint,'InserPoint' ,'Edge') -- setto una nota per indicare su che lato della porta deve essere spostato
EgtSetInfo( hint,'DeltaPos' ,( L+(2*DS)))
if est then
EgtSetInfo( hint, 'StartFromExt', 1)
end
-- se mantiene lato anche su face
if kbs and kbs > 0 then
local sKeepMode = 'n' -- setto di default per mantenere il lato narrow
if bEqualTh then -- se spessore passante
sKeepMode = 'c' -- setto per mantenere il centro dello spessore
end
EgtSetInfo( hint, 'KeepBackSet', sKeepMode)
end
if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then
EgtSetInfo( hint, 'ProbeSide', '1')
end
end
end
-- Costruzione della geometria 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 dZedStart
local dZedWork
local nStep
local dStep
local nPass
-- geometria antischeggia
if d2 then -- se parametro valido
local tPocketAs = {}
local tPocketAs2 = {}
if s >= T then -- se passo unico
local dPosY, dEndPosY, dEndPosX, dIniPosY, dDeltaPosX
local dPosY2, dEndPosY2, dEndPosX2, dIniPosY2
if bStartAng then -- se lead-in con angolo
if OS >= 0 then -- se aperto a destra
if H >= (d2*3/4) then
if (H-R) > (d2/4) then
dEndPosY = -(d2/4)
dEndPosY2 = (-H+(d2/4))
else
dEndPosY = -(H-R)
dEndPosY2 = -R
end
else
if (H-R) > 0 then
dEndPosY = -(H-R)
dEndPosY2 = -R
else
dEndPosY = -H+(d2/2)
dEndPosY2 = -(d2/2)
end
end
dPosY = dEndPosY + (d2/8)
dPosY2 = dEndPosY2 - (d2/8)
dIniPosY = dPosY + (d2*7/8)
dIniPosY2 = dPosY2 - (d2*7/8)
dDeltaPosX = ( (d2*7/8) / tan(30))
-- linea entrante inclinata
pIni = Point3d(-((L-d2)/2) + 0.2 + dDeltaPosX, dIniPosY,0)
pEnd = Point3d(-((L-d2)/2) + 0.2, dPosY,0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
-- linea entrante in Y
pIni = pEnd
pEnd = Point3d(-((L-d2)/2) + 0.2, dEndPosY,0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
-- linee tangente al percorso
pIni = pEnd
pEnd = Point3d(-((L-d2)/2), dEndPosY,0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
-- linea di uscita
pIni = pEnd
pEnd = Point3d(-((L-d2)/2),(d2*3/4),0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
-- Se spessore passante e non aperta a destra
if bEqualTh and OS == 0 then
-- linea entrante inclinata
pIni = Point3d((((L-d2)/2) - 0.2 - dDeltaPosX), dIniPosY2,0)
pEnd = Point3d((((L-d2)/2) - 0.2), dPosY2,0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs2, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
-- linea entrante in Y
pIni = pEnd
pEnd = Point3d((((L-d2)/2) - 0.2), dEndPosY2,0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
-- linee tangente al percorso
pIni = pEnd
pEnd = Point3d(((L-d2)/2), dEndPosY2,0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
-- linea di uscita
pIni = pEnd
pEnd = Point3d(((L-d2)/2),(-H-(d2*3/4)),0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
end
else -- se aperto a sinistra
if L >= (d2*3/4) then
dEndPosX = -((L/2)-(d2/4))
else
dEndPosX = -((L/2)-dExtra)
end
dEndPosY = -H+(d2/2)
dIniPosY = (d2*3/4)
dPosY = dIniPosY - (d2*7/8)
dDeltaPosX = ( (d2*7/8) / tan(30))
-- linea entrante inclinata
pIni = Point3d(dEndPosX + dDeltaPosX, dIniPosY,0)
pEnd = Point3d(dEndPosX, dPosY,0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
-- linea entrante in Y fino a tangenza percorso
pIni = pEnd
pEnd = Point3d( dEndPosX, dEndPosY,0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
-- linea di uscita
pIni = pEnd
pEnd = Point3d( -((L/2)+(d2*3/4)), dEndPosY,0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
-- Se spessore passante
if bEqualTh then
-- linea entrante inclinata
pIni = Point3d((((L-d2)/2) - 0.2 - dDeltaPosX), dIniPosY2,0)
pEnd = Point3d((((L-d2)/2) - 0.2), dPosY2,0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs2, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
-- linea entrante in Y
pIni = pEnd
pEnd = Point3d((((L-d2)/2) - 0.2), dEndPosY2,0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
-- linee tangente al percorso
pIni = pEnd
pEnd = Point3d(((L-d2)/2), dEndPosY2,0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
-- linea di uscita
pIni = pEnd
pEnd = Point3d(((L-d2)/2),(-H-(d2*3/4)),0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
end
end
else -- lead-in diritto
if OS >= 0 then
if H >= (d2*3/4) then
if (H-R) > (d2/4) then
dEndPosY = -(d2/4)
dEndPosY2 = -H+(d2/4)
else
dEndPosY = -(H-R)
dEndPosY2 = -R
end
else
if (H-R) > 0 then
dEndPosY = -(H-R)
dEndPosY2 = -R
else
dEndPosY = -H+(d2/2)
dEndPosY2 = -(d2/2)
end
end
dIniPosY = (d2*3/4)
dIniPosY2 = -H-(d2*3/4)
pIni = Point3d(-((L-d2)/2), dIniPosY,0)
pEnd = Point3d(-((L-d2)/2), dEndPosY,0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
-- Se spessore passante e non aperta a destra
if bEqualTh and OS == 0 then
pIni = Point3d(((L-d2)/2), dIniPosY2,0)
pEnd = Point3d(((L-d2)/2), dEndPosY2,0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs2, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
end
else -- se aperto a sinistra
pIni = Point3d(-((L/2)+dExtraL),(d2*3/4),0) -- parto in X un po' fuori dalla geometria
pEnd = Point3d(-((L/2)+dExtraL),-H+(d2/2),0) -- scendo fino a fine cava perchè è aperto questo lato
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
pIni = pEnd
if L >= (d2*3/4) then
dEndPosX = -((L/2)-(d2/4))
else
dEndPosX = -((L/2)-dExtra)
end
if H >= (d2*3/4) then
if (H-R) > (d2/4) then
dEndPosY2 = -H+(d2/4)
else
dEndPosY2 = -R
end
else
if (H-R) > 0 then
dEndPosY2 = -R
else
dEndPosY2 = -(d2/2)
end
end
dIniPosY2 = -H-(d2*3/4)
pEnd = Point3d( dEndPosX, -H+(d2/2),0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
-- Se spessore passante
if bEqualTh then
pIni = Point3d(((L-d2)/2), dIniPosY2,0)
pEnd = Point3d(((L-d2)/2), dEndPosY2,0)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs2, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
end
end
end
-- trasformo in geometria composita
if ( #tPocketAs > 0) then
hintAs = EgtCurveCompo( Lg, tPocketAs, true)
if hintAs then
EgtModifyCurveThickness( hintAs, -T)
end
end
if ( #tPocketAs2 > 0) then
hintAs2 = EgtCurveCompo( Lg, tPocketAs2, true)
if hintAs2 then
EgtModifyCurveThickness( hintAs2, -T)
end
end
else -- altrimenti più passate
nStep = ceil(T/s) -- numero di passate
dStep = (T/nStep) -- passo ricalcolato
nPass = 1
dZedStart = 0
local tMVar = {}
local tMVar2 = {}
local nConEnt
local sKindVar
local dPosY, dEndPosY, dEndPosX, dIniPosY, dDeltaPosX
local dPosY2, dEndPosY2, dEndPosX2, dIniPosY2
while nPass <= nStep do
dZedWork = dZedStart - dStep
if nPass == nStep then
dZedWork = -T
end
if bStartAng then -- se lead-in con angolo
if OS >= 0 then -- se aperto a destra
if H >= (d2*3/4) then
if (H-R) > (d2/4) then
dEndPosY = -(d2/4)
dEndPosY2 = -H+(d2/4)
else
dEndPosY = -(H-R)
dEndPosY2 = -R
end
else
if (H-R) > 0 then
dEndPosY = -(H-R)
dEndPosY2 = -R
else
dEndPosY = -H+(d2/2)
dEndPosY2 = -(d2/2)
end
end
dPosY = dEndPosY + (d2/8)
dPosY2 = dEndPosY2 - (d2/8)
dIniPosY = dPosY + (d2*7/8)
dIniPosY2 = dPosY2 - (d2*7/8)
dDeltaPosX = ( (d2*7/8) / tan(30))
-- linea entrante inclinata
pIni = Point3d(-((L-d2)/2) + 0.2 + dDeltaPosX, dIniPosY,dZedWork)
pEnd = Point3d(-((L-d2)/2) + 0.2, dPosY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
-- linea entrante in Y
pIni = pEnd
pEnd = Point3d(-((L-d2)/2) + 0.2, dEndPosY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
-- linee tangente al percorso
pIni = pEnd
pEnd = Point3d(-((L-d2)/2), dEndPosY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
-- linea di uscita
pIni = pEnd
pEnd = Point3d(-((L-d2)/2),(d2*3/4),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
pIni = pEnd
pEnd = Point3d(-((L-d2)/2) + 0.2 + dDeltaPosX, pIni:getY(), dZedWork)
-- se spessore passante e non aperto a destra
if bEqualTh and OS == 0 then
-- linea entrante inclinata
pIni2 = Point3d(((L-d2)/2) - 0.2 - dDeltaPosX, dIniPosY2,dZedWork)
pEnd2 = Point3d(((L-d2)/2) - 0.2, dPosY2,dZedWork)
DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
-- linea entrante in Y
pIni2 = pEnd2
pEnd2 = Point3d(((L-d2)/2) - 0.2, dEndPosY2,dZedWork)
DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
-- linee tangente al percorso
pIni2 = pEnd2
pEnd2 = Point3d(((L-d2)/2), dEndPosY2,dZedWork)
DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
-- linea di uscita
pIni2 = pEnd2
pEnd2 = Point3d(((L-d2)/2),(-H-(d2*3/4)),dZedWork)
DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
pIni2 = pEnd2
pEnd2 = Point3d(((L-d2)/2) - 0.2 - dDeltaPosX, pIni2:getY(), dZedWork)
end
else -- se aperto a sinistra
if L >= (d2*3/4) then
dEndPosX = -((L/2)-(d2/4))
else
dEndPosX = -((L/2)-dExtra)
end
if H >= (d2*3/4) then
if (H-R) > (d2/4) then
dEndPosY2 = -H+(d2/4)
else
dEndPosY2 = -R
end
else
if (H-R) > 0 then
dEndPosY2 = -R
else
dEndPosY2 = -(d2/2)
end
end
dEndPosY = -H+(d2/2)
dIniPosY = (d2*3/4)
dPosY = dIniPosY - (d2*7/8)
dPosY2 = dEndPosY2 - (d2/8)
dIniPosY2 = dPosY2 - (d2*7/8)
dDeltaPosX = ( (d2*7/8) / tan(30))
-- linea entrante inclinata
pIni = Point3d( dEndPosX + dDeltaPosX, dIniPosY,dZedWork)
pEnd = Point3d( dEndPosX, dPosY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
-- linea entrante in Y fino a tangenza percorso
pIni = pEnd
pEnd = Point3d( dEndPosX, dEndPosY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
-- linea di uscita
pIni = pEnd
pEnd = Point3d( -((L/2)+(d2*3/4)),dEndPosY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
-- linea di risalita in Y
pIni = pEnd
pEnd = Point3d( pIni:getX(), (d2*3/4), dZedWork)
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true,
ORANGE(), ORANGE(), sMaxFeed)
table.insert( tMVar, {nConEnt,sKindVar})
pIni = pEnd
pEnd = Point3d(dEndPosX + dDeltaPosX,pIni:getY(), dZedWork)
-- se spessore passante
if bEqualTh then
-- linea entrante inclinata
pIni2 = Point3d(((L-d2)/2) - 0.2 - dDeltaPosX, dIniPosY2,dZedWork)
pEnd2 = Point3d(((L-d2)/2) - 0.2, dPosY2,dZedWork)
DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
-- linea entrante in Y
pIni2 = pEnd2
pEnd2 = Point3d(((L-d2)/2) - 0.2, dEndPosY2,dZedWork)
DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
-- linee tangente al percorso
pIni2 = pEnd2
pEnd2 = Point3d(((L-d2)/2), dEndPosY2,dZedWork)
DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
-- linea di uscita
pIni2 = pEnd2
pEnd2 = Point3d(((L-d2)/2),(-H-(d2*3/4)),dZedWork)
DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
pIni2 = pEnd2
pEnd2 = Point3d(((L-d2)/2) - 0.2 - dDeltaPosX, pIni2:getY(), dZedWork)
end
end
else -- lead-in diritto
if OS >= 0 then
if H >= (d2*3/4) then
if (H-R) > (d2/4) then
dEndPosY = -(d2/4)
dEndPosY2 = -H+(d2/4)
else
dEndPosY = -(H-R)
dEndPosY2 = -R
end
else
if (H-R) > 0 then
dEndPosY = -(H-R)
dEndPosY2 = -R
else
dEndPosY = -H+(d2/2)
dEndPosY2 = -(d2/2)
end
end
dIniPosY = (d2*3/4)
dIniPosY2 = -H-(d2*3/4)
pIni = Point3d(-((L-d2)/2)+0.2, dIniPosY,dZedWork)
pEnd = Point3d(-((L-d2)/2)+0.2, dEndPosY,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
-- faccio il ritorno alla posizione di partenza
pIni = pEnd
pEnd = Point3d( pIni:getX() - 0.2, dEndPosY, dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
pIni = pEnd
pEnd = Point3d( pIni:getX(), dIniPosY, dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
pIni = pEnd
pEnd = Point3d(-((L-d2)/2)+0.2, pIni:getY(), dZedWork)
-- se spessore passante e non aperto a destra
if bEqualTh and OS == 0 then
pIni2 = Point3d(((L-d2)/2) - 0.2, dIniPosY2, dZedWork)
pEnd2 = Point3d(((L-d2)/2) - 0.2, dEndPosY2, dZedWork)
DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
-- faccio il ritorno alla posizione di partenza
pIni2 = pEnd2
pEnd2 = Point3d(((L-d2)/2), dEndPosY2, dZedWork)
DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
pIni2 = pEnd2
pEnd2 = Point3d( pIni2:getX(), dIniPosY2, dZedWork)
DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
pIni2 = pEnd2
pEnd2 = Point3d(((L-d2)/2) + 0.2, pIni2:getY(), dZedWork)
end
else -- se aperto a sinistra
pIni = Point3d(-((L/2)+dExtraL),(d2*3/4),dZedWork) -- parto in X un po' fuori dalla geometria
pEnd = Point3d(-((L/2)+dExtraL),-H+(d2/2)+0.2,dZedWork) -- scendo fino a fine cava perchè è aperto questo lato
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
pIni = pEnd
if L >= (d2*3/4) then
dEndPosX = -((L/2)-(d2/4))
else
dEndPosX = -((L/2)-dExtra)
end
if H >= (d2*3/4) then
if (H-R) > (d2/4) then
dEndPosY2 = -H+(d2/4)
else
dEndPosY2 = -R
end
else
if (H-R) > 0 then
dEndPosY2 = -R
else
dEndPosY2 = -(d2/2)
end
end
dIniPosY2 = -H-(d2*3/4)
pEnd = Point3d( dEndPosX, -H+(d2/2)+0.2,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
-- faccio il ritorno alla posizione di partenza
pIni = pEnd
pEnd = Point3d( dEndPosX, -H+(d2/2),dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
pIni = pEnd
pEnd = Point3d(-((L/2)+dExtraL), pIni:getY(), dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
pIni = pEnd
pEnd = Point3d( pIni:getX(),(d2*3/4), dZedWork)
-- se spessore passante
if bEqualTh then
pIni2 = Point3d(((L-d2)/2) - 0.2, dIniPosY2, dZedWork)
pEnd2 = Point3d(((L-d2)/2) - 0.2, dEndPosY2, dZedWork)
DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
-- faccio il ritorno alla posizione di partenza
pIni2 = pEnd2
pEnd2 = Point3d(((L-d2)/2), dEndPosY2, dZedWork)
DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
pIni2 = pEnd2
pEnd2 = Point3d( pIni2:getX(), dIniPosY2, dZedWork)
DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
pIni2 = pEnd2
pEnd2 = Point3d(((L-d2)/2) + 0.2, pIni2:getY(), dZedWork)
end
end
end
nPass = nPass + 1
dZedStart = dZedWork
-- se ho altri passi scendo in z
if nPass <= nStep then
local pIniLoc = pEnd
pEnd = Point3d(pIniLoc:getX(), pIniLoc:getY(), (dZedStart - dStep))
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true,
ORANGE(), ORANGE(), sMaxFeed)
table.insert( tMVar, {nConEnt,sKindVar})
if #tPocketAs2 > 0 then
local pIniLoc2 = pEnd2
pEnd2 = Point3d(pIniLoc2:getX(), pIniLoc2:getY(), (dZedStart - dStep))
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true,
ORANGE(), ORANGE(), sMaxFeed)
table.insert( tMVar2, {nConEnt,sKindVar})
end
end
end -- end while
-- trasformo in geometria composita
if ( #tPocketAs > 0) then
hintAs = EgtCurveCompo( Lg, tPocketAs, true)
if hintAs then
EgtModifyCurveThickness( hintAs, 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( hintAs, 'MVar', sListEnt) end
end
end
if ( #tPocketAs2 > 0) then
hintAs2 = EgtCurveCompo( Lg, tPocketAs2, true)
if hintAs2 then
EgtModifyCurveThickness( hintAs2, 0)
-- assegno nota con la lista delle entità di variazione
local sListEnt = ''
for i = 1, #tMVar2 do
sListEnt = sListEnt .. '{ ent=' .. EgtNumToString( tMVar2[i][1], 0) .. ', ' .. 'code=' .. tMVar2[i][2] .. '}'
if i < #tMVar2 then
sListEnt = sListEnt .. ','
end
end -- end for
if string.len( sListEnt) > 0 then EgtSetInfo( hintAs2, 'MVar', sListEnt) end
end
end
end
if hintAs then
EgtSetName( hintAs, LA)
-- muovo la geometria verso sinistra del valore di L/2 + DS
EgtMove( hintAs, Point3d(-((L/2)+DS),0,0) - ORIG())
EgtSetInfo( hintAs,'InserPoint' ,'Edge') -- setto una nota per indicare su che lato della porta deve essere spostato
EgtSetInfo( hintAs,'DeltaPos' ,( L+(2*DS)))
-- se mantiene lato anche su face
if kbs and kbs > 0 then
local sKeepMode = 'n' -- setto di default per mantenere il lato narrow
if bEqualTh then -- se spessore passante
sKeepMode = 'c' -- setto per mantenere il centro dello spessore
end
EgtSetInfo( hintAs, 'KeepBackSet', sKeepMode)
end
if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then
EgtSetInfo( hintAs, 'ProbeSide', '1')
end
end
if hintAs2 then
EgtSetName(hintAs2,LA)
-- muovo la geometria verso sinistra del valore di L/2 + DS
EgtMove( hintAs2, Point3d(-((L/2)+DS),0,0) - ORIG())
EgtSetInfo( hintAs2,'InserPoint' ,'Edge') -- setto una nota per indicare su che lato della porta deve essere spostato
EgtSetInfo( hintAs2,'DeltaPos' ,( L+(2*DS)))
-- se mantiene backset
if kbs and kbs > 0 then
local sKeepMode = 'n' -- setto di default per mantenere il lato narrow
if bEqualTh then -- se spessore passante
sKeepMode = 'c' -- setto per mantenere il centro dello spessore
end
EgtSetInfo( hintAs2, 'KeepBackSet', sKeepMode)
end
if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then
EgtSetInfo( hintAs2, 'ProbeSide', '1')
end
end
end
---------------------------------------
-- geometria svuotatura giro esterno
---------------------------------------
if not est then -- se non c'è lavorazione steel
local tPocket = {}
local dDeltaL
local dPosIniMach
local dPosEndMach
local tMVar = {}
local nConEnt
local sKindVar
local pStart
nPass = 1
dZedStart = 0
nStep = ceil(T/s) -- numero di passate
dStep = (T/nStep) -- passo ricalcolato
while nPass <= nStep do
dZedWork = dZedStart - dStep
if nPass == nStep then
dZedWork = -T
end
if bStartOppo then -- inizio a sinistra
if OS == 1 then -- se fianco destro aperto
pIni = Point3d(-((L-d)/2)+0.2,(d*3/4),dZedWork)
pStart = pIni -- memorizzo punto per ritorno e reiniziare nuovo step
-- linea in Y con centro utensile fuori
pEnd = Point3d(-((L-d)/2)+0.2,dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED())
-- linea traversa in X per andare sul vecchio punto iniziale (in X)
pIni = pEnd
pEnd = Point3d(((L/2)+dExtraL),dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED())
pIni = pEnd
if bEqualTh then
pEnd = Point3d(((L/2)+dExtraL),-H-dExtraH,dZedWork)
else
pEnd = Point3d(((L/2)+dExtraL),-H+(d/2),dZedWork)
end
dDeltaL = (d/2)
else -- fianco sinistro aperto
pIni = Point3d(-((L-d)/2)+0.2,(d*3/4),dZedWork)
pStart = pIni -- memorizzo punto per ritorno e reiniziare nuovo step
-- linea in Y con centro utensile fuori
pEnd = Point3d(-((L-d)/2)+0.2,dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED())
-- linea traversa in X per andare sul vecchio punto iniziale (in X)
pIni = pEnd
pEnd = Point3d(((L-d)/2),dExtraH,dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED())
pIni = pEnd
if R > (d/2) then
pEnd = Point3d(((L-d)/2),(-H+R),dZedWork)
else
if bEqualTh then
pEnd = Point3d(((L-d)/2),-H-dExtraH,dZedWork)
else
pEnd = Point3d(((L-d)/2),-H+(d/2),dZedWork)
end
end
dDeltaL = 0
end
else -- inizio a destra
if OS == 1 then -- se fianco destro aperto inizio al valore di dExtraL
pIni = Point3d(((L/2)+dExtraL),(d*3/4),dZedWork)
if bEqualTh then
pEnd = Point3d(((L/2)+dExtraL),-H-dExtraH,dZedWork)
else
pEnd = Point3d(((L/2)+dExtraL),-H+(d/2),dZedWork)
end
dDeltaL = (d/2)
else
pIni = Point3d(((L-d)/2),(d*3/4),dZedWork)
if R > (d/2) then
pEnd = Point3d(((L-d)/2),(-H+R),dZedWork)
else
if bEqualTh then
pEnd = Point3d(((L-d)/2),-H-dExtraH,dZedWork)
else
pEnd = Point3d(((L-d)/2),-H+(d/2),dZedWork)
end
end
dDeltaL = 0
end
pStart = pIni -- memorizzo punto per ritorno e reiniziare nuovo step
end
local bDrawCircle = EgtIf( bStartOppo, false, true)
-- linea entrante in Y
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), bDrawCircle, true, RED(), RED()) -- linea discesa in Y
pIni = pEnd
if OS <= 0 then -- se fianco destro chiuso
if R > (d/2) then
-- raccordo 1, a destra
pEnd = Point3d(((L/2)-R),-H+(d/2),dZedWork)
pCen = Point3d(((L/2)-R),(-H+R),dZedWork)
DrawAddCircleDrawCircle( pCen, (R-(d/2)), 0, -90, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED())
pIni = pEnd
end
end
if OS == -1 then -- se aperto a sinistra
if bEqualTh then
pEnd = Point3d(-((L/2)+dExtraL),-H-dExtraH,dZedWork)
else
pEnd = Point3d(-((L/2)+dExtraL),-H+(d/2),dZedWork)
end
else
if R > (d/2) then
pEnd = Point3d(-((L/2)-R),-H+(d/2),dZedWork)
else
if bEqualTh then
pEnd = Point3d(-((L-d)/2),-H-dExtraH,dZedWork)
else
pEnd = Point3d(-((L-d)/2),-H+(d/2),dZedWork)
end
end
end
-- linea traversa in X
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED()) -- linea orizzontale in X
pIni = pEnd
if ( H <= (d/2) or (( L + dDeltaL) <= (d*2))) then -- se cava troppo bassa o stretta line di uscita in alto e stop
if OS == -1 then -- se aperto a sinistra
pEnd = Point3d(-((L/2)+dExtraL),(d*3/4),dZedWork)
else
pEnd = Point3d(-((L-d)/2),(d*3/4),dZedWork)
end
-- linea di risalita in Y
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED()) -- linea di ritorno in Y
else
if OS == -1 then -- se aperto a sinistra
pEnd = Point3d(-((L/2)+dExtraL),dExtraH,dZedWork)
else
if R > (d/2) then
-- raccordo 2, a sinistra
pEnd = Point3d(-((L-d)/2),(-H+R),dZedWork)
pCen = Point3d(-((L/2)-R),(-H+R),dZedWork)
DrawAddCircleDrawCircle( pCen, (R-(d/2)), -90, -90, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED())
pIni = pEnd
end
pEnd = Point3d(-((L-d)/2),dExtraH,dZedWork)
end
-- linea di risalita in Y
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED()) -- linea di ritorno in Y
pIni = pEnd
if bStartOppo then -- se partenza a sinistra
-- calcolo i valori di X in base al fianco sinistro se aperto o chiuso
if OS == -1 then -- se fianco sinistro aperto
dPosIniMach = -((L-d)/2) -- se fianco aperto mi avvicino a filo del bordo già lavorato
else
dPosIniMach = -(((L*2)-(d*3))/4) -- se fianco chiuso calcolo il solito punto a 3/4 del diametro
end
-- calcolo i valori di X in base al fianco destro se aperto o chiuso
if OS == 1 then -- se fianco destro aperto
dPosEndMach = -((L-d)/2) -- se fianco aperto mi avvicino a filo del bordo già lavorato
else
dPosEndMach = -(((L*2)-(d*3))/4)
end
else
-- calcolo i valori di X in base al fianco destro se aperto o chiuso
if OS == 1 then -- se fianco destro aperto
dPosIniMach = ((L-d)/2) -- se fianco aperto mi avvicino a filo del bordo già lavorato
else
dPosIniMach = (((L*2)-(d*3))/4) -- se fianco chiuso calcolo il solito punto a 3/4 del diametro
end
-- calcolo i valori di X in base al fianco sinistro se aperto o chiuso
if OS == -1 then -- se fianco sinistro aperto
dPosEndMach = ((L-d)/2) -- se fianco aperto mi avvicino a filo del bordo già lavorato
else
dPosEndMach = (((L*2)-(d*3))/4)
end
end
pEnd = Point3d( dPosIniMach,dExtraH,dZedWork)
-- linea di riposizionamento in X
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW()) -- linea di ritorno in X
pIni = pEnd
local nDirVers = EgtIf( bStartOppo, 1, -1)
local nDistYcentr = (d*p)
local nPosYcentr = nDistYcentr - dExtraH
local dXvalue
local nDeltaXPk = 0
local KindSide
local bContinue
if bEqualTh then
bContinue = nPosYcentr < H
else
bContinue = nPosYcentr < ( H -(d/2))
end
dXvalue = dPosIniMach
-- se c'è il raggio e la coordinata Y è entrata nell'influenza del raccordo ne calcolo il delta in x
if bContinue and R > (d/2) and nPosYcentr > (H-R) then
local nDeltaY = nPosYcentr - (H-R)
nDeltaXPk = (R-(d/2)) - sqrt( ((R-(d/2))*(R-(d/2))) - (nDeltaY*nDeltaY))
end
if bStartOppo and bContinue then
if OS == -1 then -- se fianco sinistro aperto
pEnd = Point3d((nDirVers * dXvalue),-nPosYcentr,dZedWork)
else
pEnd = Point3d((nDirVers * (dXvalue+nDeltaXPk)),-nPosYcentr,dZedWork)
end
elseif bContinue then
if OS == 1 then -- se fianco destro aperto
pEnd = Point3d((-nDirVers * dXvalue),-nPosYcentr,dZedWork)
else
pEnd = Point3d((-nDirVers * (dXvalue-nDeltaXPk)),-nPosYcentr,dZedWork)
end
end
-- ciclo passate svuotatura
while bContinue do
-- linea affondamento in Y
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW())
pIni = pEnd
-- scambio quota tra fianco destro e sinsistro
if dXvalue == dPosIniMach then -- se quota sul fianco destro
dXvalue = dPosEndMach -- prendo valore del fianco sinistro
KindSide = EgtIf( bStartOppo, 1, -1) -- setto come fianco in base al lato di provenienza
else
dXvalue = dPosIniMach -- prendo valore del fianco destro
KindSide = EgtIf( bStartOppo, -1, 1) -- setto come fianco in base al lato di provenienza
end
-- scambio quota tra fianco destro e sinsistro
-- if dXvalue == dPosIniMach then -- se quota sul fianco destro
-- dXvalue = dPosEndMach -- prendo valore del fianco sinistro
-- KindSide = -1 -- setto come fianco sinistro
-- else
-- dXvalue = dPosIniMach -- prendo valore del fianco destro
-- KindSide = 1 -- setto come fianco destro
-- end
if bStartOppo then
if OS == KindSide then -- se fianco aperto
pEnd = Point3d((-nDirVers * dXvalue),-nPosYcentr,dZedWork)
else
pEnd = Point3d((-nDirVers * (dXvalue+nDeltaXPk)),-nPosYcentr,dZedWork)
end
else
if OS == KindSide then -- se fianco aperto
pEnd = Point3d((nDirVers * dXvalue),-nPosYcentr,dZedWork)
else
pEnd = Point3d((nDirVers * (dXvalue-nDeltaXPk)),-nPosYcentr,dZedWork)
end
end
-- linea passata in X
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW())
-- calcolo nuovo passo in Y e indice direzione
nPosYcentr = nPosYcentr + nDistYcentr
if bEqualTh then
bContinue = nPosYcentr < H
else
bContinue = nPosYcentr < ( H -(d/2))
end
-- calcolo il delta x relativo alla presenza del raccordo
if bContinue and R > (d/2) and nPosYcentr > (H-R) then
local nDeltaY = nPosYcentr - (H-R)
nDeltaXPk = (R-(d/2)) - sqrt( ((R-(d/2))*(R-(d/2))) - (nDeltaY*nDeltaY))
end
-- calcolo prossimo punto solo se sono ancora dentro l'area
if bContinue then
nDirVers = -nDirVers
-- ricalcolo punti per linea successiva
pIni = pEnd
if bStartOppo then
if OS == KindSide then -- se fianco aperto
pEnd = Point3d((nDirVers * dXvalue),-nPosYcentr,dZedWork)
else
pEnd = Point3d((nDirVers * (dXvalue+nDeltaXPk)),-nPosYcentr,dZedWork)
end
else
if OS == KindSide then -- se fianco aperto
pEnd = Point3d((-nDirVers * dXvalue),-nPosYcentr,dZedWork)
else
pEnd = Point3d((-nDirVers * (dXvalue-nDeltaXPk)),-nPosYcentr,dZedWork)
end
end
end
end -- end while
-- linea di risalita in Y
pIni = pEnd
pEnd = Point3d(pIni:getX(), (d*3/4), dZedWork)
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED()) -- linea di ritorno in Y
end
nPass = nPass + 1
dZedStart = dZedWork
-- se ho altri passi scendo in z
if nPass <= nStep then
pIni = pEnd
pEnd = Point3d(pStart:getX(), pStart:getY(), (dZedStart - dStep))
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true,
RED(), RED(), sMaxFeed)
table.insert( tMVar, {nConEnt,sKindVar})
end
end -- end while
-- trasformo in geometria composita
if ( #tPocket > 0) then
hintPk = EgtCurveCompo( Lg, tPocket, true)
if hintPk then
EgtModifyCurveThickness(hintPk, 0)
if s < T then -- se passi multipli
-- assegno nota con la lista delle entità di variazione
local sListEnt = ''
for i = 1, #tMVar do
sListEnt = sListEnt .. '{ ent=' .. EgtNumToString( tMVar[i][1], 0) .. ', ' .. 'code=' .. tMVar[i][2] .. '}'
if i < #tMVar then
sListEnt = sListEnt .. ','
end
end -- end for
if string.len( sListEnt) > 0 then EgtSetInfo( hintPk, 'MVar', sListEnt) end
end
EgtSetName( hintPk, LM)
-- muovo la geometria vesro sinistra del valore di L/2 + DS
EgtMove( hintPk, Point3d(-((L/2)+DS),0,0) - ORIG())
-- muovo la geometria vesro sinistra del valore di L/2 + DS
EgtMove( Dm, Point3d(-((L/2)+DS),0,0) - ORIG())
EgtSetInfo( hintPk,'InserPoint' ,'Edge') -- setto una nota per indicare su che lato della porta deve essere spostato
EgtSetInfo( Dm,'InserPoint' ,'Edge') -- setto una nota per indicare su che lato della porta deve essere spostato
EgtSetInfo( hintPk,'DeltaPos' ,( L+(2*DS)))
EgtSetInfo( Dm,'DeltaPos' ,( L+(2*DS)))
-- se mantiene lato anche su face
if kbs and kbs > 0 then
local sKeepMode = 'n' -- setto di default per mantenere il lato narrow
if bEqualTh then -- se spessore passante
sKeepMode = 'c' -- setto per mantenere il centro dello spessore
end
EgtSetInfo( hintPk, 'KeepBackSet', sKeepMode)
end
if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then
EgtSetInfo( hintPk, 'ProbeSide', '1')
end
end
end
end
if not dws then -- se viene disposto sul lato narrow o è sulla porta(disposto sul lato stretto)
-- se la sezione strike supera 1/6 dello spessore porta (se è un frame drf vale 0.1 e crea sempre regione)
-- disegno sezione ribasso su faccia superiore/inferiore porta
if fhb and drf and fhb > drf then
-- setto griglia dietro per l'ingombro sicuramente esistente
EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.BACK))
nIdSideBoxUp = EgtRectangle2P( Lg, Point3d((L/2),0,0), Point3d(-(L/2),fhb,0), GDB_RT.LOC)
if nIdSideBoxUp then
if bEqualTh then
EgtModifyCurveThickness(nIdSideBoxUp, -dThickDoor)
else
EgtModifyCurveThickness(nIdSideBoxUp, -H)
end
-- muovo la geometria verso sinistra del valore di L/2 + DS
EgtMove( nIdSideBoxUp, Point3d(-((L/2)+DS),0,0) - ORIG())
EgtSetName( nIdSideBoxUp, 'upper')
EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper')
EgtSetInfo( nIdSideBoxUp, 'DeltaPos', ( L+(2*DS)))
end
EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP))
end
else -- altrimenti viene lavorato disposto sul lato wide
local nIdSideBoxUp
if hint then
nIdSideBoxUp = EgtCopyGlob( hint, Lg)
EgtSetName( nIdSideBoxUp, 'upper')
EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper')
end
end
end
-- cambio colore alla geometria
if bPreview then
if EC == 0 then
if hint then
EgtSetColor(hint,AQUA())
end
if hintAs then
EgtSetColor(hintAs,AQUA())
end
if hintAs2 then
EgtSetColor(hintAs2,AQUA())
end
if hintPk then
EgtSetColor(hintPk,AQUA())
end
if nIdSideBoxUp then
EgtSetColor(nIdSideBoxUp,AQUA())
end
else
if hint then
EgtSetColor(hint,ORANGE())
end
if hintAs then
EgtSetColor(hintAs,ORANGE())
end
if hintAs2 then
EgtSetColor(hintAs2,ORANGE())
end
if hintPk then
EgtSetColor(hintPk,ORANGE())
end
if nIdSideBoxUp then
EgtSetColor(nIdSideBoxUp,ORANGE())
end
end
else -- altrimenti non Preview
-- (NOTA : se ci sono errori il componente non viene eseguito dal programma di gestione dei componenti)
-- cancello le parti ausiliarie se disegnate
if Dm then
EgtErase(Dm)
end
if Dor then
EgtErase(Dor)
end
-- assegno nota su percorsi antisplint e svuotatura
if hintPk then
EgtSetInfo( hintPk, 'NotCheckDir', '1')
end
if hintAs then
EgtSetInfo( hintAs, 'NotCheckDir', '1')
end
if hintAs2 then
EgtSetInfo( hintAs2, 'NotCheckDir', '1')
end
end
return hint, hintPk, hintAs, hintAs2, nIdSideBoxUp
end
return _OverHeadArm