- inizio implementazione gestione hardware
This commit is contained in:
Vendored
+2
-1
@@ -103,7 +103,8 @@
|
||||
"EgtOutText",
|
||||
"EgtPause",
|
||||
"EgtRelocate",
|
||||
"WDG"
|
||||
"WDG",
|
||||
"EgtSplitString"
|
||||
],
|
||||
"Lua.diagnostics.disable": [
|
||||
"empty-block"
|
||||
|
||||
+5
-1
@@ -648,12 +648,16 @@ local nFillId = WinCreate.AddFill( nSashId, WIN_FILLTYPES.GLASS)
|
||||
-- local nCurrOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_SPLIT)
|
||||
-- WinLib.CreatePartFromOutline( nFrameLayerId, nCurrOutlineId)
|
||||
|
||||
-- aggiungo ferramenta
|
||||
WinCreate.AddHardware( nFrameId, '000544')
|
||||
|
||||
-- imposto se calcolare i solidi o meno
|
||||
WinCalculate.SetCalcSolid( true)
|
||||
|
||||
-- -- creo i pezzi
|
||||
WinCalculate.CreatePartFromArea( nFrameId)
|
||||
|
||||
WinCalculate.AddSplitDowelToParts( nFrameId)
|
||||
WinCalculate.AddHardware( nFrameId)
|
||||
|
||||
-- -- creo tabella per salvataggio
|
||||
-- local sSaveFilePath = 'c:\\Temp\\WindowTest1.txt'
|
||||
|
||||
@@ -233,5 +233,6 @@ WIN_DWL_BOTTOMHORIZONTALSPLITPARAEND = 'BottomHorizontalSplitParaEnd'
|
||||
WIN_DWL_HORIZONTALSPLITPERPSTART = 'HorizontalSplitPerpStart'
|
||||
WIN_DWL_HORIZONTALSPLITPERPEND = 'HorizontalSplitPerpEnd'
|
||||
|
||||
WIN_HDW_FAVOURITE = 'HdwFavourite'
|
||||
---------------------------------------------------------------------
|
||||
return WinConst
|
||||
|
||||
@@ -2074,5 +2074,125 @@ function WinCalculate.AssembleFrame()
|
||||
--EgtChangeGroupFrame( nRightPartId, frRight)
|
||||
end
|
||||
|
||||
|
||||
local function SearchSash( nAreaId, SashList)
|
||||
-- verifico il tipo
|
||||
local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i')
|
||||
if nAreaType == WIN_AREATYPES.SASH then
|
||||
-- calcolo il Box
|
||||
local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_OUTLINE)
|
||||
local b3Outline = EgtGetBBox( nOutlineLayerId, GDB_BB.STANDARD)
|
||||
table.insert( SashList, { nAreaId = nAreaId, ptCener = b3Outline:getCenter()})
|
||||
end
|
||||
-- verifico se ci sono sotto-aree
|
||||
local nChildAreaId = EgtGetFirstNameInGroup( nAreaId, WIN_AREA .. '*')
|
||||
while nChildAreaId do
|
||||
-- lancio costruzione pezzi di quell'area
|
||||
SearchSash( nChildAreaId, SashList)
|
||||
nChildAreaId = EgtGetNextName( nChildAreaId, WIN_AREA .. '*')
|
||||
end
|
||||
end
|
||||
|
||||
-- funzione che aggiunge l'hardware
|
||||
function WinCalculate.AddHardware( nFrameId)
|
||||
local nFavourite = EgtGetInfo( nFrameId, WIN_HDW_FAVOURITE)
|
||||
local sInputFile = 'a:\\InputBatch\\Input.txt'
|
||||
local sAGBOutputFile = 'C:\\AGB3000NG\\OutputBatch\\Output.txt'
|
||||
local sAGBOutputLavFile = 'C:\\AGB3000NG\\OutputBatch\\OutputLav.txt'
|
||||
local sOutputFile = 'a:\\OutputBatch\\Output.txt'
|
||||
local sOutputLavFile = 'a:\\OutputBatch\\OutputLav.txt'
|
||||
-- Apro file Input in scrittura
|
||||
local fhInput = io.open( sInputFile, 'w')
|
||||
if not fhInput then
|
||||
EgtOutLog( 'Error opening file ' .. sInputFile)
|
||||
return false
|
||||
end
|
||||
|
||||
local sText = 'OUTPUTKIT=' .. sAGBOutputFile .. '\n' ..
|
||||
'S_NAME=' .. nFavourite .. '\n' ..
|
||||
'RECORDID=15A' .. '\n' ..
|
||||
'HBB=' .. tostring( 1500) .. '\n' ..
|
||||
'LBB=' .. tostring( 900) .. '\n' ..
|
||||
'FINESTRAPORTAFINESTRA=Finestra' .. '\n' ..
|
||||
'Q=1' .. '\n' ..
|
||||
'MANOSERRAMENTO=Dx' .. '\n' ..
|
||||
'CNCOUTPUT=' .. sAGBOutputLavFile .. '\n' ..
|
||||
'RUN'
|
||||
|
||||
-- Scrittura nuova linea
|
||||
fhInput:write( sText .. '\n')
|
||||
|
||||
-- Chiudo file CNC
|
||||
fhInput:close()
|
||||
|
||||
-- attendo scrittura output
|
||||
local nWait = 0
|
||||
while not EgtExistsFile( sOutputFile) and nWait < 20 do
|
||||
nWait = nWait + 1
|
||||
EgtPause( 500)
|
||||
end
|
||||
|
||||
EgtPause( 500)
|
||||
|
||||
-- cerco ed indicizzo ante del serramento
|
||||
local SashList = {}
|
||||
SearchSash( nFrameId, SashList)
|
||||
-- ordino per X e Y
|
||||
local function compareXY(a,b)
|
||||
if abs( a.X - b.X) < GEO.EPS_SMALL then
|
||||
return a.Y < b.Y
|
||||
else
|
||||
return a.X < b.X
|
||||
end
|
||||
end
|
||||
table.sort(SashList, compareXY)
|
||||
|
||||
-- Apro file Output in scrittura
|
||||
local fhOutput = io.open( sOutputLavFile, 'r')
|
||||
if not fhOutput then
|
||||
EgtOutLog( 'Error opening file ' .. sOutputLavFile)
|
||||
return false
|
||||
end
|
||||
local sOutputLine = fhOutput:lines('l')
|
||||
for sMach in fhOutput:lines('l') do
|
||||
local MachParams = EgtSplitString( sMach, ';')
|
||||
local sPart = MachParams[3]
|
||||
local nSashIndex = MachParams[4]
|
||||
local sSashPart = MachParams[5]
|
||||
local dPosX = MachParams[6]
|
||||
local dPosY = MachParams[7]
|
||||
local dPosZ = MachParams[8]
|
||||
local sMacro = MachParams[9]
|
||||
local sSide = MachParams[21] -- FT1, FT2, FT3, FA1, FA2, FA3
|
||||
local sOrigin = MachParams[24] -- AB, BC, CD, DA
|
||||
|
||||
local nSashId = SashList[nSashIndex].nAreaId
|
||||
local nOutlineLayerId = EgtGetFirstNameInGroup( nSashId, WIN_OUTLINE)
|
||||
local vOutlineIds = EgtGetAllInGroup( nOutlineLayerId)
|
||||
local nA = string.byte('A')
|
||||
local nSashPart = string.byte(sSashPart)
|
||||
local nOutlineId = vOutlineIds[#vOutlineIds - (nSashPart - nA)]
|
||||
local nPartId = GDB_ID.NULL
|
||||
if sPart == 'TELAIO' then
|
||||
local nSashBaseOutlineId = EgtGetInfo( nOutlineId, WIN_COPY, 'i')
|
||||
local nSouId = EgtGetInfo( nOutlineId, WIN_SOU, 'i')
|
||||
local nSouAreaId = EgtGetParent( EgtGetParent( nSouId))
|
||||
local nSouAreaType = EgtGetInfo( nSouAreaId, WIN_AREATYPE, 'i')
|
||||
while nSouAreaType ~= WIN_AREATYPES.FRAME do
|
||||
nSouId = EgtGetInfo( nSouId, WIN_SOU, 'i')
|
||||
nSouAreaId = EgtGetParent( EgtGetParent( nSouId))
|
||||
nSouAreaType = EgtGetInfo( nSouAreaId, WIN_AREATYPE, 'i')
|
||||
end
|
||||
local nFrameOutlineId = EgtGetInfo( nSouId, WIN_COPY, 'i')
|
||||
nPartId = EgtGetInfo( nFrameOutlineId, WIN_REF_PART, 'i')
|
||||
elseif sPart == 'ANTA' then
|
||||
nPartId = EgtGetInfo( nOutlineId, WIN_REF_PART, 'i')
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
return WinCalculate
|
||||
|
||||
@@ -482,5 +482,9 @@ function WinCreate.AddBottomRail( nAreaId)
|
||||
end
|
||||
end
|
||||
|
||||
function WinCreate.AddHardware( nFrameId, sFavourite)
|
||||
EgtSetInfo( nFrameId, WIN_HDW_FAVOURITE, sFavourite )
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
return WinCreate
|
||||
|
||||
Reference in New Issue
Block a user