cc55202ec5
- primo commit con versione corrente.
721 lines
24 KiB
Lua
721 lines
24 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
|
|
--
|
|
-- Viewer.lua by EgalWare s.r.l. 2016.07.05
|
|
-- Autore: Filippo Monchi
|
|
-- Spioncino
|
|
|
|
-- 2019.10.18 V2.000 FM Manage use Materials
|
|
-- 2020.04.29 V2.001 FM Update for aluminum material
|
|
-- 2021.11.24 V2.002 FM Manage side probe option if variable DGC.Pms > 2
|
|
-- 2022.07.20 V2.003 FM Use parameter .ITP (Internal Path) from template lua file instead of function EgtGetSourceDir(1)
|
|
-- 2022.07.27 V2.004 FM Modification to use compiled code
|
|
|
|
-- Tavola per definizione modulo (serve ma non usata)
|
|
local Viewer = {}
|
|
|
|
-- Intestazioni
|
|
require( 'EgtBase')
|
|
EgtEnableDebug( false)
|
|
|
|
-- per messaggi
|
|
-- EgtAddToPackagePath( EgtGetSourceDir() .. '?.lua')
|
|
EgtAddToPackagePath( DGD.BASEDIR .. '?.lua')
|
|
|
|
-- Funzione di sistemazione parametri
|
|
function Viewer.AdjustParams( tMhPar)
|
|
|
|
-- se porta steel o aluminum
|
|
if FindMaterial( DGD.Material, 'steel') or FindMaterial( DGD.Material, 'aluminum') then
|
|
tMhPar.est = true
|
|
else
|
|
tMhPar.est = nil
|
|
end
|
|
|
|
if tMhPar.T1 then
|
|
if tMhPar.T1 == -0.5 then
|
|
tMhPar.T1 = DGD.dT / 2
|
|
elseif tMhPar.T1 == -1 then
|
|
tMhPar.T1 = DGD.dT
|
|
end
|
|
end
|
|
|
|
if tMhPar.T2 then
|
|
if tMhPar.T2 == -0.5 then
|
|
tMhPar.T2 = DGD.dT / 2
|
|
elseif tMhPar.T2 == -1 then
|
|
tMhPar.T2 = DGD.dT
|
|
end
|
|
end
|
|
|
|
if tMhPar.T3 then
|
|
if tMhPar.T3 == -0.5 then
|
|
tMhPar.T3 = DGD.dT / 2
|
|
elseif tMhPar.T3 == -1 then
|
|
tMhPar.T3 = DGD.dT
|
|
end
|
|
end
|
|
|
|
if tMhPar.T4 then
|
|
if tMhPar.T4 == -0.5 then
|
|
tMhPar.T4 = DGD.dT / 2
|
|
elseif tMhPar.T4 == -1 then
|
|
tMhPar.T4 = DGD.dT
|
|
end
|
|
end
|
|
|
|
-- extra bores
|
|
if tMhPar.T10 then
|
|
if tMhPar.T10 == -0.5 then
|
|
tMhPar.T10 = DGD.dT / 2
|
|
elseif tMhPar.T10 == -1 or tMhPar.T10 > DGD.dT then
|
|
tMhPar.T10 = DGD.dT
|
|
end
|
|
end
|
|
|
|
if tMhPar.T11 then
|
|
if tMhPar.T11 == -0.5 then
|
|
tMhPar.T11 = DGD.dT / 2
|
|
elseif tMhPar.T11 == -1 or tMhPar.T11 > DGD.dT then
|
|
tMhPar.T11 = DGD.dT
|
|
end
|
|
end
|
|
|
|
if tMhPar.T12 then
|
|
if tMhPar.T12 == -0.5 then
|
|
tMhPar.T12 = DGD.dT / 2
|
|
elseif tMhPar.T12 == -1 or tMhPar.T12 > DGD.dT then
|
|
tMhPar.T12 = DGD.dT
|
|
end
|
|
end
|
|
|
|
if tMhPar.T13 then
|
|
if tMhPar.T13 == -0.5 then
|
|
tMhPar.T13 = DGD.dT / 2
|
|
elseif tMhPar.T13 == -1 or tMhPar.T13 > DGD.dT then
|
|
tMhPar.T13 = DGD.dT
|
|
end
|
|
end
|
|
|
|
if tMhPar.T14 then
|
|
if tMhPar.T14 == -0.5 then
|
|
tMhPar.T14 = DGD.dT / 2
|
|
elseif tMhPar.T14 == -1 or tMhPar.T14 > DGD.dT then
|
|
tMhPar.T14 = DGD.dT
|
|
end
|
|
end
|
|
|
|
if tMhPar.T15 then
|
|
if tMhPar.T15 == -0.5 then
|
|
tMhPar.T15 = DGD.dT / 2
|
|
elseif tMhPar.T15 == -1 or tMhPar.T15 > DGD.dT then
|
|
tMhPar.T15 = DGD.dT
|
|
end
|
|
end
|
|
|
|
if tMhPar.T16 then
|
|
if tMhPar.T16 == -0.5 then
|
|
tMhPar.T16 = DGD.dT / 2
|
|
elseif tMhPar.T16 == -1 or tMhPar.T16 > DGD.dT then
|
|
tMhPar.T16 = DGD.dT
|
|
end
|
|
end
|
|
|
|
if tMhPar.T17 then
|
|
if tMhPar.T17 == -0.5 then
|
|
tMhPar.T17 = DGD.dT / 2
|
|
elseif tMhPar.T17 == -1 or tMhPar.T17 > DGD.dT then
|
|
tMhPar.T17 = DGD.dT
|
|
end
|
|
end
|
|
|
|
if tMhPar.T18 then
|
|
if tMhPar.T18 == -0.5 then
|
|
tMhPar.T18 = DGD.dT / 2
|
|
elseif tMhPar.T18 == -1 or tMhPar.T18 > DGD.dT then
|
|
tMhPar.T18 = DGD.dT
|
|
end
|
|
end
|
|
|
|
if tMhPar.T19 then
|
|
if tMhPar.T19 == -0.5 then
|
|
tMhPar.T19 = DGD.dT / 2
|
|
elseif tMhPar.T19 == -1 or tMhPar.T19 > DGD.dT then
|
|
tMhPar.T19 = DGD.dT
|
|
end
|
|
end
|
|
|
|
if tMhPar.T20 then
|
|
if tMhPar.T20 == -0.5 then
|
|
tMhPar.T20 = DGD.dT / 2
|
|
elseif tMhPar.T20 == -1 or tMhPar.T20 > DGD.dT then
|
|
tMhPar.T20 = DGD.dT
|
|
end
|
|
end
|
|
|
|
if tMhPar.T21 then
|
|
if tMhPar.T21 == -0.5 then
|
|
tMhPar.T21 = DGD.dT / 2
|
|
elseif tMhPar.T21 == -1 or tMhPar.T21 > DGD.dT then
|
|
tMhPar.T21 = DGD.dT
|
|
end
|
|
end
|
|
|
|
if tMhPar.T22 then
|
|
if tMhPar.T22 == -0.5 then
|
|
tMhPar.T22 = DGD.dT / 2
|
|
elseif tMhPar.T22 == -1 or tMhPar.T22 > DGD.dT then
|
|
tMhPar.T22 = DGD.dT
|
|
end
|
|
end
|
|
|
|
if tMhPar.T23 then
|
|
if tMhPar.T23 == -0.5 then
|
|
tMhPar.T23 = DGD.dT / 2
|
|
elseif tMhPar.T23 == -1 or tMhPar.T23 > DGD.dT then
|
|
tMhPar.T23 = DGD.dT
|
|
end
|
|
end
|
|
|
|
if tMhPar.T24 then
|
|
if tMhPar.T24 == -0.5 then
|
|
tMhPar.T24 = DGD.dT / 2
|
|
elseif tMhPar.T24 == -1 or tMhPar.T24 > DGD.dT then
|
|
tMhPar.T24 = DGD.dT
|
|
end
|
|
end
|
|
|
|
if tMhPar.T25 then
|
|
if tMhPar.T25 == -0.5 then
|
|
tMhPar.T25 = DGD.dT / 2
|
|
elseif tMhPar.T25 == -1 or tMhPar.T25 > DGD.dT then
|
|
tMhPar.T25 = DGD.dT
|
|
end
|
|
end
|
|
|
|
if tMhPar.T26 then
|
|
if tMhPar.T26 == -0.5 then
|
|
tMhPar.T26 = DGD.dT / 2
|
|
elseif tMhPar.T26 == -1 or tMhPar.T26 > DGD.dT then
|
|
tMhPar.T26 = DGD.dT
|
|
end
|
|
end
|
|
|
|
if tMhPar.T27 then
|
|
if tMhPar.T27 == -0.5 then
|
|
tMhPar.T27 = DGD.dT / 2
|
|
elseif tMhPar.T27 == -1 or tMhPar.T27 > DGD.dT then
|
|
tMhPar.T27 = DGD.dT
|
|
end
|
|
end
|
|
|
|
if tMhPar.T28 then
|
|
if tMhPar.T28 == -0.5 then
|
|
tMhPar.T28 = DGD.dT / 2
|
|
elseif tMhPar.T28 == -1 or tMhPar.T28 > DGD.dT then
|
|
tMhPar.T28 = DGD.dT
|
|
end
|
|
end
|
|
|
|
if tMhPar.T29 then
|
|
if tMhPar.T29 == -0.5 then
|
|
tMhPar.T29 = DGD.dT / 2
|
|
elseif tMhPar.T29 == -1 or tMhPar.T29 > DGD.dT then
|
|
tMhPar.T29 = DGD.dT
|
|
end
|
|
end
|
|
|
|
-- percorso custom nge
|
|
if tMhPar.CGF and tMhPar.CGP then
|
|
if string.len(tMhPar.CGF) > 0 and string.len(tMhPar.CGP) == 0 then
|
|
tMhPar.CGP = tMhPar.ITP
|
|
end
|
|
end
|
|
|
|
return tMhPar
|
|
end
|
|
|
|
-- Funzione di disegno
|
|
function Viewer.Draw( tViwr, bPreview, bRunByCompo, nDrawMach)
|
|
|
|
local est = tViwr.est
|
|
|
|
-- Nome file custom geometry e percorso file da caricare
|
|
local CustGeomFile = tViwr.CGF or ''
|
|
local CustGeomPath = tViwr.CGP or ''
|
|
-- tabelle per i fori, rettangoli e linee opzionali
|
|
local tExtraBore = {}
|
|
-- Assegno le dimensioni geometrie KEYWAY
|
|
local D1 = tViwr.D1
|
|
local T1 = tViwr.T1
|
|
local ms = tViwr.ms
|
|
local D2 = tViwr.D2
|
|
local T2 = tViwr.T2
|
|
local I2 = tViwr.I2
|
|
local AV = tViwr.AV
|
|
local mc = tViwr.mc
|
|
-- inserimento dati nella tabella fori Keyway
|
|
table.insert( tExtraBore, { tViwr.D10, tViwr.T10, tViwr.PX10, tViwr.PY10, tViwr.EB10})
|
|
table.insert( tExtraBore, { tViwr.D11, tViwr.T11, tViwr.PX11, tViwr.PY11, tViwr.EB11})
|
|
table.insert( tExtraBore, { tViwr.D12, tViwr.T12, tViwr.PX12, tViwr.PY12, tViwr.EB12})
|
|
table.insert( tExtraBore, { tViwr.D13, tViwr.T13, tViwr.PX13, tViwr.PY13, tViwr.EB13})
|
|
table.insert( tExtraBore, { tViwr.D14, tViwr.T14, tViwr.PX14, tViwr.PY14, tViwr.EB14})
|
|
table.insert( tExtraBore, { tViwr.D15, tViwr.T15, tViwr.PX15, tViwr.PY15, tViwr.EB15})
|
|
table.insert( tExtraBore, { tViwr.D16, tViwr.T16, tViwr.PX16, tViwr.PY16, tViwr.EB16})
|
|
table.insert( tExtraBore, { tViwr.D17, tViwr.T17, tViwr.PX17, tViwr.PY17, tViwr.EB17})
|
|
table.insert( tExtraBore, { tViwr.D18, tViwr.T18, tViwr.PX18, tViwr.PY18, tViwr.EB18})
|
|
table.insert( tExtraBore, { tViwr.D19, tViwr.T19, tViwr.PX19, tViwr.PY19, tViwr.EB19})
|
|
-- Assegno le dimensioni geometrie SECURE
|
|
local D3 = tViwr.D3
|
|
local T3 = tViwr.T3
|
|
local msd = tViwr.msd
|
|
local D4 = tViwr.D4
|
|
local T4 = tViwr.T4
|
|
local I4 = tViwr.I4
|
|
local AVd = tViwr.AVd
|
|
local mcd = tViwr.mcd
|
|
-- inserimento dati nella tabella fori Secure
|
|
table.insert( tExtraBore, { tViwr.D20, tViwr.T20, tViwr.PX20, tViwr.PY20, tViwr.EB20})
|
|
table.insert( tExtraBore, { tViwr.D21, tViwr.T21, tViwr.PX21, tViwr.PY21, tViwr.EB21})
|
|
table.insert( tExtraBore, { tViwr.D22, tViwr.T22, tViwr.PX22, tViwr.PY22, tViwr.EB22})
|
|
table.insert( tExtraBore, { tViwr.D23, tViwr.T23, tViwr.PX23, tViwr.PY23, tViwr.EB23})
|
|
table.insert( tExtraBore, { tViwr.D24, tViwr.T24, tViwr.PX24, tViwr.PY24, tViwr.EB24})
|
|
table.insert( tExtraBore, { tViwr.D25, tViwr.T25, tViwr.PX25, tViwr.PY25, tViwr.EB25})
|
|
table.insert( tExtraBore, { tViwr.D26, tViwr.T26, tViwr.PX26, tViwr.PY26, tViwr.EB26})
|
|
table.insert( tExtraBore, { tViwr.D27, tViwr.T27, tViwr.PX27, tViwr.PY27, tViwr.EB27})
|
|
table.insert( tExtraBore, { tViwr.D28, tViwr.T28, tViwr.PX28, tViwr.PY28, tViwr.EB28})
|
|
table.insert( tExtraBore, { tViwr.D29, tViwr.T29, tViwr.PX29, tViwr.PY29, tViwr.EB29})
|
|
-- Assegno le label degli attributi porta KEYWAY
|
|
local LSU = tViwr.LSU
|
|
local SCU = tViwr.SCU
|
|
-- Assegno le label degli attributi porta SECURE
|
|
local LSD = tViwr.LSD
|
|
local SCD = tViwr.SCD
|
|
-- variabili per messaggi e settaggi vari
|
|
local sCompoName = tViwr.Nome
|
|
local nCompoNpar = tViwr.Npar
|
|
local sCompoPath = tViwr.Path
|
|
-- variabili per messaggi di errore
|
|
local sNamePar6 = tViwr.NPI2 or 'I2'
|
|
local sNamePar7 = tViwr.NPAV or 'Screw direction on KEYWAY side'
|
|
local sNamePar14 = tViwr.NPI4 or 'I4'
|
|
local sNamePar15 = tViwr.NPAVd or 'Screw direction on SECURE side'
|
|
|
|
-- RunByComponetInterface
|
|
local RC = true
|
|
-- Messaggi codice errori
|
|
local EM = ' '
|
|
local EC = 0
|
|
local ErrorBase = 1400
|
|
|
|
if not bRunByCompo then
|
|
RC = false
|
|
end
|
|
|
|
-- se non definita o parametri relativi alla definizione dei percorsi sono mancanti, la setto per non creare geometria di lavorazione
|
|
if not nDrawMach then
|
|
nDrawMach = 0
|
|
end
|
|
|
|
local EgtDoorsMsg = require( 'EgtDoorsMsg')
|
|
|
|
-- Verifica delle dimensioni, alcune condizioni vengono verificate solo se è abilitata la creazione dei percorsi di lavorazione
|
|
if ms and AV and ( AV < 0 or AV > 180) then
|
|
EC = 1
|
|
EM = string.format(EgtDoorsMsg[403],sNamePar7,AV,0,180, sCompoPath) -- il parametro 'AV' deve essere compreso tra
|
|
AV = 90
|
|
elseif msd and AVd and ( AVd < 0 or AVd > 180) then
|
|
EC = 2
|
|
EM = string.format(EgtDoorsMsg[403],sNamePar15,AVd,0,180, sCompoPath) -- il parametro 'AVd' deve essere compreso tra
|
|
AVd = 90
|
|
elseif ms and I2 and D1 and I2 <= D1 then -- se fori vite abilitati e interasse fori < diametro foro maniglia
|
|
EC = 3
|
|
EM = string.format(EgtDoorsMsg[420],sNamePar6,EgtToUiUnits(I2),EgtToUiUnits(D1), sCompoPath) -- il parametro interasse fori deve essere > del diametro foro spioncino
|
|
I2 = D1 + 10
|
|
elseif msd and D3 and I4 and I4 <= D3 then -- se fori vite abilitati e interasse fori < diametro foro maniglia
|
|
EC = 4
|
|
EM = string.format(EgtDoorsMsg[420],sNamePar33,EgtToUiUnits(I8),EgtToUiUnits(D7), sCompoPath) -- il parametro interasse fori deve essere > del diametro foro maniglia
|
|
I4 = D3 + 10
|
|
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
|
|
|
|
Lg = EgtGroup(Pz,GDB_RT.LOC) -- layer principale
|
|
EgtSetName(Lg,sCompoName)
|
|
|
|
local hint1, hint2, hint3, hint4, hint5 -- variabili entità geometriche
|
|
local hint, hint_2, hint_3 -- variabili percorsi
|
|
|
|
-- Gestione file custom
|
|
local MakeFaceGeom = true
|
|
|
|
-- caricamento del file custom
|
|
if string.len(CustGeomFile) > 0 and string.find( string.lower(CustGeomFile), '.nge') > 0 then
|
|
|
|
-- sostituisco il carattere '\' con '_' nel nome file
|
|
CustGeomFile = string.gsub(CustGeomFile, '\\', '_')
|
|
CustGeomFile = string.gsub(CustGeomFile, '/', '_')
|
|
-- concateno il file alla path
|
|
local sCustomPathFile = CustGeomPath..CustGeomFile
|
|
local nNewPart
|
|
local nNewLayer
|
|
local nNewEnt
|
|
local nTypeEnt
|
|
local sTypeInfo
|
|
local cColor
|
|
|
|
-- provo ad inserire
|
|
MakeFaceGeom = not EgtInsertFile( sCustomPathFile)
|
|
|
|
-- se fallito inserimento file dò un messaggio di errore
|
|
if MakeFaceGeom then
|
|
EC = ErrorBase + 10
|
|
EM = string.format( EgtDoorsMsg[457], sCustomPathFile)
|
|
else
|
|
|
|
nNewPart = EgtGetNext(Pz) -- nome nuovo pezzo
|
|
nNewLayer = EgtGetFirstInGroup( nNewPart) -- ottengo nuovo layer
|
|
|
|
-- riloco tutti i nuovi layer dal nuovo pezzo al pezzo corrente
|
|
while nNewLayer do
|
|
|
|
nNewEnt = EgtGetFirstInGroup( nNewLayer) -- ottengo nuova entità
|
|
|
|
while nNewEnt do
|
|
|
|
-- controllo se è un cerchio e se ha dei colori e le note giuste per cambiare lo spessore
|
|
nTypeEnt = EgtGetType( nNewEnt)
|
|
sTypeInfo = EgtGetInfo( nNewEnt, 'SideDoor')
|
|
cColor = EgtGetCalcColor( nNewEnt)
|
|
|
|
if sTypeInfo and cColor and DGD.dT then
|
|
if string.lower(sTypeInfo) == 'keyway' or string.lower(sTypeInfo) == 'secure' then
|
|
if AreSameColor(cColor,RED(),30) then -- se colore rosso allora spessore completo
|
|
EgtModifyCurveThickness(nNewEnt, -DGD.dT)
|
|
elseif AreSameColor(cColor,LIME(),30) then -- se colore verde allora metà spessore
|
|
EgtModifyCurveThickness(nNewEnt, -(DGD.dT/2))
|
|
-- se mantiene profondità e non è a spessore passante
|
|
if kbs and kbs > 1 then
|
|
EgtSetInfo( nNewEnt, 'KeepBackSet', 'x') -- setto 'x' provvisoriamente
|
|
end
|
|
if pbs and pbs > 1 then
|
|
if DGC.Pms and DGC.Pms > 2 then
|
|
EgtSetInfo( nNewEnt, 'ProbeSide', '1')
|
|
end
|
|
end
|
|
else -- altrimenti controllo che lo spessore non supera quello della porta, se lo supera lo setto = spessore porta
|
|
local dTh = EgtCurveThickness( nNewEnt)
|
|
if abs(dTh) > DGD.dT then
|
|
EgtModifyCurveThickness( nNewEnt, EgtIf( dTh > 0, DGD.dT, -DGD.dT))
|
|
elseif abs(dTh) < DGD.dT then
|
|
-- se mantiene profondità e non è a spessore passante
|
|
if kbs and kbs > 1 then
|
|
EgtSetInfo( nNewEnt, 'KeepBackSet', 'x') -- setto 'x' provvisoriamente
|
|
end
|
|
if pbs and pbs > 1 then
|
|
if DGC.Pms and DGC.Pms > 2 then
|
|
EgtSetInfo( nNewEnt, 'ProbeSide', '1')
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
elseif sTypeInfo and string.lower(sTypeInfo) == 'keyway' or string.lower(sTypeInfo) == 'secure' then
|
|
-- controllo che lo spessore non supera quello della porta, se lo supera lo setto = spessore porta
|
|
local dTh = EgtCurveThickness( nNewEnt)
|
|
if abs(dTh) > DGD.dT then
|
|
EgtModifyCurveThickness( nNewEnt, EgtIf( dTh > 0, DGD.dT, -DGD.dT))
|
|
elseif abs(dTh) < DGD.dT then
|
|
-- se mantiene profondità e non è a spessore passante
|
|
if kbs and kbs > 1 then
|
|
EgtSetInfo( nNewEnt, 'KeepBackSet', 'x') -- setto 'x' provvisoriamente
|
|
end
|
|
if pbs and pbs > 1 then
|
|
if DGC.Pms and DGC.Pms > 2 then
|
|
EgtSetInfo( nNewEnt, 'ProbeSide', '1')
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
EgtRelocateGlob( nNewEnt, Lg) -- riloco nel layer della serratura
|
|
nNewEnt = EgtGetFirstInGroup(nNewLayer)
|
|
end
|
|
nNewLayer = EgtGetNext(nNewLayer)
|
|
end
|
|
|
|
-- cancello il nuovo pezzo
|
|
EgtErase(nNewPart)
|
|
end
|
|
end
|
|
|
|
-- Costruzione della geometria KEYWAY
|
|
-- se dimensioni foro spioncino idonee
|
|
if D1 and T1 and LSU then
|
|
if D1 > 0 and T1 ~= 0 then
|
|
|
|
if not Lg then
|
|
Lg = EgtGroup(Pz,GDB_RT.LOC)
|
|
EgtSetName(Lg,sCompoName)
|
|
end
|
|
|
|
hint_1 = EgtCircle( Lg, Point3d(0,0,0), D1/2 , GDB_RT.LOC)
|
|
EgtModifyCurveThickness(hint_1, -T1)
|
|
EgtSetName(hint_1,LSU)
|
|
EgtSetInfo(hint_1,'SideDoor','Keyway') -- setto una nota per indicare su che lato della porta deve essere spostato
|
|
end
|
|
end
|
|
|
|
if ms then -- se devo fare le viti Keyway
|
|
|
|
if D2 and T2 and SCU then
|
|
|
|
-- se dimensioni foro vite idonee
|
|
if D2 > 0 and T2 ~= 0 then
|
|
|
|
if not Lg then
|
|
Lg = EgtGroup(Pz,GDB_RT.LOC)
|
|
EgtSetName(Lg,sCompoName)
|
|
end
|
|
|
|
if not I2 then
|
|
I2 = D1
|
|
end
|
|
|
|
hint_2 = EgtCircle( Lg, Point3d(-((I2/2) * sin(AV)),((I2/2) * cos(AV)),0), D2/2 , GDB_RT.LOC)
|
|
hint_3 = EgtCircle( Lg, Point3d(((I2/2) * sin(AV)),-((I2/2) * cos(AV)),0), D2/2 , GDB_RT.LOC)
|
|
EgtModifyCurveThickness(hint_2, -T2)
|
|
EgtModifyCurveThickness(hint_3, -T2)
|
|
EgtSetName(hint_2,SCU)
|
|
EgtSetName(hint_3,SCU)
|
|
EgtSetInfo(hint_2,'SideDoor','Keyway') -- setto una nota per indicare su che lato della porta deve essere spostato
|
|
EgtSetInfo(hint_3,'SideDoor','Keyway') -- setto una nota per indicare su che lato della porta deve essere spostato
|
|
|
|
if mc then -- se fori vite a croce
|
|
hint_2 = EgtCircle( Lg, Point3d(-((I2/2) * sin(AV+90)),((I2/2) * cos(AV+90)),0), D2/2 , GDB_RT.LOC)
|
|
hint_3 = EgtCircle( Lg, Point3d(((I2/2) * sin(AV+90)),-((I2/2) * cos(AV+90)),0), D2/2 , GDB_RT.LOC)
|
|
EgtModifyCurveThickness(hint_2, -T2)
|
|
EgtModifyCurveThickness(hint_3, -T2)
|
|
EgtSetName(hint_2,SCU)
|
|
EgtSetName(hint_3,SCU)
|
|
EgtSetInfo(hint_2,'SideDoor','Keyway') -- setto una nota per indicare su che lato della porta deve essere spostato
|
|
EgtSetInfo(hint_3,'SideDoor','Keyway') -- setto una nota per indicare su che lato della porta deve essere spostato
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- 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]
|
|
|
|
-- se dimensioni foro serratura idonee
|
|
if D10 and T10 and EB10 then
|
|
if D10 > 0 and T10 ~= 0 and EB10 ~= '' then
|
|
|
|
if not Lg then
|
|
Lg = EgtGroup(Pz,GDB_RT.LOC)
|
|
EgtSetName(Lg,sCompoName)
|
|
end
|
|
|
|
if not PX10 then
|
|
PX10 = 0
|
|
end
|
|
|
|
if not PY10 then
|
|
PY10 = 0
|
|
end
|
|
|
|
hint_3 = EgtCircle( Lg, Point3d(PX10,PY10,0), D10/2, GDB_RT.LOC)
|
|
EgtModifyCurveThickness(hint_3, -T10)
|
|
EgtSetName(hint_3,EB10)
|
|
EgtSetInfo(hint_3,'SideDoor','Keyway') -- setto una nota per indicare su che lato della porta deve essere spostato
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Costruzione della geometria lato Secure
|
|
-- se dimensioni foro spioncino idonee
|
|
if D3 and T3 and LSD then
|
|
if D3 > 0 and T3 ~= 0 then
|
|
|
|
if not Lg then
|
|
Lg = EgtGroup(Pz,GDB_RT.LOC)
|
|
EgtSetName(Lg,sCompoName)
|
|
end
|
|
|
|
hint_1 = EgtCircle( Lg, Point3d(0,0,0), D3/2 , GDB_RT.LOC)
|
|
EgtModifyCurveThickness(hint_1, -T3)
|
|
EgtSetName(hint_1,LSD)
|
|
EgtSetInfo(hint_1,'SideDoor','Secure') -- setto una nota per indicare su che lato della porta deve essere spostato
|
|
end
|
|
end
|
|
|
|
if msd then -- se devo fare le viti
|
|
|
|
-- se dimensioni foro vite idonee
|
|
if D4 and T4 and SCD then
|
|
if D4 > 0 and T4 ~= 0 then
|
|
|
|
if not Lg then
|
|
Lg = EgtGroup(Pz,GDB_RT.LOC) -- layer del foro serraura SECURE
|
|
EgtSetName(Lg,sCompoName)
|
|
end
|
|
|
|
if not I4 then
|
|
I4 = D3
|
|
end
|
|
|
|
hint_2 = EgtCircle( Lg, Point3d(-((I4/2) * sin(AVd)),((I4/2) * cos(AVd)),0), D4/2 , GDB_RT.LOC)
|
|
hint_3 = EgtCircle( Lg, Point3d(((I4/2) * sin(AVd)),-((I4/2) * cos(AVd)),0), D4/2 , GDB_RT.LOC)
|
|
EgtModifyCurveThickness(hint_2, -T4)
|
|
EgtModifyCurveThickness(hint_3, -T4)
|
|
EgtSetName(hint_2,SCD)
|
|
EgtSetName(hint_3,SCD)
|
|
EgtSetInfo(hint_2,'SideDoor','Secure') -- setto una nota per indicare su che lato della porta deve essere spostato
|
|
EgtSetInfo(hint_3,'SideDoor','Secure') -- setto una nota per indicare su che lato della porta deve essere spostato
|
|
|
|
if mcd then -- se fori vite a croce
|
|
hint_2 = EgtCircle( Lg, Point3d(-((I4/2) * sin(AVd+90)),((I4/2) * cos(AVd-90)),0), D4/2 , GDB_RT.LOC)
|
|
hint_3 = EgtCircle( Lg, Point3d(((I4/2) * sin(AVd+90)),-((I4/2) * cos(AVd-90)),0), D4/2 , GDB_RT.LOC)
|
|
EgtModifyCurveThickness(hint_2, -T4)
|
|
EgtModifyCurveThickness(hint_3, -T4)
|
|
EgtSetName(hint_2,SCD)
|
|
EgtSetName(hint_3,SCD)
|
|
EgtSetInfo(hint_2,'SideDoor','Secure') -- setto una nota per indicare su che lato della porta deve essere spostato
|
|
EgtSetInfo(hint_3,'SideDoor','Secure') -- setto una nota per indicare su che lato della porta deve essere spostato
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- 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]
|
|
|
|
-- se dimensioni foro serratura idonee
|
|
if D10 and T10 and EB10 then
|
|
if D10 > 0 and T10 ~= 0 and EB10 ~= '' then
|
|
|
|
if not Lg then
|
|
Lg = EgtGroup(Pz,GDB_RT.LOC)
|
|
EgtSetName(Lg,sCompoName)
|
|
end
|
|
|
|
if not PX10 then
|
|
PX10 = 0
|
|
end
|
|
|
|
if not PY10 then
|
|
PY10 = 0
|
|
end
|
|
|
|
hint_3 = EgtCircle( Lg, Point3d(PX10,-PY10,0), D10/2 , GDB_RT.LOC)
|
|
EgtModifyCurveThickness(hint_3, -T10)
|
|
EgtSetName(hint_3,EB10)
|
|
EgtSetInfo(hint_3,'SideDoor','Secure') -- setto una nota per indicare su che lato della porta deve essere spostato
|
|
end
|
|
end
|
|
end
|
|
|
|
-- cambio colore alla geometria
|
|
if bPreview then
|
|
if EC == 0 then
|
|
if Lg then
|
|
EgtSetColor(Lg,AQUA())
|
|
end
|
|
else
|
|
if Lg then
|
|
EgtSetColor(Lg,ORANGE())
|
|
end
|
|
end
|
|
else -- altrimenti non Preview
|
|
|
|
-- (NOTA : se ci sono errori il componente non viene eseguito dal programma di gestione dei componenti)
|
|
|
|
if bRunByCompo then
|
|
-- scrivo i parametri nelle info del pezzo
|
|
WriteCompoDataToPart(Pz,sCompoName,nCompoNpar)
|
|
end
|
|
|
|
-- scrivo note nel layer della cerniera
|
|
EgtSetInfo(Lg,'Type' ,'Viewer')
|
|
EgtSetInfo(Lg,'Nome' ,sCompoName)
|
|
|
|
EgtSetInfo(Lg,'D1' ,D1)
|
|
EgtSetInfo(Lg,'T1' ,T1)
|
|
EgtSetInfo(Lg,'ms' ,ms)
|
|
EgtSetInfo(Lg,'D2' ,D2)
|
|
EgtSetInfo(Lg,'T2' ,T2)
|
|
EgtSetInfo(Lg,'I2' ,I2)
|
|
EgtSetInfo(Lg,'AV' ,AV)
|
|
EgtSetInfo(Lg,'mc' ,mc)
|
|
|
|
EgtSetInfo(Lg,'D3' ,D3)
|
|
EgtSetInfo(Lg,'T3' ,T3)
|
|
EgtSetInfo(Lg,'msd' ,msd)
|
|
EgtSetInfo(Lg,'D4' ,D4)
|
|
EgtSetInfo(Lg,'T4' ,T4)
|
|
EgtSetInfo(Lg,'I4' ,I4)
|
|
EgtSetInfo(Lg,'AVd' ,AVd)
|
|
EgtSetInfo(Lg,'mcd' ,mcd)
|
|
EgtSetInfo(Lg,'est' ,est)
|
|
|
|
EgtSetInfo(Lg,'CustGeomFile' ,CustGeomFile)
|
|
EgtSetInfo(Lg,'CustGeomPath' ,CustGeomPath)
|
|
|
|
EgtSetInfo(Lg,'LSU' ,LSU)
|
|
EgtSetInfo(Lg,'SCU' ,SCU)
|
|
EgtSetInfo(Lg,'LSD' ,LSD)
|
|
EgtSetInfo(Lg,'SCD' ,SCD)
|
|
EgtSetInfo(Lg,'Path' ,sCompoPath)
|
|
end
|
|
|
|
return EC, EM, Lg
|
|
end
|
|
|
|
return Viewer
|