cc55202ec5
- primo commit con versione corrente.
130 lines
4.4 KiB
Lua
130 lines
4.4 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
|
|
--
|
|
-- FaceDecoration.lua by EgalWare s.r.l. 2019.05.07
|
|
-- Autore: Filippo Monchi
|
|
-- FaceDecoration dati i valori 'Thickness' e 'face' e con nome attributo
|
|
|
|
-- 2019.05.07 V1.000 FM Write Component
|
|
-- 2019.09.24 V1.001 FM Manage side distance parameters (top, bottom, lock, hinge) from ddf
|
|
-- 2019.09.25 V1.002 FM Fix some error on calculate lines and rectangle position when diameter tool used
|
|
-- 2019.10.18 V2.000 FM Manage use Materials
|
|
-- 2019.10.18 V2.000 FM Manage to draw not premptive lines between premptive lines only if premptive lines are 2 and their start and stop
|
|
-- distances are defined and without or zero step value
|
|
-- 2022.07.27 V2.001 FM Modification to use compiled code
|
|
-- 2023.05.15 V2.002 FM fix errors (x/0) when exists only 1 horizontal line and/or only 1 vertical line and both distances ( from reference and opposite sides) are difined
|
|
-- 2024.03.04 V2.100 FM Manage Custom lua decoration, managed by external file (defined into .templ file as .luc extension)
|
|
|
|
-- Tavola per definizione modulo (serve ma non usata)
|
|
local FaceDecoration = {}
|
|
|
|
-- Intestazioni
|
|
require( 'EgtBase')
|
|
EgtEnableDebug( false)
|
|
|
|
-- per messaggi
|
|
-- EgtAddToPackagePath( EgtGetSourceDir() .. '?.lua')
|
|
EgtAddToPackagePath( DGD.BASEDIR .. '?.lua')
|
|
|
|
-- Funzione di sistemazione parametri
|
|
function FaceDecoration.AdjustParams( tMhPar)
|
|
|
|
local EgtDoorsMsg = require( 'EgtDoorsMsg')
|
|
local dNumMessage
|
|
local dNumLog = 0
|
|
local sMessToOut = ''
|
|
|
|
-- setto le variabili dimensioni porta
|
|
tMhPar.W = DGD.dW
|
|
tMhPar.L = DGD.dH
|
|
|
|
if string.lower(DGD.TYPE) == 'lines' then
|
|
|
|
tMhPar.type = 1 -- 1: lines, 2: rectangle, 3: custom
|
|
tMhPar.CGF = 'Fc_Lines.lua'
|
|
|
|
-- percorso custom
|
|
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
|
|
elseif not tMhPar.CGP then
|
|
tMhPar.CGP = DGD.BASEDIR .. 'LuaLibs\\'
|
|
end
|
|
elseif string.lower(DGD.TYPE) == 'rectangle' then
|
|
|
|
tMhPar.type = 2 -- 1: lines, 2: rectangle, 3: custom
|
|
tMhPar.CGF = 'FC_Rectangle.lua'
|
|
|
|
-- percorso custom
|
|
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
|
|
elseif not tMhPar.CGP then
|
|
tMhPar.CGP = DGD.BASEDIR .. 'LuaLibs\\'
|
|
end
|
|
else
|
|
|
|
tMhPar.type = 3 -- 1: lines, 2: rectangle, 3: custom
|
|
|
|
if not tMhPar.CGP then
|
|
tMhPar.CGP = tMhPar.ITP
|
|
end
|
|
|
|
-- percorso custom
|
|
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
|
|
end
|
|
|
|
-- verifico esiste il file
|
|
local sFilePath,sFileName,sFileExt = EgtSplitPath( string.lower(tMhPar.CGP..tMhPar.CGF))
|
|
|
|
if not EgtExistsFile( string.lower(tMhPar.CGP..tMhPar.CGF)) then-- provo con lua
|
|
dNumLog = 2745
|
|
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[411], tMhPar.CGP..tMhPar.CGF, DGD.FILE)
|
|
end
|
|
|
|
if dNumLog ~= 0 then
|
|
return tMhPar, dNumLog, sMessToOut
|
|
end
|
|
|
|
return tMhPar, 0, ''
|
|
end
|
|
|
|
-- Funzione di disegno
|
|
function FaceDecoration.Draw( tFDecorPar, bPreview, bRunByCompo, nDrawMach)
|
|
|
|
-- verifico esiste il file
|
|
local sFilePath, sFileName, sFileExt = EgtSplitPath( string.lower(tFDecorPar.CGP..tFDecorPar.CGF))
|
|
|
|
-- se file custom aggiungo la path
|
|
if tFDecorPar.type == 3 then
|
|
EgtAddToPackagePath( tFDecorPar.CGP .. '?.luc')
|
|
end
|
|
-- Lancio il componente base
|
|
local VLOgen = require( sFileName)
|
|
tFaceDecorPar, nCod, sCod = VLOgen.AdjustParams( tFaceDecorPar)
|
|
if nCod > 0 then
|
|
return nCod, sCod
|
|
else
|
|
tFaceDecorPar.nCod = nCod
|
|
tFaceDecorPar.sCod = sCod
|
|
end
|
|
return VLOgen.Draw( tFaceDecorPar, false, false, DGD.MachEn)
|
|
end
|
|
|
|
return FaceDecoration
|