-- -- 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.04.05 V1.0a3 FM Manage info (KeepBackSet) for adjust probe on Z -- 2018.10.17 V1.0a4 FM Add parameter to show into message 402 -- 2018.11.15 V1.0a5 FM Manage latch strike option -- 2018.11.15 V1.0a5 FM Manage Y shift from door side -- 2018.11.15 V1.0a5 FM Manage face thru the thickness (only when it strike) and double anti-splint paths -- 2018.12.10 V1.0a6 FM Manage geometry for calculate box without Arm volume (when strike) -- 2019.10.16 V1.0a7 FM Manage steel option (disable generation of some geometries, make some closed path instead of open ones) -- 2019.10.18 V2.000 FM Manage use Materials -- 2019.10.30 V2.001 FM Add clean corner geometries -- 2019.12.17 V2.002 FM Fix error not initialize a DGD variable in case arm is used as single item (not by aggregator) -- 2020.04.29 V2.003 FM Update for aluminum material -- 2020.05.25 V2.004 FM Manage geometries for calculate region when frame(jamb) is disposed on wide side -- 2020.07.01 V2.005 FM Disable Warning message on frames if parameter DGD.Spd is <= 0 -- 2021.01.22 V3.000 FM Manage better checking error on tools and dimension when produce flag is false -- 2021.03.12 V3.001 FM Manage rotation parameters on extra bores/buttonhole -- 2021.11.24 V3.002 FM Manage side probe option if variable DGC.Pms > 2 -- 2022.07.27 V3.003 FM Modification to use compiled code -- 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 DgMin = 4. -- valore minimo diametro utensile local PtMin = 0.1 local PtMax = 1.0 local dExtraH = 0.5 local dExtraL = 1.0 local sMaxFeed = 'MaxFeed' local sRapid = 'Rapid' -- tipologia hardware local nTypeHdw = 2 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 local function GetMachToolErrorMessage( nErrorId, sGeomName, dIdMach, dOriDiamTool, nIdLogErr, sMchngName) local EgtDoorsMsg = require( 'EgtDoorsMsg') local sMessage = '' if dOriDiamTool then if nErrorId == -1 then -- lavorazione non presente in tabella sMessage = string.format(EgtDoorsMsg[466], nIdLogErr, dIdMach, sGeomName, EgtToUiUnits( dOriDiamTool)) elseif nErrorId == -2 then -- errore nel settare la lavorazione, lavorazione non presente in libreria sMessage = string.format(EgtDoorsMsg[467], nIdLogErr, sMchngName, dIdMach, sGeomName, EgtToUiUnits( dOriDiamTool)) elseif nErrorId == -3 then -- errore nell'acquisire parametri lavorazione sMessage = string.format(EgtDoorsMsg[468], nIdLogErr, sMchngName, dIdMach, sGeomName, EgtToUiUnits( dOriDiamTool)) elseif nErrorId == -4 then -- errore nell'acquisire parametri lavorazione sMessage = string.format(EgtDoorsMsg[469], nIdLogErr, sMchngName, dIdMach, sGeomName, EgtToUiUnits( dOriDiamTool)) elseif nErrorId == -5 then -- diametro utensile non trovato sMessage = string.format(EgtDoorsMsg[470], nIdLogErr, sMchngName, dIdMach, sGeomName, EgtToUiUnits( dOriDiamTool)) elseif nErrorId == -6 then -- nome geometria non presente in tabella sMessage = string.format(EgtDoorsMsg[471], nIdLogErr, sGeomName, EgtToUiUnits( dOriDiamTool)) elseif nErrorId == -7 then -- altezza massima utensile non trovata sMessage = string.format(EgtDoorsMsg[472], nIdLogErr, sMchngName, dIdMach, sGeomName, EgtToUiUnits( dOriDiamTool)) elseif nErrorId == -8 then -- tabella non presente nelle note sMessage = string.format(EgtDoorsMsg[509], nIdLogErr) end elseif nErrorId == -1 then -- lavorazione non presente in tabella sMessage = string.format(EgtDoorsMsg[504], nIdLogErr, dIdMach, sGeomName) elseif nErrorId == -2 then -- errore nel settare la lavorazione sMessage = string.format(EgtDoorsMsg[505], nIdLogErr, sMchngName, dIdMach, sGeomName) elseif nErrorId == -3 then -- errore nell'acquisire parametri lavorazione sMessage = string.format(EgtDoorsMsg[506], nIdLogErr, sMchngName, dIdMach, sGeomName) elseif nErrorId == -4 then -- errore nell'acquisire parametri lavorazione sMessage = string.format(EgtDoorsMsg[507], nIdLogErr, sMchngName, dIdMach, sGeomName) elseif nErrorId == -5 then -- diametro utensile non trovato sMessage = string.format(EgtDoorsMsg[508], nIdLogErr, sMchngName, dIdMach, sGeomName) elseif nErrorId == -6 then -- nome geometria non presente in tabella sMessage = string.format(EgtDoorsMsg[503], nIdLogErr, sGeomName) elseif nErrorId == -7 then -- altezza massima utensile non trovata sMessage = string.format(EgtDoorsMsg[473], nIdLogErr, sMchngName, dIdMach, sGeomName) elseif nErrorId == -8 then -- tabella non presente nelle note sMessage = string.format(EgtDoorsMsg[509], nIdLogErr) end return sMessage end -- Funzione creazione foro o asola o rampa per asola local function MakeBoreOrButtoHole( Lg, bPreview, Dm, nDrawMach, IY10, EBH10, EB10, PX10, Int10, D10, dParH, PY10, T10, RP10, AR10, RCI10, kbs, bEqualTh, HB10, ls, dws, pbs) local pIni, pEnd, pCen local hint3, hint5 local tPath = {} local tPathPok = {} if IY10 > 0 and EBH10 ~= '' then -- se parametri asola presenti pIni = Point3d((PX10+Int10+(D10/2)),(dParH+PY10),0) pEnd = Point3d((PX10+Int10+(D10/2)),(dParH+PY10-(IY10/2)),0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED()) pIni = pEnd pEnd = Point3d((PX10+Int10-(D10/2)),(dParH+PY10-(IY10/2)),0) pCen = Point3d((PX10+Int10),(dParH+PY10-(IY10/2)),0) DrawAddCircleDrawCircle( pCen, (D10/2), 0,-180, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED()) pIni = pEnd pEnd = Point3d((PX10+Int10-(D10/2)),(dParH+PY10+(IY10/2)),0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED()) pIni = pEnd pEnd = Point3d((PX10+Int10+(D10/2)),(dParH+PY10+(IY10/2)),0) pCen = Point3d((PX10+Int10),(dParH+PY10+(IY10/2)),0) DrawAddCircleDrawCircle( pCen, (D10/2), 180,-180, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED()) pIni = pEnd pEnd = Point3d((PX10+Int10+(D10/2)),(dParH+PY10),0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED()) pIni = pEnd hint3 = EgtCurveCompo( Lg, tPath, true) EgtModifyCurveThickness( hint3, -T10) -- se rotazione attiva if AR10 ~= 0 then -- rotazione in centro all'interasse if RCI10 then EgtRotate( hint3, Point3d((PX10),(dParH+PY10),0), Z_AX(), AR10, GDB_RT.LOC) -- ruoto -- rotazione in centro all'asola else EgtRotate( hint3, Point3d((PX10+Int10),(dParH+PY10),0), Z_AX(), AR10, GDB_RT.LOC) -- ruoto end end if nDrawMach > 0 and RP10 and RP10 > 0 and (RP10/2) < T10 then --se parametro step è valido, creao il percorso a zig-zag centrale EgtSetName( hint3,'_'..EBH10) -- aggiungo _ per disabilitare lavorazione local nStep = ceil(T10/RP10) -- numero di passate local dStep = (T10/nStep) -- passo ricalcolato local nPass = 1 local dZedStart = 0 local dZedWork local nInv = 1 pIni = Point3d((PX10+Int10),(dParH+PY10+((IY10/2)*nInv)),dZedStart) while nPass <= nStep do dZedWork = dZedStart - (dStep/2) nInv = -nInv pEnd = Point3d((PX10+Int10),(dParH+PY10+((IY10/2)*nInv)),dZedWork) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPathPok, bPreview, Dm, 0, false, false, RED(), RED()) pIni = pEnd dZedWork = dZedStart - dStep nInv = -nInv pEnd = Point3d((PX10+Int10),(dParH+PY10+((IY10/2)*nInv)),dZedWork) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPathPok, bPreview, Dm, 0, false, false, RED(), RED()) pIni = pEnd -- se ho altri passi scendo in z if nPass < nStep then dZedStart = dZedWork end nPass = nPass + 1 end -- faccio passata di ritorno nInv = -nInv pEnd = Point3d((PX10+Int10),(dParH+PY10+((IY10/2)*nInv)),-T10) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPathPok, bPreview, Dm, 0, false, false, RED(), RED()) hint5 = EgtCurveCompo( Lg, tPathPok, true) EgtModifyCurveThickness( hint5, 0) EgtSetName( hint5, EBH10) -- se rotazione attiva if AR10 ~= 0 then -- rotazione in centro all'interasse if RCI10 then EgtRotate( hint5, Point3d((PX10),(dParH+PY10),0), Z_AX(), AR10, GDB_RT.LOC) -- ruoto -- rotazione in centro all'asola else EgtRotate( hint5, Point3d((PX10+Int10),(dParH+PY10),0), Z_AX(), AR10, GDB_RT.LOC) -- ruoto end end else EgtSetName( hint3, EBH10) end elseif EB10 ~= '' then hint3 = EgtCircle( Lg, Point3d((PX10+Int10),(dParH+PY10),0), D10/2 , GDB_RT.LOC) EgtModifyCurveThickness( hint3, -T10) EgtSetName( hint3, EB10) -- se rotazione in centro all'interasse (sono questo caso perchè non ha senso ruotare un foro in centro a se stesso) if AR10 ~= 0 and RCI10 then EgtRotate( hint3, Point3d((PX10),(dParH+PY10),0), Z_AX(), AR10, GDB_RT.LOC) -- ruoto end end -- se mantiene backset if kbs and kbs > 0 then local sKeepMode = 'c' -- setto di default per mantenere il centro spessore if ls then -- se latch strike sKeepMode = 'n' -- setto per mantenere per mantenere il lato narrow end EgtSetInfo( hint3, 'KeepBackSet', sKeepMode) if hint5 then EgtSetInfo( hint5, 'KeepBackSet', sKeepMode) end end if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint3, 'ProbeSide', '1') if hint5 then EgtSetInfo( hint5, 'ProbeSide', '1') end end if HB10 then EgtSetInfo( hint3, 'SideDoor', 'LockLH') if hint5 then EgtSetInfo( hint5, 'SideDoor', 'LockLH') end else EgtSetInfo (hint3, 'SideDoor', 'SideLH') if hint5 then EgtSetInfo( hint5, 'SideDoor', 'SideLH') end end if dws then local nIdSideBoxUp = EgtCopyGlob( hint3, Lg) EgtSetName( nIdSideBoxUp, 'upper') EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper') if hint5 then nIdSideBoxUp = EgtCopyGlob( hint5, Lg) EgtSetName( nIdSideBoxUp, 'upper') EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper') end end end -- Funzione di sistemazione parametri function OverHeadArm.AdjustParams( tMhPar) local EgtDoorsMsg = require( 'EgtDoorsMsg') local dMaxMat0 local dMaxMat1 local dMaxMat2 local dNumMessage local dNumLog = 0 local sMessToOut = '' local nTempT0 local nTempT1 local nTempT2 local sMchngName0 local sMchngName1 local sMchngName2 local nPosDef -- parametro disposizione frame su lato wide (se = nil è sulla porta, se = true disposizione frame sul lato wide, se false disposzione su lato narrow) tMhPar.Dws = DGD.Dws tMhPar.dThF = DGD.dT if DGD.nTypePz == 3 or DGD.nTypePz == 4 then tMhPar.dThD = DGD.dW tMhPar.TTP = DGD.dW -- setto come valore iniziale, poi se è abilitata le generazione si setta con il giusto valore elseif DGD.nTypePz == 5 or DGD.nTypePz == 6 then tMhPar.dThD = DGD.dH tMhPar.TTP = DGD.dH -- setto come valore iniziale, poi se è abilitata le generazione si setta con il giusto valore elseif DGD.nTypePz <= 2 then tMhPar.dThD = DGD.dT tMhPar.TTP = DGD.dT end tMhPar.TyP = DGD.nTypePz tMhPar.fht = 0 -- setto il face h top a 0 tMhPar.fhb = 0 -- setto il face h bottom a 0 tMhPar.sopp = ( DGD.Lock == 'L' and DGD.Push) or ( DGD.Lock == 'R' and not DGD.Push) tMhPar.fopp = 1 -- se non ho il parametro lo setto disattivato if not tMhPar.ech then tMhPar.ech = false end -- se non c'è la variabile suffisso if not tMhPar.CH then tMhPar.CH = '_Chisel' end -- se non c'è la variabile DS if not tMhPar.DS then tMhPar.DS = 0 end -- se vecchia versione e non c'è la variabile che indica al face di sbordare if not tMhPar.nw and tMhPar.ls == nil then tMhPar.ls = true end -- se altezza cava maggiore o uguale dello spessore porta la ri-setto come spessore porta -- e disabilito il chisel e il clean corner tMhPar.bETh = false if tMhPar.H and ( tMhPar.H - DGD.dT) >= GEO.EPS_SMALL then tMhPar.H = DGD.dT tMhPar.ech = false -- disattivo il chisel tMhPar.rf = 0 -- disattivo il radius face tMhPar.bETh = true tMhPar.ls = true tMhPar.clc = nil tMhPar.CLC = nil -- do errore se altezza cava maggiore o uguale dello spessore porta -- return tMhPar, 2249, string.format(EgtDoorsMsg[432], tMhPar.Nome, tMhPar.H, DGD.dT, tMhPar.Path) end if not tMhPar.DY or tMhPar.DY == 0 then -- se non c'è il parametro spostamento o è a 0 tMhPar.DY = 0 if not tMhPar.ls and tMhPar.H then -- se non sborda (latch strike) lo setto per stare in centro allo spessore porta tMhPar.DY = (DGD.dT - tMhPar.H) / 2 end end -- setto il verso di spostamento dell'arm in caso sia lanciato da un aggregatore DGD.PosDir = -1 if not DGD.PosXItem then DGD.PosXItem = 0 end -- sommo il valore della posizione(da ddf) con quello della posizione aggregatore nPosDef = DGD.POSITION + ( DGD.PosXItem * DGD.PosDir) if nPosDef <= GEO.EPS_SMALL and tMhPar.DS <= GEO.EPS_SMALL then if DGD.Lock == 'L' then tMhPar.OS = 1 else tMhPar.OS = -1 end -- inverto il valore perché il bordo a filo si trova dal lato opposto if DGD.Push then tMhPar.OS = - tMhPar.OS end else tMhPar.OS = 0 end -- setto parametro riferimento profondità roller tMhPar.drf = DGD.dT/6 if DGD.sFrame then -- se è un assemblato tMhPar.drf = 0.1 -- in questo modo crea semre la regione da togliere relativa al materiale asportato tMhPar.sopp = not tMhPar.sopp tMhPar.fopp = -tMhPar.fopp end -- Assegno parametri da dati utensili in macchina local MB = require( 'MachiningBase') local sLM local nLMi = 1 local sLA local nLAi = 1 local sLG local nLGi = 1 -- se porta steel o aluminum disabilito l'antischeggia, la svuotatura, il chisel e modifico il nome geometria if FindMaterial( DGD.Material, 'steel') or FindMaterial( DGD.Material, 'aluminum') then tMhPar.LM = nil tMhPar.LA = nil tMhPar.ech = false tMhPar.CH = nil tMhPar.est = true tMhPar.d2 = nil else tMhPar.est = nil end if tMhPar.est and tMhPar.LG then sLG = tMhPar.LG if DGD.MachEn > 0 and tMhPar.d then nTempT0, dMaxMat0, sMchngName0 = MB.GetToolDataFromAttrib( sLG, nLGi) end end if tMhPar.LM then sLM = tMhPar.LM if DGD.MachEn > 0 and tMhPar.d then nTempT1, dMaxMat1, sMchngName1 = MB.GetToolDataFromAttrib( sLM, nLMi) end end if tMhPar.LA then sLA = tMhPar.LA if DGD.MachEn > 0 and tMhPar.d2 then nTempT2, dMaxMat2, sMchngName2 = MB.GetToolDataFromAttrib( sLA, nLAi) end end if tMhPar.ech and tMhPar.LG then -- se chisel abilitato sLG = tMhPar.LG .. tMhPar.CH tMhPar.d0 = 0 if DGD.MachEn > 0 and tMhPar.d0 then nTempT0, dMaxMat0, sMchngName0 = MB.GetToolDataFromAttrib( sLG, nLGi) end end -- se devo disegnare le geometrie di lavorazione if DGD.MachEn > 0 then -- gestisco il risultato della lettura utensili if DGD.bProoduce and tMhPar.est and tMhPar.d and nTempT0 and nTempT0 <= 0 then dNumLog = -2245 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT0, sLG, nLGi, tMhPar.d, dNumLog, sMchngName0) elseif tMhPar.est and nTempT0 then tMhPar.d = nTempT0 end -------------------------------------------------------------------------------- -- se c'è materiale steel faccio in modo che non assegni il diametro utensile -------------------------------------------------------------------------------- -- gestisco il risultato della lettura utensili if DGD.bProoduce and not tMhPar.est and tMhPar.d and nTempT1 and nTempT1 <= 0 then dNumLog = -2246 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT1, sLM, nLMi, tMhPar.d, dNumLog, sMchngName1) elseif not tMhPar.est and nTempT1 then tMhPar.d = nTempT1 end if DGD.bProoduce and not tMhPar.est and tMhPar.d2 and nTempT2 and nTempT2 <= 0 then dNumLog = -2246 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT2, sLA, nLAi, tMhPar.d2, dNumLog, sMchngName2) elseif not tMhPar.est and nTempT2 then tMhPar.d2 = nTempT2 end end -- Regola applicazione chiseling: -- se ho impostato un raccordo, anche se poi viene annullato perchè inferiore del raggio fresa -- disabilito il chiseling perchè implica che se c'è un valore di raccordo non devo fare il chiseling -- se ho il raggio valido disabilito il chiseling e il clean corner if tMhPar.rf and tMhPar.rf > 0 then tMhPar.ech = false tMhPar.clc = nil tMhPar.CLC = nil else -- se non è definito o già nullo lo azzero tMhPar.rf = 0 end -- se devo disegnare le geometrie di lavorazione if DGD.MachEn > 0 then -- Raggio: se altro materiale e raggio presente e se raggio minore del diametro utensile + delta, lo annullo if tMhPar.est and tMhPar.rf and tMhPar.rf > 0 and tMhPar.d and tMhPar.rf < ((tMhPar.d/2)+0.02) then tMhPar.rf = 0 end -- chiseling if tMhPar.ech and tMhPar.d0 and nTempT0 > 0 then tMhPar.d0 = nTempT0 end -- se la profondità della face per steel è maggiore della capacità utensile limito la profondità ed emetto un warning if tMhPar.est and tMhPar.T and dMaxMat0 and tMhPar.T > dMaxMat0 then dNumLog = -2244 dNumMessage = 460 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T), EgtToUiUnits(dMaxMat0)) tMhPar.T = dMaxMat0 end -- se la profondità della face è maggiore della capacità utensile limito la profondità ed emetto un warning if tMhPar.T and dMaxMat1 and tMhPar.T > dMaxMat1 then dNumLog = -2248 dNumMessage = 460 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T), EgtToUiUnits(dMaxMat1)) tMhPar.T = dMaxMat1 end -- se la profondità antischeggia della face è maggiore della capacità utensile limito la profondità ed emetto un warning if tMhPar.T and dMaxMat2 and tMhPar.T > dMaxMat2 then dNumLog = -2247 dNumMessage = 462 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T), EgtToUiUnits(dMaxMat2)) tMhPar.T = dMaxMat2 end local sPieceName if tMhPar.Dws then -- setto un valore di poco inferiore allo spessore per non fresare le ventose tMhPar.TTP = tMhPar.dThD - DGD.Spd -- setto i nomi frame per i messaggi if DGD.nTypePz == 3 then sPieceName = 'left Jamb' elseif DGD.nTypePz == 4 then sPieceName = 'right Jamb' elseif DGD.nTypePz == 5 then sPieceName = 'Frame header' else sPieceName = 'Threshold' end end -- controllo se le profondità delle geometrie non superano lo spessore frame if tMhPar.Dws and DGD.Spd > 0 and tMhPar.T and abs(tMhPar.T) > tMhPar.TTP then dNumLog = -2243 dNumMessage = 681 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, sPieceName, 'T', EgtToUiUnits(tMhPar.T), EgtToUiUnits(tMhPar.TTP), EgtToUiUnits(tMhPar.dThD)) tMhPar.T = tMhPar.TTP end if tMhPar.T and tMhPar.T > 0 and tMhPar.ls then tMhPar.fht = tMhPar.T tMhPar.fhb = tMhPar.fht end if tMhPar.CLC and tMhPar.clc and tMhPar.clc > 0 and ( tMhPar.clc >= tMhPar.H or tMhPar.clc >= tMhPar.L) then tMhPar.clc = nil elseif not tMhPar.CLC then tMhPar.clc = nil end end -- se non ho parametro step o è 0 lo assegno uguale allo spessore cava if tMhPar.T and ( not tMhPar.sf or abs(tMhPar.sf) < GEO.EPS_SMALL) then tMhPar.sf = tMhPar.T end -- extra bores if tMhPar.T10 then if tMhPar.T10 == -0.5 then tMhPar.T10 = tMhPar.dThF / 2 elseif tMhPar.T10 == -1 or tMhPar.T10 > tMhPar.dThF then tMhPar.T10 = tMhPar.dThF end end if tMhPar.T11 then if tMhPar.T11 == -0.5 then tMhPar.T11 = tMhPar.dThF / 2 elseif tMhPar.T11 == -1 or tMhPar.T11 > tMhPar.dThF then tMhPar.T11 = tMhPar.dThF end end if tMhPar.T12 then if tMhPar.T12 == -0.5 then tMhPar.T12 = tMhPar.dThF / 2 elseif tMhPar.T12 == -1 or tMhPar.T12 > tMhPar.dThF then tMhPar.T12 = tMhPar.dThF end end if tMhPar.T13 then if tMhPar.T13 == -0.5 then tMhPar.T13 = tMhPar.dThF / 2 elseif tMhPar.T13 == -1 or tMhPar.T13 > tMhPar.dThF then tMhPar.T13 = tMhPar.dThF end end if tMhPar.T14 then if tMhPar.T14 == -0.5 then tMhPar.T14 = tMhPar.dThF / 2 elseif tMhPar.T14 == -1 or tMhPar.T14 > tMhPar.dThF then tMhPar.T14 = tMhPar.dThF end end if tMhPar.T15 then if tMhPar.T15 == -0.5 then tMhPar.T15 = tMhPar.dThF / 2 elseif tMhPar.T15 == -1 or tMhPar.T15 > tMhPar.dThF then tMhPar.T15 = tMhPar.dThF end end if tMhPar.T16 then if tMhPar.T16 == -0.5 then tMhPar.T16 = tMhPar.dThF / 2 elseif tMhPar.T16 == -1 or tMhPar.T16 > tMhPar.dThF then tMhPar.T16 = tMhPar.dThF end end if tMhPar.T17 then if tMhPar.T17 == -0.5 then tMhPar.T17 = tMhPar.dThF / 2 elseif tMhPar.T17 == -1 or tMhPar.T17 > tMhPar.dThF then tMhPar.T17 = tMhPar.dThF end end if tMhPar.T18 then if tMhPar.T18 == -0.5 then tMhPar.T18 = tMhPar.dThF / 2 elseif tMhPar.T18 == -1 or tMhPar.T18 > tMhPar.dThF then tMhPar.T18 = tMhPar.dThF end end if tMhPar.T19 then if tMhPar.T19 == -0.5 then tMhPar.T19 = tMhPar.dThF / 2 elseif tMhPar.T19 == -1 or tMhPar.T19 > tMhPar.dThF then tMhPar.T19 = tMhPar.dThF end end if tMhPar.T20 then if tMhPar.T20 == -0.5 then tMhPar.T20 = tMhPar.dThF / 2 elseif tMhPar.T20 == -1 or tMhPar.T20 > tMhPar.dThF then tMhPar.T20 = tMhPar.dThF end end if tMhPar.T21 then if tMhPar.T21 == -0.5 then tMhPar.T21 = tMhPar.dThF / 2 elseif tMhPar.T21 == -1 or tMhPar.T21 > tMhPar.dThF then tMhPar.T21 = tMhPar.dThF end end if tMhPar.T22 then if tMhPar.T22 == -0.5 then tMhPar.T22 = tMhPar.dThF / 2 elseif tMhPar.T22 == -1 or tMhPar.T22 > tMhPar.dThF then tMhPar.T22 = tMhPar.dThF end end if tMhPar.T23 then if tMhPar.T23 == -0.5 then tMhPar.T23 = tMhPar.dThF / 2 elseif tMhPar.T23 == -1 or tMhPar.T23 > tMhPar.dThF then tMhPar.T23 = tMhPar.dThF end end if tMhPar.T24 then if tMhPar.T24 == -0.5 then tMhPar.T24 = tMhPar.dThF / 2 elseif tMhPar.T24 == -1 or tMhPar.T24 > tMhPar.dThF then tMhPar.T24 = tMhPar.dThF end end if tMhPar.T25 then if tMhPar.T25 == -0.5 then tMhPar.T25 = tMhPar.dThF / 2 elseif tMhPar.T25 == -1 or tMhPar.T25 > tMhPar.dThF then tMhPar.T25 = tMhPar.dThF end end if tMhPar.T26 then if tMhPar.T26 == -0.5 then tMhPar.T26 = tMhPar.dThF / 2 elseif tMhPar.T26 == -1 or tMhPar.T26 > tMhPar.dThF then tMhPar.T26 = tMhPar.dThF end end if tMhPar.T27 then if tMhPar.T27 == -0.5 then tMhPar.T27 = tMhPar.dThF / 2 elseif tMhPar.T27 == -1 or tMhPar.T27 > tMhPar.dThF then tMhPar.T27 = tMhPar.dThF end end if tMhPar.T28 then if tMhPar.T28 == -0.5 then tMhPar.T28 = tMhPar.dThF / 2 elseif tMhPar.T28 == -1 or tMhPar.T28 > tMhPar.dThF then tMhPar.T28 = tMhPar.dThF end end if tMhPar.T29 then if tMhPar.T29 == -0.5 then tMhPar.T29 = tMhPar.dThF / 2 elseif tMhPar.T29 == -1 or tMhPar.T29 > tMhPar.dThF then tMhPar.T29 = tMhPar.dThF end end if dNumLog ~= 0 then return tMhPar, dNumLog, sMessToOut end return tMhPar, 0, '' end -- Funzione di disegno function OverHeadArm.Draw( tOHArm, bPreview, bRunByCompo, nDrawMach, dThickDoor) -- Assegno le dimensioni local L = tOHArm.L local H = tOHArm.H local T = tOHArm.T local R = tOHArm.rf local clc = tOHArm.clc local ccr = tOHArm.ccr local d = tOHArm.d local p = tOHArm.p local sf = tOHArm.sf local d2 = tOHArm.d2 local DS = tOHArm.DS local OS = tOHArm.OS local ech = tOHArm.ech -- abilitazione chisel local bEqualTh = tOHArm.bETh local ls = tOHArm.ls local fht = tOHArm.fht local fhb = tOHArm.fhb local est = tOHArm.est local kbs = tOHArm.kbs -- keep backset/thickness (0: none, 1: only face, 2: all) local pbs = tOHArm.pbs local DY = tOHArm.DY local cl = 0 local invG = 1 local sopp = tOHArm.sopp local fopp = tOHArm.fopp local dws = tOHArm.Dws local dthd = tOHArm.dThD local ttp = tOHArm.TTP local typ = tOHArm.TyP -- tabelle per i fori sullo spessore e di lato local tExtraBore = {} local tExtraSHBore = {} -- inserimento dati nella tabella fori di lato table.insert( tExtraSHBore, { tOHArm.D3, tOHArm.T3, tOHArm.I3, tOHArm.PX3, tOHArm.PY3, tOHArm.EB3, tOHArm.HB3}) table.insert( tExtraSHBore, { tOHArm.D4, tOHArm.IY4, tOHArm.T4, tOHArm.I4, tOHArm.PX4, tOHArm.PY4, tOHArm.RP4, tOHArm.EB4, tOHArm.EBH4, tOHArm.HB4, tOHArm.AR4, tOHArm.RCI4}) table.insert( tExtraSHBore, { tOHArm.D5, tOHArm.IY5, tOHArm.T5, tOHArm.I5, tOHArm.PX5, tOHArm.PY5, tOHArm.RP5, tOHArm.EB5, tOHArm.EBH5, tOHArm.HB5, tOHArm.AR5, tOHArm.RCI5}) table.insert( tExtraSHBore, { tOHArm.D6, tOHArm.IY6, tOHArm.T6, tOHArm.I6, tOHArm.PX6, tOHArm.PY6, tOHArm.RP6, tOHArm.EB6, tOHArm.EBH6, tOHArm.HB6, tOHArm.AR6, tOHArm.RCI6}) -- inserimento dati nella tabella fori sullo spessore lato Keyway table.insert( tExtraBore, { tOHArm.D10, tOHArm.T10, tOHArm.PX10, tOHArm.PY10, tOHArm.EB10}) table.insert( tExtraBore, { tOHArm.D11, tOHArm.T11, tOHArm.PX11, tOHArm.PY11, tOHArm.EB11}) table.insert( tExtraBore, { tOHArm.D12, tOHArm.T12, tOHArm.PX12, tOHArm.PY12, tOHArm.EB12}) table.insert( tExtraBore, { tOHArm.D13, tOHArm.T13, tOHArm.PX13, tOHArm.PY13, tOHArm.EB13}) table.insert( tExtraBore, { tOHArm.D14, tOHArm.T14, tOHArm.PX14, tOHArm.PY14, tOHArm.EB14}) table.insert( tExtraBore, { tOHArm.D15, tOHArm.T15, tOHArm.PX15, tOHArm.PY15, tOHArm.EB15}) table.insert( tExtraBore, { tOHArm.D16, tOHArm.T16, tOHArm.PX16, tOHArm.PY16, tOHArm.EB16}) table.insert( tExtraBore, { tOHArm.D17, tOHArm.T17, tOHArm.PX17, tOHArm.PY17, tOHArm.EB17}) table.insert( tExtraBore, { tOHArm.D18, tOHArm.T18, tOHArm.PX18, tOHArm.PY18, tOHArm.EB18}) table.insert( tExtraBore, { tOHArm.D19, tOHArm.T19, tOHArm.PX19, tOHArm.PY19, tOHArm.EB19}) -- inserimento dati nella tabella fori sullo spessore lato Secure table.insert( tExtraBore, { tOHArm.D20, tOHArm.T20, tOHArm.PX20, tOHArm.PY20, tOHArm.EB20}) table.insert( tExtraBore, { tOHArm.D21, tOHArm.T21, tOHArm.PX21, tOHArm.PY21, tOHArm.EB21}) table.insert( tExtraBore, { tOHArm.D22, tOHArm.T22, tOHArm.PX22, tOHArm.PY22, tOHArm.EB22}) table.insert( tExtraBore, { tOHArm.D23, tOHArm.T23, tOHArm.PX23, tOHArm.PY23, tOHArm.EB23}) table.insert( tExtraBore, { tOHArm.D24, tOHArm.T24, tOHArm.PX24, tOHArm.PY24, tOHArm.EB24}) table.insert( tExtraBore, { tOHArm.D25, tOHArm.T25, tOHArm.PX25, tOHArm.PY25, tOHArm.EB25}) table.insert( tExtraBore, { tOHArm.D26, tOHArm.T26, tOHArm.PX26, tOHArm.PY26, tOHArm.EB26}) table.insert( tExtraBore, { tOHArm.D27, tOHArm.T27, tOHArm.PX27, tOHArm.PY27, tOHArm.EB27}) table.insert( tExtraBore, { tOHArm.D28, tOHArm.T28, tOHArm.PX28, tOHArm.PY28, tOHArm.EB28}) table.insert( tExtraBore, { tOHArm.D29, tOHArm.T29, tOHArm.PX29, tOHArm.PY29, tOHArm.EB29}) -- Assegno i nomi geometrie local LG = tOHArm.LG local LM = tOHArm.LM local LA = tOHArm.LA local CH = tOHArm.CH -- nome suffisso lavorazione chisel local CLC = tOHArm.CLC -- nome geometria clean corner local DM = 'DUMMY' -- variabili per messaggi e settaggi vari local sCompoName = tOHArm.Nome local nCompoNpar = tOHArm.Npar local sCompoPath = tOHArm.Path -- eventuale messaggio errore rilevato nell'adjust local nCodAdj = tOHArm.nCod local sCodAdj = tOHArm.sCod -- nomi parametri per messaggi local sNamePar1 = tOHArm.N1 or 'L' local sNamePar2 = tOHArm.N2 or 'H' local sNamePar3 = tOHArm.N3 or 'T' local sNamePar4 = tOHArm.N4 or 'd' local sNamePar5 = tOHArm.N5 or 'p' local sNamePar6 = tOHArm.N6 or 'd2' local sNamePar7 = tOHArm.N7 or 'DS' local sNamePar8 = tOHArm.N8 or 'OS' local sNamePar9 = tOHArm.N9 or 'sf' local sNamePar10 = tOHArm.N10 or 'R' local sNamePar11 = tOHArm.N11 or 'clc' local sNamePar12 = tOHArm.N12 or 'ccr' -- settaggio opzione per partenza ad angolo o meno local bStartAng = true local bStartOppo = true -- RunByComponetInterface local RC = true -- Messaggi codice errori local EM = ' ' local EC = 0 local ErrorBase = 2200 -- variabili che abilitano la creazione della geometria local bMakeFaceGeom = true -- variabili dei percorsi geometrici local nGeom1, nAS1, nAS2 local nPkToJoin1, nIdSideBoxUp if not bRunByCompo then -- controllo se lanciato da componente RC = false end -- verifico se dei parametri sono nulli e in qual caso assegno dei valori sostitutivi -- o setto la disabilitazione della creazione di alcune geometrie if not L or not H then bMakeFaceGeom = false clc = nil CLC = nil end if not T then T = 0 end -- set variabili per compatibilità con vecchi componenti -- step face: per compatibilità con tutti i componenti, se non è definito lo setto = alla profondità cava if not sf or abs(sf) <= GEO.EPS_SMALL then sf = T end -- radius face: per compatibilità con tutti i componenti, se non è definito lo setto a 0 if not R or R <= GEO.EPS_SMALL then R = 0 end -- se non sborda if H and not ls then DY = DY + H/2 -- compenso lo spostamento della metà cava -- se c'è un raccordo setto per raccordare tutti gli angoli if R and R > 0 then cl = 3 end end -- 0 solo geom esterna, 1 solo geom mach, 2 entrambe if not nDrawMach then -- se non definita la setto per non creare geometria di lavorazione nDrawMach = 0 end local nForceMakeFace = nDrawMach -- se ho abilitato il chiseling modifico il nome geometria if ech then LG = LG .. CH tOHArm.LG = LG tOHArm.smr = 1 -- inserisco i raccordini per non fare il chisel -- se ho abilitato solo le geometrie di lavorazione, abilito la generazione di entrambe per il contorno chisel if nDrawMach == 1 then nForceMakeFace = 2 end end local EgtDoorsMsg = require( 'EgtDoorsMsg') -- Verifica delle dimensioni, le condizioni vengono verificate in base a quale geometria deve essere creata if bMakeFaceGeom and nDrawMach > 0 and d < DgMin then EC = 1 EM = string.format(EgtDoorsMsg[400],sNamePar4,EgtToUiUnits(d),EgtToUiUnits(DgMin)) -- il diametro utensile deve essere >= di d = DgMin elseif bMakeFaceGeom and nDrawMach > 0 and d2 and d2 < DgMin then EC = 2 EM = string.format(EgtDoorsMsg[400],sNamePar6,EgtToUiUnits(d2),EgtToUiUnits(DgMin)) -- il diametro utensile deve essere >= di d2 = DgMin elseif bMakeFaceGeom and H <= 0 then EC = 3 EM = string.format(EgtDoorsMsg[401],sNamePar2,EgtToUiUnits(H), sCompoPath) -- il parametro 'H' deve essere > 0 H = d/2 elseif bMakeFaceGeom and nDrawMach > 0 and L <= d then if DGD.bProoduce then EC = 4 EM = string.format(EgtDoorsMsg[402],sNamePar1,EgtToUiUnits(L),sNamePar4,EgtToUiUnits(d), sCompoPath) -- il parametro 'L' deve essere maggiore al diametro utensile d L = d + 0.002 else d = L - 0.002 end elseif bMakeFaceGeom and nDrawMach > 0 and d2 and L <= d2 then if DGD.bProoduce then EC = 5 EM = string.format(EgtDoorsMsg[402],sNamePar1,EgtToUiUnits(L),sNamePar6,EgtToUiUnits(d2), sCompoPath) -- il parametro 'L' deve essere maggiore al diametro utensile d2 L = d2 + 0.002 else d2 = L - 0.002 end elseif bMakeFaceGeom and nDrawMach > 0 and ( p < PtMin or p > PtMax) then EC = 6 EM = string.format(EgtDoorsMsg[403],sNamePar5,p,PtMin,PtMax, sCompoPath) -- il parametro 'p' deve essere compreso tra p = 0.8 elseif bMakeFaceGeom and T < 0 then EC = 7 EM = string.format(EgtDoorsMsg[404],sNamePar3,EgtToUiUnits(T), sCompoPath) -- il parametro 'T' deve essere >= 0 T = 0 elseif bMakeFaceGeom and L <= 0 then EC = 8 EM = string.format(EgtDoorsMsg[401],sNamePar1,EgtToUiUnits(L), sCompoPath) -- il parametro 'L' deve essere > 0 L = d elseif bMakeFaceGeom and OS ~= 0 and OS ~= 1 and OS ~= -1 then EC = 9 EM = string.format(EgtDoorsMsg[417],sNamePar8,OS, sCompoPath) -- il parametro 'OS' accetta solo valore: 0, 1 o -1 OS = 0 elseif bMakeFaceGeom and DS < 0 then EC = 10 EM = string.format(EgtDoorsMsg[404],sNamePar7,EgtToUiUnits(DS), sCompoPath) -- il parametro 'DS' deve essere > 0 DS = 0 elseif bMakeFaceGeom and nDrawMach > 0 and sf and sf <= 0 then EC = 11 EM = string.format(EgtDoorsMsg[401],sNamePar9,EgtToUiUnits(sf), sCompoPath) -- il parametro 'sf' deve essere > 0 sf = d elseif bMakeFaceGeom and R and L <= R*2 then EC = 12 EM = string.format(EgtDoorsMsg[406],sNamePar10,EgtToUiUnits(R),sNamePar1..'/2',EgtToUiUnits(L/2), sCompoPath) -- il parametro 'R' deve essere < L/2 L = (R*2)+1 elseif bMakeFaceGeom and ls and R >= H then EC = 13 EM = string.format(EgtDoorsMsg[406],sNamePar10,EgtToUiUnits(R),sNamePar2,EgtToUiUnits(H), sCompoPath) -- il parametro 'R' deve essere < H R = d/2 elseif bMakeFaceGeom and not ls and H < d then if DGD.bProoduce then EC = 14 EM = string.format(EgtDoorsMsg[405],sNamePar2,EgtToUiUnits(H),EgtToUiUnits(d), sCompoPath) -- il parametro 'H' deve essere maggiore o uguale del diametro utensile H = d else d = H - 0.002 end elseif bMakeFaceGeom and not ls and R and H <= R*2 then EC = 15 EM = string.format(EgtDoorsMsg[406],sNamePar17,EgtToUiUnits(R),sNamePar2..'/2',EgtToUiUnits(H/2), sCompoPath) -- il parametro 'R' deve essere < H/2 R = H/2 elseif bMakeFaceGeom and not ls and cl > 0 and R and abs(R - (H/2)) < GEO.EPS_SMALL and L <= H then EC = 16 EM = string.format(EgtDoorsMsg[407],sNamePar1,EgtToUiUnits(L),sNamePar2,EgtToUiUnits(H), sCompoPath) -- il parametro 'L' deve essere > 'H' L = H+5 elseif bMakeFaceGeom and not ls and cl > 0 and R and R < (H/2) and L <= (R*2) then EC = 17 EM = string.format(EgtDoorsMsg[407],sNamePar1,EgtToUiUnits(L),sNamePar17..'*2',EgtToUiUnits(R*2), sCompoPath) -- il parametro 'L' deve essere > 'R*2' L = (R*2)+5 elseif bMakeFaceGeom and CLC and clc and ccr and clc > 0 and ccr > 0 and (2*(ccr*sin(45))) >= clc then EC = 18 EM = string.format(EgtDoorsMsg[407],sNamePar11,EgtToUiUnits(clc),'',EgtToUiUnits(2*(ccr*sin(45))), sCompoPath) -- il parametro 'clc' deve essere > 'crc' clc = (2*(ccr*sin(45)))+0.2 end if not bPreview and EC ~= 0 then return (ErrorBase+EC), EM end -- Se Preview cancello tutto if bPreview then EgtNewFile() EgtSetDefaultMaterial( BLACK()) end -- Pezzo e Layer local Pz if bPreview then Pz = EgtGroup(GDB_ID.ROOT,GDB_RT.LOC) -- nuovo pezzo else if not RC then Pz = EgtGetCurrPart() -- pezzo corrente end if not Pz then Pz = EgtGroup(GDB_ID.ROOT,GDB_RT.LOC) -- nuovo pezzo end end -- local Lg, Dm, Dor local Lg, Dm local sRequireCompoName Lg = EgtGroup(Pz,GDB_RT.LOC) -- layer della figura principale EgtSetName( Lg, sCompoName) if nDrawMach > 0 then -- se abilitata geometria lavorazione Dm = EgtGroup( Pz, GDB_RT.LOC) -- layer disegni cerchi rappresentante il diametro utensile EgtSetName( Dm, DM) end if ls then -- se latch strike lancio il componente standard sRequireCompoName = '_OverHeadArm' else sRequireCompoName = '_Latch' tOHArm.cl = cl tOHArm.invG = invG tOHArm.DY = -DY tOHArm.smr = 0 end if bMakeFaceGeom then -- riassegno alla tabelle eventuali valori modificati nei controlli tOHArm.L = L tOHArm.H = H tOHArm.T = T tOHArm.rf = R tOHArm.d = d tOHArm.p = p tOHArm.sf = sf tOHArm.d2 = d2 tOHArm.DS = DS tOHArm.OS = OS -- lancio il primo componente base MHgen = require( sRequireCompoName) nGeom1, nPkToJoin1, nAS1, nAS2, nIdSideBoxUp = MHgen.Draw( EC, EM, tOHArm, bPreview, bRunByCompo, nForceMakeFace, Pz, Lg, dThickDoor, 'OH') -- Clean corner if nDrawMach >= 0 then -- se abilitata geometria local CLC1 if CLC and clc and clc > 0 and clc < H and clc < L then CLC1 = MakeClcPath( clc, ccr, CLC, Lg, -T) if CLC1 then -- 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 or not ls then -- se spessore passante o in centro allo spessore sKeepMode = 'c' -- setto per mantenere il centro dello spessore end EgtSetInfo( CLC1, 'KeepBackSet', sKeepMode) end if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( CLC1, 'ProbeSide', '1') end EgtSetInfo( CLC1,'InserPoint' ,'Edge') -- setto una nota per indicare su che lato della porta deve essere spostato EgtSetInfo( CLC1,'DeltaPos' ,( L+(2*DS))) if ls then -- se latch string if OS <= 0 then -- se cava non aperta a destra -- angolo x+y- local CLC2 = EgtCopyGlob( CLC1, Lg) EgtRotate( CLC2, Point3d(0,0,0), Z_AX(), 180) EgtMove( CLC2, Point3d((L/2),-H,0) - ORIG()) -- muovo ulteriormente le geometrie EgtMove( CLC2, Point3d(-((L/2)+DS),0,0) - ORIG()) end if OS >= 0 then -- se cava non aperta a sinistra -- angolo x-y- EgtRotate( CLC1, Point3d(0,0,0), Z_AX(), 90) EgtMove( CLC1, Point3d(-(L/2),-H,0) - ORIG()) -- muovo ulteriormente le geometrie EgtMove( CLC1, Point3d(-((L/2)+DS),0,0) - ORIG()) else EgtErase(CLC1) end else -- altrimenti non latch strike if OS <= 0 then -- se cava non aperta a destra -- angolo x+y+ local CLC2 = EgtCopyGlob( CLC1, Lg) EgtRotate( CLC2, Point3d(0,0,0), Z_AX(), -90) EgtMove( CLC2, Point3d((L/2),(H/2),0) - ORIG()) -- angolo x+y- local CLC3 = EgtCopyGlob( CLC1, Lg) EgtRotate( CLC3, Point3d(0,0,0), Z_AX(), 180) EgtMove( CLC3, Point3d((L/2),-(H/2),0) - ORIG()) EgtMove( CLC2, Point3d(-((L/2)+DS),-(dThickDoor/2),0) - ORIG()) EgtMove( CLC3, Point3d(-((L/2)+DS),-(dThickDoor/2),0) - ORIG()) end if OS >= 0 then -- se cava non aperta a sinistra -- angolo x-y- local CLC4 = EgtCopyGlob( CLC1, Lg) EgtRotate( CLC4, Point3d(0,0,0), Z_AX(), 90) EgtMove( CLC4, Point3d(-(L/2),-(H/2),0) - ORIG()) -- angolo x-y+ EgtMove( CLC1, Point3d(-(L/2),(H/2),0) - ORIG()) -- muovo ulteriormente le geometrie EgtMove( CLC1, Point3d(-((L/2)+DS),-(dThickDoor/2),0) - ORIG()) EgtMove( CLC4, Point3d(-((L/2)+DS),-(dThickDoor/2),0) - ORIG()) else EgtErase(CLC1) end end end end end end if EC == 0 and nDrawMach >= 0 then if not bMakeFaceGeom then L = 0 end -- fori ( viti o passaggio filo elettrico) for k = 1, 4 do local D10 local IY10 local T10 local I10 local PX10 local PY10 local RP10 local EB10 local EBH10 local HB10 local AR10 local RCI10 if k == 1 then D10 = tExtraSHBore[k][1] T10 = tExtraSHBore[k][2] I10 = tExtraSHBore[k][3] PX10 = tExtraSHBore[k][4] PY10 = tExtraSHBore[k][5] EB10 = tExtraSHBore[k][6] HB10 = tExtraSHBore[k][7] else D10 = tExtraSHBore[k][1] IY10 = tExtraSHBore[k][2] T10 = tExtraSHBore[k][3] I10 = tExtraSHBore[k][4] PX10 = tExtraSHBore[k][5] PY10 = tExtraSHBore[k][6] RP10 = tExtraSHBore[k][7] EB10 = tExtraSHBore[k][8] EBH10 = tExtraSHBore[k][9] HB10 = tExtraSHBore[k][10] AR10 = tExtraSHBore[k][11] RCI10 = tExtraSHBore[k][12] end if dws and T10 and abs(T10) > ttp then T10 = ttp end if D10 and T10 and ( EB10 or EBH10) then if D10 > 0 and T10 ~= 0 and ( EB10 ~= '' or EBH10 ~= '') then if not IY10 then IY10 = 0 end if not I10 then I10 = 0 end if not PX10 then PX10 = 0 end if not PY10 then PY10 = 0 end if not AR10 then AR10 = 0 end local dInt10 = (I10/2) local dPosX10 = ( PX10 * EgtIf( sopp, 1, -1)) - ( (L/2) + DS) local dPosY10 = -PY10 if bEqualTh or not ls then -- dPosY10 = ( dPosY10 - (dThickDoor/2)) * fopp dPosY10 = ( dPosY10 - (dThickDoor/2)) end if abs(AR10) >= 360 then while abs(AR10) >= 360 do AR10 = AR10 + EgtIf( AR10 > 0, -360, 360) end end -- creo foro o asola con eventuale svuotatura a rampa MakeBoreOrButtoHole( Lg, bPreview, Dm, nDrawMach, IY10, EBH10, EB10, dPosX10, dInt10, D10, 0, dPosY10, T10, RP10, AR10, RCI10, kbs, bEqualTh, HB10, not(bEqualTh or not ls), dws, pbs) -- se l'interasse è valido if abs(I10) > GEO.EPS_SMALL then -- creo foro o asola con eventuale svuotatura a rampa MakeBoreOrButtoHole( Lg, bPreview, Dm, nDrawMach, IY10, EBH10, EB10, dPosX10, -dInt10, D10, 0, dPosY10, T10, RP10, AR10, RCI10, kbs, bEqualTh, HB10, not(bEqualTh or not ls), dws, pbs) end end end end -- Costruzione della geometria KEYWAY -- Extra bores Keyway for k = 1, 10 do local D10 = tExtraBore[k][1] local T10 = tExtraBore[k][2] local PX10 = tExtraBore[k][3] local PY10 = tExtraBore[k][4] local EB10 = tExtraBore[k][5] if not dws and T10 and abs(T10) > ttp then T10 = ttp end -- se dimensioni foro idonee if D10 and T10 and EB10 then if D10 > 0 and T10 ~= 0 and EB10 ~= '' then if not PX10 then PX10 = 0 end if not PY10 then PY10 = 0 end local dPosX10 = ( PX10 * EgtIf( sopp, 1, -1)) - ( (L/2) + DS) local dPosY10 = EgtIf( typ <= 2, EgtIf( DGD.Push, PY10, -(PY10 + dThickDoor)), EgtIf( DGD.Push, -(PY10 + dThickDoor), PY10)) local hint_13 = EgtCircle( Lg, Point3d( dPosX10, dPosY10, 0), D10/2, GDB_RT.LOC) EgtModifyCurveThickness( hint_13, -T10) EgtSetName( hint_13, EB10) EgtSetInfo( hint_13, 'SideDoor', 'Keyway') -- setto una nota per indicare su che lato della porta deve essere spostato if typ <= 2 then if DGD.Push then EgtRotate( hint_13, ORIG(), X_AX(), -90 ) -- ruoto in X per posizionarlo sullo spessore porta ( con swing RH) else EgtRotate( hint_13, Point3d( 0, -dThickDoor, 0), X_AX(), 90 ) -- ruoto in Y per posizionarlo isullo spessore porta ( con swing RHR) end else if DGD.Push then EgtRotate( hint_13, Point3d( 0, -dThickDoor, 0), X_AX(), 90 ) -- ruoto in X per posizionarlo sullo spessore porta ( con swing RH) else EgtRotate( hint_13, ORIG(), X_AX(), -90 ) -- ruoto in Y per posizionarlo isullo spessore porta ( con swing RHR) end end end end end -- Costruzione della geometria SECURE -- Extra bores Secure for k = 11, 20 do local D10 = tExtraBore[k][1] local T10 = tExtraBore[k][2] local PX10 = tExtraBore[k][3] local PY10 = tExtraBore[k][4] local EB10 = tExtraBore[k][5] if not dws and T10 and abs(T10) > ttp then T10 = ttp end -- se dimensioni foro serratura idonee if D10 and T10 and EB10 then if D10 > 0 and T10 ~= 0 and EB10 ~= '' then if not PX10 then PX10 = 0 end if not PY10 then PY10 = 0 end local dPosX10 = ( PX10 * EgtIf( sopp, 1, -1)) - ( (L/2) + DS) local dPosY10 = EgtIf( typ <= 2, EgtIf( DGD.Push, -(PY10 + dThickDoor), PY10), EgtIf( DGD.Push, PY10, -(PY10 + dThickDoor))) local hint_13 = EgtCircle( Lg, Point3d( dPosX10, dPosY10, 0), D10/2 , GDB_RT.LOC) EgtModifyCurveThickness( hint_13, -T10) EgtSetName( hint_13, EB10) EgtSetInfo( hint_13, 'SideDoor', 'Secure') -- setto una nota per indicare su che lato della porta deve essere spostato if typ <= 2 then if DGD.Push then EgtRotate( hint_13, Point3d( 0, -dThickDoor, 0), X_AX(), 90 ) -- ruoto in X per posizionarlo sullo spessore porta ( con swing RH) else EgtRotate( hint_13, ORIG(), X_AX(), -90 ) -- ruoto in Y per posizionarlo isullo spessore porta ( con swing RHR) end else if DGD.Push then EgtRotate( hint_13, ORIG(), X_AX(), -90 ) -- ruoto in X per posizionarlo sullo spessore porta ( con swing RH) else EgtRotate( hint_13, Point3d( 0, -dThickDoor, 0), X_AX(), 90 ) -- ruoto in Y per posizionarlo isullo spessore porta ( con swing RHR) end end end end end end --debug -- EgtSaveFile() -- EgtMove(DGD.PZ, Point3d(0,0,nil) - ORIG()) if not bPreview and EC == 0 then if bRunByCompo then -- scrivo i parametri nelle info del pezzo WriteCompoDataToPart(Pz,sCompoName,nCompoNpar) end -- scrivo note nel layer della cerniera EgtSetInfo(Lg,'Type' ,'OverHeadArm') EgtSetInfo(Lg,'Nome' ,sCompoName) EgtSetInfo(Lg,'L' ,L) EgtSetInfo(Lg,'H' ,H) EgtSetInfo(Lg,'T' ,T) EgtSetInfo(Lg,'R' ,R) EgtSetInfo(Lg,'clc' ,clc) EgtSetInfo(Lg,'ccr' ,ccr) EgtSetInfo(Lg,'d' ,d) EgtSetInfo(Lg,'p' ,p) EgtSetInfo(Lg,'sf' ,sf) EgtSetInfo(Lg,'ech' ,ech) EgtSetInfo(Lg,'ls' ,ls) EgtSetInfo(Lg,'bEqualTh' ,bEqualTh) EgtSetInfo(Lg,'DY' ,DY) EgtSetInfo(Lg,'d2' ,d2) EgtSetInfo(Lg,'DS' ,DS) EgtSetInfo(Lg,'OS' ,OS) EgtSetInfo(Lg,'kbs' ,kbs) EgtSetInfo(Lg,'pbs' ,pbs) EgtSetInfo(Lg,'est' ,est) EgtSetInfo(Lg,'fht' ,fht) EgtSetInfo(Lg,'fhb' ,fhb) EgtSetInfo(Lg,'sopp' ,sopp) EgtSetInfo(Lg,'fopp' ,fopp) EgtSetInfo(Lg,'dws' ,dws) EgtSetInfo(Lg,'dthd' ,dthd) EgtSetInfo(Lg,'ttp' ,ttp) EgtSetInfo(Lg,'LG' ,LG) EgtSetInfo(Lg,'LM' ,LM) EgtSetInfo(Lg,'LA' ,LA) EgtSetInfo(Lg,'CH' ,CH) EgtSetInfo(Lg,'CLC' ,CLC) EgtSetInfo(Lg,'InserPoint' ,'Edge') -- setto una nota per indicare su che lato della porta deve essere spostato EgtSetInfo(Lg,'DeltaPos' ,( L+(2*DS))) EgtSetInfo(Lg,'Path' ,sCompoPath) -- cancello le parti ausiliarie se disegnate if Dm then EgtErase( Dm) end elseif not bPreview then -- cancello le parti ausiliarie se disegnate if Dm then EgtErase( Dm) end end if EC == 0 and nCodAdj and nCodAdj < 0 then EC = nCodAdj EM = sCodAdj end return EC, EM, Lg, nTypeHdw end return OverHeadArm