0613fa0df6
- modifiche per consentire di inserire ConeCleanCorner in sfinestrature da disegno (dare nome opportuno tipicamente ConeCleanCorner, aggiungere info ConeCleanCorner=1, ActiveStopMach=1 e SetMaxElev=1, la quota 0 di queste geometrie viene portata al filo sotto della porta).
7545 lines
386 KiB
Lua
7545 lines
386 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
|
|
--
|
|
-- Machining_3v3.lua by EgalWare s.r.l. 2019.02.05
|
|
-- Autore: Filippo Monchi
|
|
-- Machining generation for Doors program machine Multiax NE
|
|
-- New mode to manage properties and manage materials, manage 2 tables
|
|
|
|
-- 2017.06.05 V1.011 DS Fix main cycle at 10 times
|
|
-- 2017.06.13 V1.012 FM Manage machining optimization
|
|
-- 2017.06.13 V1.012 FM Fix bug on calculate box and row piece
|
|
-- 2017.06.30 V1.013 FM Manage optimization and assignement of more paths to one machining
|
|
-- 2017.11.17 V1.014 FM Add manage parameter dExtraThruDepth from CurrCamInfo for functions AdjustThrouIsle and AdjustVertHole
|
|
-- 2018.02.26 V1.0b1 FM Manage piece dimension checking
|
|
-- 2018.03.01 V1.0b2 FM use a table tMainTabPar instead of many variables ( more than 200 variables)
|
|
-- 2018.03.22 V1.0b3 FM Manage checking effective lock/hinge side machining and adjust the second disposition. Before not recognize if
|
|
-- lock/hinge side was machined or not in 1st phase
|
|
-- 2018.03.23 V1.0b4 FM Manage parameter for probe extra Z position and adjust probe error values
|
|
-- 2018.03.23 V1.0b4 FM Fix problem on second phase disposition by side path notes
|
|
-- 2018.05.04 V1.0b5 FM Fix write 2nd phase disposition notes when first phase is empty and substitute by second phase
|
|
-- 2018.05.09 V1.0b6 FM Fix error message on vacuums disposition
|
|
-- 2018.05.09 V1.0b6 FM Calculate the solid box without extra surfaces
|
|
-- 2018.06.18 V1.0b7 FM Manage door in probe mode and rebuilded
|
|
-- 2018.06.22 V1.0b8 FM Manage second phase on rebuilded door and fix some bugs
|
|
-- 2018.06.26 V1.0b9 FM Manage to use 2 bars with small width door
|
|
-- 2018.06.27 V1.0c1 FM write note about number of probez geometries and if generate one of their machinings
|
|
-- 2018.07.17 V1.0c2 FM Manage vacuum disposition: in case it uses only 2 bars use the vacuum for 3rd bar on 2nd bar
|
|
-- 2018.07.24 V1.0d1 FM Read Properties (start managing properties)
|
|
-- 2018.08.22 V1.0d2 FM Fix error on calculare roughing on bevel side profiles
|
|
-- 2018.08.29 V1.0d3 FM Manage Arc Vacuum for top arc doors
|
|
-- 2018.08.31 V1.0d4 ES Manage door with property 'narrowstile' (force door position like frame position, force to use smaller vacuum on 1st ad 3rd bars )
|
|
-- 2018.08.31 V1.0d5 ES Manage jamb position by parameter MachineJambsTogether from CurrCamInfo.lua
|
|
-- 2018.10.17 V1.0d6 FM Fix error on Manage vacuum disposition: in case it uses only 2 bars use the vacuum for 3rd bar on 2nd bar
|
|
-- 2019.01.10 V1.0d7 FM Manage assignement of dMinDistGroup variable from CurrCamInfo.lua file (by optional variable dMinDistBetweenBars)
|
|
-- 2019.01.11 V1.0d8 FM Manage better group note Mach2nd to fix a problem of double machining (on 1st and 2nd phase) of same geometries into same group
|
|
-- 2019.01.14 V1.0d9 FM Manage new CurrCamInfo parameter (nGenCncAsDdfName) to set
|
|
-- which name use to generate the cnc file (by default as ddf file name)
|
|
-- 2019.01.18 V1.0e1 FM Remove empty phase (after the first one)
|
|
-- 2019.01.21 V1.0e2 FM if machine can work underneath (by bWorkUnder) and fail to machine thru drill,
|
|
-- try to apply also the underneath machining (If present into Mtable)
|
|
-- 2019.01.23 V1.0d8 FM Not generate machining on Group 0 (of MTable ordered table) and print warning message into repot files.
|
|
-- 2019.01.31 V1.0d9 FM Move on CurrCamInfo file the vacuums data definition: point name on bars, name vacuum type, name vacuum type with lifter
|
|
-- radius to apply on any type of vacuum
|
|
-- 2019.02.01 V2.001 FM Change version by Egtcam5 new version
|
|
-- 2019.02.01 V2.002 FM Manage 3 kind of vacuums for bar 1 and bar3 (on bar 2 only 1 type)
|
|
-- 2019.02.01 V2.002 FM Rewrite function CalcDispositionSubPieces to manage better information of vacuums type (by use table of tables ttBaseDataVac)
|
|
-- 2019.02.04 V2.003 FM Define version 2 to indentificate the new mode to calculate vacuums: Machining_3v2.lua
|
|
-- 2019.02.04 V2.004 FM Manage new Egt function to calculate vacuums position (that use region defined into vacuum nge file)
|
|
-- 2019.02.08 V2.005 FM Fix bug into CalcDispositionSubPieces when it's missing a vacuum lock point on nge machien table, and print a log message too
|
|
-- 2019.02.18 V2.006 FM Manage better bar position and calculate better the bars position according by overmaterial
|
|
-- 2019.02.19 V2.007 FM Manage check door/jamb dimension by function CheckPieceDimension
|
|
-- 2019.02.25 V2.008 FM Fix error on calculation bar disposition and menage better into CheckPieceDimension by shift door values
|
|
-- 2019.02.25 V2.008 FM Modify error messages format into CheckPieceDimension
|
|
-- 2019.03.22 V2.009 FM Change % values of middle bar into function CheckEnoughVacuums
|
|
-- 2019.03.27 V2.00a FM Manage estimate time
|
|
-- 2019.03.29 V2.00b FM Manage Edge break (EB) and Bevel Edge break (BVEB) profiles
|
|
-- 2019.04.08 V2.00c FM Manage Blade groove machinings with lead-in lead-out to reduce MTABLE lines
|
|
-- Now it uses 1 line for antisplint blade and 1 line for normal blade
|
|
-- 2019.04.08 V2.00c FM Manage Blade groove function AdjustBladeVertCurve
|
|
-- 2019.04.11 V2.00d FM Manage special arc vacuum disposition as standard vacuum check (that use vacuum region) by function InsertSpecialSubPiece
|
|
-- 2019.05.28 V2.00e FM Fix problem on update all machining after reorder, now use EgtApplyAllMachinings instead of EgtUpdateAllMachinings
|
|
-- 2019.07.02 V2.00f FM Fix error on AdjustProbeHole section, if its machining is not present into MTable it cause the flip door on 2nd phase
|
|
-- 2019.07.09 V2.010 FM On Vacuum disposition now it consider also the external rectangular region of bottom face into StartVacVerify,
|
|
-- ExecVacVerify, ExecVacShapeVerify, EndVacVerify. it uses the new CurrCamInfo dSafetyDistVacSide and
|
|
-- dArcSafetyDistVacSide variables to compare the vacuum distance to external side path
|
|
-- 2019.07.09 V2.010 FM Disable re-calculate bars position on 2nd phase (and next phases)
|
|
-- 2019.07.09 V2.010 FM On 1st Mtable scan modify the condition about shifted door, before it skip also by narrow style door (because it results shifted door),
|
|
-- Now it skip olny shifted doors but not in case the door is narrow stile
|
|
-- 2019.07.09 V2.010 FM Modify the % of not disposed vacuum on middle bar, now is 55%.
|
|
-- When external bar have enough vacuums, the middle bar can accept less vacuums
|
|
-- 2019.07.09 V2.010 FM Insert Arc Vacuum also in case on the bar is admitted only 1 vacuum type (arc vacuum is a special vacuum that has another code)
|
|
-- 2019.07.17 V2.011 FM Add Tolerance on horizontal drill by GangDrill: add nProbeMode variable to AdjustHorizDrillX and AdjustHorizDrillY function call
|
|
-- 2019.07.18 V2.012 FM Manage better the rare case to invert a single thru path (machining on top) if all others paths are machined in second phase
|
|
-- and the opposite case ( a single thru path machine on bottom and all other paths machined fist phase). near line 2296
|
|
-- 2019.09.12 V2.013 FM Manage machine with 2 or more tables
|
|
-- 2019.09.16 V2.014 FM Manage properties definition into CurrDoorCustomData (as DGC. variables), and his identification into Main, stop here.
|
|
-- 2019.09.16 V2.014 FM Stop Manage properties definition into CurrDoorCustomData (as DGC. variables), and his identification into Main
|
|
-- 2019.10.17 V2.015 FM New Managing of materials (steel) and properties
|
|
-- 2019.10.17 V2.016 FM Add note into piece of table used
|
|
-- 2019.10.24 V2.017 FM Add blind geometries (made by components) into blind group
|
|
-- 2019.11.12 V2.018 FM Manage disposition of Top Chamfer shape by using 3 number code (1st for top rectangle, 2nd for top arc, 3rd for top angle)
|
|
-- 2019.11.14 V2.014 FM Manage door resize machining, only on sides not at reference
|
|
-- 2019.11.27 V2.015 FM Write new error message into log file if vacuum model are too old and without region (into ExecVacShapeVerify function)
|
|
-- 2019.12.03 V2.016 FM Basic collision detection for underneath aggregate with references
|
|
-- include Reference Disposition on table (it need references data into CurrCamInfo)
|
|
-- 2020.06.05 V2.020 FM Manage aluminum doors and frame disposition on narrow side and wide side
|
|
-- 2020.06.11 V2.021 FM Manage number pods on any bars by CurrCamInfo variable ( tMainTabPar.NTVR)
|
|
-- 2020.06.25 V2.021 FM Check better if table is set right (and show error message when happen error)
|
|
-- 2020.07.02 V2.022 FM Manage clamp subpieces with jambs ( only with single jamb on first bar)
|
|
-- 2020.10.02 V2.023 FM Manage frame disposition head by new CurrCamInfo parameter FrameTopSideDriveDisp
|
|
-- 2020.10.14 V2.024 FM Set Piece Type info for machine post pprocessor (mlpe)
|
|
-- 2020.11.03 V2.025 FM Extend values of CurrCamInfo FrameTopSideDriveDisp parameter to customize the header (frame top) disposition
|
|
-- 2021.04.06 V2.100 FM Now int ExecVacShapeVerify function it search double pod region (1st is standard region as before, 2nd one region is for blind geometries)
|
|
-- The 2nd region is bigger than 1st region and could be equal or bigger than base pod area
|
|
-- 2021.05.03 V2.101 FM Manage simulation in background to verify collisions, if something collide, not generate CNC program
|
|
-- 2021.05.04 V2.102 FM Manage new CurrCamInfo parameter (nDisableAutoCncName) to disable the automatic cnc name composed when generate cnc by GENERATE button
|
|
-- to have always the same cnc file name
|
|
-- 2021.05.20 V2.103 FM Manage new CurrCamInfo parameter (EnableCollisionDetect) to enable/disable the collision detect
|
|
-- 2021.05.24 V2.104 FM Add the CurrCamInfo machine name as a note
|
|
-- 2021.07.23 V2.105 FM Fix error on not return to Machining.lua the variable nNumGroup
|
|
-- 2021.10.28 V2.106 FM Fix internal error when calculate Box with STANDARD parameter, now it uses EXACT parameter
|
|
-- 2021.11.23 V2.107 FM Manage option side probing. Expand function number of CurrDoorCustomData DGC.Pms: 3 side probe on all hardware (for NE machines) ;
|
|
-- 4: side probe on all hardware except hardware on hinge side (for machines with shuttles)
|
|
-- 2022.01.17 V2.108 FM Manage Split door cut by new CurrCamInfo parameter sCutDirectionAdmitted: = 'H' for cut along door Height;
|
|
-- = 'W' for cut along door Width
|
|
-- 2022.01.18 V2.109 FM Manage rectangle CutOut clean corners by cone tool on tilting aggregate and generate machine stop before execute these machinings
|
|
-- 2022.05.03 V2.110 FM Use EgtNumToString function instead of tostring
|
|
-- 2022.07.06 V2.111 FM Fix error ino machining section on not check if exists the new path nNewIdEnt
|
|
-- 2022.11.15 V2.112 FM Manage side groove region as throu path and not as blind region
|
|
-- 2022.07.27 V2.114 FM Modification to use compiled code
|
|
-- 2023.01.20 V2.115 FM Manage vacuums with custom type number
|
|
-- 2023.03.07 V2.116 FM Fix error on manage region into StartVacVerify function
|
|
-- 2023.03.29 V2.117 FM Fix error on calculate rough paths on Convex profile
|
|
-- 2023.03.31 V2.118 FM Manage offsetted path ( by path note) to extra path of Convex profile
|
|
-- 2023.04.03 V2.119 FM Manage Scrap piece removing
|
|
-- 2023.05.12 V2.120 FM Manage virtual milling option into collision avoid check
|
|
-- 2023.05.24 V2.121 FM Manage by new function AdjustVertAsOnHeads to modify anti split paths (of door heads) to be vertical on bevelled sides
|
|
-- 2023.05.26 V2.122 FM Manage new CurrCamInfo parameter ExportTableView to export 3d table view ( disposed door + table) with html format
|
|
-- or export piece view with png format
|
|
-- 2023.12.01 V2.123 FM Manage small planes on Convex profile
|
|
-- 2024.03.11 V2.124 FM Add to piece the further info (from CurrCamInfo): dAltRef, dTallRef
|
|
-- 2024.03.14 V2.125 FM Manage new CurrCamInfo parameter dMaxPosMobBar to check if 2nd bar position not go over than max value
|
|
-- 2024.06.19 V2.126 FM Manage new DGD.GHT to let with suffix '_HIDE' ( or '_2HIDE' to manage the machining geometries on different machines (like Five lakes machines))
|
|
-- 2024.12.03 V2.127 FM Fix error on checking the machining BBox3d, now also add :isEmpty()
|
|
-- 2024.12.20 V2.128 FM Change error numbers ( used into main.lua): 26 -> 34, 28 -> 35
|
|
|
|
-- Intestazioni
|
|
require( 'EgtBase')
|
|
_ENV = EgtProtectGlobal()
|
|
EgtEnableDebug( false)
|
|
|
|
local MachiningLoc = {}
|
|
|
|
-- Librerie particolari
|
|
local sBaseDir = DGD.BASEDIR -- EgtGetSourceDir()
|
|
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
|
|
require( 'EgtDoorsBase')
|
|
require( 'EgtDoorsData')
|
|
local EgtDoorsMsg = require( 'EgtDoorsMsg')
|
|
local MB = require( 'MachiningBase')
|
|
|
|
-- Impostazioni Cam per consentire forature con utensile più piccolo
|
|
EgtMdbSetGeneralParam( MCH_GP.HOLEDIAMTOLER, -50)
|
|
EgtMdbSave()
|
|
|
|
----------------- SETTAGGI -------------------------------------------------
|
|
-- Definizione disposizione pezzi ( a sinistra : 1, a destra : -1)
|
|
local DISPMODE = -1
|
|
-- Variabile distanza minima tra pezzo finito e ventosa (in X)
|
|
local DIST_MIN_VAC = 5.5
|
|
-- variabile numero tavole utilizzate (al momento utilizzata solo per smistare differenti materiali di porta)
|
|
local NUMTABLE = 1
|
|
|
|
----------------- COSTANTI -------------------------------------------------
|
|
-- Definizione possibilità di lavorare sottosquadra nei profili bevel ( true: non lavora sottosquadra, false: possibile lavorare sottosquadra)
|
|
local NO_WORK_UNDERSQUARE = false
|
|
-- Definizione possibilità di lavorare soprasquadra nei profili bevel ( true: non lavora soprasquadra, false: possibile lavorare soprasquadra)
|
|
local NO_WORK_UPSQUARE = true
|
|
-- variabili genarazione lavorazioni
|
|
local GEN_MACH = false
|
|
local NOT_GEN_MACH = true
|
|
---------------- VARIABILI GLOBALI -----------------------------------------
|
|
-- variabili disposizione porta
|
|
local bPush
|
|
local bFlip
|
|
local bNoVertProf = false -- true: for 5 axif head, leave not vertical path (like bevel) false: for 4 axis head, modify not vertical path to vertical
|
|
local bWorkUnder = true
|
|
|
|
-----------------------------------------------------------------
|
|
-- *** Error write file ***
|
|
-----------------------------------------------------------------
|
|
local function WriteErrFile( sFileErr, sDispMsg)
|
|
local nIdFile = io.open( sFileErr, 'w')
|
|
if nIdFile then
|
|
if DGD.ERR == 0 then
|
|
if DGD.ERM and #DGD.ERM > 0 then
|
|
nIdFile:write( 'Err=' .. EgtNumToString( DGD.ERR, 0) .. '\n' .. DGD.ERM)
|
|
else
|
|
nIdFile:write( 'Err=' .. EgtNumToString( DGD.ERR, 0))
|
|
end
|
|
else
|
|
if DGD.EMC and #DGD.EMC > 0 then
|
|
nIdFile:write( 'Err=' .. EgtNumToString( DGD.ERR, 0) .. DGD.EMC)
|
|
else
|
|
nIdFile:write( 'Err=' .. EgtNumToString( DGD.ERR, 0))
|
|
end
|
|
end
|
|
if sDispMsg and #sDispMsg > 0 then
|
|
nIdFile:write('\n' .. sDispMsg)
|
|
end
|
|
nIdFile:close()
|
|
end
|
|
end
|
|
|
|
local function GetChoice()
|
|
|
|
local sChoice = 'CB:'
|
|
sChoice = sChoice .. '1 : Top on Right' .. ',' .. '2 : Top on Left'
|
|
local sChose
|
|
local tChose = EgtDialogBox( 'Set Header Disposition', { 'Header Top dispose on: ', sChoice })
|
|
|
|
if tChose then
|
|
sChose = tChose[1]
|
|
else
|
|
return
|
|
end
|
|
|
|
if sChose then
|
|
local PosComm = sChose:find('1', 1, true)
|
|
if PosComm and PosComm == 1 then
|
|
return true
|
|
else
|
|
return false
|
|
end
|
|
else
|
|
return
|
|
end
|
|
end
|
|
|
|
-----------------------------------------------------------------
|
|
-- *** calculate door disposition by parameters ***
|
|
-----------------------------------------------------------------
|
|
local function CalcTopPosition( nTopSideDriveDisp, bAtRight, dTopRadius, dTopAngle, sFrameName)
|
|
local bTopOnRight
|
|
|
|
-- controllo se la variabile ha la tripla cifra
|
|
if nTopSideDriveDisp and nTopSideDriveDisp > 100 then
|
|
-- se porta ad angolo
|
|
if dTopAngle then
|
|
-- guardo la cifra meno significativa
|
|
nTopSideDriveDisp = nTopSideDriveDisp - 100
|
|
if nTopSideDriveDisp > 100 then
|
|
nTopSideDriveDisp = nTopSideDriveDisp - 100
|
|
end
|
|
nTopSideDriveDisp = nTopSideDriveDisp - 10
|
|
if nTopSideDriveDisp > 10 then
|
|
nTopSideDriveDisp = nTopSideDriveDisp - 10
|
|
end
|
|
if nTopSideDriveDisp == 1 then
|
|
bTopOnRight = true
|
|
else
|
|
bTopOnRight = false
|
|
end
|
|
elseif dTopRadius then -- altrimenti se è una porta ad arco
|
|
-- guardo la seconda cifra meno significativa
|
|
nTopSideDriveDisp = nTopSideDriveDisp - 100
|
|
if nTopSideDriveDisp > 100 then
|
|
nTopSideDriveDisp = nTopSideDriveDisp - 100
|
|
end
|
|
if nTopSideDriveDisp >= 20 then
|
|
bTopOnRight = false
|
|
else
|
|
bTopOnRight = true
|
|
end
|
|
else -- altrimenti è rettangolare
|
|
if nTopSideDriveDisp >= 200 then
|
|
bTopOnRight = false
|
|
else
|
|
bTopOnRight = true
|
|
end
|
|
end
|
|
-- controllo se la variabile ha la doppia cifra
|
|
elseif nTopSideDriveDisp and nTopSideDriveDisp > 10 then
|
|
-- se porta ad arco o ad angolo
|
|
if dTopRadius or dTopAngle then
|
|
-- guardo la cifra meno significativa
|
|
nTopSideDriveDisp = nTopSideDriveDisp - 10
|
|
if nTopSideDriveDisp > 10 then
|
|
nTopSideDriveDisp = nTopSideDriveDisp - 10
|
|
end
|
|
if nTopSideDriveDisp == 1 then
|
|
bTopOnRight = true
|
|
else
|
|
bTopOnRight = false
|
|
end
|
|
else -- altrimenti porta rettangolare
|
|
|
|
-- Nel caso della disposizione frame, se è il frame top (header) e ho la cifra più significativa == 1 ( quindi valori 11 o 12)
|
|
-- allora lancio una richiesta di input all'utente.
|
|
-- Se frame top e parametro coerende con disposizione personalizzata
|
|
if sFrameName == 'frametop' and nTopSideDriveDisp >= 10 and nTopSideDriveDisp < 20 then
|
|
-- lancio richiesta input utente
|
|
bTopOnRight = GetChoice()
|
|
-- se restituisce nill, scelgo il vecchio metodo
|
|
if bTopOnRight == nil then
|
|
if bAtRight then -- se serratura a destra
|
|
bTopOnRight = true
|
|
else
|
|
bTopOnRight = false
|
|
end
|
|
end
|
|
elseif nTopSideDriveDisp >= 20 then -- altrimenti se non è un frame mi baso sulla cifra più significativa
|
|
-- guardo la cifra più significativa
|
|
if nTopSideDriveDisp >= 20 then
|
|
bTopOnRight = false
|
|
else
|
|
bTopOnRight = true
|
|
end
|
|
-- negli altri casi considero la cifra meno significatica
|
|
else
|
|
-- riduco ad una sola cifra
|
|
repeat
|
|
if nTopSideDriveDisp >= 10 then
|
|
nTopSideDriveDisp = nTopSideDriveDisp -10
|
|
end
|
|
until nTopSideDriveDisp < 10
|
|
if nTopSideDriveDisp == 2 then
|
|
bTopOnRight = false
|
|
else
|
|
bTopOnRight = true
|
|
end
|
|
end
|
|
end
|
|
-- ha cifra singola: non si fanno distinzioni tra porte ad arco o ad angolo o normali
|
|
elseif nTopSideDriveDisp then
|
|
if nTopSideDriveDisp == 1 then
|
|
bTopOnRight = true
|
|
else
|
|
bTopOnRight = false
|
|
end
|
|
else
|
|
if bAtRight then -- se serratura a destra
|
|
bTopOnRight = true
|
|
else
|
|
bTopOnRight = false
|
|
end
|
|
end
|
|
|
|
return bTopOnRight
|
|
end
|
|
|
|
-----------------------------------------------------------------
|
|
-- *** Add Machining in table for second part ***
|
|
-----------------------------------------------------------------
|
|
local function AddMachIntable( MTMachLine, tSecMcng, nIndexTab)
|
|
|
|
if tSecMcng then
|
|
|
|
if #tSecMcng > 0 then
|
|
|
|
local bFound = false
|
|
MTMachLine.Row = nIndexTab
|
|
|
|
for k = 1, #tSecMcng do
|
|
if MTMachLine == tSecMcng[k] then
|
|
bFound = true
|
|
end
|
|
end
|
|
|
|
-- se non trovato lo inserisco
|
|
if not bFound then
|
|
table.insert( tSecMcng,MTMachLine)
|
|
end
|
|
else
|
|
MTMachLine.Row = nIndexTab
|
|
table.insert( tSecMcng,MTMachLine)
|
|
end
|
|
end
|
|
|
|
return tSecMcng
|
|
end
|
|
|
|
-----------------------------------------------------------------
|
|
-- *** Vacuums disposition ***
|
|
-----------------------------------------------------------------
|
|
local ThroughId, BlindId, FaceDwId
|
|
-----------------------------------------------------------------
|
|
local function StartVacVerify( nIdSolid, bFlipped, nProbeMode, dThDoor, bFlipFrame)
|
|
-- regioni passante e cieca non definite
|
|
EgtErase( ThroughId or GDB_ID.NULL)
|
|
ThroughId = nil
|
|
EgtErase( BlindId or GDB_ID.NULL)
|
|
BlindId = nil
|
|
EgtErase( FaceDwId or GDB_ID.NULL)
|
|
FaceDwId = nil
|
|
-- recupero le regioni sopra e sotto della porta messa in macchina
|
|
local UpId, DwId
|
|
local UpId2, DwId2
|
|
local DwIdExtraBlind = {}
|
|
local sExtraBlindRegName
|
|
local DwIdExtraGrvBlind = {}
|
|
local sExtraGrvBlindRegName
|
|
local dZedToMove
|
|
-- se porta ribaltata
|
|
if bFlipped or bFlipFrame then
|
|
if nProbeMode == 2 then
|
|
-- superficie a contatto con le ventose
|
|
DwId = MB.FindGeomWithName( nIdSolid, 'FLAT_UP', true)
|
|
-- superficie sopra
|
|
UpId = MB.FindGeomWithName( nIdSolid, 'FLAT_DW', true)
|
|
-- superficie a contatto con le ventose
|
|
DwId2 = MB.FindGeomWithName( nIdSolid, 'FLAT_UP_2', true)
|
|
-- superficie sopra
|
|
UpId2 = MB.FindGeomWithName( nIdSolid, 'FLAT_DW_2', true)
|
|
else
|
|
-- superficie a contatto con le ventose
|
|
DwId = MB.FindGeomWithName( nIdSolid, 'FLAT_UP', true)
|
|
-- superficie sopra
|
|
UpId = MB.FindGeomWithName( nIdSolid, 'FLAT_DW', true)
|
|
end
|
|
sExtraBlindRegName = 'FLAT_UP_BLIND'
|
|
DwIdExtraBlind = MB.FindGeomWithName( nIdSolid, sExtraBlindRegName, false)
|
|
sExtraGrvBlindRegName = 'FLAT_UP_SD_BLIND'
|
|
DwIdExtraGrvBlind = MB.FindGeomWithName( nIdSolid, sExtraGrvBlindRegName, false)
|
|
dZedToMove = dThDoor
|
|
else
|
|
if nProbeMode == 2 then
|
|
-- superficie a contatto con le ventose
|
|
DwId = MB.FindGeomWithName( nIdSolid, 'FLAT_DW', true)
|
|
-- superficie sopra
|
|
UpId = MB.FindGeomWithName( nIdSolid, 'FLAT_UP', true)
|
|
-- superficie a contatto con le ventose
|
|
DwId2 = MB.FindGeomWithName( nIdSolid, 'FLAT_DW_2', true)
|
|
-- superficie sopra
|
|
UpId2 = MB.FindGeomWithName( nIdSolid, 'FLAT_UP_2', true)
|
|
else
|
|
-- superficie a contatto con le ventose
|
|
DwId = MB.FindGeomWithName( nIdSolid, 'FLAT_DW', true)
|
|
-- superficie sopra
|
|
UpId = MB.FindGeomWithName( nIdSolid, 'FLAT_UP', true)
|
|
end
|
|
sExtraBlindRegName = 'FLAT_DW_BLIND'
|
|
DwIdExtraBlind = MB.FindGeomWithName( nIdSolid, sExtraBlindRegName, false)
|
|
sExtraGrvBlindRegName = 'FLAT_DW_SD_BLIND'
|
|
DwIdExtraGrvBlind = MB.FindGeomWithName( nIdSolid, sExtraGrvBlindRegName, false)
|
|
dZedToMove = 0
|
|
end
|
|
-- creo le regioni complementari
|
|
local CompUpId
|
|
if nProbeMode == 2 then
|
|
local nRecId = EgtGetFirstNameInGroup( Pz, 'REC')
|
|
local nCurveId = EgtExtractSurfFrChunkLoops( UpId2, 0, nRecId) -- prendo il contorno della regione piena
|
|
CompUpId = EgtSurfFlatRegion( nIdSolid, nCurveId) -- creo regione rettangolare piena
|
|
else
|
|
local b3Up = EgtGetBBoxGlob( UpId, GDB_BB.EXACT)
|
|
CompUpId = EgtSurfFrRectangle( nIdSolid, b3Up:getMin(), b3Up:getMax(), GDB_RT.GLOB) -- creo regione rettangolare piena
|
|
end
|
|
local vtNUp = EgtSurfFrNormVersor( UpId, GDB_ID.ROOT)
|
|
local vtNCompUp = EgtSurfFrNormVersor( CompUpId, GDB_ID.ROOT)
|
|
if not AreSameVectorApprox( vtNUp, vtNCompUp) then EgtInvertSurf( CompUpId) end
|
|
EgtSurfFrSubtract( CompUpId, UpId)
|
|
if not EgtExistsObj( CompUpId) then CompUpId = nil end
|
|
|
|
local CompDwId
|
|
if nProbeMode == 2 then
|
|
local nRecId = EgtGetFirstNameInGroup( Pz, 'REC')
|
|
local nCurveId = EgtExtractSurfFrChunkLoops( DwId2, 0, nRecId)
|
|
CompDwId = EgtSurfFlatRegion( nIdSolid, nCurveId)
|
|
else
|
|
local b3Dw = EgtGetBBoxGlob( DwId, GDB_BB.EXACT)
|
|
CompDwId = EgtSurfFrRectangle( nIdSolid, b3Dw:getMin(), b3Dw:getMax(), GDB_RT.GLOB)
|
|
end
|
|
-- faccio una copia per gli altri controlli
|
|
local DownRegId = nil
|
|
if CompDwId then
|
|
DownRegId = EgtCopyGlob( CompDwId, nIdSolid)
|
|
EgtInvertSurf( DownRegId)
|
|
end
|
|
local vtNDw = EgtSurfFrNormVersor( DwId, GDB_ID.ROOT)
|
|
local vtNCompDw = EgtSurfFrNormVersor( CompDwId, GDB_ID.ROOT)
|
|
if not AreSameVectorApprox( vtNDw, vtNCompDw) then EgtInvertSurf( CompDwId) end
|
|
EgtSurfFrSubtract( CompDwId, DwId)
|
|
if not EgtExistsObj( CompDwId) then CompDwId = nil end
|
|
if CompDwId then EgtInvertSurf( CompDwId) end
|
|
|
|
-- calcolo le regioni passante e cieca e contorno
|
|
local ThroughRegId = nil
|
|
local BlindRegId = nil
|
|
-- se ci sono entrambe le regioni
|
|
if CompUpId and CompDwId then
|
|
-- per ottenere la regione passante faccio intersezione tra sopra e sotto
|
|
EgtSurfFrIntersect( CompUpId, CompDwId)
|
|
if EgtExistsObj( CompUpId) then
|
|
ThroughRegId = CompUpId
|
|
end
|
|
-- per ottenere la regione cieca faccio differenza tra sotto e passante
|
|
if ThroughRegId then
|
|
EgtSurfFrSubtract( CompDwId, ThroughRegId)
|
|
if EgtExistsObj( CompDwId) then
|
|
BlindRegId = CompDwId
|
|
end
|
|
else
|
|
BlindRegId = CompDwId
|
|
end
|
|
-- se c'è solo la regione sotto è già quella delle lavorazioni cieche
|
|
elseif CompDwId then
|
|
BlindRegId = CompDwId
|
|
-- se c'è solo la sopra, non interessa e la cancello
|
|
elseif CompUpId then
|
|
EgtErase( CompUpId)
|
|
end
|
|
-- sistemazioni finali
|
|
if ThroughRegId or #DwIdExtraGrvBlind > 0 then
|
|
ThroughId = EgtGroup( GDB_ID.ROOT)
|
|
EgtSetName( ThroughId, 'THROUGH')
|
|
EgtSetColor( ThroughId, RED())
|
|
EgtSetLevel( ThroughId, GDB_LV.TEMP)
|
|
local nChunk = 0
|
|
if ThroughRegId then
|
|
while EgtExtractSurfFrChunkLoops( ThroughRegId, nChunk, ThroughId) do
|
|
nChunk = nChunk + 1
|
|
end
|
|
end
|
|
-- aggiungo le regioni extra presenti (calcolate dai singoli componenti)
|
|
for l = 1, #DwIdExtraGrvBlind do
|
|
local nIdBl = DwIdExtraGrvBlind[l]
|
|
if nIdBl then
|
|
-- faccio la copia e la muovo alla Z bassa
|
|
local nTempBlndReg = EgtCopyGlob ( nIdBl, nIdSolid)
|
|
if nTempBlndReg then
|
|
-- prendo il punto iniziale
|
|
local pCenTmp = EgtCP( nTempBlndReg)
|
|
if pCenTmp then
|
|
EgtMove( nTempBlndReg, Point3d(0,0,dZedToMove) - Point3d(0,0,pCenTmp:getZ()))
|
|
end
|
|
-- estraggo i contorni e li aggiungo al gruppo blind
|
|
nChunk = 0
|
|
while EgtExtractSurfFrChunkLoops( nTempBlndReg, nChunk, ThroughId) do
|
|
nChunk = nChunk + 1
|
|
end
|
|
-- cancello la copia locale
|
|
EgtErase( nTempBlndReg)
|
|
end
|
|
end
|
|
end
|
|
EgtErase( ThroughRegId)
|
|
--EgtSetName( ThroughRegId, 'THROUGH')
|
|
--EgtSetColor( ThroughRegId, RED())
|
|
--EgtSetLevel( ThroughRegId, GDB_LV.TEMP)
|
|
end
|
|
if BlindRegId or #DwIdExtraBlind > 0 then
|
|
BlindId = EgtGroup( GDB_ID.ROOT)
|
|
EgtSetName( BlindId, 'BLIND')
|
|
EgtSetColor( BlindId, BLUE())
|
|
EgtSetLevel( BlindId, GDB_LV.TEMP)
|
|
local nChunk = 0
|
|
if BlindRegId then
|
|
while EgtExtractSurfFrChunkLoops( BlindRegId, nChunk, BlindId) do
|
|
nChunk = nChunk + 1
|
|
end
|
|
end
|
|
-- aggiungo le regioni extra presenti (calcolate dai singoli componenti)
|
|
for l = 1, #DwIdExtraBlind do
|
|
local nIdBl = DwIdExtraBlind[l]
|
|
if nIdBl then
|
|
-- faccio la copia e la muovo alla Z bassa
|
|
local nTempBlndReg = EgtCopyGlob ( nIdBl, nIdSolid)
|
|
if nTempBlndReg then
|
|
-- prendo il punto iniziale
|
|
local pCenTmp = EgtCP( nTempBlndReg)
|
|
if pCenTmp then
|
|
EgtMove( nTempBlndReg, Point3d(0,0,dZedToMove) - Point3d(0,0,pCenTmp:getZ()))
|
|
end
|
|
-- estraggo i contorni e li aggiungo al gruppo blind
|
|
nChunk = 0
|
|
while EgtExtractSurfFrChunkLoops( nTempBlndReg, nChunk, BlindId) do
|
|
nChunk = nChunk + 1
|
|
end
|
|
-- cancello la copia locale
|
|
EgtErase( nTempBlndReg)
|
|
end
|
|
end
|
|
end
|
|
if BlindRegId then
|
|
EgtErase( BlindRegId)
|
|
--EgtSetName( BlindRegId, 'BLIND')
|
|
--EgtSetColor( BlindRegId, BLUE())
|
|
--EgtSetLevel( BlindRegId, GDB_LV.TEMP)
|
|
end
|
|
end
|
|
if DownRegId then
|
|
FaceDwId = EgtGroup( GDB_ID.ROOT)
|
|
EgtSetName( FaceDwId, 'DWREG')
|
|
EgtSetColor( FaceDwId, BLUE())
|
|
EgtSetLevel( FaceDwId, GDB_LV.TEMP)
|
|
local nChunk = 0
|
|
while EgtExtractSurfFrChunkLoops( DownRegId, nChunk, FaceDwId) do
|
|
nChunk = nChunk + 1
|
|
end
|
|
EgtErase( DownRegId)
|
|
--EgtSetName( DownRegId, 'DWREG')
|
|
--EgtSetColor( DownRegId, GREEN())
|
|
--EgtSetLevel( DownRegId, GDB_LV.TEMP)
|
|
end
|
|
end
|
|
|
|
-----------------------------------------------------------------
|
|
local function GetBoxViseRegion( nIdVise, sRegName)
|
|
|
|
local nShapeId
|
|
local nShapeMoveId
|
|
local nAreaId
|
|
local nAreaMoveId
|
|
local tViseArea = {}
|
|
|
|
if nIdVise then
|
|
-- cerco l'id della geometria shape
|
|
nAreaId = EgtGetFirstNameInGroup( nIdVise, 'BASE')
|
|
nAreaMoveId = EgtGetFirstNameInGroup( nIdVise, 'MOBILE')
|
|
|
|
if nAreaId then
|
|
-- cerco il nome della regione
|
|
nShapeId = EgtGetFirstNameInGroup( nAreaId, sRegName)
|
|
end
|
|
|
|
if nAreaMoveId then
|
|
-- cerco il nome della regione
|
|
nShapeMoveId = EgtGetFirstNameInGroup( nAreaMoveId, sRegName)
|
|
end
|
|
|
|
-- se ho le regioni provo a verificare
|
|
if nShapeId and nShapeMoveId then
|
|
local bBoxReg = EgtGetBBoxGlob ( nShapeId, GDB_BB.EXACT)
|
|
table.insert( tViseArea, bBoxReg)
|
|
bBoxReg = EgtGetBBoxGlob ( nShapeMoveId, GDB_BB.EXACT)
|
|
table.insert( tViseArea, bBoxReg)
|
|
end
|
|
end
|
|
|
|
return tViseArea
|
|
end
|
|
|
|
-----------------------------------------------------------------
|
|
local function VerifyIntersXYZ( bRefBox, bMachBox, dDeltaBody, bCheckZ)
|
|
|
|
local bNoCollisionX
|
|
local bNoCollisionY
|
|
local bNoCollisionZ
|
|
|
|
-- prendo punti box della lavorazione e del pezzo (riferimento/morsa)
|
|
local pMinMach = bMachBox:getMin()
|
|
local pMaxMach = bMachBox:getMax()
|
|
local pMinRef = bRefBox:getMin()
|
|
local pMaxRef = bRefBox:getMax()
|
|
|
|
-- verifico collisioni
|
|
if ( pMinRef:getX() - dDeltaBody > pMaxMach:getX()) or
|
|
( pMaxRef:getX() + dDeltaBody < pMinMach:getX()) then -- se non toccano in x
|
|
bNoCollisionX = true
|
|
else
|
|
bNoCollisionX = false
|
|
end
|
|
|
|
if ( pMaxRef:getY() + dDeltaBody < pMinMach:getY()) or
|
|
( pMinRef:getY() - dDeltaBody > pMaxMach:getY()) then -- se non si toccano in y
|
|
bNoCollisionY = true
|
|
else
|
|
bNoCollisionY = false
|
|
end
|
|
|
|
if bCheckZ then
|
|
if ( pMinMach:getZ() - dDeltaBody) > pMaxRef:getZ() then -- se non toccano in z
|
|
bNoCollisionZ = true
|
|
else
|
|
bNoCollisionZ = false
|
|
end
|
|
end
|
|
|
|
return bNoCollisionX, bNoCollisionY, bNoCollisionZ
|
|
end
|
|
|
|
-----------------------------------------------------------------
|
|
local function RemoveSubPieceAtPos( sRawDisp, nPos, nNumPieceOnBar, DISPMODE, nNumChar)
|
|
|
|
local sNewRow = ''
|
|
local nNumTotChar = nNumPieceOnBar * nNumChar
|
|
|
|
if #sRawDisp == nNumTotChar then
|
|
-- se non in prima posizione compongo la parte iniziale
|
|
if nPos > 1 then
|
|
sNewRow = sNewRow .. string.sub ( sRawDisp, 1 , ( ( nPos * nNumChar) - nNumChar ))
|
|
end
|
|
-- aggiungo la posizione vuota
|
|
sNewRow = sNewRow .. '0_'
|
|
-- se non in ultima posizione compongo la parte finale
|
|
if nPos < nNumPieceOnBar then
|
|
sNewRow = sNewRow .. string.sub ( sRawDisp, ( ( nPos * nNumChar) + 1 ))
|
|
end
|
|
else
|
|
sNewRow = sRawDisp
|
|
end
|
|
|
|
return sNewRow
|
|
end
|
|
|
|
-----------------------------------------------------------------
|
|
local function ReduceViseNumber( tIdViseDisp, nMinViseNumber, Pz, nNumPhase, DISPMODE, nNumPieceOnBar, sRawDisp, nNumChar)
|
|
|
|
-- calcolo le distanze tra le ventose
|
|
local nTotNumVise = #tIdViseDisp
|
|
local nLastVise = tIdViseDisp[nTotNumVise][2]
|
|
local nFirstVise = tIdViseDisp[1][2]
|
|
local tDeleteVise = {}
|
|
-- posizione intermedia tra le posizioni occupate
|
|
local dMiddleDist = ( nFirstVise + nLastVise) / 2
|
|
local nMiddlePos = 0
|
|
local dMinDistance = 15
|
|
|
|
-- ciclo sulla tabella per trovare la posizione più vicina alla posizione media
|
|
for i = 2, ( nTotNumVise -1) do
|
|
|
|
local nPosLoc = tIdViseDisp[i][2]
|
|
local nDist = abs( dMiddleDist - nPosLoc)
|
|
if nDist < dMinDistance then
|
|
dMinDistance = nDist
|
|
nMiddlePos = i
|
|
end
|
|
end
|
|
|
|
-- se trovata una posizione
|
|
if nMiddlePos > 0 then
|
|
-- ciclo per eliminare tutte le posizioni tranne (gli estremi) e la candidata
|
|
for i = 2, ( nTotNumVise -1) do
|
|
local nPosLoc = tIdViseDisp[i][2]
|
|
if i ~= nMiddlePos then
|
|
-- rimuovo la morsa dalla disposizione e anche nella tabella
|
|
EgtRemoveFixture( tIdViseDisp[i][1])
|
|
table.insert( tDeleteVise, i)
|
|
-- rimuovo la posizione dalla stringa delle posizioni
|
|
sRawDisp = RemoveSubPieceAtPos( sRawDisp, tIdViseDisp[i][2], nNumPieceOnBar, DISPMODE, nNumChar)
|
|
-- se stringa valida riscrivo la nota corretta
|
|
if #sRawDisp > 0 then
|
|
EgtSetInfo( Pz, 'FixVacRow_Phase_'..EgtNumToString( nNumPhase, 0), sRawDisp)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
-- cancello dalla tabella le morse eliminate
|
|
for i = #tDeleteVise, 1, -1 do
|
|
table.remove( tIdViseDisp, tDeleteVise[i])
|
|
end
|
|
|
|
return sRawDisp
|
|
end
|
|
|
|
-----------------------------------------------------------------
|
|
local function VerifyViseCollision( tIdViseDisp, bMachBox, Pz, nNumPhase, DISPMODE, nNumPieceOnBar, sRawDisp, nNumChar)
|
|
|
|
if tIdViseDisp and #tIdViseDisp > 0 then
|
|
|
|
local tDeleteVise = {}
|
|
|
|
for i = 1, #tIdViseDisp do
|
|
|
|
local bOkCollision = true
|
|
|
|
-- prendo gli ingombri delle regioni esterne e più in alto della morsa
|
|
local tViseArea = GetBoxViseRegion( tIdViseDisp[i][1], 'REG_UP')
|
|
|
|
if tViseArea then
|
|
|
|
for j = 1, #tViseArea do
|
|
-- verifico se c'è possibile collisione in X e/o Y
|
|
local bNoCollisionX, bNoCollisionY, bNoCollisionZ = VerifyIntersXYZ( tViseArea[j], bMachBox, 1, true)
|
|
-- controllo se c'è solo collisione in Y
|
|
bOkCollision = bOkCollision and ( bNoCollisionX or bNoCollisionY or ( bNoCollisionX and bNoCollisionY and bNoCollisionZ))
|
|
end
|
|
|
|
-- Se ho collisione rimuovo la morsa
|
|
if not bOkCollision then
|
|
-- ottengo la posizione della morsa
|
|
local nPos = tIdViseDisp[i][2]
|
|
-- rimuovo la morsa dalla disposizione e anche nella tabella
|
|
EgtRemoveFixture( tIdViseDisp[i][1])
|
|
table.insert( tDeleteVise, i)
|
|
-- rimuovo la posizione dalla stringa delle posizioni
|
|
sRawDisp = RemoveSubPieceAtPos( sRawDisp, nPos, nNumPieceOnBar, DISPMODE, nNumChar)
|
|
-- se stringa valida riscrivo la nota corretta
|
|
if #sRawDisp > 0 then
|
|
EgtSetInfo( Pz, 'FixVacRow_Phase_'..EgtNumToString( nNumPhase, 0), sRawDisp)
|
|
end
|
|
end
|
|
end
|
|
|
|
-- se non ho rimosso la morsa
|
|
if bOkCollision then
|
|
-- prendo gli ingombri delle regioni interne e più basse della morsa
|
|
tViseArea = {}
|
|
tViseArea = GetBoxViseRegion( tIdViseDisp[i][1], 'REG_0')
|
|
|
|
if tViseArea then
|
|
|
|
for j = 1, #tViseArea do
|
|
-- verifico se c'è possibile collisione in X e/o Y
|
|
local bNoCollisionX, bNoCollisionY, bNoCollisionZ = VerifyIntersXYZ( tViseArea[j], bMachBox, 1, true)
|
|
-- controllo se c'è solo collisione in Y
|
|
bOkCollision = bOkCollision and ( bNoCollisionX or bNoCollisionY or ( bNoCollisionX and bNoCollisionY and bNoCollisionZ))
|
|
end
|
|
|
|
-- Se ho collisione rimuovo la morsa
|
|
if not bOkCollision then
|
|
-- ottengo la posizione della morsa
|
|
local nPos = tIdViseDisp[i][2]
|
|
-- rimuovo la morsa dalla disposizione e anche nella tabella
|
|
EgtRemoveFixture( tIdViseDisp[i][1])
|
|
table.insert( tDeleteVise, i)
|
|
-- rimuovo la posizione dalla stringa delle posizioni
|
|
sRawDisp = RemoveSubPieceAtPos( sRawDisp, nPos, nNumPieceOnBar, DISPMODE, nNumChar)
|
|
-- se stringa valida riscrivo la nota corretta
|
|
if #sRawDisp > 0 then
|
|
EgtSetInfo( Pz, 'FixVacRow_Phase_'..EgtNumToString( nNumPhase, 0), sRawDisp)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
-- cancello dalla tabella le morse eliminate
|
|
for i = #tDeleteVise, 1, -1 do
|
|
table.remove( tIdViseDisp, tDeleteVise[i])
|
|
end
|
|
end
|
|
return sRawDisp
|
|
end
|
|
|
|
-----------------------------------------------------------------
|
|
local function VerifyRowCollision( tRefBox, bMachBox)
|
|
|
|
local bOkCollisionX = true
|
|
local bOkCollisionY = true
|
|
local bOkCollision = true
|
|
local dDeltaBody = 40
|
|
|
|
-- devono esserci almeno un box di un riferimento e il box lavorazione
|
|
if ( tRefBox.ref1 or tRefBox.ref2 or tRefBox.ref3 or tRefBox.ref4) and bMachBox then
|
|
|
|
if tRefBox.ref1 then
|
|
bOkCollisionX, bOkCollisionY = VerifyIntersXYZ( tRefBox.ref1, bMachBox, dDeltaBody)
|
|
bOkCollision = bOkCollision and ( bOkCollisionX or bOkCollisionY)
|
|
end
|
|
if tRefBox.ref2 then
|
|
bOkCollisionX, bOkCollisionY = VerifyIntersXYZ( tRefBox.ref2, bMachBox, dDeltaBody)
|
|
bOkCollision = bOkCollision and ( bOkCollisionX or bOkCollisionY)
|
|
end
|
|
if tRefBox.ref3 then
|
|
bOkCollisionX, bOkCollisionY = VerifyIntersXYZ( tRefBox.ref3, bMachBox, dDeltaBody)
|
|
bOkCollision = bOkCollision and ( bOkCollisionX or bOkCollisionY)
|
|
end
|
|
if tRefBox.ref4 then
|
|
bOkCollisionX, bOkCollisionY = VerifyIntersXYZ( tRefBox.ref4, bMachBox, dDeltaBody)
|
|
bOkCollision = bOkCollision and ( bOkCollisionX or bOkCollisionY)
|
|
end
|
|
end
|
|
|
|
return bOkCollision
|
|
end
|
|
|
|
-----------------------------------------------------------------
|
|
local function FindRefInTable( nTab, sParzName)
|
|
|
|
local tRefList = MB.FindGroupWithPartName( nTab, sParzName)
|
|
local bBoxRef
|
|
local tBoxRef = {}
|
|
local tFoundRef = {}
|
|
|
|
if tRefList then
|
|
for i = 1, #tRefList do
|
|
local sNameEnt = EgtGetName(tRefList[i])
|
|
local sNumRef = string.sub( sNameEnt, #sNameEnt)
|
|
-- trasformo in numero
|
|
local nLocNumRef = tonumber(sNumRef)
|
|
if nLocNumRef == 1 then
|
|
tFoundRef.r1 = tRefList[i]
|
|
elseif nLocNumRef == 2 then
|
|
tFoundRef.r2 = tRefList[i]
|
|
elseif nLocNumRef == 3 then
|
|
tFoundRef.r3 = tRefList[i]
|
|
elseif nLocNumRef == 4 then
|
|
tFoundRef.r4 = tRefList[i]
|
|
end
|
|
end
|
|
|
|
if tFoundRef.r1 or tFoundRef.r2 or tFoundRef.r3 or tFoundRef.r4 then
|
|
|
|
local nRefId
|
|
if tFoundRef.r1 then
|
|
-- ottengo il sottogruppo ref
|
|
nRefId = EgtGetFirstNameInGroup( tFoundRef.r1, 'BASE2')
|
|
if nRefId then
|
|
tBoxRef.ref1 = EgtGetBBoxGlob ( nRefId, GDB_BB.EXACT)
|
|
end
|
|
end
|
|
if tFoundRef.r2 then
|
|
-- ottengo il sottogruppo ref
|
|
nRefId = EgtGetFirstNameInGroup( tFoundRef.r2, 'BASE2')
|
|
if nRefId then
|
|
tBoxRef.ref2 = EgtGetBBoxGlob ( nRefId, GDB_BB.EXACT)
|
|
end
|
|
end
|
|
if tFoundRef.r3 then
|
|
-- ottengo il sottogruppo ref
|
|
nRefId = EgtGetFirstNameInGroup( tFoundRef.r3, 'BASE2')
|
|
if nRefId then
|
|
tBoxRef.ref3 = EgtGetBBoxGlob ( nRefId, GDB_BB.EXACT)
|
|
end
|
|
end
|
|
if tFoundRef.r4 then
|
|
-- ottengo il sottogruppo ref
|
|
nRefId = EgtGetFirstNameInGroup( tFoundRef.r4, 'BASE2')
|
|
if nRefId then
|
|
tBoxRef.ref4 = EgtGetBBoxGlob ( nRefId, GDB_BB.EXACT)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
return tBoxRef
|
|
end
|
|
|
|
-----------------------------------------------------------------
|
|
local function ExecVacVerify( ptVac, dDistVac) -- This function is not more used, now it uses ExecVacShapeVerify
|
|
-- verifica con le regioni passanti
|
|
local nId = EgtGetFirstInGroup( ThroughId or GDB_ID.NULL)
|
|
while nId do
|
|
local ptNear = EgtNP( nId, ptVac, GDB_ID.ROOT)
|
|
if ptNear then
|
|
local dDist = sqrt( ( ptNear[1] - ptVac[1]) * ( ptNear[1] - ptVac[1]) +
|
|
( ptNear[2] - ptVac[2]) * ( ptNear[2] - ptVac[2]))
|
|
-- se distanza inferiore al limite ...
|
|
if dDist < dDistVac + 15 then
|
|
return false
|
|
end
|
|
end
|
|
nId = EgtGetNext( nId)
|
|
end
|
|
-- verifica con le regioni cieche
|
|
nId = EgtGetFirstInGroup( BlindId or GDB_ID.NULL)
|
|
while nId do
|
|
local ptNear = EgtNP( nId, ptVac, GDB_ID.ROOT)
|
|
if ptNear then
|
|
local dDist = sqrt( ( ptNear[1] - ptVac[1]) * ( ptNear[1] - ptVac[1]) +
|
|
( ptNear[2] - ptVac[2]) * ( ptNear[2] - ptVac[2]))
|
|
-- se distanza inferiore al limite ...
|
|
if dDist < dDistVac + 45 then
|
|
return false
|
|
end
|
|
end
|
|
nId = EgtGetNext( nId)
|
|
end
|
|
-- verifica con il contorno esterno inferiore
|
|
nId = EgtGetFirstInGroup( FaceDwId or GDB_ID.NULL)
|
|
while nId do
|
|
local ptNear = EgtNP( nId, ptVac, GDB_ID.ROOT)
|
|
if ptNear then
|
|
local dDist = sqrt( ( ptNear[1] - ptVac[1]) * ( ptNear[1] - ptVac[1]) +
|
|
( ptNear[2] - ptVac[2]) * ( ptNear[2] - ptVac[2]))
|
|
-- se distanza inferiore al contorno + una piccola distanza
|
|
if dDist < dDistVac + 1 then
|
|
return false
|
|
end
|
|
end
|
|
nId = EgtGetNext( nId)
|
|
end
|
|
-- nessuna interferenza
|
|
return true
|
|
end
|
|
|
|
-----------------------------------------------------------------
|
|
local function ExecViseShapeVerify( ptVac, sNameVac, tabOri, dDistThru, dDistBlind,
|
|
dDistCont, dRotVal, dMove2)
|
|
|
|
local nShapeId
|
|
local nShapeMoveId
|
|
local nAreaId
|
|
local nAreaMoveId
|
|
local nRetErr = 0
|
|
|
|
-- inserisco la ventosa e ne ottengo l'id
|
|
local nFixVac = EgtAddFixture( sNameVac, ( ptVac - tabOri), dRotVal, dMove2)
|
|
--debug
|
|
-- EgtSaveFile()
|
|
-- EgtMove(DGD.PZ, Point3d(0,0,nil) - ORIG())
|
|
|
|
if nFixVac then
|
|
|
|
-- cerco l'id della geometria shape
|
|
nAreaId = EgtGetFirstNameInGroup( nFixVac, 'BASE')
|
|
nAreaMoveId = EgtGetFirstNameInGroup( nFixVac, 'MOBILE')
|
|
|
|
if nAreaId then
|
|
-- cerco il nome della regione
|
|
nShapeId = EgtGetFirstNameInGroup( nAreaId, 'REG_UP')
|
|
else
|
|
if nFixVac then -- se inserita ventosa la rimuovo
|
|
EgtRemoveFixture( nFixVac)
|
|
end
|
|
nRetErr = 1
|
|
return false, nRetErr
|
|
end
|
|
|
|
if nAreaMoveId then
|
|
-- cerco il nome della regione
|
|
nShapeMoveId = EgtGetFirstNameInGroup( nAreaMoveId, 'REG_UP')
|
|
else
|
|
if nFixVac then -- se inserita ventosa la rimuovo
|
|
EgtRemoveFixture( nFixVac)
|
|
end
|
|
nRetErr = 1
|
|
return false, nRetErr
|
|
end
|
|
end
|
|
|
|
-- se ho le regioni provo a verificare
|
|
if nShapeId and nShapeMoveId then
|
|
|
|
-- verifica se regione ventosa interferisce con le regioni passanti
|
|
local nId = EgtGetFirstInGroup( ThroughId or GDB_ID.NULL)
|
|
-- EgtSaveFile()
|
|
while nId do
|
|
local bDistBtwRegion = not EgtSurfFrTestExternal( nShapeId, nId, dDistThru)
|
|
local bDistBtwRegionM = not EgtSurfFrTestExternal( nShapeMoveId, nId, dDistThru)
|
|
if bDistBtwRegion or bDistBtwRegionM then -- se interferisce cancello ventosa ed esco
|
|
EgtRemoveFixture( nFixVac)
|
|
return false, nRetErr
|
|
end
|
|
nId = EgtGetNext( nId)
|
|
end
|
|
-- verifica se regione ventosa interferisce con le regioni cieche
|
|
nId = EgtGetFirstInGroup( BlindId or GDB_ID.NULL)
|
|
while nId do
|
|
local bDistBtwRegion = not EgtSurfFrTestExternal( nShapeId, nId, dDistBlind)
|
|
local bDistBtwRegionM = not EgtSurfFrTestExternal( nShapeMoveId, nId, dDistBlind)
|
|
if bDistBtwRegion or bDistBtwRegionM then -- se interferisce cancello ventosa ed esco
|
|
EgtRemoveFixture( nFixVac)
|
|
return false, nRetErr, true
|
|
end
|
|
nId = EgtGetNext( nId)
|
|
end
|
|
-- verifica se regione ventosa interferisce con le regioni contorno
|
|
nId = EgtGetFirstInGroup( FaceDwId or GDB_ID.NULL)
|
|
while nId do
|
|
local bDistBtwRegion = not EgtSurfFrTestExternal( nShapeId, nId, dDistCont)
|
|
local bDistBtwRegionM = not EgtSurfFrTestExternal( nShapeMoveId, nId, dDistCont)
|
|
if bDistBtwRegion or bDistBtwRegionM then -- se interferisce cancello ventosa ed esco
|
|
EgtRemoveFixture( nFixVac)
|
|
return false, nRetErr
|
|
end
|
|
nId = EgtGetNext( nId)
|
|
end
|
|
else -- regione non trovata
|
|
if nFixVac then -- se inserita ventosa la rimuovo
|
|
EgtRemoveFixture( nFixVac)
|
|
end
|
|
nRetErr = 2
|
|
return false, nRetErr
|
|
end
|
|
|
|
-- nessuna interferenza
|
|
if nFixVac then -- se inserita ventosa la rimuovo
|
|
EgtRemoveFixture( nFixVac)
|
|
end
|
|
return true, nRetErr
|
|
end
|
|
|
|
-----------------------------------------------------------------
|
|
local function ExecVacShapeVerify( ptVac, sNameVac, tabOri, dDistThru, dDistBlind,
|
|
dDistCont, bCodeMobileVac, dRotVal, dMove2)
|
|
|
|
local nShapeId
|
|
local nShapeBlindId
|
|
local nAreaId
|
|
local dMoveLoc = EgtIf( bCodeMobileVac, dMove2, 0)
|
|
local dRotLoc = EgtIf( bCodeMobileVac, dRotVal, 0)
|
|
local dMaxMov = 0
|
|
local nRetErr = 0
|
|
local nCustomType
|
|
|
|
-- inserisco la ventosa e ne ottengo l'id
|
|
local nFixVac = EgtAddFixture( sNameVac, ( ptVac - tabOri), dRotLoc, dMoveLoc)
|
|
|
|
if nFixVac then
|
|
|
|
-- cerco l'id della geometria shape
|
|
if bCodeMobileVac then
|
|
nAreaId = EgtGetFirstNameInGroup( nFixVac, 'MOBILE')
|
|
else
|
|
nAreaId = EgtGetFirstNameInGroup( nFixVac, 'AREA')
|
|
end
|
|
|
|
-- leggo la nota del typo custom
|
|
nCustomType = EgtGetInfo( nFixVac, 'CustomType', 'i')
|
|
|
|
if nAreaId then
|
|
if bCodeMobileVac then -- se mobile leggo la nota di movimento massimo
|
|
dMaxMov = EgtGetInfo( nAreaId, 'MAXMOV', 'd') or 0
|
|
end
|
|
-- cerco il nome della regione
|
|
nShapeId = EgtGetFirstNameInGroup( nAreaId, 'SHAPE')
|
|
-- cerco il nome della regione dedicata alle geometrie cieche
|
|
nShapeBlindId = EgtGetFirstNameInGroup( nAreaId, 'SHAPE_BL')
|
|
-- se non ho la doppia regione prendo l'unica
|
|
if nShapeId and not nShapeBlindId then
|
|
nShapeBlindId = nShapeId
|
|
end
|
|
else
|
|
if nFixVac then -- se inserita ventosa la rimuovo
|
|
EgtRemoveFixture( nFixVac)
|
|
end
|
|
nRetErr = 1
|
|
return false, nRetErr
|
|
end
|
|
end
|
|
|
|
-- se ho la regione provo a verificare
|
|
if nShapeId then
|
|
|
|
-- se ventosa mobile controllo se la distanza di movimento è superiore a quella ammessa
|
|
if bCodeMobileVac and dMoveLoc > dMaxMov then
|
|
EgtRemoveFixture( nFixVac)
|
|
return false, nRetErr
|
|
end
|
|
-- verifica se regione ventosa interferisce con le regioni passanti
|
|
local nId = EgtGetFirstInGroup( ThroughId or GDB_ID.NULL)
|
|
-- EgtSaveFile()
|
|
while nId do
|
|
local bDistBtwRegion = not EgtSurfFrTestExternal( nShapeId, nId, dDistThru)
|
|
if bDistBtwRegion then -- se interferisce cancello ventosa ed esco
|
|
EgtRemoveFixture( nFixVac)
|
|
return false, nRetErr
|
|
end
|
|
nId = EgtGetNext( nId)
|
|
end
|
|
-- verifica se regione ventosa interferisce con le regioni cieche
|
|
nId = EgtGetFirstInGroup( BlindId or GDB_ID.NULL)
|
|
while nId do
|
|
local bDistBtwRegion = not EgtSurfFrTestExternal( nShapeBlindId, nId, dDistBlind)
|
|
if bDistBtwRegion then -- se interferisce cancello ventosa ed esco
|
|
EgtRemoveFixture( nFixVac)
|
|
return false, nRetErr, true
|
|
end
|
|
nId = EgtGetNext( nId)
|
|
end
|
|
-- verifica se regione ventosa interferisce con le regioni contorno
|
|
nId = EgtGetFirstInGroup( FaceDwId or GDB_ID.NULL)
|
|
while nId do
|
|
local bDistBtwRegion = not EgtSurfFrTestExternal( nShapeId, nId, dDistCont)
|
|
if bDistBtwRegion then -- se interferisce cancello ventosa ed esco
|
|
EgtRemoveFixture( nFixVac)
|
|
return false, nRetErr
|
|
end
|
|
nId = EgtGetNext( nId)
|
|
end
|
|
else -- regione non trovata
|
|
if nFixVac then -- se inserita ventosa la rimuovo
|
|
EgtRemoveFixture( nFixVac)
|
|
end
|
|
nRetErr = 2
|
|
return false, nRetErr
|
|
end
|
|
|
|
-- nessuna interferenza
|
|
if nFixVac then -- se inserita ventosa la rimuovo
|
|
EgtRemoveFixture( nFixVac)
|
|
end
|
|
return true, nRetErr, nil, nCustomType
|
|
end
|
|
|
|
-----------------------------------------------------------------
|
|
local function EndVacVerify()
|
|
-- cancello regioni passante e cieca
|
|
EgtErase( ThroughId or GDB_ID.NULL)
|
|
ThroughId = nil
|
|
EgtErase( BlindId or GDB_ID.NULL)
|
|
BlindId = nil
|
|
EgtErase( FaceDwId or GDB_ID.NULL)
|
|
FaceDwId = nil
|
|
end
|
|
|
|
--------------------------------------------------------------------------------
|
|
-- * Abilitazione/disabilitazione geometrie *
|
|
local function ShowHideGeom( nGroupId, sName, dVal)
|
|
local nId = EgtGetFirstNameInGroup( nGroupId, sName)
|
|
if nId then
|
|
local dOldVal = EgtGetInfo( nId, 'Val', 'd') or 0.1
|
|
if dVal ~= dOldVal then
|
|
if dVal > 0.5 then
|
|
EgtSetStatus( nId, GDB_ST.ON)
|
|
else
|
|
EgtSetStatus( nId, GDB_ST.OFF)
|
|
end
|
|
EgtSetInfo( nId, 'Val', dVal)
|
|
end
|
|
end
|
|
end
|
|
|
|
local function SetInfoTable( tListEnt, sNameInfo, nValInfo)
|
|
|
|
for j = 1, #tListEnt do
|
|
if tListEnt[j] then
|
|
EgtSetInfo( tListEnt[j], sNameInfo, nValInfo)
|
|
end
|
|
end
|
|
end
|
|
|
|
local function CheckExtSideMach( tListEnt)
|
|
local sEdgeNote
|
|
for j = 1, #tListEnt do
|
|
if tListEnt[j] then
|
|
sEdgeNote = EgtGetInfo( tListEnt[j], 'EdgeDoor') or ''
|
|
if sEdgeNote == 'T' then -- se lavorato lato top
|
|
DGD.MTS = 1
|
|
elseif sEdgeNote == 'B' then -- se lavorato lato bottom
|
|
DGD.MBS = 1
|
|
elseif sEdgeNote == 'H' then -- se lavorato lato hinge
|
|
DGD.MHS = 1
|
|
elseif sEdgeNote == 'L' then -- se lavorato lato lock
|
|
DGD.MLS = 1
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-----------------------------------------------------------------
|
|
-- *** Apply Machining by Mach number ***
|
|
-----------------------------------------------------------------
|
|
local function InsertMachiningByMachNum ( tEndId, nMach, sLocName, nNumGroup, sMach,
|
|
sMachUp, sMachDw, bOk, nNumMach, bModifyMacNote,
|
|
bNotGenMachining, tMachining, dBladePerpLeadIn, dPercRedFeed, bCalMach)
|
|
|
|
local dOverL = EgtGetInfo( tEndId[1], 'OL')
|
|
local dOverR = EgtGetInfo( tEndId[1], 'OFFSTOPATH', 'd')
|
|
local sKeepBackSet = EgtGetInfo( tEndId[1], 'KeepBackSet')
|
|
local sProbeSide = EgtGetInfo( tEndId[1], 'ProbeSide') -- ProbeMachXY
|
|
local nActiveStop = EgtGetInfo( tEndId[1], 'ActiveStopMach', 'i')
|
|
local nSetMaxElev = EgtGetInfo( tEndId[1], 'SetMaxElev', 'i')
|
|
local nOffsetDel = EgtIf( bNotGenMachining, 20, 0)
|
|
local nOffsetDelFail = EgtIf( bNotGenMachining, 30, 0)
|
|
local sKeepBackSetCode
|
|
local sActiveStop
|
|
local sSetMaxElev
|
|
local sProbeSideCode
|
|
|
|
-- determino in base alla disposizione quale codice KeepBackSet dare alla lavorazione
|
|
if sKeepBackSet and not bNotGenMachining then
|
|
if (bPush and bFlip) or ( not bPush and not bFlip) then -- se lato narrow è in basso (BD)
|
|
if sKeepBackSet == 'c' then -- se devo stare in centro allo spessore porta setto per correggere Z di metà valore medio
|
|
sKeepBackSetCode = 'CORR_Z_PROBE=1' -- codice moltiplicativo del valore di correzione (media/2)
|
|
elseif sKeepBackSet == 'n' then -- se mantenere su lato narrow, setto per non correggere Z
|
|
sKeepBackSetCode = 'CORR_Z_PROBE=0' -- codice moltiplicativo del valore di correzione (media/2)
|
|
elseif sKeepBackSet == 'w' then -- se mantenere su lato wide, setto per correggere Z
|
|
sKeepBackSetCode = 'CORR_Z_PROBE=2' -- codice moltiplicativo del valore di correzione (media/2)
|
|
end
|
|
else -- altrimenti lato narrow è in alto (BU)
|
|
if sKeepBackSet == 'c' then -- se devo stare in centro allo spessore porta setto per correggere Z di metà valore medio
|
|
sKeepBackSetCode = 'CORR_Z_PROBE=1' -- codice moltiplicativo del valore di correzione (media/2)
|
|
elseif sKeepBackSet == 'n' then -- se mantenere su lato narrow, setto per correggere Z
|
|
sKeepBackSetCode = 'CORR_Z_PROBE=2' -- codice moltiplicativo del valore di correzione (media/2)
|
|
elseif sKeepBackSet == 'w' then -- se mantenere su lato wide, setto per non correggere Z
|
|
sKeepBackSetCode = 'CORR_Z_PROBE=0' -- codice moltiplicativo del valore di correzione (media/2)
|
|
end
|
|
end
|
|
end
|
|
--
|
|
if sProbeSide and not bNotGenMachining then
|
|
sProbeSideCode = 'CPBP' -- CORR_POS_BY_PROBE
|
|
end
|
|
--
|
|
if nActiveStop and not bNotGenMachining then
|
|
sActiveStop = 'ActiveStopMach=1'
|
|
end
|
|
--
|
|
if nSetMaxElev and not bNotGenMachining then
|
|
sSetMaxElev = 'MaxElev=0.0'
|
|
end
|
|
|
|
if nMach == 1 then
|
|
local nRes, nMachId, sToolName = MB.AddAndDelMachining( sLocName .. '_G' .. EgtNumToString(nNumGroup, 0), sMach, tEndId, dOverL, sLocName,
|
|
bNotGenMachining, sKeepBackSetCode, dBladePerpLeadIn, dPercRedFeed, sProbeSideCode,
|
|
sActiveStop, sSetMaxElev, dOverR)
|
|
if nRes < 0 then -- se la lavorazione ha fallito
|
|
bOk = false
|
|
if bModifyMacNote then
|
|
-- setto nota per non lavorarla di nuovo nemmeno nella generazione reale
|
|
SetInfoTable( tEndId, 'Mach', 11+ nOffsetDelFail)
|
|
end
|
|
if bNotGenMachining then
|
|
-- setto nota per non lavorarla di nuovo nemmeno nella generazione reale
|
|
SetInfoTable( tEndId, 'Mach', 11+ nOffsetDelFail)
|
|
end
|
|
elseif nRes == 0 then -- se lavorazione mancante
|
|
if bModifyMacNote then
|
|
-- setto nota per non lavorarla di nuovo
|
|
SetInfoTable( tEndId, 'Mach', 11+ nOffsetDelFail)
|
|
end
|
|
if bNotGenMachining then
|
|
-- setto nota per non lavorarla di nuovo nemmeno nella generazione reale
|
|
SetInfoTable( tEndId, 'Mach', 11+ nOffsetDelFail)
|
|
end
|
|
else -- lavorazione ok
|
|
if bModifyMacNote then
|
|
-- setto nota per non lavorarla di nuovo
|
|
SetInfoTable( tEndId, 'Mach', 11+ nOffsetDel)
|
|
end
|
|
if bNotGenMachining then
|
|
-- setto nota per non lavorarla di nuovo
|
|
SetInfoTable( tEndId, 'Mach', 11+ nOffsetDel)
|
|
if bCalMach then
|
|
SetInfoTable( tEndId, 'Machining', sMach)
|
|
nNumMach = nNumMach + 1
|
|
end
|
|
else
|
|
if tMachining then
|
|
table.insert( tMachining,{nMachId,sToolName})
|
|
end
|
|
-- verifico se lavorati lati esterni porta
|
|
CheckExtSideMach(tEndId)
|
|
end
|
|
end
|
|
elseif nMach == 2 then
|
|
local nRes, nMachId, sToolName = MB.AddAndDelMachining( sLocName .. '_G' .. EgtNumToString(nNumGroup, 0), sMachUp, tEndId, dOverL, sLocName,
|
|
bNotGenMachining, sKeepBackSetCode, dBladePerpLeadIn, dPercRedFeed, sProbeSideCode,
|
|
sActiveStop, sSetMaxElev, dOverR)
|
|
if nRes < 0 then -- se la lavorazione ha fallito
|
|
bOk = false
|
|
if bModifyMacNote then
|
|
-- setto nota per non lavorarla di nuovo
|
|
SetInfoTable( tEndId, 'Mach', 12+ nOffsetDelFail)
|
|
end
|
|
if bNotGenMachining then
|
|
-- setto nota per non lavorarla di nuovo nemmeno nella generazione reale
|
|
SetInfoTable( tEndId, 'Mach', 12+ nOffsetDelFail)
|
|
end
|
|
elseif nRes == 0 then -- se lavorazione mancante
|
|
if bModifyMacNote then
|
|
-- setto nota per non lavorarla di nuovo
|
|
SetInfoTable( tEndId, 'Mach', 12+ nOffsetDelFail)
|
|
end
|
|
if bNotGenMachining then
|
|
-- setto nota per non lavorarla di nuovo nemmeno nella generazione reale
|
|
SetInfoTable( tEndId, 'Mach', 12+ nOffsetDelFail)
|
|
end
|
|
else -- lavorazione ok
|
|
if bModifyMacNote then
|
|
-- setto nota per non lavorarla di nuovo
|
|
SetInfoTable( tEndId, 'Mach', 12+ nOffsetDel)
|
|
end
|
|
if bNotGenMachining then
|
|
-- setto nota per non lavorarla di nuovo
|
|
SetInfoTable( tEndId, 'Mach', 12+ nOffsetDel)
|
|
if bCalMach then
|
|
SetInfoTable( tEndId, 'Machining', sMachUp)
|
|
nNumMach = nNumMach + 1
|
|
end
|
|
else
|
|
if tMachining then
|
|
table.insert( tMachining,{nMachId,sToolName})
|
|
end
|
|
-- verifico se lavorati lati esterni porta
|
|
CheckExtSideMach(tEndId)
|
|
end
|
|
end
|
|
elseif nMach == 3 then
|
|
local nRes, nMachId, sToolName = MB.AddAndDelMachining( sLocName .. '_G' .. EgtNumToString(nNumGroup, 0), sMachDw, tEndId, dOverL, sLocName,
|
|
bNotGenMachining, sKeepBackSetCode, dBladePerpLeadIn, dPercRedFeed, sProbeSideCode,
|
|
sActiveStop, sSetMaxElev, dOverR)
|
|
if nRes < 0 then -- se la lavorazione ha fallito
|
|
bOk = false
|
|
if bModifyMacNote then
|
|
-- setto nota per non lavorarla di nuovo
|
|
SetInfoTable( tEndId, 'Mach', 13+ nOffsetDelFail)
|
|
end
|
|
if bNotGenMachining then
|
|
-- setto nota per non lavorarla di nuovo nemmeno nella generazione reale
|
|
SetInfoTable( tEndId, 'Mach', 13+ nOffsetDelFail)
|
|
end
|
|
elseif nRes == 0 then -- se lavorazione mancante
|
|
if bModifyMacNote then
|
|
-- setto nota per non lavorarla di nuovo
|
|
SetInfoTable( tEndId, 'Mach', 13+ nOffsetDelFail)
|
|
end
|
|
if bNotGenMachining then
|
|
-- setto nota per non lavorarla di nuovo nemmeno nella generazione reale
|
|
SetInfoTable( tEndId, 'Mach', 13+ nOffsetDelFail)
|
|
end
|
|
else -- lavorazione ok
|
|
if bModifyMacNote then
|
|
-- setto nota per non lavorarla di nuovo
|
|
SetInfoTable( tEndId, 'Mach', 13+ nOffsetDel)
|
|
end
|
|
if bNotGenMachining then
|
|
-- setto nota per non lavorarla di nuovo
|
|
SetInfoTable( tEndId, 'Mach', 13+ nOffsetDel)
|
|
if bCalMach then
|
|
SetInfoTable( tEndId, 'Machining', sMachDw)
|
|
nNumMach = nNumMach + 1
|
|
end
|
|
else
|
|
if tMachining then
|
|
table.insert( tMachining,{nMachId,sToolName})
|
|
end
|
|
-- verifico se lavorati lati esterni porta
|
|
CheckExtSideMach(tEndId)
|
|
end
|
|
end
|
|
end
|
|
|
|
return bOk, nNumMach, tMachining
|
|
end
|
|
|
|
-----------------------------------------------------------------
|
|
-- *** Calc Machining for same group ***
|
|
-----------------------------------------------------------------
|
|
local function FindAndCalcGroupMachining( nEndId, nEndIdGhost, tLocTable, nNumMachFromTable, nMach,
|
|
nNumGroup, nNumMach, bOk, dBladePerpLeadIn, dPercRedFeed )
|
|
|
|
local nParendId = EgtGetParent(nEndId)
|
|
local EntListMain = MB.FindEntities( nParendId) -- ricavo tutte le entità che sono nello stesso gruppo
|
|
local sLocMachId
|
|
local bNotGenMachining = true
|
|
|
|
-- ordinare lavorazioni navette come scritto su foglio nella documentazione
|
|
|
|
for i = 1, #tLocTable do
|
|
|
|
if tLocTable[i].On ~= 0 then
|
|
|
|
sLocMachId = tLocTable[i].MachId
|
|
if not sLocMachId then sLocMachId = 1 end
|
|
|
|
if sLocMachId == nNumMachFromTable then
|
|
|
|
-- Recupero le entità
|
|
local EntList = MB.FindEntitiesWithNameFromTab( EntListMain, tLocTable[i].Name)
|
|
|
|
-- Applico le lavorazioni
|
|
for j = 1, #EntList do
|
|
|
|
local nMachCk = EgtGetInfo( EntList[j], 'MachCk', 'i') or 1
|
|
|
|
if tLocTable[i].Oper == 'AdjustHead' and nMachCk > 0 and nMachCk < 10 then
|
|
|
|
-- assegno la stessa nota nMach dell'entità del gruppo
|
|
EgtSetInfo( EntList[j], 'Mach', nMach)
|
|
-- duplico entià
|
|
local nNewEntId = MB.MakeGhostCopy( EntList[j])
|
|
-- carico id entità in una tabella
|
|
local tListSameMach = {}
|
|
table.insert( tListSameMach, nNewEntId)
|
|
|
|
bOk, nNumMach = InsertMachiningByMachNum( tListSameMach, nMach, tLocTable[i].Name, nNumGroup, tLocTable[i].Mach,
|
|
tLocTable[i].MachUp, tLocTable[i].MachDw, bOk, nNumMach, true,
|
|
bNotGenMachining, nil, dBladePerpLeadIn, dPercRedFeed)
|
|
|
|
local nNewMach = EgtGetInfo( tListSameMach[1], 'Mach', 'i') or 1
|
|
if nNewMach > 30 and nNewMach < 40 then
|
|
EgtSetInfo( EntList[j], 'Mach', nNewMach-20) -- assegno nota per non lavorarla di nuovo
|
|
elseif nNewMach > 40 and nNewMach < 50 then
|
|
EgtSetInfo( EntList[j], 'Mach', nNewMach-30) -- assegno nota per non lavorarla di nuovo
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
return bOk, nNumMach
|
|
end
|
|
|
|
-----------------------------------------------------------------
|
|
-- *** Add Machining for same group ***
|
|
-----------------------------------------------------------------
|
|
local function MakeGroupMachining( nEndId, nParendId, tLocTable, nMach, nNumGroup,
|
|
nNumMach, bOk, sGhostName, dMaxDistToChain, EndLastMach,
|
|
dBladePerpLeadIn, dPercRedFeed)
|
|
|
|
local EntListMain = MB.FindEntities( nParendId) -- ricavo tutte le entità che sono nello stesso gruppo
|
|
|
|
-- ordinare lavorazioni navette come scritto su foglio nella documentazione
|
|
|
|
for i = 1, #tLocTable do
|
|
|
|
-- Recupero le entità
|
|
local EntList = MB.FindEntitiesWithNameFromTab( EntListMain, tLocTable[i].Name..sGhostName)
|
|
|
|
-- Applico le lavorazioni
|
|
for j = 1, #EntList do
|
|
|
|
local nMachCk = EgtGetInfo( EntList[j], 'Mach', 'i') or 1
|
|
nMachCk = nMachCk - 30 -- se lavorazione corretta ottengo 1
|
|
local nMach2nd = EgtGetInfo( EntList[j], 'Mach2nd', 'i') or 0
|
|
if nMachCk > 0 and nMachCk < 10 then nMachCk = 1 end
|
|
|
|
if nMachCk > 0 and nMachCk < 10 then
|
|
|
|
local nNewEntId = EntList[j]
|
|
local sMachining = EgtGetInfo( nNewEntId, 'Machining')
|
|
|
|
if sMachining and nMach == 1 and nMach2nd == 0 and sMachining == tLocTable[i].Mach then
|
|
|
|
-- cerco di unire più entità nella stessa lavorazione ( non da sotto e non oltre una certa distanza)
|
|
local tListSameMach = MB.FindEntitiesCompMach( nNewEntId, EntList, sMachining, tLocTable[i].Join, dMaxDistToChain, true, true)
|
|
|
|
-- se più di 1 entità le ordino
|
|
if #tListSameMach > 1 then
|
|
tListSameMach = MB.OrderEnt( tListSameMach, EndLastMach)
|
|
EndLastMach = EgtSP( tListSameMach[#tListSameMach], GDB_ID.ROOT )
|
|
end
|
|
|
|
bOk, nNumMach = InsertMachiningByMachNum( tListSameMach, nMach, tLocTable[i].Name, nNumGroup, tLocTable[i].Mach,
|
|
tLocTable[i].MachUp, tLocTable[i].MachDw, bOk, nNumMach, true,
|
|
GEN_MACH, nil, dBladePerpLeadIn, dPercRedFeed)
|
|
|
|
-- se ho assegnato lavorazione a più entità, marco quelle che ho già fatto
|
|
SetInfoTable( tListSameMach, 'Mach2nd', 1)
|
|
|
|
local nNewMach = EgtGetInfo( tListSameMach[1], 'Mach', 'i') or 1
|
|
if nNewMach > 30 and nNewMach < 40 then
|
|
SetInfoTable( tListSameMach, 'Mach', nNewMach-20) -- assegno nota per non lavorarla di nuovo
|
|
elseif nNewMach > 40 and nNewMach < 50 then
|
|
SetInfoTable( tListSameMach, 'Mach', nNewMach-30) -- assegno nota per non lavorarla di nuovo
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- tolgo di mezzo le note secondarie
|
|
for j = 1, #EntList do
|
|
EgtRemoveInfo( EntList[j], 'Mach2nd')
|
|
end
|
|
end
|
|
|
|
return bOk, nNumMach
|
|
end
|
|
|
|
-----------------------------------------------------------------
|
|
-- *** calc disposition references ***
|
|
-----------------------------------------------------------------
|
|
local function CalcDispositionRef( bLeftPiece, bTopOnRight, dLeftOffs, dRightOffs, dTopOffs, dBottomOffs, bFlip, nKeepSideDoorInFront)
|
|
|
|
local dExtraX, dExtraY, nCorner
|
|
|
|
if DISPMODE > 0 then -- se disposizione a sinistra della tavola
|
|
if bTopOnRight then -- se top a destra
|
|
dExtraX = -dBottomOffs
|
|
if ( bPush and bLeftPiece) or ( not bPush and not bLeftPiece) then
|
|
nCorner = MCH_CR.BL
|
|
dExtraY = EgtIf( bFlip, -dLeftOffs, -dRightOffs)
|
|
else
|
|
-- se orientamento teste definito
|
|
if nKeepSideDoorInFront > 0 then
|
|
nCorner = MCH_CR.BL
|
|
else
|
|
nCorner = MCH_CR.TL
|
|
end
|
|
dExtraY = EgtIf( bFlip, dRightOffs, dLeftOffs)
|
|
end
|
|
else -- se top a sinistra
|
|
dExtraX = -dTopOffs
|
|
if ( bPush and bLeftPiece) or ( not bPush and not bLeftPiece) then
|
|
-- se orientamento teste definito
|
|
if nKeepSideDoorInFront > 0 then
|
|
nCorner = MCH_CR.BL
|
|
else
|
|
nCorner = MCH_CR.TL
|
|
end
|
|
dExtraY = EgtIf( bFlip, dLeftOffs, dRightOffs)
|
|
else
|
|
nCorner = MCH_CR.BL
|
|
dExtraY = EgtIf( bFlip, -dRightOffs, -dLeftOffs)
|
|
end
|
|
end
|
|
else -- altrimenti disposizione a destra della tavola
|
|
if bTopOnRight then -- se top a destra
|
|
dExtraX = dTopOffs
|
|
if ( bPush and bLeftPiece) or ( not bPush and not bLeftPiece) then
|
|
nCorner = MCH_CR.BR
|
|
dExtraY = EgtIf( bFlip, -dLeftOffs, -dRightOffs)
|
|
else
|
|
-- se orientamento teste definito
|
|
if nKeepSideDoorInFront > 0 then
|
|
nCorner = MCH_CR.BR
|
|
else
|
|
nCorner = MCH_CR.TR
|
|
end
|
|
dExtraY = EgtIf( bFlip, dRightOffs, dLeftOffs)
|
|
end
|
|
else -- se top a sinistra
|
|
dExtraX = dBottomOffs
|
|
if ( bPush and bLeftPiece) or ( not bPush and not bLeftPiece) then
|
|
-- se orientamento teste definito
|
|
if nKeepSideDoorInFront > 0 then
|
|
nCorner = MCH_CR.BR
|
|
else
|
|
nCorner = MCH_CR.TR
|
|
end
|
|
dExtraY = EgtIf( bFlip, dLeftOffs, dRightOffs)
|
|
else
|
|
nCorner = MCH_CR.BR
|
|
dExtraY = EgtIf( bFlip, -dRightOffs, -dLeftOffs)
|
|
end
|
|
end
|
|
end
|
|
|
|
return dExtraX, dExtraY, nCorner
|
|
end
|
|
|
|
-----------------------------------------------------------------
|
|
-- *** calc disposition subpieces ***
|
|
-----------------------------------------------------------------
|
|
local function CalcDispositionSubPieces( nNumB, nRowId, bFixSameVac, tsBaseNameVac, ttBaseDataVac,
|
|
sInd, tnNumVacInsert, tnNumKindVac, tdYCommpos, nInd,
|
|
tnCountFailed, tnMaxIniFailed, tnIniFailed, tnMaxMiddleFailed, tnMiddleFailed,
|
|
tnMaxEndFailed, tnEndFailed, nNumTotVacRow, dLenCalc, bNarrowStile,
|
|
tabOri, tnTypeSingleVacOnBar, bFrameOnNarrow, bUseViseOnFrameOnWide, dDimY)
|
|
|
|
local ptPos -- punto posizioni ventose
|
|
local bCanUp
|
|
local tPosSubPiece = {}
|
|
local tPosRowSubPieceRow = {}
|
|
local nCenterId
|
|
local nTypeVacSel = 0
|
|
local bCheckNext = true
|
|
local nCountTypeVac = 1
|
|
local nVacErr
|
|
local bBlindColl
|
|
local nCustType
|
|
|
|
-- se uso morsa
|
|
if bUseViseOnFrameOnWide then
|
|
|
|
nTypeVacSel = 1 -- inizio con il primo
|
|
|
|
while nCountTypeVac <= #ttBaseDataVac do
|
|
|
|
-- parto con il controllo del primo tipo di morsa
|
|
if nTypeVacSel == nCountTypeVac and bCheckNext then
|
|
|
|
nCenterId = EgtGetFirstNameInGroup( nRowId, ttBaseDataVac[nCountTypeVac][nNumB][1]..sInd)
|
|
-- se nome punto di riferimento presente e numero tipi di ventose sulla barra non nullo
|
|
if nCenterId and #ttBaseDataVac > 0 then
|
|
|
|
local dDistThru = ttBaseDataVac[nCountTypeVac][nNumB][3]
|
|
local dDistBlind = ttBaseDataVac[nCountTypeVac][nNumB][4]
|
|
local dDistCont = ttBaseDataVac[nCountTypeVac][nNumB][5]
|
|
|
|
ptPos = EgtSP( nCenterId, GDB_ID.ROOT)
|
|
bBlindColl = false
|
|
bCanUp, nVacErr, bBlindColl = ExecViseShapeVerify( ptPos, ttBaseDataVac[nCountTypeVac][nNumB][2], tabOri, dDistThru, dDistBlind, dDistCont, 0, dDimY)
|
|
if not bCanUp and nVacErr > 0 then
|
|
if nVacErr == 1 then
|
|
DoorOutLog( 'Group Mobile or Area not found into Vise model: '.. ttBaseDataVac[nCountTypeVac][nNumB][2] .. '. Please update vise nge model', 0)
|
|
else
|
|
DoorOutLog( 'Region REG_x not found into vise model: '.. ttBaseDataVac[nCountTypeVac][nNumB][2] .. '. Please update vise nge model', 0)
|
|
end
|
|
end
|
|
else
|
|
bCanUp = false
|
|
DoorOutLog( 'Point on .nge machine table not found: '.. ttBaseDataVac[nCountTypeVac][nNumB][1]..sInd, 0)
|
|
end
|
|
|
|
if bCanUp then -- è andata bene la ventosa
|
|
if #tsBaseNameVac[nNumB][1] > 0 then -- ho già il tipo ventosa
|
|
-- confermo questo tipo
|
|
tnNumKindVac[nNumB] = tsBaseNameVac[nNumB][3]
|
|
bCheckNext = false
|
|
else -- setto il nuovo tipo (in questo caso è il primo)
|
|
tsBaseNameVac[nNumB][1] = ttBaseDataVac[nCountTypeVac][nNumB][2]
|
|
tsBaseNameVac[nNumB][2] = ttBaseDataVac[nCountTypeVac][nNumB][2]
|
|
tsBaseNameVac[nNumB][3] = nTypeVacSel
|
|
tdYCommpos[nNumB] = ptPos:getY()
|
|
-- confermo questo tipo
|
|
tnNumKindVac[nNumB] = tsBaseNameVac[nNumB][3]
|
|
bCheckNext = false
|
|
end
|
|
end
|
|
end
|
|
|
|
nCountTypeVac = nCountTypeVac + 1
|
|
end -- end while
|
|
else
|
|
-- se ventosa fissa
|
|
if bFixSameVac then
|
|
if bNarrowStile and nNumB ~= 2 then
|
|
nTypeVacSel = tnNumVacInsert[nNumB] -- setto pari al numero di tipi gestito (può essere 1, 2 ,3, ecc)
|
|
else
|
|
-- controllo se ho già il tipo di ventosa usata
|
|
if #tsBaseNameVac[nNumB][1] > 0 then -- ho già il tipo ventosa
|
|
nTypeVacSel = tsBaseNameVac[nNumB][3]
|
|
else
|
|
nTypeVacSel = 1 -- inizio con il primo
|
|
end
|
|
end
|
|
elseif bNarrowStile and nNumB ~= 2 then -- se ho la proprietà per la narrow stile passo subito con quella più piccola
|
|
nTypeVacSel = tnNumVacInsert[nNumB] -- setto pari al numero di tipi gestito (può essere 1, 2 ,3, ecc)
|
|
else
|
|
if tnTypeSingleVacOnBar[nNumB] and tnTypeSingleVacOnBar[nNumB] >= 0 then
|
|
nTypeVacSel = tnTypeSingleVacOnBar[nNumB]
|
|
else
|
|
nTypeVacSel = 1 -- inizio con il primo
|
|
end
|
|
end
|
|
|
|
while nCountTypeVac <= #ttBaseDataVac do
|
|
|
|
-- parto con il controllo del primo tipo di ventosa
|
|
if nTypeVacSel == nCountTypeVac and bCheckNext then
|
|
|
|
nCenterId = EgtGetFirstNameInGroup( nRowId, ttBaseDataVac[nCountTypeVac][nNumB][1]..sInd)
|
|
-- se nome punto di riferimento presente e numero tipi di ventose sulla barra non nullo
|
|
if nCenterId and tnNumVacInsert[nNumB] > 0 then
|
|
local dDistThru = ttBaseDataVac[nCountTypeVac][nNumB][4]
|
|
local dDistBlind = ttBaseDataVac[nCountTypeVac][nNumB][5]
|
|
local dDistCont = ttBaseDataVac[nCountTypeVac][nNumB][6]
|
|
if bFrameOnNarrow then
|
|
dDistThru = ttBaseDataVac[nCountTypeVac][nNumB][7]
|
|
dDistBlind = ttBaseDataVac[nCountTypeVac][nNumB][8]
|
|
dDistCont = ttBaseDataVac[nCountTypeVac][nNumB][9]
|
|
end
|
|
ptPos = EgtSP( nCenterId, GDB_ID.ROOT)
|
|
bBlindColl = false
|
|
bCanUp, nVacErr, bBlindColl, nCustType = ExecVacShapeVerify( ptPos, ttBaseDataVac[nCountTypeVac][nNumB][2], tabOri, dDistThru, dDistBlind, dDistCont)
|
|
if not bCanUp and nVacErr > 0 then
|
|
if nVacErr == 1 then
|
|
DoorOutLog( 'Group Mobile or Area not found into Vacuum model: '.. ttBaseDataVac[nCountTypeVac][nNumB][2] .. '. Please update vacuum nge model', 0)
|
|
else
|
|
DoorOutLog( 'Region SHAPE not found into vacuum model: '.. ttBaseDataVac[nCountTypeVac][nNumB][2] .. '. Please update vacuum nge model', 0)
|
|
end
|
|
end
|
|
else
|
|
bCanUp = false
|
|
DoorOutLog( 'Point on .nge machine table not found: '.. ttBaseDataVac[nCountTypeVac][nNumB][1]..sInd, 0)
|
|
end
|
|
|
|
if bCanUp then -- è andata bene la ventosa
|
|
if #tsBaseNameVac[nNumB][1] > 0 then -- ho già il tipo ventosa
|
|
-- se ventosa fissa e corrisponde con questo tipo, setto quella fissa
|
|
if bFixSameVac and tsBaseNameVac[nNumB][3] == nTypeVacSel then
|
|
-- confermo questo tipo
|
|
tnNumKindVac[nNumB] = nCustType or tsBaseNameVac[nNumB][3]
|
|
bCheckNext = false
|
|
elseif not( bNarrowStile and nNumB ~= 2) then -- se non è tipo narrow stile setto questa
|
|
tsBaseNameVac[nNumB][1] = ttBaseDataVac[nCountTypeVac][nNumB][2]
|
|
tsBaseNameVac[nNumB][2] = ttBaseDataVac[nCountTypeVac][nNumB][3]
|
|
tsBaseNameVac[nNumB][3] = nTypeVacSel
|
|
tdYCommpos[nNumB] = ptPos:getY()
|
|
-- confermo questo tipo
|
|
tnNumKindVac[nNumB] = nCustType or tsBaseNameVac[nNumB][3]
|
|
bCheckNext = false
|
|
elseif ( bNarrowStile and nNumB ~= 2) then -- se tipo narrow stile
|
|
if tnNumVacInsert[nNumB] == nTypeVacSel then -- se sono all'ultimo tipo ventosa la confermo
|
|
tsBaseNameVac[nNumB][1] = ttBaseDataVac[nCountTypeVac][nNumB][2]
|
|
tsBaseNameVac[nNumB][2] = ttBaseDataVac[nCountTypeVac][nNumB][3]
|
|
tsBaseNameVac[nNumB][3] = nTypeVacSel
|
|
tdYCommpos[nNumB] = ptPos:getY()
|
|
-- confermo questo tipo
|
|
tnNumKindVac[nNumB] = nCustType or tsBaseNameVac[nNumB][3]
|
|
bCheckNext = false
|
|
elseif tnNumVacInsert[nNumB] > nTypeVacSel then
|
|
nTypeVacSel = nTypeVacSel + 1
|
|
end
|
|
end
|
|
else -- setto il nuovo tipo (in questo caso è il primo)
|
|
tsBaseNameVac[nNumB][1] = ttBaseDataVac[nCountTypeVac][nNumB][2]
|
|
tsBaseNameVac[nNumB][2] = ttBaseDataVac[nCountTypeVac][nNumB][3]
|
|
tsBaseNameVac[nNumB][3] = nTypeVacSel
|
|
tdYCommpos[nNumB] = ptPos:getY()
|
|
-- confermo questo tipo
|
|
tnNumKindVac[nNumB] = nCustType or tsBaseNameVac[nNumB][3]
|
|
|
|
if bFixSameVac then -- se ventosa fissa
|
|
if bNarrowStile and nNumB ~= 2 then -- se narrow stile
|
|
if tnNumVacInsert[nNumB] == nTypeVacSel then -- se ultima ventosa
|
|
bCheckNext = false
|
|
elseif tnNumVacInsert[nNumB] > nTypeVacSel then
|
|
nTypeVacSel = nTypeVacSel + 1
|
|
end
|
|
else -- non è narrow
|
|
bCheckNext = false
|
|
end
|
|
end
|
|
end
|
|
else
|
|
if nCountTypeVac < #ttBaseDataVac then
|
|
if bFixSameVac or not( bNarrowStile and nNumB ~= 2) then -- se ventose uguali o non ha propietà narrow stile
|
|
-- se posso incrementare il tipo ventosa
|
|
if tnNumVacInsert[nNumB] > nTypeVacSel then
|
|
nTypeVacSel = nTypeVacSel + 1
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
nCountTypeVac = nCountTypeVac + 1
|
|
end -- end while
|
|
end
|
|
|
|
-- eventuale abilitazione parte fissa
|
|
if bCanUp then -- se sottopezzo da inserire
|
|
|
|
local nCodVac
|
|
nCodVac = tnNumKindVac[nNumB]
|
|
|
|
-- inserisco la ventosa sul fisso
|
|
tPosSubPiece[1] = ptPos
|
|
tPosSubPiece[2] = nCodVac
|
|
tPosRowSubPieceRow = { tPosSubPiece[1], tPosSubPiece[2]}
|
|
|
|
-- interrompo le serie negative
|
|
if nInd > 1 then
|
|
tnCountFailed[nNumB] = 0
|
|
if tnMaxIniFailed[nNumB] < tnIniFailed[nNumB] then
|
|
tnMaxIniFailed[nNumB] = tnIniFailed[nNumB]
|
|
end
|
|
if tnMaxMiddleFailed[nNumB] < tnMiddleFailed[nNumB] then
|
|
tnMaxMiddleFailed[nNumB] = tnMiddleFailed[nNumB]
|
|
end
|
|
if tnMaxEndFailed[nNumB] < tnEndFailed[nNumB] then
|
|
tnMaxEndFailed[nNumB] = tnEndFailed[nNumB]
|
|
end
|
|
tnIniFailed[nNumB] = 0
|
|
tnMiddleFailed[nNumB] = 0
|
|
tnEndFailed[nNumB] = 0
|
|
end
|
|
else -- sottopezzo non inserito
|
|
if nNumB == 2 then -- se barra intermedia scrivo lo stesso la posizione
|
|
tPosSubPiece[1] = ptPos
|
|
else
|
|
tPosSubPiece[1] = ''
|
|
end
|
|
tPosSubPiece[2] = 0
|
|
tPosRowSubPieceRow = { tPosSubPiece[1], tPosSubPiece[2]}
|
|
|
|
tnCountFailed[nNumB] = tnCountFailed[nNumB] + 1
|
|
if nInd == 1 then -- setto solo il fallimento iniziale
|
|
tnIniFailed[nNumB] = tnCountFailed[nNumB]
|
|
elseif nInd == nNumTotVacRow or dLenCalc <= 0 then -- setto solo quello finale e annullo il medio
|
|
tnEndFailed[nNumB] = tnCountFailed[nNumB]
|
|
if tnMaxEndFailed[nNumB] < tnEndFailed[nNumB] then
|
|
tnMaxEndFailed[nNumB] = tnEndFailed[nNumB]
|
|
end
|
|
tnMiddleFailed[nNumB] = 0
|
|
else -- se fallisce riga intermedia aggiorno solo i contatori già iniziati
|
|
if tnIniFailed[nNumB] > 0 then
|
|
tnIniFailed[nNumB] = tnCountFailed[nNumB]
|
|
elseif tnEndFailed[nNumB] > 0 then
|
|
tnEndFailed[nNumB] = tnCountFailed[nNumB] - 1
|
|
else
|
|
tnMiddleFailed[nNumB] = tnCountFailed[nNumB]
|
|
end
|
|
end
|
|
end
|
|
|
|
return tPosRowSubPieceRow, bBlindColl
|
|
end
|
|
|
|
-----------------------------------------------------------------
|
|
-- *** insert special subpieces ***
|
|
-----------------------------------------------------------------
|
|
local function InsertSpecialSubPiece( tPosRowSubPieceRow, nNumTotVacRow, bTopOnRight, tsSpecialNameVac, tabOri,
|
|
dDistThru, dDistBlind, dDistSide, pPiecePos, nNumB,
|
|
tnMaxIniFailed, tnMaxMiddleFailed, tnMaxEndFailed, DISPMODE)
|
|
|
|
local bFound = false
|
|
local bRotVac = EgtIf( bTopOnRight, true, false)
|
|
local dMove = 0
|
|
local nFoundFirst = 0
|
|
local nPrecVacType = 0
|
|
local nVacErr
|
|
|
|
for l = 1, nNumTotVacRow do
|
|
|
|
local nIndVac = EgtIf( not bTopOnRight, l, ( nNumTotVacRow - l + 1))
|
|
local tnCodVac = tPosRowSubPieceRow[nIndVac]
|
|
|
|
if tnCodVac then -- se codice presente
|
|
|
|
if nFoundFirst == 0 then
|
|
nFoundFirst = EgtIf( bTopOnRight, nIndVac, l)
|
|
end
|
|
|
|
if bRotVac then
|
|
dMove = pPiecePos:getX() - tnCodVac[1]:getX()
|
|
else
|
|
dMove = tnCodVac[1]:getX() - pPiecePos:getX()
|
|
end
|
|
|
|
nPrecVacType = tnCodVac[2]
|
|
|
|
-- provo ad inserire la ventosa con il codice collisione
|
|
local bCanUp, nVacErr = ExecVacShapeVerify( tnCodVac[1], tsSpecialNameVac, tabOri, dDistThru, dDistBlind,
|
|
dDistSide, true, EgtIf( bRotVac, 180, 0), dMove)
|
|
|
|
if bCanUp then
|
|
|
|
tnCodVac[2] = EgtIf( bRotVac, 6, 5)
|
|
bFound = true
|
|
|
|
if nFoundFirst == l then -- se prima ventosa trovata dalla parte finale ( a sinistra)
|
|
if DISPMODE > 0 then -- se porta disposta a sinistra
|
|
if nPrecVacType == 0 then -- se ventosa precedente vuota
|
|
if tnMaxIniFailed[nNumB] > 0 then
|
|
tnMaxMiddleFailed[nNumB] = tnMaxMiddleFailed[nNumB] + tnMaxIniFailed[nNumB] - 1
|
|
tnMaxIniFailed[nNumB] = 0
|
|
end
|
|
end
|
|
else
|
|
if nPrecVacType == 0 then -- se ventosa precedente vuota
|
|
if tnMaxEndFailed[nNumB] > 0 then
|
|
tnMaxMiddleFailed[nNumB] = tnMaxMiddleFailed[nNumB] + tnMaxEndFailed[nNumB] - 1
|
|
tnMaxEndFailed[nNumB] = 0
|
|
end
|
|
end
|
|
end
|
|
-- se ( top a sinistra e ultima ventosa trovata ( a destra)) o ( top a destra e prima ventosa dalla parte iniziale ( a destra))
|
|
elseif (not bTopOnRight and l == nIndVac) or ( bTopOnRight and nFoundFirst == nIndVac) then
|
|
if DISPMODE > 0 then -- se porta disposta a sinistra
|
|
if nPrecVacType == 0 then -- se ventosa precedente vuota
|
|
if tnMaxEndFailed[nNumB] > 0 then
|
|
tnMaxMiddleFailed[nNumB] = tnMaxMiddleFailed[nNumB] + tnMaxEndFailed[nNumB] - 1
|
|
tnMaxEndFailed[nNumB] = 0
|
|
end
|
|
end
|
|
else
|
|
if nPrecVacType == 0 then -- se ventosa precedente vuota
|
|
if tnMaxIniFailed[nNumB] > 0 then
|
|
tnMaxMiddleFailed[nNumB] = tnMaxMiddleFailed[nNumB] + tnMaxIniFailed[nNumB] - 1
|
|
tnMaxIniFailed[nNumB] = 0
|
|
end
|
|
end
|
|
end
|
|
else -- se sono in posizione intermedia
|
|
if nPrecVacType == 0 then -- se ventosa vuota
|
|
-- se ( porta a sinistra e top a destra) o ( porta a destra e top a sinistra)
|
|
if ( DISPMODE > 0 and bTopOnRight) or ( DISPMODE < 0 and not bTopOnRight) then
|
|
if tnMaxEndFailed[nNumB] > 0 then
|
|
tnMaxMiddleFailed[nNumB] = tnMaxMiddleFailed[nNumB] + ( tnMaxEndFailed[nNumB] - ( nFoundFirst - nIndVac + 1))
|
|
tnMaxEndFailed[nNumB] = nFoundFirst - nIndVac - 1 -- sottraggo ancora 1 perché la base occupa due spazi
|
|
end
|
|
else
|
|
if tnMaxIniFailed[nNumB] > 0 then
|
|
tnMaxMiddleFailed[nNumB] = tnMaxMiddleFailed[nNumB] + ( tnMaxIniFailed[nNumB] - ( nIndVac - nFoundFirst + 1))
|
|
tnMaxIniFailed[nNumB] = nIndVac - nFoundFirst - 1 -- sottraggo ancora 1 perché la base occupa due spazi
|
|
end
|
|
end
|
|
-- if tnMaxMiddleFailed[nNumB] > 0 then
|
|
-- tnMaxMiddleFailed[nNumB] = tnMaxMiddleFailed[nNumB] - 1
|
|
-- end
|
|
end
|
|
end
|
|
else
|
|
if nVacErr == 1 then
|
|
DoorOutLog( 'Group Mobile or Area not found into Vacuum model: '.. tsSpecialNameVac .. '. Please update vacuum nge model', 0)
|
|
break
|
|
elseif nVacErr > 1 then
|
|
DoorOutLog( 'Region SHAPE not found into vacuum model: '.. tsSpecialNameVac .. '. Please update vacuum nge model', 0)
|
|
break
|
|
end
|
|
end
|
|
end
|
|
if bFound then break end
|
|
end
|
|
return tPosRowSubPieceRow, bFound
|
|
end
|
|
|
|
-----------------------------------------------------------------
|
|
-- *** disposition subpieces ***
|
|
-----------------------------------------------------------------
|
|
local function DispositionSubPieces( nNumB, nIndVac, tPosRowSubPieceRow, bFixSameVac, tsBaseNameVac,
|
|
tdYCommpos, ttBaseDataVac, nIndOri, tabOri, tsNoteRow,
|
|
nDispId, tsSpecialNameVac, pPiecePos, Pz, bInsSpecVac,
|
|
bUseViseOnFrameOnWide, dDimY)
|
|
|
|
local tnCodVac = tPosRowSubPieceRow[nIndVac]
|
|
local sCodVac
|
|
local sNameV, sNameVSld
|
|
local dMove = 0
|
|
local nFixVac
|
|
|
|
if tnCodVac then -- se codice presente
|
|
if tnCodVac[2] == 0 then
|
|
sCodVac = '0_'
|
|
else
|
|
if bInsSpecVac and tnCodVac[2] >= 5 and bFixSameVac then -- se ho inserito la ventosa speciale ma ho il codice di uniformare tutte le ventose, lo disabilito
|
|
bFixSameVac = false
|
|
end
|
|
if bUseViseOnFrameOnWide then
|
|
sNameV = ttBaseDataVac[1][nNumB][2]
|
|
sNameVSld = ttBaseDataVac[1][nNumB][2]
|
|
sCodVac = 'V_'
|
|
dMove = dDimY
|
|
elseif bFixSameVac and #tsBaseNameVac[nNumB][1] > 0 then -- se fissa sulla stessa ventosa
|
|
sNameV = tsBaseNameVac[nNumB][1]
|
|
sNameVSld = tsBaseNameVac[nNumB][2]
|
|
sCodVac = string.format( '%s_', tsBaseNameVac[nNumB][3])
|
|
tnCodVac[1] = Point3d{ tnCodVac[1]:getX(), tdYCommpos[nNumB], tnCodVac[1]:getZ()}
|
|
elseif tnCodVac[2] == 1 then
|
|
sNameV = ttBaseDataVac[1][nNumB][2]
|
|
sNameVSld = ttBaseDataVac[1][nNumB][3]
|
|
sCodVac = '1_'
|
|
elseif tnCodVac[2] == 2 then
|
|
sNameV = ttBaseDataVac[2][nNumB][2]
|
|
sNameVSld = ttBaseDataVac[2][nNumB][3]
|
|
sCodVac = '2_'
|
|
elseif tnCodVac[2] == 3 then
|
|
sNameV = ttBaseDataVac[3][nNumB][2]
|
|
sNameVSld = ttBaseDataVac[3][nNumB][3]
|
|
sCodVac = '3_'
|
|
elseif tnCodVac[2] == 5 then
|
|
sNameV = tsSpecialNameVac
|
|
sNameVSld = tsSpecialNameVac
|
|
sCodVac = '5_'
|
|
dMove = tnCodVac[1]:getX() - pPiecePos:getX()
|
|
-- scrivo una nota con la posizione della ventosa ad arco
|
|
EgtSetInfo( Pz, 'TopVacArcPos', Point3d( pPiecePos:getX(), tnCodVac[1]:getY(),0))
|
|
elseif tnCodVac[2] == 6 then
|
|
sNameV = tsSpecialNameVac
|
|
sNameVSld = tsSpecialNameVac
|
|
sCodVac = '6_'
|
|
dMove = pPiecePos:getX() - tnCodVac[1]:getX()
|
|
-- scrivo una nota con la posizione della ventosa ad arco
|
|
EgtSetInfo( Pz, 'TopVacArcPos', Point3d( pPiecePos:getX(), tnCodVac[1]:getY(),0))
|
|
elseif tnCodVac[2] == 7 then
|
|
sNameV = ttBaseDataVac[3][nNumB][2]
|
|
sNameVSld = ttBaseDataVac[3][nNumB][3]
|
|
sCodVac = '7_'
|
|
end
|
|
|
|
-- inserisco la ventosa
|
|
local sNameVac = EgtIf( fmod( nIndOri, 2) == 1, sNameVSld, sNameV)
|
|
nFixVac = EgtAddFixture( sNameVac, ( tnCodVac[1] - tabOri), EgtIf( tnCodVac[2] == 6, 180,0), dMove)
|
|
EgtSetInfo( nDispId, 'POS'..EgtNumToString( nNumB, 0)..'_'..EgtNumToString( nIndVac, 0), ( tnCodVac[1] - tabOri))
|
|
EgtSetInfo( nDispId, 'MOD'..EgtNumToString( nNumB, 0)..'_'..EgtNumToString( nIndVac, 0), sNameVac)
|
|
EgtSetInfo( nDispId, 'COD'..EgtNumToString( nNumB, 0)..'_'..EgtNumToString( nIndVac, 0), sCodVac)
|
|
end
|
|
tsNoteRow[nNumB] = EgtIf( DISPMODE > 0, tsNoteRow[nNumB] .. sCodVac, sCodVac .. tsNoteRow[nNumB])
|
|
else
|
|
tsNoteRow[nNumB] = EgtIf( DISPMODE > 0, tsNoteRow[nNumB] .. '0_', '0_' .. tsNoteRow[nNumB])
|
|
EgtRemoveInfo( nDispId, 'POS'..EgtNumToString( nNumB, 0)..'_'..EgtNumToString( nIndVac, 0))
|
|
EgtRemoveInfo( nDispId, 'MOD'..EgtNumToString( nNumB, 0)..'_'..EgtNumToString( nIndVac, 0))
|
|
EgtRemoveInfo( nDispId, 'COD'..EgtNumToString( nNumB, 0)..'_'..EgtNumToString( nIndVac, 0))
|
|
end
|
|
|
|
return nFixVac
|
|
end
|
|
|
|
-----------------------------------------------------------------
|
|
-- *** disposition references ***
|
|
-----------------------------------------------------------------
|
|
local function DispositionReferences( sNameRef, ptPosRef, nRotRef)
|
|
if sNameRef and ptPosRef and nRotRef then
|
|
local ptLoc = Point3d( ptPosRef)
|
|
local nRef = EgtAddFixture( sNameRef, ptLoc, nRotRef, 0)
|
|
end
|
|
end
|
|
|
|
local function CheckEnoughVacuums( nInd, nIdVac, tnMaxIniFailed, tnMaxMiddleFailed, tnMaxEndFailed,
|
|
bUseOnly2Bars, dTopRadius, bTopOnRight, bUseVise,
|
|
tIdViseDisp)
|
|
|
|
local bOk = true
|
|
local sMess = ''
|
|
|
|
if nIdVac == 0 then -- se codice per porta
|
|
if bUseOnly2Bars then -- in caso di due barre, inferiore e media
|
|
if nInd > 0 and (( tnMaxIniFailed[1] == nInd or tnMaxMiddleFailed[1] == nInd or tnMaxEndFailed[1] == nInd) or
|
|
( tnMaxIniFailed[2] == nInd or tnMaxMiddleFailed[2] == nInd or tnMaxEndFailed[2] == nInd)) then -- tutte le ventose basse
|
|
sMess = ' ' .. EgtDoorsMsg[531]
|
|
bOk = false
|
|
elseif nInd > 0 and ( tnMaxIniFailed[1] / nInd > 0.25) and
|
|
( tnMaxIniFailed[2] / nInd > 0.25) then -- ventose iniziali ( parte sinistra)
|
|
local nNumMsg = EgtIf( DISPMODE > 0, 532, 534)
|
|
sMess = ' ' .. EgtDoorsMsg[nNumMsg]
|
|
bOk = false
|
|
elseif nInd > 0 and ( tnMaxMiddleFailed[1] / nInd > 0.45) and
|
|
( tnMaxMiddleFailed[2] / nInd > 0.45) then -- ventose centrali
|
|
sMess = ' ' .. EgtDoorsMsg[533]
|
|
bOk = false
|
|
elseif nInd > 0 and ( tnMaxEndFailed[1] / nInd > 0.25) and
|
|
( tnMaxEndFailed[2] / nInd > 0.25) then -- ventose finali ( parte destra)
|
|
local nNumMsg = EgtIf( DISPMODE > 0, 534, 532)
|
|
sMess = ' ' .. EgtDoorsMsg[nNumMsg]
|
|
bOk = false
|
|
elseif (( tnMaxIniFailed[1] + tnMaxMiddleFailed[1] + tnMaxEndFailed[1]) >= nInd/2) and
|
|
(( tnMaxIniFailed[2] + tnMaxMiddleFailed[2] + tnMaxEndFailed[2]) >= nInd/2) then -- somma di vari intervalli
|
|
sMess = ' ' .. EgtDoorsMsg[531]
|
|
bOk = false
|
|
end
|
|
else
|
|
-- casi di scarse ventose: solo per le file esterne, quella centrale le considero solo per le porte ad arco
|
|
-- perché è capitato che la disposizione porta risultasse corretta con solo la fila centrale
|
|
if nInd > 0 and (( tnMaxIniFailed[1] == nInd or tnMaxMiddleFailed[1] == nInd or tnMaxEndFailed[1] == nInd) or
|
|
-- ( tnMaxIniFailed[2] == nInd or tnMaxMiddleFailed[2] == nInd or tnMaxEndFailed[2] == nInd) or
|
|
( tnMaxIniFailed[3] == nInd or tnMaxMiddleFailed[3] == nInd or tnMaxEndFailed[3] == nInd)) then -- tutte le ventose basse
|
|
sMess = ' ' .. EgtDoorsMsg[531]
|
|
bOk = false
|
|
elseif nInd > 0 and not dTopRadius and ( tnMaxIniFailed[1] / nInd > 0.25) and
|
|
-- ( tnMaxIniFailed[2] / nInd > 0.25) and
|
|
( tnMaxIniFailed[3] / nInd > 0.25) then -- ventose iniziali ( parte destra) senza top ad arco
|
|
local nNumMsg = EgtIf( DISPMODE > 0, 532, 534)
|
|
sMess = ' ' .. EgtDoorsMsg[nNumMsg]
|
|
bOk = false
|
|
elseif nInd > 0 and dTopRadius and not bTopOnRight and ( tnMaxIniFailed[1] / nInd > 0.25) and
|
|
-- ( tnMaxIniFailed[2] / nInd > 0.25) and
|
|
( tnMaxIniFailed[3] / nInd > 0.25) then -- ventose iniziali ( parte destra) top ad arco opposto
|
|
local nNumMsg = EgtIf( DISPMODE > 0, 532, 534)
|
|
sMess = ' ' .. EgtDoorsMsg[nNumMsg]
|
|
bOk = false
|
|
elseif nInd > 0 and dTopRadius and bTopOnRight and not ( tnMaxIniFailed[1] / nInd <= 0.35 and
|
|
tnMaxIniFailed[2] / nInd <= 0.55 and
|
|
tnMaxIniFailed[3] / nInd <= 0.35) then -- ventose iniziali ( parte destra) top ad arco su questo lato
|
|
local nNumMsg = EgtIf( DISPMODE > 0, 532, 534)
|
|
sMess = ' ' .. EgtDoorsMsg[nNumMsg]
|
|
bOk = false
|
|
elseif nInd > 0 and ( tnMaxMiddleFailed[1] / nInd > 0.45) and
|
|
-- ( tnMaxMiddleFailed[2] / nInd > 0.45) and
|
|
( tnMaxMiddleFailed[3] / nInd > 0.45) then -- ventose centrali
|
|
sMess = ' ' .. EgtDoorsMsg[533]
|
|
bOk = false
|
|
elseif nInd > 0 and not dTopRadius and ( tnMaxEndFailed[1] / nInd > 0.25) and
|
|
-- ( tnMaxEndFailed[2] / nInd > 0.25) and
|
|
( tnMaxEndFailed[3] / nInd > 0.25) then -- ventose finali ( parte sinistra) senza top ad arco
|
|
local nNumMsg = EgtIf( DISPMODE > 0, 534, 532)
|
|
sMess = ' ' .. EgtDoorsMsg[nNumMsg]
|
|
bOk = false
|
|
elseif nInd > 0 and dTopRadius and bTopOnRight and ( tnMaxEndFailed[1] / nInd > 0.25) and
|
|
-- ( tnMaxEndFailed[2] / nInd > 0.25) and
|
|
( tnMaxEndFailed[3] / nInd > 0.25) then -- ventose finali ( parte sinistra) top ad arco opposto
|
|
local nNumMsg = EgtIf( DISPMODE > 0, 534, 532)
|
|
sMess = ' ' .. EgtDoorsMsg[nNumMsg]
|
|
bOk = false
|
|
elseif nInd > 0 and dTopRadius and not bTopOnRight and not ( tnMaxEndFailed[1] / nInd <= 0.35 and
|
|
tnMaxEndFailed[2] / nInd <= 0.55 and
|
|
tnMaxEndFailed[3] / nInd <= 0.35) then -- ventose finali ( parte sinistra) top ad arco su questo lato
|
|
local nNumMsg = EgtIf( DISPMODE > 0, 534, 532)
|
|
sMess = ' ' .. EgtDoorsMsg[nNumMsg]
|
|
bOk = false
|
|
elseif (( tnMaxIniFailed[1] + tnMaxMiddleFailed[1] + tnMaxEndFailed[1]) >= nInd/2) and
|
|
-- (( tnMaxIniFailed[2] + tnMaxMiddleFailed[2] + tnMaxEndFailed[2]) >= nInd/2) and
|
|
(( tnMaxIniFailed[3] + tnMaxMiddleFailed[3] + tnMaxEndFailed[3]) >= nInd/2) then -- somma di vari intervalli
|
|
sMess = ' ' .. EgtDoorsMsg[531]
|
|
bOk = false
|
|
end
|
|
end
|
|
else -- altrimenti frame
|
|
if bUseVise then
|
|
-- numero morse insufficente
|
|
if tIdViseDisp and #tIdViseDisp < 3 then
|
|
sMess = ' ' .. EgtDoorsMsg[683]
|
|
bOk = false
|
|
elseif nInd > 0 and ( tnMaxIniFailed[nIdVac] > 2) then
|
|
local nNumMsg = EgtIf( DISPMODE > 0, 684, 685)
|
|
sMess = ' ' .. EgtDoorsMsg[nNumMsg]
|
|
bOk = false
|
|
elseif nInd > 0 and ( tnMaxEndFailed[nIdVac] > 2) then
|
|
local nNumMsg = EgtIf( DISPMODE > 0, 685, 684)
|
|
sMess = ' ' .. EgtDoorsMsg[nNumMsg]
|
|
bOk = false
|
|
end
|
|
else
|
|
-- casi di scarse ventose: solo per la fila 1
|
|
if nInd > 0 and ( tnMaxIniFailed[nIdVac] == nInd or tnMaxMiddleFailed[nIdVac] == nInd or tnMaxEndFailed[nIdVac] == nInd) then
|
|
sMess = ' ' .. EgtDoorsMsg[531]
|
|
bOk = false
|
|
elseif nInd > 0 and ( tnMaxIniFailed[nIdVac] / nInd > 0.25) then
|
|
local nNumMsg = EgtIf( DISPMODE > 0, 532, 534)
|
|
sMess = ' ' .. EgtDoorsMsg[nNumMsg]
|
|
bOk = false
|
|
elseif nInd > 0 and ( tnMaxMiddleFailed[nIdVac] / nInd > 0.45) then
|
|
sMess = ' ' .. EgtDoorsMsg[533]
|
|
bOk = false
|
|
elseif nInd > 0 and ( tnMaxEndFailed[nIdVac] / nInd > 0.25) then
|
|
local nNumMsg = EgtIf( DISPMODE > 0, 534, 532)
|
|
sMess = ' ' .. EgtDoorsMsg[nNumMsg]
|
|
bOk = false
|
|
elseif (( tnMaxIniFailed[nIdVac] + tnMaxMiddleFailed[nIdVac] + tnMaxEndFailed[nIdVac]) >= nInd/2) then
|
|
sMess = ' ' .. EgtDoorsMsg[531]
|
|
bOk = false
|
|
end
|
|
end
|
|
end
|
|
|
|
return bOk, sMess
|
|
end
|
|
|
|
local function MakeBoxFromSolidLayer( nSolidLayer, nProbeMode, nAuxLayer)
|
|
|
|
-- Box solido: lo ottengo dalla somma delle varie superfici della porta
|
|
local tListFaces = {}
|
|
if nProbeMode == 2 then
|
|
table.insert( tListFaces, EgtGetFirstNameInGroup( nSolidLayer, 'FLAT_UP_2'))
|
|
table.insert( tListFaces, EgtGetFirstNameInGroup( nSolidLayer, 'FLAT_DW_2'))
|
|
else
|
|
table.insert( tListFaces, EgtGetFirstNameInGroup( nSolidLayer, 'FLAT_UP'))
|
|
table.insert( tListFaces, EgtGetFirstNameInGroup( nSolidLayer, 'FLAT_DW'))
|
|
end
|
|
table.insert( tListFaces, EgtGetFirstNameInGroup( nSolidLayer, 'SIDE_LF'))
|
|
table.insert( tListFaces, EgtGetFirstNameInGroup( nSolidLayer, 'SIDE_RH'))
|
|
table.insert( tListFaces, EgtGetFirstNameInGroup( nSolidLayer, 'SIDE_BT'))
|
|
table.insert( tListFaces, EgtGetFirstNameInGroup( nSolidLayer, 'SIDE_TP'))
|
|
table.insert( tListFaces, EgtGetFirstNameInGroup( nSolidLayer, 'SIDE'))
|
|
|
|
-- aggiungo anche il layer AUX escludendo il testo
|
|
if nAuxLayer then
|
|
|
|
local nIdGeom = EgtGetFirstInGroup(nAuxLayer)
|
|
local nTypeEnt
|
|
|
|
while nIdGeom do
|
|
-- se elemento passato è un testo lo escludo
|
|
nTypeEnt = EgtGetType( nIdGeom)
|
|
if nTypeEnt ~= GDB_TY.EXT_TEXT then
|
|
table.insert( tListFaces, nIdGeom)
|
|
end
|
|
nIdGeom = EgtGetNext(nIdGeom)
|
|
end
|
|
end
|
|
|
|
local b3fx = BBox3d() -- inizializzo il box nullo
|
|
|
|
for i = 1, #tListFaces do
|
|
if tListFaces[i] then
|
|
local b3f1 = EgtGetBBoxGlob( tListFaces[i], GDB_BB.EXACT)
|
|
b3fx:Add(b3f1)
|
|
end
|
|
end
|
|
|
|
return b3fx
|
|
end
|
|
|
|
local function CheckPieceDimension ( bFrame, dLengthDoor, dWidthDoor, dThickDoor, OffsXSovr, OffsYSovr, ShiftXOri, ShiftYOri)
|
|
|
|
local bFailDim = false
|
|
local sErrMess = ''
|
|
local dLimitToCheck
|
|
local nNumMess
|
|
|
|
nNumMess = EgtIf( bFrame, 623, 622)
|
|
dLimitToCheck = EgtIf( bFrame, tMainTabPar.MnJL, ( tMainTabPar.MnDL - abs(ShiftXOri)))
|
|
if ( dLengthDoor + OffsXSovr) < dLimitToCheck then -- se lunghezza inferiore
|
|
bFailDim = true
|
|
sErrMess = string.format(EgtDoorsMsg[617], EgtDoorsMsg[nNumMess], EgtToUiUnits(dLengthDoor), EgtToUiUnits(OffsXSovr), EgtToUiUnits(dLengthDoor+OffsXSovr),
|
|
EgtToUiUnits(abs(ShiftXOri)), EgtToUiUnits(dLimitToCheck))
|
|
if #DGD.EMC > 0 then
|
|
DGD.EMC = DGD.EMC .. '\n'.. sErrMess
|
|
else
|
|
DGD.EMC = '\n'.. sErrMess
|
|
end
|
|
end
|
|
|
|
dLimitToCheck = EgtIf( bFrame, tMainTabPar.MxJL, ( tMainTabPar.MxDL - abs(ShiftXOri)))
|
|
if ( dLengthDoor + OffsXSovr) > dLimitToCheck then -- se lunghezza superiore
|
|
bFailDim = true
|
|
sErrMess = string.format(EgtDoorsMsg[616], EgtDoorsMsg[nNumMess], EgtToUiUnits(dLengthDoor), EgtToUiUnits(OffsXSovr), EgtToUiUnits(dLengthDoor+OffsXSovr),
|
|
EgtToUiUnits(abs(ShiftXOri)), EgtToUiUnits(dLimitToCheck))
|
|
if #DGD.EMC > 0 then
|
|
DGD.EMC = DGD.EMC .. '\n'.. sErrMess
|
|
else
|
|
DGD.EMC = '\n'.. sErrMess
|
|
end
|
|
end
|
|
|
|
dLimitToCheck = EgtIf( bFrame, tMainTabPar.MnJW, ( tMainTabPar.MnDW - abs(2*ShiftYOri)))
|
|
if ( dWidthDoor + (2*OffsYSovr)) < dLimitToCheck then -- se larghezza inferiore
|
|
bFailDim = true
|
|
sErrMess = string.format(EgtDoorsMsg[619], EgtDoorsMsg[nNumMess], EgtToUiUnits(dWidthDoor), EgtToUiUnits(2*OffsYSovr), EgtToUiUnits(dWidthDoor+(2*OffsYSovr)),
|
|
EgtToUiUnits(abs(2*ShiftYOri)), EgtToUiUnits(dLimitToCheck))
|
|
if #DGD.EMC > 0 then
|
|
DGD.EMC = DGD.EMC .. '\n'.. sErrMess
|
|
else
|
|
DGD.EMC = '\n'.. sErrMess
|
|
end
|
|
end
|
|
|
|
dLimitToCheck = EgtIf( bFrame, tMainTabPar.MxJW, ( tMainTabPar.MxDW - abs(2*ShiftYOri)))
|
|
if ( dWidthDoor + (2*OffsYSovr)) > dLimitToCheck then -- se larghezza superiore
|
|
bFailDim = true
|
|
sErrMess = string.format(EgtDoorsMsg[618], EgtDoorsMsg[nNumMess], EgtToUiUnits(dWidthDoor), EgtToUiUnits(2*OffsYSovr), EgtToUiUnits(dWidthDoor+(2*OffsYSovr)),
|
|
EgtToUiUnits(abs(2*ShiftYOri)), EgtToUiUnits(dLimitToCheck))
|
|
if #DGD.EMC > 0 then
|
|
DGD.EMC = DGD.EMC .. '\n'.. sErrMess
|
|
else
|
|
DGD.EMC = '\n'.. sErrMess
|
|
end
|
|
end
|
|
|
|
dLimitToCheck = EgtIf( bFrame, tMainTabPar.MnJT, tMainTabPar.MnDT)
|
|
if dThickDoor < dLimitToCheck then -- se spessore inferiore
|
|
bFailDim = true
|
|
sErrMess = string.format(EgtDoorsMsg[621], EgtDoorsMsg[nNumMess], EgtToUiUnits(dThickDoor), EgtToUiUnits(dLimitToCheck))
|
|
if #DGD.EMC > 0 then
|
|
DGD.EMC = DGD.EMC .. '\n'.. sErrMess
|
|
else
|
|
DGD.EMC = '\n'.. sErrMess
|
|
end
|
|
end
|
|
|
|
dLimitToCheck = EgtIf( bFrame, tMainTabPar.MxJT, tMainTabPar.MxDT)
|
|
if dThickDoor > dLimitToCheck then -- se spessore superiore
|
|
bFailDim = true
|
|
sErrMess = string.format(EgtDoorsMsg[620], EgtDoorsMsg[nNumMess], EgtToUiUnits(dThickDoor), EgtToUiUnits(dLimitToCheck))
|
|
if #DGD.EMC > 0 then
|
|
DGD.EMC = DGD.EMC .. '\n'.. sErrMess
|
|
else
|
|
DGD.EMC = '\n'.. sErrMess
|
|
end
|
|
end
|
|
|
|
return bFailDim
|
|
end
|
|
|
|
-----------------------------------------------------------------
|
|
-- *** Funzione di generazione lavorazioni ***
|
|
-----------------------------------------------------------------
|
|
function MachiningLoc.Calc( tPz, tsAssemb, nNumMachFromTable, nNumMachFromCam, nNumGroup)
|
|
|
|
--local nTime
|
|
|
|
-- inizializzo il contatore
|
|
--EgtStartCounter()
|
|
|
|
-- macchina e tabella di default
|
|
-- tabella parametri d'uso per variabili CurrcamInfo
|
|
tMainTabPar = {}
|
|
-- Machine name
|
|
tMainTabPar.MN = 'Multiax-' -- id 1
|
|
|
|
-- Machinings Table
|
|
local MachiningsTable = 'MachStdTable'
|
|
local MachiningsTableOrd = 'MachStdTable_Ord'
|
|
|
|
-- References on table (respect Zero machine)
|
|
-- Y Table
|
|
-- shift value
|
|
local vShift = Vector3d(0,0,0)
|
|
local vShiftVac = Vector3d(0,0,0)
|
|
local vNullShift = Vector3d(0,0,0)
|
|
|
|
-- utilizzo la tabella dati cam
|
|
local sPathCurrMachtabOri = 'CurrCamInfo'
|
|
local mCamData = require( sPathCurrMachtabOri)
|
|
|
|
-- resetto la macchinata (riporto il pezzo in area disegno)
|
|
EgtResetCurrMachGroup()
|
|
|
|
-- setto nuova variabile suffisso ghost DGD.GHT
|
|
DGD.GHT = '_HIDE'
|
|
|
|
-- elimino percorsi eventualmente creati dal Mach
|
|
-- cancello i percorsi ghost e tutti i percorsi di sgrossatura
|
|
local DelList = MB.FindEntitiesWithPartName( tPz, DGD.GHT)
|
|
-- ciclo su tutte le entità trovate
|
|
for j = 1, #DelList do
|
|
EgtErase( DelList[j] )
|
|
end
|
|
DelList = MB.FindEntitiesWithPartName( tPz, 'ROUGH_')
|
|
-- ciclo su tutte le entità trovate
|
|
for j = 1, #DelList do
|
|
EgtErase( DelList[j] )
|
|
end
|
|
|
|
--------------------------------------------------------------------------------
|
|
-- Dati del pezzo (porta, frame)
|
|
local tsProperties = {}
|
|
local tsRadiusProf = {}
|
|
local tsPlaneProf = {}
|
|
local tsDispJambByMat = {}
|
|
local tsStringData = {}
|
|
local tsDoubleData = {}
|
|
local tsBoolData = {}
|
|
local nProbeMode
|
|
local nPostProbeSet
|
|
|
|
-- Box pezzo
|
|
local Ls
|
|
local Aux
|
|
local b3Part, b3Solid
|
|
local tb3Part = {}
|
|
local tb3Solid = {}
|
|
|
|
-- Project path, name, extension
|
|
local sFilePath = EgtGetCurrFilePath()
|
|
local sFileDir, sFileName, sFileExt = EgtSplitPath( sFilePath)
|
|
|
|
--------------------------------------------------------------------------------
|
|
-- variabili CAM
|
|
local TAB
|
|
local MachinesName
|
|
-- *** settaggi CAM *** -- Mtable 2
|
|
local TABORD
|
|
-- variabili disposizione su più tavole
|
|
local nNumTblForOthMat = 2
|
|
local nForceAsMultiTbl
|
|
|
|
--------------------------------------------------------------------------------
|
|
-- variabili sottopezzi
|
|
local nTabId, nMobId1, nMobId2, nFixId, nDispId
|
|
local dFixval, dOldVal, dNewVal_2, dNewVal_1, dCalcLen
|
|
local tRefArea = {}
|
|
-- Interasse minimo gruppi ventose
|
|
local dMinDistGroup = 139.5
|
|
|
|
--------------------------------------------------------------------------------
|
|
-- assegnazione variabili CurrCamInfo
|
|
|
|
-- imposto i dati macchina secondo le informazioni del file cam
|
|
tMainTabPar.MN = mCamData[nNumMachFromCam].MachName -- MachName
|
|
tMainTabPar.MxDL = mCamData[nNumMachFromCam].MaxDoorLength -- dMaxDoorLength
|
|
tMainTabPar.MnDL = mCamData[nNumMachFromCam].MinDoorLength -- dMinDoorLength
|
|
tMainTabPar.MxDW = mCamData[nNumMachFromCam].MaxDoorWidth -- dMaxDoorWidth
|
|
tMainTabPar.MnDW = mCamData[nNumMachFromCam].MinDoorWidth -- dMinDoorWidth
|
|
tMainTabPar.MxDT = mCamData[nNumMachFromCam].MaxDoorThick -- dMaxDoorThick
|
|
tMainTabPar.MnDT = mCamData[nNumMachFromCam].MinDoorThick -- dMinDoorThick
|
|
tMainTabPar.MxJL = mCamData[nNumMachFromCam].MaxJambLength -- dMaxJambLength
|
|
tMainTabPar.MnJL = mCamData[nNumMachFromCam].MinJambLength -- dMinJambLength
|
|
tMainTabPar.MxJW = mCamData[nNumMachFromCam].MaxJambWidth -- dMaxJambWidth
|
|
tMainTabPar.MnJW = mCamData[nNumMachFromCam].MinJambWidth -- dMinJambWidth
|
|
tMainTabPar.MxJT = mCamData[nNumMachFromCam].MaxJambThick -- dMaxJambThick
|
|
tMainTabPar.MnJT = mCamData[nNumMachFromCam].MinJambThick -- dMinJambThick
|
|
tMainTabPar.AR = mCamData[nNumMachFromCam].dAltRef -- dAltRef
|
|
tMainTabPar.TR = mCamData[nNumMachFromCam].dTallRef -- dTallRef
|
|
tMainTabPar.LS = mCamData[nNumMachFromCam].sLocSecure -- sLocSecure
|
|
tMainTabPar.MOM = mCamData[nNumMachFromCam].MaxOverMat -- dMaxOverMat
|
|
tMainTabPar.SOM = mCamData[nNumMachFromCam].StepOverMat or 10 -- dStepOverMat
|
|
tMainTabPar.TDD = mCamData[nNumMachFromCam].TopSideDriveDisp -- nTopSideDriveDisp
|
|
tMainTabPar.MDC = mCamData[nNumMachFromCam].MaxDistToChain -- dMaxDistToChain
|
|
tMainTabPar.FPB = mCamData[nNumMachFromCam].FramePosBar -- dPosBarForJamb
|
|
tMainTabPar.FVR = mCamData[nNumMachFromCam].nFixSameVacOnRaw == 1 -- bFixSameVac
|
|
tMainTabPar.NTVB1 = mCamData[nNumMachFromCam].nNumTypeVacOnBar1 -- nNumTypeVacOnBar1
|
|
tMainTabPar.NTVB2 = mCamData[nNumMachFromCam].nNumTypeVacOnBar2 -- nNumTypeVacOnBar2
|
|
tMainTabPar.NTVB3 = mCamData[nNumMachFromCam].nNumTypeVacOnBar3 -- nNumTypeVacOnBar3
|
|
tMainTabPar.TSVB1 = mCamData[nNumMachFromCam].nTypeSingleVacOnBar1 -- new
|
|
tMainTabPar.TSVB2 = mCamData[nNumMachFromCam].nTypeSingleVacOnBar2 -- new
|
|
tMainTabPar.TSVB3 = mCamData[nNumMachFromCam].nTypeSingleVacOnBar3 -- new
|
|
-- nomi punti associati ai tipi ventosa sulle barre
|
|
tMainTabPar.P1T = mCamData[nNumMachFromCam].sNamePntOnBarsType1 -- new
|
|
tMainTabPar.P2T = mCamData[nNumMachFromCam].sNamePntOnBarsType2 -- new
|
|
tMainTabPar.P3T = mCamData[nNumMachFromCam].sNamePntOnBarsType3 -- new
|
|
-- tolleranza di ricerca per ventose
|
|
tMainTabPar.DTG = mCamData[nNumMachFromCam].dSafetyDistVacThru or 15 -- new
|
|
tMainTabPar.DBG = mCamData[nNumMachFromCam].dSafetyDistVacBlind or 45 -- new
|
|
tMainTabPar.DSG = mCamData[nNumMachFromCam].dSafetyDistVacSide or 1 -- new
|
|
tMainTabPar.DTGN = mCamData[nNumMachFromCam].dSafetyDistVacThruOnSide or 5 -- new
|
|
tMainTabPar.DBGN = mCamData[nNumMachFromCam].dSafetyDistVacBlindOnSide or 15 -- new
|
|
tMainTabPar.DSGN = mCamData[nNumMachFromCam].dSafetyDistVacSideOnSide or 1 -- new
|
|
-- primo tipo ventose
|
|
tMainTabPar.V1T1 = mCamData[nNumMachFromCam].sNameVacOnFixBarType1 -- new
|
|
tMainTabPar.V2T1 = mCamData[nNumMachFromCam].sNameVacOnMob1BarType1 -- new
|
|
tMainTabPar.V3T1 = mCamData[nNumMachFromCam].sNameVacOnMob2BarType1 -- new
|
|
tMainTabPar.V1T1E = mCamData[nNumMachFromCam].sNameVacElvOnFixBarType1 -- new
|
|
tMainTabPar.V2T1E = mCamData[nNumMachFromCam].sNameVacElvOnMob1BarType1 -- new
|
|
tMainTabPar.V3T1E = mCamData[nNumMachFromCam].sNameVacElvOnMob2BarType1 -- new
|
|
-- secondo tipo ventose
|
|
tMainTabPar.V1T2 = mCamData[nNumMachFromCam].sNameVacOnFixBarType2 -- new
|
|
tMainTabPar.V2T2 = mCamData[nNumMachFromCam].sNameVacOnMob1BarType2 -- new
|
|
tMainTabPar.V3T2 = mCamData[nNumMachFromCam].sNameVacOnMob2BarType2 -- new
|
|
tMainTabPar.V1T2E = mCamData[nNumMachFromCam].sNameVacElvOnFixBarType2 -- new
|
|
tMainTabPar.V2T2E = mCamData[nNumMachFromCam].sNameVacElvOnMob1BarType2 -- new
|
|
tMainTabPar.V3T2E = mCamData[nNumMachFromCam].sNameVacElvOnMob2BarType2 -- new
|
|
-- terzo tipo ventose
|
|
tMainTabPar.V1T3 = mCamData[nNumMachFromCam].sNameVacOnFixBarType3 -- new
|
|
tMainTabPar.V2T3 = mCamData[nNumMachFromCam].sNameVacOnMob1BarType3 -- new
|
|
tMainTabPar.V3T3 = mCamData[nNumMachFromCam].sNameVacOnMob2BarType3 -- new
|
|
tMainTabPar.V1T3E = mCamData[nNumMachFromCam].sNameVacElvOnFixBarType3 -- new
|
|
tMainTabPar.V2T3E = mCamData[nNumMachFromCam].sNameVacElvOnMob1BarType3 -- new
|
|
tMainTabPar.V3T3E = mCamData[nNumMachFromCam].sNameVacElvOnMob2BarType3 -- new
|
|
|
|
tMainTabPar.ETM = mCamData[nNumMachFromCam].ExtraThruDepthMachining -- dExtraThruDepth
|
|
tMainTabPar.OR1 = mCamData[nNumMachFromCam].Ori1 -- Ori1
|
|
tMainTabPar.OR2 = mCamData[nNumMachFromCam].Ori2 -- Ori2
|
|
tMainTabPar.OR1f = mCamData[nNumMachFromCam].Ori1f -- Ori1f
|
|
tMainTabPar.OR2f = mCamData[nNumMachFromCam].Ori2f -- Ori2f
|
|
tMainTabPar.OR1fv = mCamData[nNumMachFromCam].Ori1fv -- Ori1fv
|
|
tMainTabPar.OR2fv = mCamData[nNumMachFromCam].Ori2fv -- Ori2fv
|
|
tMainTabPar.OR3f = mCamData[nNumMachFromCam].Ori3f -- Ori3f
|
|
tMainTabPar.OR4f = mCamData[nNumMachFromCam].Ori4f -- Ori4f
|
|
tMainTabPar.OR5f = mCamData[nNumMachFromCam].Ori5f -- Ori5f
|
|
tMainTabPar.OR6f = mCamData[nNumMachFromCam].Ori6f -- Ori6f
|
|
tMainTabPar.SH1 = mCamData[nNumMachFromCam].Shift1 -- vShiftAct
|
|
tMainTabPar.SHL = mCamData[nNumMachFromCam].ShiftLck -- vShiftLockSide not used
|
|
tMainTabPar.DVL = mCamData[nNumMachFromCam].dDistanceVacLeft -- new
|
|
tMainTabPar.DVR = mCamData[nNumMachFromCam].dDistanceVacRight -- new
|
|
tMainTabPar.EZPB = mCamData[nNumMachFromCam].dExtraZedProbeBevels -- new
|
|
tMainTabPar.PTK = mCamData[nNumMachFromCam].dProbeThickness -- new
|
|
tMainTabPar.MJT = mCamData[nNumMachFromCam].MachineJambsTogether -- MachineJambsTogether
|
|
-- nome ventosa ad arco e parametri di sicurezza
|
|
tMainTabPar.AVNM = mCamData[nNumMachFromCam].ArcVacuumName_Mob1 -- new
|
|
tMainTabPar.ADTG = mCamData[nNumMachFromCam].dArcSafetyDistVacThru or 3 -- new
|
|
tMainTabPar.ADBG = mCamData[nNumMachFromCam].dArcSafetyDistVacBlind or 45 -- new
|
|
tMainTabPar.ADSG = mCamData[nNumMachFromCam].dArcSafetyDistVacSide or 1 -- new
|
|
tMainTabPar.GCDN = mCamData[nNumMachFromCam].nGenCncAsDdfName or 1 -- new
|
|
tMainTabPar.DACN = mCamData[nNumMachFromCam].nDisableAutoCncName or 0 -- new
|
|
tMainTabPar.BPLI = mCamData[nNumMachFromCam].BladePerpLeadIn or (3*25.4) -- new
|
|
tMainTabPar.PRF = mCamData[nNumMachFromCam].PercRedFeed or 0.3 -- new
|
|
dMinDistGroup = mCamData[nNumMachFromCam].dMinDistBetweenBars or dMinDistGroup -- new
|
|
tMainTabPar.MPMB = mCamData[nNumMachFromCam].dMaxPosMobBar or 1100.000 -- new
|
|
DISPMODE = mCamData[nNumMachFromCam].SideDoorDispose or DISPMODE -- SideDoorDispose
|
|
NUMTABLE = mCamData[nNumMachFromCam].nNumTableOnMachine or NUMTABLE -- new
|
|
nNumTblForOthMat = mCamData[nNumMachFromCam].nNumTableForOtherMaterial or nNumTblForOthMat -- new
|
|
nForceAsMultiTbl = mCamData[nNumMachFromCam].nForceUseAsMultiTable or nForceAsMultiTbl -- new
|
|
tMainTabPar.CUC = mCamData[nNumMachFromCam].nCheckUnderNCollision or 0 -- new
|
|
tMainTabPar.REF1 = mCamData[nNumMachFromCam].tDefinitionRef1 -- new
|
|
tMainTabPar.REF2 = mCamData[nNumMachFromCam].tDefinitionRef2 -- new
|
|
tMainTabPar.REF3 = mCamData[nNumMachFromCam].tDefinitionRef3 -- new
|
|
tMainTabPar.REF4 = mCamData[nNumMachFromCam].tDefinitionRef4 -- new
|
|
tMainTabPar.FWHB = mCamData[nNumMachFromCam].nWoodForceHorizMachOnBevelProf -- new
|
|
tMainTabPar.FSHB = mCamData[nNumMachFromCam].nSteelForceHorizMachOnBevelProf -- new
|
|
tMainTabPar.FAHB = mCamData[nNumMachFromCam].nAluminForceHorizMachOnBevelProf -- new
|
|
tMainTabPar.FFHB = mCamData[nNumMachFromCam].nFiberGForceHorizMachOnBevelProf -- new
|
|
tMainTabPar.NTVR = mCamData[nNumMachFromCam].nNumTotVacRow or 15 -- new
|
|
tMainTabPar.UVFF = mCamData[nNumMachFromCam].nUseViseForFrames or 0 -- new
|
|
-- primo tipo morse
|
|
tMainTabPar.VSF1 = mCamData[nNumMachFromCam].sNameViseOnFixBarType1 -- new
|
|
-- tolleranza di ricerca per morse
|
|
tMainTabPar.DTGV = mCamData[nNumMachFromCam].dSafetyDistVisThru or 15 -- new
|
|
tMainTabPar.DBGV = mCamData[nNumMachFromCam].dSafetyDistVisBlind or 45 -- new
|
|
tMainTabPar.DSGV = mCamData[nNumMachFromCam].dSafetyDistVisSide or 1 -- new
|
|
-- codice disposizione frames
|
|
tMainTabPar.FTDD = mCamData[nNumMachFromCam].FrameTopSideDriveDisp or 0 -- new
|
|
-- abilitazione collision detect
|
|
tMainTabPar.ECD = mCamData[nNumMachFromCam].EnableCollisionDetect or 0 -- new
|
|
-- flag che indica la direzione taglio porta
|
|
tMainTabPar.CDA = mCamData[nNumMachFromCam].sCutDirectionAdmitted or '' -- new
|
|
-- parametri per gestione scrap mode (limita le sgrossature solo all'ultima passata)
|
|
tMainTabPar.RSM = mCamData[nNumMachFromCam].RemoveScrapMode or 0 -- new
|
|
tMainTabPar.MSV = mCamData[nNumMachFromCam].MinScrapValue or 0 -- new
|
|
-- parametro esportazione vista tavola
|
|
tMainTabPar.ETV = mCamData[nNumMachFromCam].ExportTableView or 0 -- new
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
local MTable, MTableOrd
|
|
local sLocMachId
|
|
local bOk = true
|
|
local bFirstStep = true
|
|
local bShiftMchng = false
|
|
local bSmallShiftedDoor = false
|
|
local sDispMode
|
|
local sNotePhase
|
|
local sTotDispMode = ''
|
|
local sNumGroup = ''
|
|
local bGenFirstStep = false
|
|
local nIndexStartMach = 1
|
|
local bWork = true
|
|
local sIdList = ''
|
|
-- variabili utilizzate dentro al ciclo
|
|
local tMchId = {}
|
|
local nMchId
|
|
local sTab
|
|
local sTabx
|
|
local tabOri
|
|
local Ori
|
|
local vExtraYDelta
|
|
local ColA
|
|
local nRaw
|
|
local tnRaw = {}
|
|
local bSetTable
|
|
local bMoveRaw
|
|
local bTopOnRight
|
|
local bFrame
|
|
local bHingeOnRef
|
|
local bTopOnRef
|
|
-- variabili per disposizione sottopezzi
|
|
local dMobOffs1
|
|
local dMobOffs2
|
|
local dDistMinX
|
|
local dDistMaxX
|
|
local dVacOn
|
|
local dInterAx
|
|
local bUseOnly2Bars
|
|
local OffsXSovr = 0
|
|
local OffsYSovr = 0
|
|
local bUseVise
|
|
-- variabile per tool setup
|
|
local bSetUp
|
|
local MSetup
|
|
local sSetup
|
|
local tListError
|
|
local sListTool
|
|
-- variabili calcolo box
|
|
local b3SolidPiece = {}
|
|
local b3SolidPiece2 = {}
|
|
local b3SolidOnTab
|
|
local pMin
|
|
local pMinRecalc
|
|
local pMax
|
|
local dOffsX = 0
|
|
local dOffsY = 0
|
|
-- variabili conteggio lavorazioni profilatura bevel e saltate
|
|
local nNumMachSkip = 0
|
|
local bLocMach
|
|
local tsMachProf = {}
|
|
-- variabile per conteggio lavorazioni
|
|
local nNumMach = 0
|
|
local nNumSkip
|
|
local tSecMachTab = {}
|
|
local tSecMachTabOrd = {}
|
|
-- variabili per fase
|
|
local nNumPhase
|
|
local nPrevPhase
|
|
local nNumCycle = 1
|
|
-- variabili per gestione ripresa porta
|
|
local bFlipFirst
|
|
local bTopOnRightFirst
|
|
local sProfiles = ''
|
|
local nNumGeomBottom = 0
|
|
local nNumGeomTop = 0
|
|
local pDistToMove
|
|
local dAngleToAlign = 0
|
|
-- variabile materiale porta
|
|
local bWoodDoor
|
|
local bSteelDoor
|
|
local bAlumDoor
|
|
-- variabili proprietà speciali
|
|
local bSkinned
|
|
local bExtruded
|
|
local bNarrowStile
|
|
-- variabile check dimensioni porta
|
|
local bFailDim = false
|
|
-- variabile forza lavorazioni bevel orizzontali
|
|
local bForceHorizontalDir = false
|
|
-- variabile disposizione jambs
|
|
local nDispJambsMode = 0
|
|
-- variabile per disposizione frame
|
|
local bFlipFrame
|
|
local bFrameOnNarrow
|
|
|
|
-- tabella lavorazioni
|
|
local tLocMach = {}
|
|
local tLocMachOrd = {}
|
|
local tSplitDoorEnt = {}
|
|
local tSplitDataInf = {}
|
|
|
|
local bEnBreak = false
|
|
local bGetSplitCuts = false
|
|
local nNumProbeZ
|
|
|
|
-- Set Current Machine: si setta sulla fase 1
|
|
EgtSetCurrMachine( tMainTabPar.MN)
|
|
|
|
-- raccolgo gli id dei pezzi
|
|
for v = 1, #tPz do
|
|
sIdList = sIdList .. '_' .. EgtNumToString(tPz[v],0)
|
|
end
|
|
|
|
-- faccio tutte le fasi
|
|
while bWork do
|
|
|
|
-- per ogni pezzo passato
|
|
for v = 1, #tPz do
|
|
|
|
--nTime = EgtStopCounter()
|
|
--if not DGD or not DGD.NCGEN then
|
|
-- EgtOutBox( string.format( 'tempo calcolato sec: %s', (nTime/1000)), 'Time1', 'Time1')
|
|
--end
|
|
|
|
-- inizializzo il contatore
|
|
--EgtStartCounter()
|
|
|
|
Pz = tPz[v]
|
|
sAssemb = tsAssemb[v]
|
|
-- assegnamento variabili
|
|
bFrame = sAssemb and string.find( sAssemb, 'frame') == 1
|
|
Ls = EgtGetFirstNameInGroup( Pz, 'SOLID')
|
|
Aux = EgtGetFirstNameInGroup( Pz, 'AUX')
|
|
tsStringData.sCode = EgtGetInfo( Pz, 'Code')
|
|
tsDoubleData.dWidthDoor = EgtGetInfo( Pz, 'W', 'd')
|
|
tsDoubleData.dLengthDoor = EgtGetInfo( Pz, 'H', 'd')
|
|
tsDoubleData.dThickDoor = EgtGetInfo( Pz, 'T', 'd')
|
|
tsStringData.sSwing = EgtGetInfo( Pz, 'Swing')
|
|
tsStringData.sSecure = EgtGetInfo( Pz, 'Secure')
|
|
tsStringData.sDoorMaterial = EgtGetInfo( Pz, 'Material')
|
|
tsProperties = EgtSplitString( EgtGetInfo( Pz, 'Properties') or '')
|
|
tsDoubleData.TypePiece = EgtGetInfo( Pz, 'Piece Type', 'i')
|
|
tsStringData.sHingeTrim = EgtGetInfo( Pz, 'hingeedge_trimming')
|
|
tsStringData.sLockTrim = EgtGetInfo( Pz, 'lockedge_trimming')
|
|
tsStringData.sTopTrim = EgtGetInfo( Pz, 'top_trimming')
|
|
tsStringData.sBottomTrim = EgtGetInfo( Pz, 'bottom_trimming')
|
|
tsBoolData.bHingeMach = EgtGetInfo( Pz, 'hingeedge_machining', 'b')
|
|
tsBoolData.bLockMach = EgtGetInfo( Pz, 'lockedge_machining', 'b')
|
|
tsBoolData.bTopMach = EgtGetInfo( Pz, 'top_machining', 'b')
|
|
tsBoolData.bBottomMach = EgtGetInfo( Pz, 'bottom_machining', 'b')
|
|
tsDoubleData.dTopRadius = EgtGetInfo( Pz, 'top_radius', 'd')
|
|
tsDoubleData.dTopAngle = EgtGetInfo( Pz, 'top_angle', 'd')
|
|
tsDoubleData.dTopxDeltapos = EgtGetInfo( Pz, 'top_xdeltapos', 'd')
|
|
tsBoolData.bSwingDriveDisp = EgtGetInfo( Pz, 'SwingDriveDisp', 'b')
|
|
tsBoolData.bFrameOnWide = EgtGetInfo( Pz, 'FrameDispositionOnSide', 'b')
|
|
tsRadiusProf[1] = EgtGetInfo( Pz, 'RadHingeProfile', 'd')
|
|
tsRadiusProf[2] = EgtGetInfo( Pz, 'RadLockProfile', 'd')
|
|
tsRadiusProf[3] = EgtGetInfo( Pz, 'RadTopProfile', 'd')
|
|
tsRadiusProf[4] = EgtGetInfo( Pz, 'RadBottomProfile', 'd')
|
|
tsPlaneProf[1] = EgtGetInfo( Pz, 'PlnHingeProfile', 'd')
|
|
tsPlaneProf[2] = EgtGetInfo( Pz, 'PlnLockProfile', 'd')
|
|
tsPlaneProf[3] = EgtGetInfo( Pz, 'PlnTopProfile', 'd')
|
|
tsPlaneProf[4] = EgtGetInfo( Pz, 'PlnBottomProfile', 'd')
|
|
tsDispJambByMat[1] = EgtGetInfo( Pz, 'DisposeWJambsOnSide', 'i')
|
|
tsDispJambByMat[2] = EgtGetInfo( Pz, 'DisposeSJambsOnSide', 'i')
|
|
tsDispJambByMat[3] = EgtGetInfo( Pz, 'DisposeAJambsOnSide', 'i')
|
|
tsDispJambByMat[4] = EgtGetInfo( Pz, 'DisposeFJambsOnSide', 'i')
|
|
nProbeMode = EgtGetInfo( Pz, 'ProbeMode', 'i') or 0
|
|
nPostProbeSet = EgtGetInfo( Pz, 'PostProbeSet', 'i') or 0
|
|
tsDoubleData.dLeftOffs = EgtGetInfo( EgtGetFirstNameInGroup( Pz, 'Left') or GDB_ID.NULL, 'Offs', 'd') or 0
|
|
tsDoubleData.dRightOffs = EgtGetInfo( EgtGetFirstNameInGroup( Pz, 'Right') or GDB_ID.NULL, 'Offs', 'd') or 0
|
|
tsDoubleData.dTopOffs = EgtGetInfo( EgtGetFirstNameInGroup( Pz, 'Top') or GDB_ID.NULL, 'Offs', 'd') or 0
|
|
tsDoubleData.dBottomOffs = EgtGetInfo( EgtGetFirstNameInGroup( Pz, 'Bottom') or GDB_ID.NULL, 'Offs', 'd') or 0
|
|
-- flag posizione serratura ( vero se serratura a destra)
|
|
tsBoolData.bAtRight = ( tsStringData.sSwing:sub(1,1) == 'L')
|
|
|
|
-- setto il movimento di apertura della porta
|
|
if tsStringData.sSwing == 'RH' or tsStringData.sSwing == 'RHA' or tsStringData.sSwing == 'RHI' or
|
|
tsStringData.sSwing == 'LH' or tsStringData.sSwing == 'LHI' or tsStringData.sSwing == 'LHA' then
|
|
bPush = true
|
|
else
|
|
bPush = false
|
|
end
|
|
|
|
if bFirstStep and not bShiftMchng then
|
|
|
|
if v == 1 and tMainTabPar.GCDN == 0 then -- solo il primo pezzo e se il flag ha valore nullo
|
|
-- assegno al nome file il nome del campo Code del ddf
|
|
-- di default è uguale al nome del file ddf
|
|
sFileName = tsStringData.sCode
|
|
end
|
|
|
|
-- determino se la porta ha il materiale
|
|
bWoodDoor = FindMaterial( tsStringData.sDoorMaterial, 'wood') -- per wood ddors
|
|
bSteelDoor = FindMaterial( tsStringData.sDoorMaterial, 'steel') -- old nNumProperties = 4 -- per steeldoors
|
|
bAlumDoor = FindMaterial( tsStringData.sDoorMaterial, 'aluminum') -- per aluminum doors
|
|
|
|
if bWoodDoor then
|
|
ColA = Color3d( 255, 165, 0, 25)
|
|
-- setto forzatura lavorazioni orizzontali in base alla variabile nel CurrCamInfo inerente al materiale
|
|
if tMainTabPar.FWHB and tMainTabPar.FWHB > 0 then bForceHorizontalDir = true end
|
|
-- setto disposizione frame in base alla nota del pezzo (proviene dal file CurrDoorCustomData)
|
|
if tsDispJambByMat[1] then nDispJambsMode = tsDispJambByMat[1] end
|
|
elseif bSteelDoor then
|
|
ColA = Color3d( 167,196,197, 25)
|
|
-- setto forzatura lavorazioni orizzontali in base alla variabile nel CurrCamInfo inerente al materiale
|
|
if tMainTabPar.FSHB and tMainTabPar.FSHB > 0 then bForceHorizontalDir = true end
|
|
-- setto disposizione frame in base alla nota del pezzo (proviene dal file CurrDoorCustomData)
|
|
if tsDispJambByMat[2] then nDispJambsMode = tsDispJambByMat[2] end
|
|
elseif bAlumDoor then
|
|
ColA = Color3d( 208,213,217, 25)
|
|
-- setto forzatura lavorazioni orizzontali in base alla variabile nel CurrCamInfo inerente al materiale
|
|
if tMainTabPar.FAHB and tMainTabPar.FAHB > 0 then bForceHorizontalDir = true end
|
|
-- setto disposizione frame in base alla nota del pezzo (proviene dal file CurrDoorCustomData)
|
|
if tsDispJambByMat[3] then nDispJambsMode = tsDispJambByMat[3] end
|
|
else
|
|
ColA = Color3d( 255, 165, 0, 25)
|
|
-- setto forzatura lavorazioni orizzontali in base alla variabile nel CurrCamInfo inerente al materiale
|
|
if tMainTabPar.FFHB and tMainTabPar.FFHB > 0 then bForceHorizontalDir = true end
|
|
-- setto disposizione frame in base alla nota del pezzo (proviene dal file CurrDoorCustomData)
|
|
if tsDispJambByMat[4] then nDispJambsMode = tsDispJambByMat[4] end
|
|
end
|
|
|
|
-- se pezzo ( porta o telaio) in alluminio o acciaio
|
|
if bAlumDoor or bSteelDoor then
|
|
-- setto a 0 tutti i sovramateriali e li segno da non lavorare
|
|
tsDoubleData.dLeftOffs = 0
|
|
tsDoubleData.dRightOffs = 0
|
|
tsDoubleData.dTopOffs = 0
|
|
tsDoubleData.dBottomOffs = 0
|
|
tsBoolData.bHingeMach = false
|
|
tsBoolData.bLockMach = false
|
|
tsBoolData.bTopMach = false
|
|
tsBoolData.bBottomMach = false
|
|
end
|
|
|
|
-- determino se la porta ha speciali proprietà
|
|
bSkinned = FindProperty( tsProperties, 'skinned') -- old nNumProperties = 1 -- per skinned
|
|
bExtruded = FindProperty( tsProperties, 'extruded') -- old nNumProperties = 2 -- per extruded
|
|
bNarrowStile = FindProperty( tsProperties, 'narrowstile') -- old nNumProperties = 3 -- per narrowstile
|
|
|
|
-- ottengo la tabella corrente del primo pezzo
|
|
MachiningsTable = EgtGetInfo( tPz[1], 'MTable')
|
|
-- Box pezzo
|
|
table.insert( tb3Part, v, EgtGetBBoxGlob( Pz, GDB_BB.EXACT))
|
|
|
|
local b3fx = BBox3d() -- inizializzo il box nullo
|
|
b3fx = MakeBoxFromSolidLayer( Ls, nProbeMode, Aux)
|
|
|
|
table.insert( tb3Solid, v, b3fx)
|
|
end
|
|
|
|
-- assegno i box del pezzo
|
|
b3Part = tb3Part[v]
|
|
b3Solid = tb3Solid[v]
|
|
|
|
if v == 1 then -- solo il primo pezzo
|
|
|
|
if bFirstStep and not bShiftMchng then
|
|
|
|
-- *** settaggi CAM *** -- Mtable 1
|
|
if not MachiningsTable then -- se non c'è il nome della MTable esco
|
|
DGD.ERR = 34
|
|
local sErrMess = string.format(EgtDoorsMsg[597], MachiningsTable)
|
|
DGD.EMC = DGD.EMC .. '\n' .. sErrMess
|
|
WriteErrFile( sFileDir..sFileName..'.txt')
|
|
DoorOutLog( ' Err=' .. EgtNumToString( DGD.ERR, 0), 0)
|
|
DoorOutLog( sErrMess, 0) -- errore, file di tabella non trovato
|
|
-- se lanciato da DMach stampo anche un messaggio a video
|
|
if not DGD or not DGD.NCGEN then
|
|
EgtOutBox( sErrMess, EgtDoorsMsg[476], EgtDoorsMsg[477])
|
|
end
|
|
return false
|
|
end
|
|
EgtAddToPackagePath( sBaseDir .. 'MTables\\?.mtl')
|
|
|
|
if EgtExistsFile( sBaseDir .. 'MTables\\' .. MachiningsTable .. '.mtl') then
|
|
TAB = require( MachiningsTable)
|
|
if not TAB then
|
|
DGD.ERR = 27
|
|
local sErrMess = string.format(EgtDoorsMsg[490], sBaseDir .. 'MTables\\' .. MachiningsTable .. '.mtl')
|
|
DGD.EMC = DGD.EMC .. '\n' .. sErrMess
|
|
WriteErrFile( sFileDir..sFileName..'.txt')
|
|
DoorOutLog( ' Err=' .. EgtNumToString( DGD.ERR, 0), 0)
|
|
DoorOutLog( sErrMess, 0) -- errore tabella non trovata nel file
|
|
if not DGD or not DGD.NCGEN then
|
|
EgtOutBox( sErrMess, EgtDoorsMsg[476], EgtDoorsMsg[477])
|
|
end
|
|
return false
|
|
end
|
|
else
|
|
DGD.ERR = 35
|
|
local sErrMess = string.format(EgtDoorsMsg[597], sBaseDir .. 'MTables\\' .. MachiningsTable .. '.mtl')
|
|
DGD.EMC = DGD.EMC .. '\n' .. sErrMess
|
|
WriteErrFile( sFileDir..sFileName..'.txt')
|
|
DoorOutLog( ' Err=' .. EgtNumToString( DGD.ERR, 0), 0)
|
|
DoorOutLog( sErrMess, 0) -- errore, file di tabella non trovato
|
|
-- se lanciato da DMach stampo anche un messaggio a video
|
|
if not DGD or not DGD.NCGEN then
|
|
EgtOutBox( sErrMess, EgtDoorsMsg[476], EgtDoorsMsg[477])
|
|
end
|
|
return false
|
|
end
|
|
MachinesName = TAB.MMachineData
|
|
if not MachinesName then
|
|
DGD.ERR = 29
|
|
local sErrMess = string.format(EgtDoorsMsg[491], '')
|
|
DGD.EMC = DGD.EMC .. '\n' .. sErrMess
|
|
WriteErrFile( sFileDir..sFileName..'.txt')
|
|
DoorOutLog( ' Err=' .. EgtNumToString( DGD.ERR, 0), 0)
|
|
DoorOutLog( sErrMess, 0) -- Errore! Nome macchina: non presente in MTable
|
|
if not DGD or not DGD.NCGEN then
|
|
EgtOutBox( sErrMess, EgtDoorsMsg[476], EgtDoorsMsg[477])
|
|
end
|
|
return false
|
|
end
|
|
|
|
-- *** settaggi CAM *** -- Mtable 2
|
|
MachiningsTableOrd = MachiningsTable..'_'..EgtNumToString(nNumMachFromTable, 0)
|
|
EgtAddToPackagePath( sBaseDir .. 'MTables\\?.otl')
|
|
|
|
if EgtExistsFile( sBaseDir .. 'MTables\\' .. MachiningsTableOrd .. '.otl') then
|
|
TABORD = require( MachiningsTableOrd)
|
|
if not TABORD then
|
|
DGD.ERR = 30
|
|
local sErrMess = string.format(EgtDoorsMsg[490], sBaseDir .. 'MTables\\' .. MachiningsTableOrd .. '.otl')
|
|
DGD.EMC = DGD.EMC .. '\n' .. sErrMess
|
|
WriteErrFile( sFileDir..sFileName..'.txt')
|
|
DoorOutLog( ' Err=' .. EgtNumToString( DGD.ERR, 0), 0)
|
|
DoorOutLog( sErrMess, 0) -- errore tabella non trovata nel file
|
|
-- se lanciato da DMach stampo anche un messaggio a video
|
|
if not DGD or not DGD.NCGEN then
|
|
EgtOutBox( sErrMess, EgtDoorsMsg[476], EgtDoorsMsg[477])
|
|
end
|
|
return false
|
|
end
|
|
else
|
|
DGD.ERR = 31
|
|
local sErrMess = string.format(EgtDoorsMsg[597], sBaseDir .. 'MTables\\' .. MachiningsTableOrd .. '.otl')
|
|
DGD.EMC = DGD.EMC .. '\n' .. sErrMess
|
|
WriteErrFile( sFileDir..sFileName..'.txt')
|
|
DoorOutLog( ' Err=' .. EgtNumToString( DGD.ERR, 0), 0)
|
|
DoorOutLog( sErrMess, 0) -- errore, file di tabella non trovato
|
|
-- se lanciato da DMach stampo anche un messaggio a video
|
|
if not DGD or not DGD.NCGEN then
|
|
EgtOutBox( sErrMess, EgtDoorsMsg[476], EgtDoorsMsg[477])
|
|
end
|
|
return false
|
|
end
|
|
|
|
-- se non devo generare il cn esco subito
|
|
if MachinesName[nNumMachFromTable].NcGenerate ~= nil and not MachinesName[nNumMachFromTable].NcGenerate then
|
|
DoorOutLog( string.format(EgtDoorsMsg[492], tMainTabPar.MN), 0) -- warning. Cnc generation disable
|
|
return true
|
|
end
|
|
|
|
if tsStringData.sHingeTrim ~= 'SQ' and tsStringData.sHingeTrim ~= 'EB' and bNarrowStile then
|
|
DGD.ERR = 32
|
|
local sErrMess = string.format(EgtDoorsMsg[636], '')
|
|
DGD.EMC = DGD.EMC .. '\n' .. sErrMess
|
|
WriteErrFile( sFileDir..sFileName..'.txt')
|
|
DoorOutLog( ' Err=' .. EgtNumToString( DGD.ERR, 0), 0)
|
|
DoorOutLog( sErrMess, 0) -- errore, la proprietà narrow stile è compatibile solo con lato bevel
|
|
-- se lanciato da DMach stampo anche un messaggio a video
|
|
if not DGD or not DGD.NCGEN then
|
|
EgtOutBox( sErrMess, EgtDoorsMsg[476], EgtDoorsMsg[477])
|
|
end
|
|
return false
|
|
end
|
|
|
|
MTable = TAB.MTable
|
|
MTableOrd = TABORD.MTable
|
|
end
|
|
end
|
|
|
|
sDispMode = ''
|
|
|
|
if bFirstStep and not bShiftMchng then
|
|
|
|
if v == 1 then nNumGroup = nNumGroup + 1 end
|
|
|
|
-- Set Machining Group
|
|
if not sAssemb then -- se pezzo unico
|
|
nMchId = EgtAddMachGroup( 'Mach_' .. EgtNumToString(nNumGroup, 0) .. '_' .. tMainTabPar.MN)
|
|
else
|
|
-- creo gruppo lavoro
|
|
if v == 1 then
|
|
nMchId = EgtAddMachGroup( 'Ids'.. sIdList ..'_'..'Mach_' .. EgtNumToString(nNumGroup, 0) .. '_' .. tMainTabPar.MN)
|
|
end
|
|
end
|
|
if nMchId then
|
|
if tMainTabPar.DACN == 1 then
|
|
local sLocNumGroup = ''
|
|
if nNumGroup > 1 then sLocNumGroup = '_'..EgtNumToString(nNumGroup, 0) end
|
|
EgtSetInfo( nMchId, 'NcName', sFileName .. sLocNumGroup .. EgtIf( nProbeMode ~= 1,'.cnc','.prb'))
|
|
end
|
|
-- assegno al gruppo di lavoro l'info relativo allo stato del controllo collisione
|
|
EgtSetInfo( nMchId, 'EnableCollisionDetect', tMainTabPar.ECD)
|
|
-- Simulation for collision check
|
|
if tMainTabPar.ECD == 1 then
|
|
EgtSetInfo( nMchId, 'Vm', '1')
|
|
end
|
|
-- metto il gruppo lavorazione nella tabella
|
|
table.insert( tMchId, { tMainTabPar.MN, nMchId, Pz})
|
|
end
|
|
nNumPhase = EgtGetCurrPhase()
|
|
else
|
|
|
|
if v == 1 then
|
|
|
|
-- -- se non c'è probe mode (prod) e abilitata la tastatura di fianco filtro le geometrie che si trovano sopra e sotto
|
|
-- if nProbeMode == 0 and nPostProbeSet >= 3 then
|
|
-- -- Cancello i percorsi _HIDE di sideprobe perchè se viene ribaltata la porta la posizione del percorso _HIDE viene a
|
|
-- -- trovarsi a filo ventose
|
|
-- local DelList = MB.FindEntitiesWithPartName( tPz, 'ProbeSidePoint_HIDE')
|
|
-- -- ciclo su tutte le entità trovate
|
|
-- for j = 1, #DelList do
|
|
-- EgtErase( DelList[j] )
|
|
-- end
|
|
-- end
|
|
|
|
-- se nessuna lavorazione riutilizzo la vecchia fase
|
|
if nNumMach == 0 then
|
|
|
|
-- elimino i vecchi grezzi
|
|
for t = 1, #tnRaw do
|
|
EgtRemoveRawPart( tnRaw[t]) -- elimino il grezzo
|
|
end
|
|
|
|
-- elimino la disposizione dei sottopezzi
|
|
local nNumFix = EgtGetFirstFixture()
|
|
while nNumFix do
|
|
EgtRemoveFixture( nNumFix)
|
|
nNumFix = EgtGetFirstFixture()
|
|
end
|
|
else
|
|
nPrevPhase = nNumPhase
|
|
nNumPhase = EgtAddPhase() -- creo nuova fase
|
|
end
|
|
end
|
|
|
|
-- rendo corrente la fase
|
|
if nNumPhase then
|
|
EgtSetCurrPhase(nNumPhase)
|
|
end
|
|
end
|
|
|
|
-----------------------------------------------------------------------
|
|
-- Calcolo dei sovramateriali e definizione e posizionamento del grezzo
|
|
-----------------------------------------------------------------------
|
|
|
|
if bFirstStep and not bShiftMchng then
|
|
|
|
-- se check macchina settato per non gestire grezzo
|
|
if MachinesName[nNumMachFromTable].MakeRaw ~= nil and not MachinesName[nNumMachFromTable].MakeRaw then
|
|
tsDoubleData.dLeftOffs = 0
|
|
tsDoubleData.dRightOffs = 0
|
|
tsDoubleData.dTopOffs = 0
|
|
tsDoubleData.dBottomOffs = 0
|
|
end
|
|
else -- fase successiva ribaltata o spostata
|
|
|
|
-- i profili con lavorazione disabilitata li posso mettere subito a zero
|
|
if ( not tsBoolData.bLockMach and tsBoolData.bAtRight) or ( not tsBoolData.bHingeMach and not tsBoolData.bAtRight) then -- lavorazione lato destro disabilitata
|
|
tsDoubleData.dRightOffs = 0
|
|
end
|
|
|
|
if ( not tsBoolData.bLockMach and not tsBoolData.bAtRight) or ( not tsBoolData.bHingeMach and tsBoolData.bAtRight) then -- lavorazione lato sinistro disabilitata
|
|
tsDoubleData.dLeftOffs = 0
|
|
end
|
|
|
|
if not tsBoolData.bTopMach then -- lavorazione lato top disabilitata
|
|
tsDoubleData.dTopOffs = 0
|
|
end
|
|
|
|
if not tsBoolData.bBottomMach then -- lavorazione lato top disabilitata
|
|
tsDoubleData.dBottomOffs = 0
|
|
end
|
|
|
|
-- azzero i sovramateriali dei profili che sono stati lavorati
|
|
if tsMachProf and #tsMachProf[v] > 0 then
|
|
|
|
local sListProf = EgtSplitString( tsMachProf[v], ',')
|
|
for m = 1, #sListProf do
|
|
if string.lower( sListProf[m]) == 'left' then
|
|
tsDoubleData.dLeftOffs = 0
|
|
elseif string.lower( sListProf[m]) == 'right' then
|
|
tsDoubleData.dRightOffs = 0
|
|
elseif string.lower( sListProf[m]) == 'top' then
|
|
tsDoubleData.dTopOffs = 0
|
|
elseif string.lower( sListProf[m]) == 'bottom' then
|
|
tsDoubleData.dBottomOffs = 0
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- in base ai valori di sovramateriale sui lati, se tutti sono al di sotto di 3 volte il valore di attivazione della sgrossatura
|
|
-- allora disabilito lo scrapmode
|
|
if tsDoubleData.dLeftOffs < tMainTabPar.MSV and tsDoubleData.dRightOffs < tMainTabPar.MSV and
|
|
tsDoubleData.dTopOffs < tMainTabPar.MSV and tsDoubleData.dBottomOffs < tMainTabPar.MSV then
|
|
tMainTabPar.RSM = 0
|
|
end
|
|
|
|
-- se sono in ribaltamento e in rebuild della porta devo ruotare la porta
|
|
-- con il lato opposto parallelo a Y (prima della disposizione)
|
|
if not bFirstStep and nProbeMode == 2 then
|
|
|
|
local nRecId = EgtGetFirstNameInGroup( Pz, 'REC')
|
|
local nSideToAlign
|
|
local sSideToAlign
|
|
local nSideToAlignMid
|
|
local sSideToAlignMid
|
|
local nSideToAlignTop
|
|
local sSideToAlignTop
|
|
local bInvert
|
|
|
|
if ( bFlipFirst and bTopOnRightFirst) or ( not bFlipFirst and not bTopOnRightFirst) then
|
|
sSideToAlign = 'Right'
|
|
sSideToAlignMid = 'RightMid'
|
|
sSideToAlignTop = 'RightTop'
|
|
bInvert = false
|
|
else
|
|
sSideToAlign = 'Left'
|
|
sSideToAlignMid = 'LeftMid'
|
|
sSideToAlignTop = 'LeftTop'
|
|
bInvert = true
|
|
end
|
|
|
|
nSideToAlign = EgtGetFirstNameInGroup( nRecId, sSideToAlign)
|
|
nSideToAlignMid = EgtGetFirstNameInGroup( nRecId, sSideToAlignMid)
|
|
nSideToAlignTop = EgtGetFirstNameInGroup( nRecId, sSideToAlignTop)
|
|
|
|
local vVectorToAlign
|
|
|
|
if nSideToAlign then
|
|
if bInvert then
|
|
vVectorToAlign = EgtSV( nSideToAlign)
|
|
dAngleToAlign = atan(vVectorToAlign:getX(),vVectorToAlign:getY()) - 180
|
|
else
|
|
vVectorToAlign = EgtSV( nSideToAlign)
|
|
dAngleToAlign = atan(vVectorToAlign:getX(),vVectorToAlign:getY())
|
|
end
|
|
|
|
-- allineo il pezzo prendendo il riferimento del lato opposto al lato riferito nella prima fase
|
|
EgtRotate( Pz , ORIG(), Z_AX(), dAngleToAlign )
|
|
|
|
-- muovo la porta nelle origini
|
|
if ( bFlipFirst and bTopOnRightFirst) or ( not bFlipFirst and not bTopOnRightFirst) then -- lato allineato right
|
|
if tsBoolData.bAtRight then -- se serratura a destra
|
|
if tsStringData.sLockTrim == 'BD' or tsStringData.sLockTrim == 'BU' or
|
|
tsStringData.sLockTrim == 'BDEB' or tsStringData.sLockTrim == 'BUEB' then -- se profilo bevel
|
|
if bPush then -- se porta a spingere prendo come riferimento lato bottom
|
|
pDistToMove = EgtSP(nSideToAlign, GDB_ID.ROOT)
|
|
else -- prendo riferimento da lato top
|
|
pDistToMove = EgtSP(nSideToAlignTop, GDB_ID.ROOT)
|
|
end
|
|
elseif tsStringData.sLockTrim == 'CV' then -- prendo riferimento da lato bottom (o top)
|
|
pDistToMove = EgtSP(nSideToAlign, GDB_ID.ROOT)
|
|
else -- prendo riferimento da lato medio
|
|
pDistToMove = EgtSP(nSideToAlignMid, GDB_ID.ROOT)
|
|
end
|
|
else
|
|
if tsStringData.sHingeTrim == 'BD' or tsStringData.sHingeTrim == 'BU' or
|
|
tsStringData.sHingeTrim == 'BDEB' or tsStringData.sHingeTrim == 'BUEB' then -- se profilo bevel
|
|
if bPush then -- se porta a spingere prendo come riferimento lato bottom
|
|
pDistToMove = EgtSP(nSideToAlign, GDB_ID.ROOT)
|
|
else -- prendo riferimento da lato top
|
|
pDistToMove = EgtSP(nSideToAlignTop, GDB_ID.ROOT)
|
|
end
|
|
elseif tsStringData.sHingeTrim == 'CV' then -- prendo riferimento da lato bottom (o top)
|
|
pDistToMove = EgtSP(nSideToAlign, GDB_ID.ROOT)
|
|
else -- prendo riferimento da lato medio
|
|
pDistToMove = EgtSP(nSideToAlignMid, GDB_ID.ROOT)
|
|
end
|
|
end
|
|
else -- lato allineato left
|
|
if tsBoolData.bAtRight then -- se serratura a destra
|
|
if tsStringData.sHingeTrim == 'BD' or tsStringData.sHingeTrim == 'BU' or
|
|
tsStringData.sHingeTrim == 'BDEB' or tsStringData.sHingeTrim == 'BUEB' then -- se profilo bevel
|
|
if bPush then -- se porta a spingere prendo come riferimento lato bottom
|
|
pDistToMove = EgtEP(nSideToAlign, GDB_ID.ROOT)
|
|
else -- prendo riferimento da lato top
|
|
pDistToMove = EgtEP(nSideToAlignTop, GDB_ID.ROOT)
|
|
end
|
|
elseif tsStringData.sHingeTrim == 'CV' then -- prendo riferimento da lato bottom (o top)
|
|
pDistToMove = EgtEP(nSideToAlign, GDB_ID.ROOT)
|
|
else -- prendo riferimento da lato medio
|
|
pDistToMove = EgtEP(nSideToAlignMid, GDB_ID.ROOT)
|
|
end
|
|
else
|
|
if tsStringData.sLockTrim == 'BD' or tsStringData.sLockTrim == 'BU' or
|
|
tsStringData.sLockTrim == 'BDEB' or tsStringData.sLockTrim == 'BUEB' then -- se profilo bevel
|
|
if bPush then -- se porta a spingere prendo come riferimento lato bottom
|
|
pDistToMove = EgtEP(nSideToAlign, GDB_ID.ROOT)
|
|
else -- prendo riferimento da lato top
|
|
pDistToMove = EgtEP(nSideToAlignTop, GDB_ID.ROOT)
|
|
end
|
|
elseif tsStringData.sLockTrim == 'CV' then -- prendo riferimento da lato bottom (o top)
|
|
pDistToMove = EgtEP(nSideToAlign, GDB_ID.ROOT)
|
|
else -- prendo riferimento da lato medio
|
|
pDistToMove = EgtEP(nSideToAlignMid, GDB_ID.ROOT)
|
|
end
|
|
end
|
|
end
|
|
|
|
-- muovo il pezzo sull'origine
|
|
EgtMove( Pz, ORIG() - Point3d( pDistToMove:getX(), pDistToMove:getY(), 0), GDB_RT.GLOB)
|
|
|
|
-- ricalcolo il box del solido
|
|
b3Solid = MakeBoxFromSolidLayer( Ls, nProbeMode, Aux)
|
|
-- ricalcolo il box del pezzo
|
|
b3Part = EgtGetBBoxGlob( Pz, GDB_BB.EXACT)
|
|
end
|
|
-- bEnBreak = true
|
|
-- bWork = false
|
|
-- break
|
|
end
|
|
|
|
if bFirstStep then
|
|
table.insert( b3SolidPiece, EgtGetBBoxGlob( Pz, GDB_BB.EXACT))
|
|
else
|
|
table.insert( b3SolidPiece2, EgtGetBBoxGlob( Pz, GDB_BB.EXACT))
|
|
end
|
|
|
|
if b3SolidPiece[v] and b3SolidPiece2[v] and nProbeMode ~= 2 then
|
|
dOffsX = b3SolidPiece2[v]:getMin():getX() - b3SolidPiece[v]:getMin():getX()
|
|
dOffsY = b3SolidPiece2[v]:getMin():getY() - b3SolidPiece[v]:getMin():getY()
|
|
else
|
|
dOffsX = 0
|
|
dOffsY = 0
|
|
end
|
|
|
|
nRaw = EgtAddRawPart( Point3d(0,0,0),b3Solid:getDimX() + tsDoubleData.dLeftOffs + tsDoubleData.dRightOffs,
|
|
b3Solid:getDimY() + tsDoubleData.dTopOffs + tsDoubleData.dBottomOffs, b3Solid:getDimZ(), ColA)
|
|
table.insert( tnRaw, v, nRaw)
|
|
EgtAddPartToRawPart( Pz, b3Part:getMin() - b3Solid:getMin() + Vector3d( tsDoubleData.dLeftOffs + dOffsX, tsDoubleData.dBottomOffs + dOffsY, 0), nRaw)
|
|
|
|
if not bFirstStep and nProbeMode == 2 then
|
|
-- contromovimento e controrotazione del pezzo per riportarlo nelle condizioni originarie
|
|
EgtResetCurrMachGroup()
|
|
EgtMove( Pz, Point3d( pDistToMove:getX(), pDistToMove:getY(), 0) - ORIG(), GDB_RT.GLOB)
|
|
EgtRotate( Pz , ORIG(), Z_AX(), -dAngleToAlign )
|
|
EgtSetCurrMachGroup()
|
|
EgtSetCurrPhase(nNumPhase)
|
|
end
|
|
|
|
if bFirstStep then
|
|
-- se pezzo del telaio faccio l'opportuna rotazione
|
|
-- nDispJambsMode = 1: geometria verso il basso; = 2: geometria verso l'alto
|
|
if bFrame then
|
|
if nDispJambsMode > 0 then
|
|
bFlipFrame = false
|
|
if sAssemb == 'framesx' and not tsBoolData.bFrameOnWide then
|
|
bFrameOnNarrow = true
|
|
if (bPush and nDispJambsMode == 1) or (not bPush and nDispJambsMode == 2) then
|
|
EgtRotateRawPart( nRaw , Y_AX(), 90)
|
|
EgtRotateRawPart( nRaw , Z_AX(), 180)
|
|
else
|
|
EgtRotateRawPart( nRaw , Y_AX(), -90)
|
|
EgtRotateRawPart( nRaw , Z_AX(), 180)
|
|
bFlipFrame = true
|
|
end
|
|
elseif sAssemb == 'framedx' and not tsBoolData.bFrameOnWide then
|
|
bFrameOnNarrow = true
|
|
if (bPush and nDispJambsMode == 1) or (not bPush and nDispJambsMode == 2) then
|
|
EgtRotateRawPart( nRaw , Y_AX(), -90)
|
|
EgtRotateRawPart( nRaw , Z_AX(), 180)
|
|
else
|
|
EgtRotateRawPart( nRaw , Y_AX(), 90)
|
|
EgtRotateRawPart( nRaw , Z_AX(), 180)
|
|
bFlipFrame = true
|
|
end
|
|
elseif sAssemb == 'frametop' and not tsBoolData.bFrameOnWide then
|
|
bFrameOnNarrow = true
|
|
if (bPush and nDispJambsMode == 1) or (not bPush and nDispJambsMode == 2) then
|
|
EgtRotateRawPart( nRaw , Y_AX(), 90)
|
|
EgtRotateRawPart( nRaw , Z_AX(), 180)
|
|
else
|
|
EgtRotateRawPart( nRaw , Y_AX(), -90)
|
|
EgtRotateRawPart( nRaw , Z_AX(), 180)
|
|
bFlipFrame = true
|
|
end
|
|
elseif sAssemb == 'framebot' and not tsBoolData.bFrameOnWide then
|
|
bFrameOnNarrow = true
|
|
if (bPush and nDispJambsMode == 1) or (not bPush and nDispJambsMode == 2) then
|
|
EgtRotateRawPart( nRaw , Y_AX(), -90)
|
|
EgtRotateRawPart( nRaw , Z_AX(), 180)
|
|
else
|
|
EgtRotateRawPart( nRaw , Y_AX(), 90)
|
|
EgtRotateRawPart( nRaw , Z_AX(), 180)
|
|
bFlipFrame = true
|
|
end
|
|
end
|
|
end
|
|
|
|
-- se non è un frame disposto sul lato narrow verifico se il flag abilita le morse
|
|
if not bFrameOnNarrow then
|
|
bUseVise = tMainTabPar.UVFF and tMainTabPar.UVFF == 1
|
|
end
|
|
end
|
|
end
|
|
|
|
if bFirstStep and nProbeMode == 2 then
|
|
local dtempX = EgtIf( abs(b3Solid:getMin():getX()) < abs(b3Solid:getMax():getX()), b3Solid:getMin():getX(), b3Solid:getMax():getX())
|
|
local dtempY = EgtIf( abs(b3Solid:getMin():getY()) < abs(b3Solid:getMax():getY()), b3Solid:getMin():getY(), b3Solid:getMax():getY())
|
|
pMinRecalc = Point3d( dtempX, dtempY, 0)
|
|
else
|
|
pMinRecalc = Point3d( 0, 0, 0)
|
|
end
|
|
|
|
-- fase premach, in base al profilo cerniere e/o serratura, e se ci sono lavorazioni sopra o sotto o entrambe,
|
|
-- decido su quale lato disporre la porta per evitare inutili ribaltamenti
|
|
|
|
-- ricavo minimo e massimo del solido del pezzo
|
|
b3SolidOnTab = EgtGetBBoxGlob( Ls, GDB_BB.EXACT)
|
|
pMin = b3SolidOnTab:getMin()
|
|
pMax = b3SolidOnTab:getMax()
|
|
|
|
if v == 1 then -- solo il primo pezzo
|
|
|
|
if bFirstStep then
|
|
tLocMach = MTable
|
|
tLocMachOrd = MTableOrd
|
|
if not bShiftMchng then
|
|
nIndexStartMach = 1
|
|
end
|
|
else
|
|
tLocMach = tSecMachTab
|
|
tLocMachOrd = MTableOrd
|
|
if not bShiftMchng then
|
|
nIndexStartMach = 1
|
|
end
|
|
end
|
|
end
|
|
|
|
if bFirstStep and not bShiftMchng then
|
|
tsMachProf[v] = ''
|
|
end
|
|
|
|
if v == #tPz then -- solo all'ultimo pezzo
|
|
|
|
-- solo il primo giro, prendo nota dei profili tipo bevel
|
|
-- verifico se cave da sotto o da sopra
|
|
-- verifico se trovate lavorazioni applicate con 'shift'
|
|
if bFirstStep and not bShiftMchng then
|
|
|
|
local nUnderGeom
|
|
local tGeomThruUp = {}
|
|
local tGeomThruDw = {}
|
|
local tGeomBlindUp = {}
|
|
local tGeomBlindDw = {}
|
|
|
|
for i = 1, #tLocMach do
|
|
if tLocMach[i].On ~= 0 then
|
|
sLocMachId = tLocMach[i].MachId
|
|
-- se non c'è il campo macchina setto di default la 1
|
|
if not sLocMachId then sLocMachId = 1 end
|
|
|
|
-- se macchina corrispondente
|
|
if sLocMachId == nNumMachFromTable then
|
|
|
|
-- prendo i profili bevel direttamente dalla tabella
|
|
local sUpperProfName = string.upper(tLocMach[i].Name)
|
|
if tLocMach[i].Oper and tLocMach[i].Oper == 'AdjustBevel' then
|
|
if not string.find( sProfiles, sUpperProfName .. ',') then
|
|
sProfiles = sProfiles .. sUpperProfName .. ','
|
|
end
|
|
end
|
|
|
|
-- Recupero le entità
|
|
local EntList = MB.FindEntitiesWithName( tPz, tLocMach[i].Name)
|
|
|
|
-- se è una porta
|
|
if not bFrame then
|
|
-- se flag non ancora settato e trovata geometria e l'associazione è shiftata ..
|
|
-- setto il flag di disposizione iniziale Traslata
|
|
if not bSmallShiftedDoor and #EntList > 0 and
|
|
tLocMach[i].Shift and tLocMach[i].Shift > 0 then
|
|
bSmallShiftedDoor = true
|
|
end
|
|
end
|
|
-- Test delle lavorazioni
|
|
for j = 1, #EntList do
|
|
local nTypeGeom = 0
|
|
-- OPERAZIONI
|
|
if tLocMach[i].Oper == 'AdjustThrouIsle' then
|
|
bLocMach, nUnderGeom, nTypeGeom = MB.TestThrouIsle( EntList[j], b3Solid:getDimZ(), pMin, pMax, bWorkUnder)
|
|
if bLocMach then
|
|
if nUnderGeom and nUnderGeom == 1 then
|
|
nNumGeomBottom = nNumGeomBottom + 1
|
|
elseif nUnderGeom and nUnderGeom == -1 then
|
|
nNumGeomTop = nNumGeomTop + 1
|
|
end
|
|
end
|
|
if nTypeGeom == 1 then -- se passante up
|
|
table.insert( tGeomThruUp, EntList[j])
|
|
elseif nTypeGeom == 2 then -- se passante dw
|
|
table.insert( tGeomThruDw, EntList[j])
|
|
elseif nTypeGeom == 3 then -- se cieca up
|
|
table.insert( tGeomBlindUp, EntList[j])
|
|
elseif nTypeGeom == 4 then -- se cieca dw
|
|
table.insert( tGeomBlindDw, EntList[j])
|
|
end
|
|
elseif tLocMach[i].Oper == 'AdjustVertHole' then
|
|
bLocMach, nUnderGeom, nTypeGeom = MB.TestVertHole( EntList[j], b3Solid:getDimZ(), pMin, pMax, bWorkUnder)
|
|
if bLocMach then
|
|
if nUnderGeom and nUnderGeom == 1 then
|
|
nNumGeomBottom = nNumGeomBottom + 1
|
|
elseif nUnderGeom and nUnderGeom == -1 then
|
|
nNumGeomTop = nNumGeomTop + 1
|
|
end
|
|
end
|
|
if nTypeGeom == 1 then -- se passante up
|
|
table.insert( tGeomThruUp, EntList[j])
|
|
elseif nTypeGeom == 2 then -- se passante dw
|
|
table.insert( tGeomThruDw, EntList[j])
|
|
elseif nTypeGeom == 3 then -- se cieca up
|
|
table.insert( tGeomBlindUp, EntList[j])
|
|
elseif nTypeGeom == 4 then -- se cieca dw
|
|
table.insert( tGeomBlindDw, EntList[j])
|
|
end
|
|
elseif tLocMach[i].Oper == 'AdjustBevel' then
|
|
table.insert( tGeomThruUp, EntList[j])
|
|
elseif tLocMach[i].Oper == 'AdjustThrouCurve' then
|
|
table.insert( tGeomThruUp, EntList[j])
|
|
elseif tLocMach[i].Oper == 'AdjPrfThrouCurve' then
|
|
table.insert( tGeomThruUp, EntList[j])
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
-- in base al tipo e al numero geometrie, vedo se invertire una sola geometria
|
|
if #tGeomThruUp == 1 and #tGeomThruDw == 0 and #tGeomBlindUp == 0 and #tGeomBlindDw > 1 then -- se condizione per invertire l'unica geometria UP
|
|
if nNumGeomBottom > 0 then
|
|
MB.InvertGeom(tGeomThruUp[1])
|
|
end
|
|
end
|
|
if #tGeomThruDw == 1 and #tGeomThruUp == 0 and #tGeomBlindDw == 0 and #tGeomBlindUp > 1 then -- se condizione per invertire l'unica geometria UP
|
|
if nNumGeomTop > 0 then
|
|
MB.InvertGeom(tGeomThruDw[1])
|
|
end
|
|
end
|
|
elseif not bFirstStep and not bShiftMchng then -- se porta ribaltata
|
|
|
|
for i = 1, #tLocMach do
|
|
if tLocMach[i].On ~= 0 then
|
|
sLocMachId = tLocMach[i].MachId
|
|
-- se non c'è il campo macchina setto di default la 1
|
|
if not sLocMachId then sLocMachId = 1 end
|
|
|
|
if sLocMachId == nNumMachFromTable then
|
|
|
|
-- Recupero le entità
|
|
local EntList = MB.FindEntitiesWithName( tPz, tLocMach[i].Name)
|
|
|
|
-- se è una porta
|
|
if not bFrame then
|
|
-- se flag non ancora settato e trovata geometria e l'associazione è shiftata
|
|
-- setto il flag di disposizione iniziale Traslata
|
|
if not bSmallShiftedDoor and #EntList > 0 and
|
|
tLocMach[i].Shift and tLocMach[i].Shift > 0 then
|
|
bSmallShiftedDoor = true
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- se porta da disporre subito traslata o attiva proprietà narrow stile, setto i flag
|
|
if bSmallShiftedDoor or ( not bFrame and bNarrowStile) then
|
|
-- se narrowstile attiva, ricalcolo il valore dello shift
|
|
-- come differenza tra l'origine della porta e l'origine della barra fissa
|
|
if bNarrowStile then
|
|
if DISPMODE > 0 then -- se porta disposta a sinistra
|
|
tMainTabPar.SH1 = tMainTabPar.OR1f - tMainTabPar.OR1
|
|
else -- altrimenti porta disposta a destra
|
|
tMainTabPar.SH1 = tMainTabPar.OR2f - tMainTabPar.OR2
|
|
end
|
|
end
|
|
bShiftMchng = true -- porta traslata
|
|
bGenFirstStep = true -- flag per saltare il primo giro
|
|
end
|
|
end
|
|
|
|
-----------------------
|
|
-- *** Disposizione ***
|
|
-----------------------
|
|
|
|
if v == 1 then -- solo il primo pezzo
|
|
|
|
local sTabPrev = sTab
|
|
-- Scelta della tavola (per ora gestisco max 2 tavole)
|
|
if NUMTABLE and NUMTABLE > 1 then -- se ho la seconda tavola
|
|
if nForceAsMultiTbl and nForceAsMultiTbl > 0 then
|
|
sTab = string.format( 'Tab%s', nForceAsMultiTbl) -- setto la tavola
|
|
EgtSetInfo( Pz, 'TableUsed', nForceAsMultiTbl)
|
|
else -- altrimenti assegno la tavola in base al materiale
|
|
if bWoodDoor then -- se ho una wood door la metto sulla prima
|
|
-- se altro materiale messo sulla tavola 1 lo standard lo metto sulla seconda
|
|
if nNumTblForOthMat and nNumTblForOthMat == 1 then -- se ho il numero tavola per altro materiale
|
|
sTab = string.format( 'Tab%s', NUMTABLE) -- setto la tavola
|
|
EgtSetInfo( Pz, 'TableUsed', NUMTABLE)
|
|
else -- altrimenti forzo sulla prima tavola
|
|
sTab = 'Tab1' -- setto la prima tavola
|
|
EgtSetInfo( Pz, 'TableUsed', 1)
|
|
end
|
|
elseif bSteelDoor then -- se ho una steel door la metto sulla seconda tavola
|
|
if nNumTblForOthMat and nNumTblForOthMat > 0 then -- se ho il numero tavola per altro materiale
|
|
sTab = string.format( 'Tab%s', nNumTblForOthMat) -- setto la tavola
|
|
EgtSetInfo( Pz, 'TableUsed', nNumTblForOthMat)
|
|
else -- altrimenti forzo sulla seconda tavola
|
|
sTab = 'Tab2' -- setto la seconda
|
|
EgtSetInfo( Pz, 'TableUsed', 2)
|
|
end
|
|
else -- altrimenti materiale standard
|
|
-- se altro materiale messo sulla tavola 1 lo standard lo metto sulla seconda
|
|
if nNumTblForOthMat and nNumTblForOthMat == 1 then -- se ho il numero tavola per altro materiale
|
|
sTab = string.format( 'Tab%s', NUMTABLE) -- setto la tavola
|
|
EgtSetInfo( Pz, 'TableUsed', NUMTABLE)
|
|
else -- altrimenti forzo sulla prima tavola
|
|
sTab = 'Tab1' -- setto la prima tavola
|
|
EgtSetInfo( Pz, 'TableUsed', 1)
|
|
end
|
|
end
|
|
end
|
|
else -- se macchina ha solo una tavola
|
|
-- se uso macchina con due tavole ma forzata a una sola tavola (solo la 1)
|
|
if nForceAsMultiTbl then
|
|
if nForceAsMultiTbl > 0 then
|
|
sTab = string.format( 'Tab%s', nForceAsMultiTbl) -- setto la tavola
|
|
EgtSetInfo( Pz, 'TableUsed', nForceAsMultiTbl)
|
|
else
|
|
sTab = 'Tab1' -- setto la prima tavola
|
|
EgtSetInfo( Pz, 'TableUsed', 1)
|
|
sTabx = 'Tab'
|
|
end
|
|
else
|
|
sTab = 'Tab'
|
|
EgtSetInfo( Pz, 'TableUsed', 1)
|
|
end
|
|
end
|
|
|
|
if bFirstStep then
|
|
bSetTable = EgtSetTable( sTab)
|
|
if not bSetTable then
|
|
-- se sono nel caso che ho una sola tavola, probabilmente usa il nome semplice della tavola
|
|
if sTabx and sTabx ~= sTab then
|
|
sTab = sTabx
|
|
bSetTable = EgtSetTable( sTab)
|
|
end
|
|
if not bSetTable then
|
|
bOk = false
|
|
DGD.EMC = ' ' .. EgtDoorsMsg[676]..EgtDoorsMsg[682] -- Error in table setting.
|
|
break
|
|
end
|
|
end
|
|
else
|
|
if sTabPrev ~= sTab then
|
|
sTab = sTabPrev
|
|
end
|
|
end
|
|
|
|
-- Origine tavola corrente rispetto a Zero macchina (anche se la macchina ha 2 tavole si deve mettere l'indice 1)
|
|
tabOri = EgtGetTableRef( 1)
|
|
end
|
|
|
|
-- Rotazione porta in base alla macchina
|
|
bMoveRaw = false
|
|
local nCodeVacDisp = 0
|
|
|
|
-- definito col cliente: prima comanda il lato hinge, se ha il bevel lo si dispone secondo quello che c'è nel ddf
|
|
-- se il lato hinge non ha profilo bevel si guarda il profilo lock, se ha un bevel allora guardo quello.
|
|
-- in caso di inactive doors con bevel paralleli comanda ovviamente il lato hinge
|
|
-- in caso nessuno dei due lati ha un profilo bevel, utilizzo il parametro Secure passato nel ddf
|
|
-- se non c'è il parametro considero la porta come se avesse bevel down
|
|
-- ed effettuo il ribaltamento e rotazioni in base allo swing ( con DGD.SwDD = 1 nel file EgtDoorsData)
|
|
|
|
local sNumPhase
|
|
if nNumPhase and nNumPhase < 10 then
|
|
sNumPhase = '0'.. EgtNumToString( nNumPhase, 0)
|
|
elseif nNumPhase then
|
|
sNumPhase = EgtNumToString( nNumPhase, 0)
|
|
else
|
|
sNumPhase = '0'
|
|
end
|
|
|
|
if bFirstStep then
|
|
|
|
local bOkDisp = false
|
|
nNumProbeZ = 0
|
|
|
|
if bFrame then
|
|
|
|
bOkDisp = true
|
|
bFlip = false
|
|
bTopOnRight = CalcTopPosition( tMainTabPar.FTDD, not tsBoolData.bAtRight, nil, nil, sAssemb)
|
|
|
|
-- if not bFrameOnNarrow then
|
|
if sAssemb == 'frametop' then -- modifico rotazione per avere sempre lato porta verso l'alto
|
|
if tMainTabPar.FTDD == 0 then -- se mantengo il lato porta sul fronte
|
|
-- forzo per a true
|
|
bTopOnRight = true
|
|
if bPush then
|
|
bTopOnRight = not bTopOnRight
|
|
end
|
|
end
|
|
elseif sAssemb == 'framebot' then -- modifico rotazione per avere sempre lato porta verso il basso
|
|
if tMainTabPar.FTDD == 0 then -- se mantengo il lato porta sul fronte
|
|
-- forzo per a true
|
|
bTopOnRight = true
|
|
if bPush then
|
|
bTopOnRight = not bTopOnRight
|
|
end
|
|
end
|
|
end
|
|
-- end
|
|
else
|
|
|
|
-- prima controllo che il lato cerniere abbia un bevel (da lavorare), se no passo al lato serratura,
|
|
-- se non ha bevel nemmeno il lato serratura considero il parametro secure
|
|
if tsStringData.sHingeTrim == 'BD' or tsStringData.sHingeTrim == 'BU' or
|
|
tsStringData.sHingeTrim == 'BDEB' or tsStringData.sHingeTrim == 'BUEB' then -- se profilo cerniera indicato bevel
|
|
|
|
-- verifico se i profili risultanti sono presenti in tabella
|
|
if bPush and tsStringData.sHingeTrim == 'BD' and string.find( sProfiles, 'BU,') then
|
|
bOkDisp = true
|
|
elseif bPush and tsStringData.sHingeTrim == 'BDEB' and string.find( sProfiles, 'BU,') then
|
|
bOkDisp = true
|
|
elseif not bPush and tsStringData.sHingeTrim == 'BD' and string.find( sProfiles, 'BD,') then
|
|
bOkDisp = true
|
|
elseif not bPush and tsStringData.sHingeTrim == 'BDEB'and string.find( sProfiles, 'BD,') then
|
|
bOkDisp = true
|
|
elseif not bPush and tsStringData.sHingeTrim == 'BU' and string.find( sProfiles, 'BD,') then
|
|
bOkDisp = true
|
|
elseif not bPush and tsStringData.sHingeTrim == 'BUEB' and string.find( sProfiles, 'BD,') then
|
|
bOkDisp = true
|
|
elseif bPush and tsStringData.sHingeTrim == 'BU' and string.find( sProfiles, 'BU,') then
|
|
bOkDisp = true
|
|
elseif bPush and tsStringData.sHingeTrim == 'BUEB' and string.find( sProfiles, 'BU,') then
|
|
bOkDisp = true
|
|
end
|
|
|
|
if bOkDisp then
|
|
|
|
-- casi in cui il bevel indicato nel ddf non corrisponde al bevel generato dallo swing
|
|
-- devo ribaltare la porta e la parte top va posizionata in base al parametro presente nel currcaminfo
|
|
if ( bPush and ( tsStringData.sHingeTrim == 'BD' or tsStringData.sHingeTrim == 'BDEB')) or
|
|
( not bPush and ( tsStringData.sHingeTrim == 'BU' or tsStringData.sHingeTrim == 'BUEB')) then
|
|
bFlip = true
|
|
bTopOnRight = CalcTopPosition( tMainTabPar.TDD, tsBoolData.bAtRight, tsDoubleData.dTopRadius, tsDoubleData.dTopAngle)
|
|
-- in caso la porta è ad arco, dispongo la porta
|
|
-- gli altri casi in cui il bevel indicato corrisponde al bevel generato dallo swing
|
|
-- non devo ribaltare la porta e la parte top va posizionata in base al parametro presente nel curcaminfo
|
|
else
|
|
bFlip = false
|
|
bTopOnRight = CalcTopPosition( tMainTabPar.TDD, not tsBoolData.bAtRight, tsDoubleData.dTopRadius, tsDoubleData.dTopAngle)
|
|
end
|
|
end
|
|
end
|
|
|
|
-- se profilo serratura indicato bevel (e da lavorare)
|
|
if not bOkDisp and ( tsStringData.sLockTrim == 'BD' or tsStringData.sLockTrim == 'BU' or
|
|
tsStringData.sLockTrim == 'BDEB' or tsStringData.sLockTrim == 'BUEB') then
|
|
|
|
-- verifico se i profili risultanti sono presenti in tabella
|
|
if bPush and tsStringData.sLockTrim == 'BD' and string.find( sProfiles, 'BU,') then
|
|
bOkDisp = true
|
|
elseif bPush and tsStringData.sLockTrim == 'BDEB' and string.find( sProfiles, 'BU,') then
|
|
bOkDisp = true
|
|
elseif bPush and tsStringData.sLockTrim == 'BD' and not string.find( sProfiles, 'BD,') then
|
|
bOkDisp = true
|
|
elseif bPush and tsStringData.sLockTrim == 'BDEB' and not string.find( sProfiles, 'BD,') then
|
|
bOkDisp = true
|
|
elseif not bPush and tsStringData.sLockTrim == 'BU' and string.find( sProfiles, 'BD,') then
|
|
bOkDisp = true
|
|
elseif not bPush and tsStringData.sLockTrim == 'BUEB' and string.find( sProfiles, 'BD,') then
|
|
bOkDisp = true
|
|
elseif bPush and tsStringData.sLockTrim == 'BU' and string.find( sProfiles, 'BU,') then
|
|
bOkDisp = true
|
|
elseif bPush and tsStringData.sLockTrim == 'BUEB' and string.find( sProfiles, 'BU,') then
|
|
bOkDisp = true
|
|
end
|
|
|
|
if bOkDisp then
|
|
|
|
-- casi in cui il bevel indicato nel ddf non corrisponde al bevel generato dallo swing
|
|
-- devo ribaltare la porta e la parte top va posizionata in base al parametro presente nel curcaminfo
|
|
if ( bPush and ( tsStringData.sLockTrim == 'BD' or tsStringData.sLockTrim == 'BDEB')) or
|
|
( not bPush and ( tsStringData.sLockTrim == 'BU' or tsStringData.sLockTrim == 'BUEB')) then
|
|
bFlip = true
|
|
bTopOnRight = CalcTopPosition( tMainTabPar.TDD, tsBoolData.bAtRight, tsDoubleData.dTopRadius, tsDoubleData.dTopAngle)
|
|
-- gli altri casi in cui il bevel indicato corrisponde al bevel generato dallo swing
|
|
-- non devo ribaltare la porta e la parte top va posizionata in base al parametro presente nel curcaminfo
|
|
else
|
|
bFlip = false
|
|
bTopOnRight = CalcTopPosition( tMainTabPar.TDD, not tsBoolData.bAtRight, tsDoubleData.dTopRadius, tsDoubleData.dTopAngle)
|
|
end
|
|
end
|
|
end
|
|
|
|
-- se arco abilitato e profilo top indicato bevel (e da lavorare)
|
|
if not bOkDisp and ( tsStringData.sTopTrim == 'BD' or tsStringData.sTopTrim == 'BD_H' or
|
|
tsStringData.sTopTrim == 'BU' or tsStringData.sTopTrim == 'BU_H' or
|
|
tsStringData.sTopTrim == 'BDEB' or tsStringData.sTopTrim == 'BDEB_H' or
|
|
tsStringData.sTopTrim == 'BUEB' or tsStringData.sTopTrim == 'BUEB_H') then
|
|
|
|
-- verifico se i profili risultanti sono presenti in tabella
|
|
if bPush and ( tsStringData.sTopTrim == 'BD' or tsStringData.sTopTrim == 'BD_H') and string.find( sProfiles, 'BU,') then
|
|
bOkDisp = true
|
|
elseif bPush and ( tsStringData.sTopTrim == 'BDEB' or tsStringData.sTopTrim == 'BDEB_H') and string.find( sProfiles, 'BU,') then
|
|
bOkDisp = true
|
|
elseif not bPush and ( tsStringData.sTopTrim == 'BD' or tsStringData.sTopTrim == 'BD_H') and string.find( sProfiles, 'BD,') then
|
|
bOkDisp = true
|
|
elseif not bPush and ( tsStringData.sTopTrim == 'BDEB' or tsStringData.sTopTrim == 'BDEB_H') and string.find( sProfiles, 'BD,') then
|
|
bOkDisp = true
|
|
elseif not bPush and ( tsStringData.sTopTrim == 'BU' or tsStringData.sTopTrim == 'BU_H') and string.find( sProfiles, 'BD,') then
|
|
bOkDisp = true
|
|
elseif not bPush and ( tsStringData.sTopTrim == 'BUEB' or tsStringData.sTopTrim == 'BUEB_H') and string.find( sProfiles, 'BD,') then
|
|
bOkDisp = true
|
|
elseif bPush and ( tsStringData.sTopTrim == 'BU' or tsStringData.sTopTrim == 'BU_H') and string.find( sProfiles, 'BU,') then
|
|
bOkDisp = true
|
|
elseif bPush and ( tsStringData.sTopTrim == 'BUEB' or tsStringData.sTopTrim == 'BUEB_H') and string.find( sProfiles, 'BU,') then
|
|
bOkDisp = true
|
|
end
|
|
|
|
if bOkDisp then
|
|
|
|
-- casi in cui il bevel indicato nel ddf non corrisponde al bevel generato dallo swing
|
|
-- devo ribaltare la porta e la parte top va posizionata in base al parametro presente nel curcaminfo
|
|
if ( bPush and ( tsStringData.sTopTrim == 'BD' or tsStringData.sTopTrim == 'BD_H' or
|
|
tsStringData.sTopTrim == 'BDEB' or tsStringData.sTopTrim == 'BDEB_H')) or
|
|
( not bPush and ( tsStringData.sTopTrim == 'BU' or tsStringData.sTopTrim == 'BU_H' or
|
|
tsStringData.sTopTrim == 'BUEB' or tsStringData.sTopTrim == 'BUEB_H')) then
|
|
bFlip = true
|
|
bTopOnRight = CalcTopPosition( tMainTabPar.TDD, tsBoolData.bAtRight, tsDoubleData.dTopRadius, tsDoubleData.dTopAngle)
|
|
-- gli altri casi in cui il bevel indicato corrisponde al bevel generato dallo swing
|
|
-- non devo ribaltare la porta e la parte top va posizionata in base al parametro presente nel curcaminfo
|
|
else
|
|
bFlip = false
|
|
bTopOnRight = CalcTopPosition( tMainTabPar.TDD, not tsBoolData.bAtRight, tsDoubleData.dTopRadius, tsDoubleData.dTopAngle)
|
|
end
|
|
end
|
|
end
|
|
|
|
-- se profilo top indicato bevel (e da lavorare)
|
|
if not bOkDisp and ( tsStringData.sBottomTrim == 'BD' or tsStringData.sBottomTrim == 'BD_H' or
|
|
tsStringData.sBottomTrim == 'BU' or tsStringData.sBottomTrim == 'BU_H' or
|
|
tsStringData.sBottomTrim == 'BDEB' or tsStringData.sBottomTrim == 'BDEB_H' or
|
|
tsStringData.sBottomTrim == 'BUEB' or tsStringData.sBottomTrim == 'BUEB_H') then
|
|
|
|
-- verifico se i profili risultanti sono presenti in tabella
|
|
if bPush and ( tsStringData.sBottomTrim == 'BD' or tsStringData.sBottomTrim == 'BD_H') and string.find( sProfiles, 'BU,') then
|
|
bOkDisp = true
|
|
elseif bPush and ( tsStringData.sBottomTrim == 'BDEB' or tsStringData.sBottomTrim == 'BDEB_H') and string.find( sProfiles, 'BU,') then
|
|
bOkDisp = true
|
|
elseif not bPush and ( tsStringData.sBottomTrim == 'BD' or tsStringData.sBottomTrim == 'BD_H') and string.find( sProfiles, 'BD,') then
|
|
bOkDisp = true
|
|
elseif not bPush and ( tsStringData.sBottomTrim == 'BDEB' or tsStringData.sBottomTrim == 'BDEB_H') and string.find( sProfiles, 'BD,') then
|
|
bOkDisp = true
|
|
elseif not bPush and ( tsStringData.sBottomTrim == 'BU' or tsStringData.sBottomTrim == 'BU_H') and string.find( sProfiles, 'BD,') then
|
|
bOkDisp = true
|
|
elseif not bPush and ( tsStringData.sBottomTrim == 'BUEB' or tsStringData.sBottomTrim == 'BUEB_H') and string.find( sProfiles, 'BD,') then
|
|
bOkDisp = true
|
|
elseif bPush and ( tsStringData.sBottomTrim == 'BU' or tsStringData.sBottomTrim == 'BU_H') and string.find( sProfiles, 'BU,') then
|
|
bOkDisp = true
|
|
elseif bPush and ( tsStringData.sBottomTrim == 'BUEB' or tsStringData.sBottomTrim == 'BUEB_H') and string.find( sProfiles, 'BU,') then
|
|
bOkDisp = true
|
|
end
|
|
|
|
if bOkDisp then
|
|
|
|
-- casi in cui il bevel indicato nel ddf non corrisponde al bevel generato dallo swing
|
|
-- devo ribaltare la porta e la parte top va posizionata in base al parametro presente nel curcaminfo
|
|
if ( bPush and ( tsStringData.sBottomTrim == 'BD' or tsStringData.sBottomTrim == 'BD_H' or
|
|
tsStringData.sBottomTrim == 'BDEB' or tsStringData.sBottomTrim == 'BDEB_H')) or
|
|
( not bPush and ( tsStringData.sBottomTrim == 'BU' or tsStringData.sBottomTrim == 'BU_H' or
|
|
tsStringData.sBottomTrim == 'BUEB' or tsStringData.sBottomTrim == 'BUEB_H')) then
|
|
bFlip = true
|
|
bTopOnRight = CalcTopPosition( tMainTabPar.TDD, tsBoolData.bAtRight, tsDoubleData.dTopRadius, tsDoubleData.dTopAngle)
|
|
-- gli altri casi in cui il bevel indicato corrisponde al bevel generato dallo swing
|
|
-- non devo ribaltare la porta e la parte top va posizionata in base al parametro presente nel curcaminfo
|
|
else
|
|
bFlip = false
|
|
bTopOnRight = CalcTopPosition( tMainTabPar.TDD, not tsBoolData.bAtRight, tsDoubleData.dTopRadius, tsDoubleData.dTopAngle)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- in caso non ci sia nessun profilo bevel verifico il parametro Secure
|
|
if not bOkDisp then
|
|
|
|
-- se il parametro secure è passato con valore '0' prendo quello del CurCamInfo atrimenti do errore
|
|
if tsStringData.sSecure and string.upper(tsStringData.sSecure) == '0' then
|
|
-- se parametro da CurrcamInfo non è valido do errore
|
|
if not tMainTabPar.LS or ( string.upper(tMainTabPar.LS) ~= 'UP' and string.upper(tMainTabPar.LS) ~= 'DN') then
|
|
bOk = false
|
|
DGD.EMC = ' ' .. EgtDoorsMsg[590]
|
|
break
|
|
else
|
|
tsStringData.sSecure = tMainTabPar.LS
|
|
end
|
|
end
|
|
|
|
-- se lato secure va sopra il ribaltamento è obbligato
|
|
if tsStringData.sSecure and string.upper(tsStringData.sSecure) == 'UP' then
|
|
bFlip = true
|
|
bTopOnRight = CalcTopPosition( tMainTabPar.TDD, tsBoolData.bAtRight, tsDoubleData.dTopRadius, tsDoubleData.dTopAngle)
|
|
elseif tsStringData.sSecure and string.upper(tsStringData.sSecure) == 'DN' then
|
|
bFlip = false
|
|
bTopOnRight = CalcTopPosition( tMainTabPar.TDD, not tsBoolData.bAtRight, tsDoubleData.dTopRadius, tsDoubleData.dTopAngle)
|
|
-- altrimenti la preferenza sembrerebbe essere ( non è ancora confermata) qualla di considerare la porta bevel down
|
|
-- quindi se è una reverse non deve essere ribaltata, mentre se è normale deve essere ribaltata
|
|
-- ed effettuo il ribaltamento e rotazioni in base allo swing ( con DGD.SwDD = 1 nel file EgtDoorsData)
|
|
else
|
|
|
|
if tsBoolData.bSwingDriveDisp then -- se metodo di posizionamento guidato dallo swing
|
|
|
|
-- se porta a spingere ( dovrebbe avere bevel up) la ribalto per essere bevel down
|
|
if bPush then
|
|
bFlip = true
|
|
bTopOnRight = CalcTopPosition( tMainTabPar.TDD, tsBoolData.bAtRight, tsDoubleData.dTopRadius, tsDoubleData.dTopAngle)
|
|
-- se porta a tirare non la ribalto perché si presta già ad essere bevel down
|
|
else
|
|
bFlip = false
|
|
bTopOnRight = CalcTopPosition( tMainTabPar.TDD, not tsBoolData.bAtRight, tsDoubleData.dTopRadius, tsDoubleData.dTopAngle)
|
|
end
|
|
-- in attesa delle considerazioni del cliente, in base alle geometrie trovate ribalto oppure no la porta
|
|
else
|
|
|
|
if nNumGeomBottom > nNumGeomTop then
|
|
bFlip = true
|
|
bTopOnRight = CalcTopPosition( tMainTabPar.TDD, tsBoolData.bAtRight, tsDoubleData.dTopRadius, tsDoubleData.dTopAngle)
|
|
elseif nNumGeomTop >= nNumGeomBottom then
|
|
bFlip = false
|
|
bTopOnRight = CalcTopPosition( tMainTabPar.TDD, not tsBoolData.bAtRight, tsDoubleData.dTopRadius, tsDoubleData.dTopAngle)
|
|
else -- altrimenti vecchio metodo
|
|
bFlip = true
|
|
bTopOnRight = CalcTopPosition( tMainTabPar.TDD, tsBoolData.bAtRight, tsDoubleData.dTopRadius, tsDoubleData.dTopAngle)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Scelta dell'origine (ora espressa rispetto Zero Tavola)
|
|
if sAssemb == 'framesx' then
|
|
if bPush then
|
|
if bTopOnRight then -- se top a destra
|
|
if bUseVise then
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1fv, tMainTabPar.OR2fv)
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1f, tMainTabPar.OR2f)
|
|
end
|
|
nCodeVacDisp = 1
|
|
else
|
|
if tMainTabPar.MJT == 0 then -- se da lavorare uno alla volta
|
|
if bUseVise then
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1fv, tMainTabPar.OR2fv)
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1f, tMainTabPar.OR2f)
|
|
end
|
|
nCodeVacDisp = 1
|
|
if tMainTabPar.FTDD == 0 then -- se mantengo il lato porta sul fronte
|
|
bTopOnRight = true
|
|
end
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR5f, tMainTabPar.OR6f)
|
|
nCodeVacDisp = 3
|
|
end
|
|
end
|
|
else
|
|
if bTopOnRight then -- se top a destra
|
|
if tMainTabPar.MJT == 0 then -- se da lavorare uno alla volta
|
|
if bUseVise then
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1fv, tMainTabPar.OR2fv)
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1f, tMainTabPar.OR2f)
|
|
end
|
|
nCodeVacDisp = 1
|
|
if tMainTabPar.FTDD == 0 then -- se mantengo il lato porta sul fronte
|
|
bTopOnRight = false
|
|
end
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR5f, tMainTabPar.OR6f)
|
|
nCodeVacDisp = 3
|
|
end
|
|
else
|
|
if bUseVise then
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1fv, tMainTabPar.OR2fv)
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1f, tMainTabPar.OR2f)
|
|
end
|
|
nCodeVacDisp = 1
|
|
end
|
|
end
|
|
elseif sAssemb == 'framedx' then
|
|
if bPush then
|
|
if bTopOnRight then -- se top a destra
|
|
if tMainTabPar.MJT == 0 then -- se da lavorare uno alla volta
|
|
if bUseVise then
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1fv, tMainTabPar.OR2fv)
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1f, tMainTabPar.OR2f)
|
|
end
|
|
nCodeVacDisp = 1
|
|
if tMainTabPar.FTDD == 0 then -- se mantengo il lato porta sul fronte
|
|
bTopOnRight = false
|
|
end
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR5f, tMainTabPar.OR6f)
|
|
nCodeVacDisp = 3
|
|
end
|
|
else
|
|
if bUseVise then
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1fv, tMainTabPar.OR2fv)
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1f, tMainTabPar.OR2f)
|
|
end
|
|
nCodeVacDisp = 1
|
|
end
|
|
else
|
|
if bTopOnRight then -- se top a destra
|
|
if bUseVise then
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1fv, tMainTabPar.OR2fv)
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1f, tMainTabPar.OR2f)
|
|
end
|
|
nCodeVacDisp = 1
|
|
else
|
|
if tMainTabPar.MJT == 0 then -- se da lavorare uno alla volta
|
|
if bUseVise then
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1fv, tMainTabPar.OR2fv)
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1f, tMainTabPar.OR2f)
|
|
end
|
|
nCodeVacDisp = 1
|
|
if tMainTabPar.FTDD == 0 then -- se mantengo il lato porta sul fronte
|
|
bTopOnRight = true
|
|
end
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR5f, tMainTabPar.OR6f)
|
|
nCodeVacDisp = 3
|
|
end
|
|
end
|
|
end
|
|
elseif sAssemb == 'frametop' then
|
|
if tMainTabPar.MJT == 0 then -- da lavorare uno alla volta
|
|
if bUseVise then
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1fv, tMainTabPar.OR2fv)
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1f, tMainTabPar.OR2f)
|
|
end
|
|
nCodeVacDisp = 1
|
|
if tMainTabPar.FTDD == 0 then -- se mantengo il lato porta sul fronte
|
|
bTopOnRight = not bTopOnRight
|
|
end
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR3f, tMainTabPar.OR4f)
|
|
nCodeVacDisp = 2
|
|
end
|
|
elseif sAssemb == 'framebot' then
|
|
if bUseVise then
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1fv, tMainTabPar.OR2fv)
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1f, tMainTabPar.OR2f)
|
|
end
|
|
nCodeVacDisp = 1
|
|
-- door
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1, tMainTabPar.OR2)
|
|
end
|
|
|
|
if v == #tPz then -- solo all'ultimo pezzo
|
|
-- se porta da traslare setto lo shift da applicare
|
|
if bShiftMchng then
|
|
vShift = tMainTabPar.SH1
|
|
else
|
|
vShift = vNullShift
|
|
end
|
|
|
|
Ori = Ori + vShift
|
|
end
|
|
|
|
-- faccio le rotazioni della porta
|
|
if bFlip then
|
|
EgtRotateRawPart( nRaw, Y_AX(), 180)
|
|
sDispMode = sDispMode .. EgtDoorsMsg[511] .. sNumPhase .. ' ' .. EgtIf( bFrame, EgtDoorsMsg[610], EgtDoorsMsg[479])
|
|
else
|
|
sDispMode = sDispMode .. EgtDoorsMsg[511] .. sNumPhase .. ' ' .. EgtIf( bFrame, EgtDoorsMsg[611], EgtDoorsMsg[480])
|
|
end
|
|
|
|
if bTopOnRight then
|
|
EgtRotateRawPart( nRaw, Z_AX(), -90)
|
|
sDispMode = sDispMode .. EgtDoorsMsg[481]
|
|
else
|
|
EgtRotateRawPart( nRaw, Z_AX(), 90)
|
|
sDispMode = sDispMode .. EgtDoorsMsg[482]
|
|
end
|
|
|
|
if bShiftMchng then
|
|
sDispMode = sDispMode .. EgtDoorsMsg[510]
|
|
end
|
|
-- sTotDispMode = sTotDispMode .. ' ' .. sDispMode .. '\n'
|
|
|
|
-- se c'è probe mode (prod) filtro le geometrie che si trovano sotto
|
|
if nProbeMode == 1 then
|
|
if bFlip then
|
|
DelList = MB.FindEntitiesWithPartName( tPz, 'ProbePoint_keyway')
|
|
else
|
|
DelList = MB.FindEntitiesWithPartName( tPz, 'ProbePoint_secure')
|
|
end
|
|
-- ciclo su tutte le entità trovate
|
|
for j = 1, #DelList do
|
|
EgtErase( DelList[j] )
|
|
end
|
|
DelList = MB.FindEntitiesWithPartName( tPz, 'ProbeSidePoint_secure')
|
|
-- ciclo su tutte le entità trovate
|
|
for j = 1, #DelList do
|
|
EgtErase( DelList[j] )
|
|
end
|
|
DelList = MB.FindEntitiesWithPartName( tPz, 'ProbeSidePoint_keyway')
|
|
-- ciclo su tutte le entità trovate
|
|
for j = 1, #DelList do
|
|
EgtErase( DelList[j] )
|
|
end
|
|
-- rinomino i rimenenti
|
|
if bFlip then
|
|
DelList = MB.FindEntitiesWithPartName( tPz, 'ProbePoint_secure')
|
|
else
|
|
DelList = MB.FindEntitiesWithPartName( tPz, 'ProbePoint_keyway')
|
|
end
|
|
-- mi tengo via il numero di probe in Z
|
|
nNumProbeZ = #DelList
|
|
-- ciclo su tutte le entità trovate
|
|
for j = 1, #DelList do
|
|
EgtSetName( DelList[j], 'ProbePoint')
|
|
end
|
|
-- se non c'è probe mode (prod) e abilitata la tastatura di fianco filtro le geometrie che si trovano sopra e sotto
|
|
elseif nProbeMode == 0 and nPostProbeSet >= 3 then
|
|
DelList = MB.FindEntitiesWithPartName( tPz, 'ProbePoint_secure')
|
|
-- ciclo su tutte le entità trovate
|
|
for j = 1, #DelList do
|
|
EgtErase( DelList[j] )
|
|
end
|
|
DelList = MB.FindEntitiesWithPartName( tPz, 'ProbePoint_keyway')
|
|
-- ciclo su tutte le entità trovate
|
|
for j = 1, #DelList do
|
|
EgtErase( DelList[j] )
|
|
end
|
|
if bFlip then
|
|
DelList = MB.FindEntitiesWithPartName( tPz, 'ProbeSidePoint_keyway')
|
|
else
|
|
DelList = MB.FindEntitiesWithPartName( tPz, 'ProbeSidePoint_secure')
|
|
end
|
|
-- ciclo su tutte le entità trovate
|
|
for j = 1, #DelList do
|
|
EgtErase( DelList[j] )
|
|
end
|
|
-- rinomino i rimenenti
|
|
if bFlip then
|
|
DelList = MB.FindEntitiesWithPartName( tPz, 'ProbeSidePoint_secure')
|
|
else
|
|
DelList = MB.FindEntitiesWithPartName( tPz, 'ProbeSidePoint_keyway')
|
|
end
|
|
-- mi tengo via il numero di probe sul fianco
|
|
nNumProbeZ = #DelList
|
|
-- ciclo su tutte le entità trovate
|
|
for j = 1, #DelList do
|
|
EgtSetName( DelList[j], 'ProbeSidePoint')
|
|
end
|
|
else -- se non c'è il probe point elimino tutti i percorsi di probe (in Z e xy)
|
|
DelList = MB.FindEntitiesWithPartName( tPz, 'ProbePoint')
|
|
-- ciclo su tutte le entità trovate
|
|
for j = 1, #DelList do
|
|
EgtErase( DelList[j] )
|
|
end
|
|
DelList = MB.FindEntitiesWithPartName( tPz, 'ProbeSidePoint')
|
|
-- ciclo su tutte le entità trovate
|
|
for j = 1, #DelList do
|
|
EgtErase( DelList[j] )
|
|
end
|
|
end
|
|
|
|
------------------------------------------------------------------
|
|
-- calcolo delta Y in base al profilo e al ribaltamento del pezzo
|
|
------------------------------------------------------------------
|
|
local dExtraY = 0
|
|
local dExtraYOppo = 0
|
|
local dDeltaProbe = 0
|
|
local dDeltaProf = 0
|
|
local dDeltaProfOppo = 0
|
|
-- variabili per note relative al lato hinges
|
|
local nHingeMach = 0 -- setto default non lavorato
|
|
local nLockMach = 0 -- setto default non lavorato
|
|
local nSideType = -1 -- 0 per profili SQ
|
|
local nSideOppoType = -1 -- 0 per profili SQ
|
|
local sProfName
|
|
local sProfOppoName -- nome profilo lato opposto alla battuta
|
|
local bCalcProf = false
|
|
local bCalcProfOppo = false
|
|
|
|
-- per i frame non calcolo distanza profilo su finito
|
|
if bFrame then
|
|
bCalcProf = false
|
|
bCalcProfOppo = false
|
|
else
|
|
|
|
-- se profilo hinge è da lavorare annullo il delta Y e setto il valore della nota
|
|
if tsBoolData.bHingeMach then
|
|
nHingeMach = 1
|
|
end
|
|
-- se profilo lock da lavorare setto la variabile per la nota
|
|
if tsBoolData.bLockMach then
|
|
nLockMach = 1
|
|
end
|
|
|
|
-- se il profilo hinge è in battuta
|
|
if ( not bFlip and bTopOnRight and not tsBoolData.bAtRight) or ( not bFlip and not bTopOnRight and tsBoolData.bAtRight) or
|
|
( bFlip and bTopOnRight and tsBoolData.bAtRight) or ( bFlip and not bTopOnRight and not tsBoolData.bAtRight) then
|
|
sProfName = tsStringData.sHingeTrim
|
|
sProfOppoName = tsStringData.sLockTrim
|
|
tsDoubleData.dRadiusPrf = tsRadiusProf[1]
|
|
tsDoubleData.dPlanePrf = tsPlaneProf[1]
|
|
bHingeOnRef = true
|
|
-- se il profilo hinge non è da lavorare
|
|
if not tsBoolData.bHingeMach then
|
|
bCalcProf = true
|
|
end
|
|
-- se il profilo lock non è da lavorare
|
|
if not tsBoolData.bLockMach then
|
|
bCalcProfOppo = true
|
|
end
|
|
else -- altrimenti è il profilo lock in battuta
|
|
sProfName = tsStringData.sLockTrim
|
|
sProfOppoName = tsStringData.sHingeTrim
|
|
tsDoubleData.dRadiusPrf = tsRadiusProf[2]
|
|
tsDoubleData.dPlanePrf = tsPlaneProf[2]
|
|
bHingeOnRef = false
|
|
-- se il profilo lock non è da lavorare
|
|
if not tsBoolData.bLockMach then
|
|
bCalcProf = true
|
|
end
|
|
-- se il profilo hinge non è da lavorare
|
|
if not tsBoolData.bHingeMach then
|
|
bCalcProfOppo = true
|
|
end
|
|
end
|
|
bTopOnRef = ( bTopOnRight and DISPMODE < 0) or ( not bTopOnRight and DISPMODE > 0)
|
|
|
|
if nProbeMode == 2 then
|
|
bCalcProf = false
|
|
bCalcProfOppo = false
|
|
end
|
|
end
|
|
|
|
-- se devo calcolare eventuale spostamento dato dal profilo in battuta
|
|
if bCalcProf then
|
|
if sProfName == 'SQ' or sProfName == 'EB' then
|
|
nSideType = 0
|
|
-- se disposizione bevel down uso il riferimento in alto
|
|
elseif sProfName == 'BD' or sProfName == 'BDEB' then
|
|
nSideType = 1
|
|
if tsDoubleData.dThickDoor > tMainTabPar.AR then
|
|
dExtraY = ( tsDoubleData.dThickDoor - tMainTabPar.AR) * TAN3
|
|
end
|
|
-- se abilitato il side probe
|
|
if nProbeMode == 0 and nPostProbeSet >= 3 then
|
|
-- calcolo errore del probe tastando dallo spessore - il parametro z extra probe
|
|
dDeltaProf = tMainTabPar.EZPB * TAN3
|
|
else
|
|
-- calcolo errore del probe tastando a metà spessore - il parametro z extra probe
|
|
dDeltaProf = ((( tsDoubleData.dThickDoor / 2) - tMainTabPar.EZPB) * TAN3)
|
|
end
|
|
dDeltaProbe = dDeltaProf - dExtraY
|
|
-- dato che viene compensato il dDeltaProbe nella tastatura. il dDeltaProf risulta essere uguale a dExtraY
|
|
dDeltaProf = dExtraY
|
|
-- se disposizione bevel up uso il riferimento in basso
|
|
elseif sProfName == 'BU' or sProfName == 'BUEB' then
|
|
nSideType = 2
|
|
dExtraY = ( tMainTabPar.AR - tMainTabPar.TR) * TAN3
|
|
-- se abilitato il side probe
|
|
if nProbeMode == 0 and nPostProbeSet >= 3 then
|
|
-- calcolo errore del probe tastando dallo spessore - il parametro z extra probe
|
|
dDeltaProf = (( tsDoubleData.dThickDoor - tMainTabPar.EZPB) * TAN3)
|
|
else
|
|
-- calcolo errore del probe tastando a metà spessore + il parametro z extra probe
|
|
dDeltaProf = ((( tsDoubleData.dThickDoor / 2) + tMainTabPar.EZPB) * TAN3)
|
|
end
|
|
dDeltaProbe = dDeltaProf - dExtraY
|
|
-- dato che viene compensato il dDeltaProbe nella tastatura. il dDeltaProf risulta essere uguale a dExtraY
|
|
dDeltaProf = dExtraY
|
|
-- se profilo bull nose verifico in base al raggio
|
|
elseif sProfName == '1B' or sProfName == '2B' or sProfName == '3B' or sProfName == '4B' or
|
|
sProfName == '5B' or sProfName == '6B' or sProfName == '7B' or sProfName == '8B' then
|
|
|
|
nSideType = 3
|
|
-- calcolo punto massimo ingombro profilo
|
|
local dAltProf = tsDoubleData.dThickDoor/2
|
|
local dAltcalc = 0
|
|
|
|
-- se punto max è sotto il minimo riferimento
|
|
if dAltProf < ( tMainTabPar.AR - tMainTabPar.TR) then
|
|
dAltcalc = tMainTabPar.AR - tMainTabPar.TR - dAltProf
|
|
-- se punto max è sopra il massimo riferimento
|
|
elseif dAltProf > tMainTabPar.AR then
|
|
dAltcalc = dAltProf - tMainTabPar.AR
|
|
end
|
|
|
|
-- se punto massimo profilo non è compreso nel riferimento calcolo il delta Y
|
|
if dAltcalc > 0 then
|
|
dExtraY = tsDoubleData.dRadiusPrf - sqrt((tsDoubleData.dRadiusPrf*tsDoubleData.dRadiusPrf)-(dAltcalc*dAltcalc))
|
|
end
|
|
-- calcolo errore del probe tastando a metà spessore
|
|
dDeltaProbe = -dExtraY
|
|
-- dato che viene compensato il dDeltaProbe nella tastatura. il dDeltaProf risulta essere uguale a dExtraY
|
|
dDeltaProf = dExtraY
|
|
-- se profilo convex verifico in base al raggio
|
|
elseif sProfName == 'CV' then
|
|
|
|
nSideType = 4
|
|
-- calcolo punto minimo ingombro profilo
|
|
local dAltProf = tsDoubleData.dThickDoor/2
|
|
local dAltcalc = (tMainTabPar.TR/2)
|
|
-- calcolo il delta Y massimo del minimo ingombro profilo
|
|
local dMaxInsPrf = sqrt((tsDoubleData.dRadiusPrf*tsDoubleData.dRadiusPrf)-((dAltProf-tsDoubleData.dPlanePrf)*(dAltProf-tsDoubleData.dPlanePrf)))
|
|
|
|
-- se riferimento è sul max ingombro porta
|
|
if ( tsDoubleData.dThickDoor < tMainTabPar.AR) and ( tsDoubleData.dThickDoor > ( tMainTabPar.AR - tMainTabPar.TR)) then
|
|
dAltcalc = 0
|
|
-- se punto minimo ingombro profilo è sotto all'altezza media del riferimento
|
|
elseif dAltProf < ( tMainTabPar.AR - (tMainTabPar.TR/2)) then
|
|
dAltcalc = tMainTabPar.AR - dAltProf
|
|
-- se punto minimo ingombro profilo è sopra all'altezza media del riferimento
|
|
elseif dAltProf > ( tMainTabPar.AR - (tMainTabPar.TR/2)) then
|
|
dAltcalc = dAltProf - tMainTabPar.AR + tMainTabPar.TR
|
|
end
|
|
|
|
-- calcolo il delta Y
|
|
if dAltcalc > 0 then
|
|
dExtraY = sqrt((tsDoubleData.dRadiusPrf*tsDoubleData.dRadiusPrf)-(dAltcalc*dAltcalc)) - dMaxInsPrf
|
|
end
|
|
-- calcolo errore del probe tastando a metà spessore
|
|
dDeltaProbe = tsDoubleData.dRadiusPrf - (dExtraY + dMaxInsPrf)
|
|
-- dato che viene compensato il dDeltaProbe nella tastatura. il dDeltaProf risulta essere uguale a dExtraY
|
|
dDeltaProf = dExtraY
|
|
end
|
|
end
|
|
|
|
if bCalcProfOppo then
|
|
if sProfOppoName == 'SQ' or sProfOppoName == 'EB' then
|
|
nSideOppoType = 0
|
|
-- se disposizione bevel down ( il nome è riferito alla prima disposizione) uso il riferimento in alto
|
|
elseif sProfOppoName == 'BD' or sProfOppoName == 'BDEB' then
|
|
nSideOppoType = 1
|
|
-- se abilitato il side probe
|
|
if nProbeMode == 0 and nPostProbeSet >= 3 then
|
|
-- calcolo errore del probe tastando dallo spessore - il parametro z extra probe
|
|
dDeltaProfOppo = tMainTabPar.EZPB * TAN3
|
|
else
|
|
-- calcolo errore del probe tastando a metà spessore - il parametro z extra p
|
|
dDeltaProfOppo = ((( tsDoubleData.dThickDoor / 2) - tMainTabPar.EZPB) * TAN3)
|
|
end
|
|
-- se disposizione bevel up uso il riferimento in basso
|
|
elseif sProfOppoName == 'BU' or sProfOppoName == 'BUEB' then
|
|
nSideOppoType = 2
|
|
-- se abilitato il side probe
|
|
if nProbeMode == 0 and nPostProbeSet >= 3 then
|
|
-- calcolo errore del probe tastando dallo spessore - il parametro z extra probe
|
|
dDeltaProfOppo = (( tsDoubleData.dThickDoor - tMainTabPar.EZPB) * TAN3)
|
|
else
|
|
-- calcolo errore del probe tastando a metà spessore + il parametro z extra probe
|
|
dDeltaProfOppo = ((( tsDoubleData.dThickDoor / 2) + tMainTabPar.EZPB) * TAN3)
|
|
end
|
|
-- se profilo bull nose verifico in base al raggio
|
|
elseif sProfOppoName == '1B' or sProfOppoName == '2B' or sProfOppoName == '3B' or sProfOppoName == '4B' or
|
|
sProfOppoName == '5B' or sProfOppoName == '6B' or sProfOppoName == '7B' or sProfOppoName == '8B' then
|
|
|
|
nSideOppoType = 3
|
|
-- se profilo convex verifico in base al raggio
|
|
elseif sProfOppoName == 'CV' then
|
|
|
|
nSideOppoType = 4
|
|
local dAltProfOppo
|
|
local dAltProfOppoTh
|
|
local dExtraYOppoTh
|
|
-- se abilitato il side probe
|
|
if nProbeMode == 0 and nPostProbeSet >= 3 then
|
|
-- calcolo punto minimo ingombro profilo
|
|
dAltProfOppoTh = tsDoubleData.dThickDoor/2 - tsDoubleData.dPlanePrf
|
|
-- calcolo errore del probe tastando a spessore completo - extra z
|
|
dAltProfOppo = (tsDoubleData.dThickDoor/2) - tMainTabPar.EZPB - tsDoubleData.dPlanePrf
|
|
-- calcolo il delta Y massimo del minimo ingombro profilo
|
|
dExtraYOppo = sqrt((tsDoubleData.dRadiusPrf*tsDoubleData.dRadiusPrf)-(dAltProfOppo*dAltProfOppo))
|
|
dExtraYOppoTh = sqrt((tsDoubleData.dRadiusPrf*tsDoubleData.dRadiusPrf)-(dAltProfOppoTh*dAltProfOppoTh))
|
|
-- calcolo errore del probe tastando dallo spessore - quota extra z
|
|
dDeltaProfOppo = dExtraYOppo - dExtraYOppoTh
|
|
else
|
|
-- calcolo punto minimo ingombro profilo
|
|
dAltProfOppo = tsDoubleData.dThickDoor/2 - tsDoubleData.dPlanePrf
|
|
-- calcolo il delta Y massimo del minimo ingombro profilo
|
|
dExtraYOppo = sqrt((tsDoubleData.dRadiusPrf*tsDoubleData.dRadiusPrf)-(dAltProfOppo*dAltProfOppo))
|
|
-- calcolo errore del probe tastando a metà spessore
|
|
dDeltaProfOppo = tsDoubleData.dRadiusPrf - dExtraYOppo
|
|
end
|
|
end
|
|
end
|
|
|
|
vExtraYDelta = Vector3d(0,-dExtraY,0)
|
|
-- scrivo le note
|
|
EgtSetInfo( Pz, 'Piece Type', tsDoubleData.TypePiece)
|
|
EgtSetInfo( Pz, 'ExtraCalcMoveY', dExtraY)
|
|
EgtSetInfo( Pz, 'DoorProbeErrorY', dDeltaProbe)
|
|
EgtSetInfo( Pz, 'DoorProbeExtraPosZ', tMainTabPar.EZPB)
|
|
EgtSetInfo( Pz, 'DoorProbeThick', tMainTabPar.PTK)
|
|
EgtSetInfo( Pz, 'DoorProfErrorY', dDeltaProf)
|
|
EgtSetInfo( Pz, 'DoorProfOppoErrorY', dDeltaProfOppo)
|
|
EgtSetInfo( Pz, 'SideDisposition', DISPMODE)
|
|
EgtSetInfo( Pz, 'UseViseWithFrame', bUseVise)
|
|
-- scrivo nota lavorazione lato hinge
|
|
EgtSetInfo( Pz, 'SideHingeMach', nHingeMach)
|
|
-- per compatibilità scrivo nota tipo profilo su lato in battuta (inizialmente il lato hinge era sempre in battuta)
|
|
EgtSetInfo( Pz, 'SideHingeProf', nSideType)
|
|
-- scrivo profilo lato in battuta
|
|
EgtSetInfo( Pz, 'SideProfOnRef', nSideType)
|
|
-- scrivo profilo lato opposto
|
|
EgtSetInfo( Pz, 'SideProfOnOppo', nSideOppoType)
|
|
-- scrivo nota lavorazione lato lock
|
|
EgtSetInfo( Pz, 'SideLockMach', nLockMach)
|
|
-- scrivo nota con numero geometrie di ProbeZ o probeXY (in base ai settaggi di nProbeMode e nPostProbeSet)
|
|
EgtSetInfo( Pz, 'NumProbeZ', nNumProbeZ)
|
|
-- scrivo nota flag modalita remove scrap
|
|
EgtSetInfo( Pz, 'RemoveScrapMode', tMainTabPar.RSM)
|
|
-- scrivo nota altezza riferimento e spessore riferimento
|
|
EgtSetInfo( Pz, 'ReferenceHeight', tMainTabPar.AR)
|
|
EgtSetInfo( Pz, 'ReferenceTall', tMainTabPar.TR)
|
|
-- scrivo posizioni riferimenti
|
|
EgtSetInfo( Pz, 'ReferencePos1', tMainTabPar.REF1)
|
|
EgtSetInfo( Pz, 'ReferencePos2', tMainTabPar.REF2)
|
|
EgtSetInfo( Pz, 'ReferencePos3', tMainTabPar.REF3)
|
|
EgtSetInfo( Pz, 'ReferencePos4', tMainTabPar.REF4)
|
|
|
|
local vExtraXY
|
|
local dExtraX = 0
|
|
dExtraY = 0
|
|
local nCorner = MCH_CR.BL
|
|
|
|
if sAssemb == 'framesx' then
|
|
dExtraX , dExtraY, nCorner = CalcDispositionRef( true, bTopOnRight, tsDoubleData.dLeftOffs, tsDoubleData.dRightOffs, tsDoubleData.dTopOffs,
|
|
tsDoubleData.dBottomOffs, bFlip, tMainTabPar.FTDD)
|
|
vExtraXY = Vector3d( dExtraX, dExtraY, 0)
|
|
-- Muovo frame nella posizione di origine
|
|
bMoveRaw = EgtMoveToCornerRawPart( nRaw, ( Ori + vExtraYDelta + vExtraXY), nCorner)
|
|
elseif sAssemb == 'framedx' then
|
|
dExtraX , dExtraY, nCorner = CalcDispositionRef( false, bTopOnRight, tsDoubleData.dLeftOffs, tsDoubleData.dRightOffs, tsDoubleData.dTopOffs,
|
|
tsDoubleData.dBottomOffs, bFlip, tMainTabPar.FTDD)
|
|
vExtraXY = Vector3d( dExtraX, dExtraY, 0)
|
|
-- Muovo frame nella posizione di origine
|
|
bMoveRaw = EgtMoveToCornerRawPart( nRaw, ( Ori + vExtraYDelta + vExtraXY), nCorner)
|
|
elseif sAssemb == 'frametop' then
|
|
dExtraX , dExtraY, nCorner = CalcDispositionRef( true, bTopOnRight, tsDoubleData.dLeftOffs, tsDoubleData.dRightOffs, tsDoubleData.dTopOffs,
|
|
tsDoubleData.dBottomOffs, bFlip, tMainTabPar.FTDD)
|
|
vExtraXY = Vector3d( dExtraX, dExtraY, 0)
|
|
-- Muovo frame nella posizione di origine
|
|
bMoveRaw = EgtMoveToCornerRawPart( nRaw, ( Ori + vExtraYDelta + vExtraXY), nCorner)
|
|
elseif sAssemb == 'framebot' then
|
|
dExtraX , dExtraY, nCorner = CalcDispositionRef( false, bTopOnRight, tsDoubleData.dLeftOffs, tsDoubleData.dRightOffs, tsDoubleData.dTopOffs,
|
|
tsDoubleData.dBottomOffs, bFlip, tMainTabPar.FTDD)
|
|
vExtraXY = Vector3d( dExtraX, dExtraY, 0)
|
|
-- Muovo frame nella posizione di origine
|
|
bMoveRaw = EgtMoveToCornerRawPart( nRaw, ( Ori + vExtraYDelta + vExtraXY), nCorner)
|
|
else
|
|
|
|
-- Muovo porta con l'angolo in basso a ( destra o sinistra) nella posizione di origine
|
|
bMoveRaw = EgtMoveToCornerRawPart( nRaw, ( Ori + vExtraYDelta), EgtIf( DISPMODE > 0, MCH_CR.BL, MCH_CR.BR))
|
|
|
|
if nProbeMode == 2 then
|
|
local btempX = EgtIf( bTopOnRight, bFlip, not bFlip)
|
|
bMoveRaw = EgtMoveRawPart( nRaw, Vector3d( EgtIf( bTopOnRight, pMinRecalc:getY(), -pMinRecalc:getY()), EgtIf( btempX, pMinRecalc:getX(), -pMinRecalc:getX()), 0))
|
|
end
|
|
end
|
|
|
|
-- memorizzo i flag per le fasi successive
|
|
bFlipFirst = bFlip
|
|
bTopOnRightFirst = bTopOnRight
|
|
|
|
else -- se sono in ribaltamento porta
|
|
|
|
if bFrame then
|
|
if sAssemb == 'frametop' then -- modifico rotazione per avere sempre lato porta verso l'alto
|
|
if bPush then
|
|
bTopOnRight = not bTopOnRight
|
|
end
|
|
elseif sAssemb == 'framebot' then -- modifico rotazione per avere sempre lato porta verso il basso
|
|
if bPush then
|
|
bTopOnRight = not bTopOnRight
|
|
end
|
|
end
|
|
else
|
|
-- posizioni opposte
|
|
local nSelDisp = 0
|
|
bTopOnRight = CalcTopPosition( tMainTabPar.TDD, not bTopOnRightFirst, tsDoubleData.dTopRadius, tsDoubleData.dTopAngle)
|
|
end
|
|
|
|
bFlip = not bFlipFirst
|
|
nNumProbeZ = 0
|
|
|
|
-- Scelta dell'origine (ora espressa rispetto Zero Tavola)
|
|
if sAssemb == 'framesx' then
|
|
if bPush then
|
|
if bTopOnRight then -- se top a destra
|
|
if bUseVise then
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1fv, tMainTabPar.OR2fv)
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1f, tMainTabPar.OR2f)
|
|
end
|
|
nCodeVacDisp = 1
|
|
else
|
|
if tMainTabPar.MJT == 0 then -- se da lavorare uno alla volta
|
|
if bUseVise then
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1fv, tMainTabPar.OR2fv)
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1f, tMainTabPar.OR2f)
|
|
end
|
|
nCodeVacDisp = 1
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR5f, tMainTabPar.OR6f)
|
|
nCodeVacDisp = 3
|
|
end
|
|
end
|
|
else
|
|
if bTopOnRight then -- se top a destra
|
|
if tMainTabPar.MJT == 0 then -- se da lavorare uno alla volta
|
|
if bUseVise then
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1fv, tMainTabPar.OR2fv)
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1f, tMainTabPar.OR2f)
|
|
end
|
|
nCodeVacDisp = 1
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR5f, tMainTabPar.OR6f)
|
|
nCodeVacDisp = 3
|
|
end
|
|
else
|
|
if bUseVise then
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1fv, tMainTabPar.OR2fv)
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1f, tMainTabPar.OR2f)
|
|
end
|
|
nCodeVacDisp = 1
|
|
end
|
|
end
|
|
elseif sAssemb == 'framedx' then
|
|
if bPush then
|
|
if bTopOnRight then -- se top a destra
|
|
if tMainTabPar.MJT == 0 then -- se da lavorare uno alla volta
|
|
if bUseVise then
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1fv, tMainTabPar.OR2fv)
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1f, tMainTabPar.OR2f)
|
|
end
|
|
nCodeVacDisp = 1
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR5f, tMainTabPar.OR6f)
|
|
nCodeVacDisp = 3
|
|
end
|
|
else
|
|
if bUseVise then
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1fv, tMainTabPar.OR2fv)
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1f, tMainTabPar.OR2f)
|
|
end
|
|
nCodeVacDisp = 1
|
|
end
|
|
else
|
|
if bTopOnRight then -- se top a destra
|
|
if bUseVise then
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1fv, tMainTabPar.OR2fv)
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1f, tMainTabPar.OR2f)
|
|
end
|
|
nCodeVacDisp = 1
|
|
else
|
|
if tMainTabPar.MJT == 0 then -- se da lavorare uno alla volta
|
|
if bUseVise then
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1fv, tMainTabPar.OR2fv)
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1f, tMainTabPar.OR2f)
|
|
end
|
|
nCodeVacDisp = 1
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR5f, tMainTabPar.OR6f)
|
|
nCodeVacDisp = 3
|
|
end
|
|
end
|
|
end
|
|
elseif sAssemb == 'frametop' then
|
|
if tMainTabPar.MJT == 0 then -- da lavorare uno alla volta
|
|
if bUseVise then
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1fv, tMainTabPar.OR2fv)
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1f, tMainTabPar.OR2f)
|
|
end
|
|
nCodeVacDisp = 1
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR3f, tMainTabPar.OR4f)
|
|
nCodeVacDisp = 2
|
|
end
|
|
elseif sAssemb == 'framebot' then
|
|
if bUseVise then
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1fv, tMainTabPar.OR2fv)
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1f, tMainTabPar.OR2f)
|
|
end
|
|
nCodeVacDisp = 1
|
|
else
|
|
Ori = EgtIf( DISPMODE > 0, tMainTabPar.OR1, tMainTabPar.OR2)
|
|
end
|
|
|
|
if v == #tPz then -- solo all'ultimo pezzo
|
|
-- se porta da traslare setto lo shift da applicare
|
|
if bShiftMchng then
|
|
vShift = tMainTabPar.SH1
|
|
else
|
|
vShift = vNullShift
|
|
end
|
|
|
|
Ori = Ori + vShift
|
|
end
|
|
|
|
-- faccio le rotazioni della porta
|
|
if bFlip then
|
|
EgtRotateRawPart( nRaw, Y_AX(), 180)
|
|
sDispMode = sDispMode .. EgtDoorsMsg[511] .. sNumPhase .. ' ' .. EgtIf( bFrame, EgtDoorsMsg[610], EgtDoorsMsg[479])
|
|
else
|
|
sDispMode = sDispMode .. EgtDoorsMsg[511] .. sNumPhase .. ' ' .. EgtIf( bFrame, EgtDoorsMsg[611], EgtDoorsMsg[480])
|
|
end
|
|
|
|
if bTopOnRight then
|
|
EgtRotateRawPart( nRaw, Z_AX(), -90)
|
|
sDispMode = sDispMode .. EgtDoorsMsg[481]
|
|
else
|
|
EgtRotateRawPart( nRaw, Z_AX(), 90)
|
|
sDispMode = sDispMode .. EgtDoorsMsg[482]
|
|
end
|
|
|
|
if bShiftMchng then
|
|
sDispMode = sDispMode .. EgtDoorsMsg[510]
|
|
end
|
|
-- sTotDispMode = sTotDispMode .. ' ' .. sDispMode .. '\n'
|
|
|
|
-- -- se non c'è probe mode (prod) e abilitata la tastatura di fianco filtro le geometrie che si trovano sopra e sotto
|
|
-- if nProbeMode == 0 and nPostProbeSet >= 3 then
|
|
-- DelList = MB.FindEntitiesWithName( tPz, 'NO_ProbeSidePoint')
|
|
-- -- ciclo su tutte le entità trovate
|
|
-- for j = 1, #DelList do
|
|
-- EgtSetName( DelList[j], 'ProbeSidePoint')
|
|
-- end
|
|
-- DelList = MB.FindEntitiesWithName( tPz, 'ProbeSidePoint')
|
|
-- -- ciclo su tutte le entità trovate
|
|
-- for j = 1, #DelList do
|
|
-- -- se prima non era flippata
|
|
-- if bFlip then
|
|
-- EgtSetName( DelList[j], 'ProbeSidePoint_keyway')
|
|
-- else
|
|
-- EgtSetName( DelList[j], 'ProbeSidePoint_secure')
|
|
-- end
|
|
-- end
|
|
-- -- rinomino i rimenenti
|
|
-- if bFlip then
|
|
-- DelList = MB.FindEntitiesWithPartName( tPz, 'ProbeSidePoint_secure')
|
|
-- else
|
|
-- DelList = MB.FindEntitiesWithPartName( tPz, 'ProbeSidePoint_keyway')
|
|
-- end
|
|
-- -- mi tengo via il numero di probe sul fianco
|
|
-- nNumProbeZ = #DelList
|
|
-- -- ciclo su tutte le entità trovate
|
|
-- for j = 1, #DelList do
|
|
-- EgtSetName( DelList[j], 'ProbeSidePoint')
|
|
-- end
|
|
-- end
|
|
------------------------------------------------------------------
|
|
-- calcolo delta Y in base al profilo e al ribaltamento del pezzo
|
|
------------------------------------------------------------------
|
|
local dExtraY = 0
|
|
local dExtraYOppo = 0
|
|
local dDeltaProbe = 0
|
|
local dDeltaProf = 0
|
|
local dDeltaProfOppo = 0
|
|
-- variabili per note relative al lato hinges
|
|
local nHingeMach = 0 -- setto default non lavorato
|
|
local nLockMach = 0 -- setto default non lavorato
|
|
nSideType = -1 -- 0 per profili SQ
|
|
local nSideOppoType = -1 -- 0 per profili SQ
|
|
local sProfName -- nome profilo in battuta
|
|
local sProfOppoName -- nome profilo lato opposto alla battuta
|
|
local bCalcProf = false
|
|
local bCalcProfOppo = false
|
|
|
|
-- per i frame non calcolo distanza profilo su finito
|
|
if bFrame then
|
|
bCalcProf = false
|
|
bCalcProfOppo = false
|
|
else
|
|
|
|
-- se profilo hinge è da lavorare e non è stato lavorato setto il valore della nota
|
|
if tsBoolData.bHingeMach and not DGD.MHS then
|
|
nHingeMach = 1
|
|
end
|
|
-- se profilo lock é da lavorare e non è stato lavorato setto la variabile per la nota
|
|
if tsBoolData.bLockMach and not DGD.MLS then
|
|
nLockMach = 1
|
|
end
|
|
|
|
-- se il profilo hinge è in battuta
|
|
if ( not bFlip and bTopOnRight and not tsBoolData.bAtRight) or ( not bFlip and not bTopOnRight and tsBoolData.bAtRight) or
|
|
( bFlip and bTopOnRight and tsBoolData.bAtRight) or ( bFlip and not bTopOnRight and not tsBoolData.bAtRight) then
|
|
sProfName = tsStringData.sHingeTrim
|
|
sProfOppoName = tsStringData.sLockTrim
|
|
tsDoubleData.dRadiusPrf = tsRadiusProf[1]
|
|
tsDoubleData.dPlanePrf = tsPlaneProf[1]
|
|
bHingeOnRef = true
|
|
-- se il profilo hinge non è da lavorare o è già stato lavorato
|
|
if not tsBoolData.bHingeMach or DGD.MHS then
|
|
bCalcProf = true
|
|
end
|
|
-- se il profilo lock non è da lavorare o è già stato lavorato
|
|
if not tsBoolData.bLockMach or DGD.MLS then
|
|
bCalcProfOppo = true
|
|
end
|
|
else -- altrimenti è il profilo lock in battuta
|
|
sProfName = tsStringData.sLockTrim
|
|
sProfOppoName = tsStringData.sHingeTrim
|
|
tsDoubleData.dRadiusPrf = tsRadiusProf[2]
|
|
tsDoubleData.dPlanePrf = tsPlaneProf[2]
|
|
bHingeOnRef = false
|
|
-- se il profilo lock non è da lavorare o è già stato lavorato
|
|
if not tsBoolData.bLockMach or DGD.MLS then
|
|
bCalcProf = true
|
|
end
|
|
-- se il profilo hinge non è da lavorare o è già stato lavorato
|
|
if not tsBoolData.bHingeMach or DGD.MHS then
|
|
bCalcProfOppo = true
|
|
end
|
|
end
|
|
bTopOnRef = ( bTopOnRight and DISPMODE < 0) or ( not bTopOnRight and DISPMODE > 0)
|
|
--[[
|
|
-- se il profilo in battuta non è da lavorare o è già stato lavorato
|
|
if ( not tsBoolData.bHingeMach or DGD.MHS) and ( ( not bFlip and bTopOnRight and not tsBoolData.bAtRight) or ( not bFlip and not bTopOnRight and tsBoolData.bAtRight) or
|
|
( bFlip and bTopOnRight and tsBoolData.bAtRight) or ( bFlip and not bTopOnRight and not tsBoolData.bAtRight)) then
|
|
sProfName = tsStringData.sHingeTrim
|
|
sProfOppoName = tsStringData.sLockTrim
|
|
bHingeOnRef = true
|
|
bCalcProf = true
|
|
elseif ( not tsBoolData.bLockMach or DGD.MLS) and ( ( not bFlip and bTopOnRight and tsBoolData.bAtRight) or ( not bFlip and not bTopOnRight and not tsBoolData.bAtRight) or
|
|
( bFlip and bTopOnRight and not tsBoolData.bAtRight) or ( bFlip and not bTopOnRight and tsBoolData.bAtRight)) then
|
|
sProfName = tsStringData.sLockTrim
|
|
sProfOppoName = tsStringData.sHingeTrim
|
|
bHingeOnRef = false
|
|
bCalcProf = true
|
|
end
|
|
]]--
|
|
end
|
|
|
|
-- se devo calcolare eventuale spostamento dato dal profilo in battuta
|
|
if bCalcProf then
|
|
if sProfName == 'SQ' or sProfName == 'EB' then
|
|
nSideType = 0
|
|
-- se disposizione bevel down ( il nome è riferito alla prima disposizione) uso il riferimento in alto
|
|
elseif sProfName == 'BU' or sProfName == 'BUEB' then
|
|
nSideType = 1
|
|
if tsDoubleData.dThickDoor > tMainTabPar.AR then
|
|
dExtraY = ( tsDoubleData.dThickDoor - tMainTabPar.AR) * TAN3
|
|
end
|
|
-- se abilitato il side probe
|
|
if nProbeMode == 0 and nPostProbeSet >= 3 then
|
|
-- calcolo errore del probe tastando dallo spessore - il parametro z extra probe
|
|
dDeltaProf = tMainTabPar.EZPB * TAN3
|
|
else
|
|
-- calcolo errore del probe tastando a metà spessore - il parametro z extra probe
|
|
dDeltaProf = ((( tsDoubleData.dThickDoor / 2) - tMainTabPar.EZPB) * TAN3)
|
|
end
|
|
dDeltaProbe = dDeltaProf - dExtraY
|
|
-- dato che viene compensato il dDeltaProbe nella tastatura. il dDeltaProf risulta essere uguale a dExtraY
|
|
dDeltaProf = dExtraY
|
|
-- se disposizione bevel up ( il nome è riferito alla prima disposizione) uso il riferimento in basso
|
|
elseif sProfName == 'BD' or sProfName == 'BDEB' then
|
|
nSideType = 2
|
|
dExtraY = ( tMainTabPar.AR - tMainTabPar.TR) * TAN3
|
|
-- se abilitato il side probe
|
|
if nProbeMode == 0 and nPostProbeSet >= 3 then
|
|
-- calcolo errore del probe tastando dallo spessore - il parametro z extra probe
|
|
dDeltaProf = (( tsDoubleData.dThickDoor - tMainTabPar.EZPB) * TAN3)
|
|
else
|
|
-- calcolo errore del probe tastando a metà spessore + il parametro z extra probe
|
|
dDeltaProf = ((( tsDoubleData.dThickDoor / 2) + tMainTabPar.EZPB) * TAN3)
|
|
end
|
|
dDeltaProbe = dDeltaProf - dExtraY
|
|
-- dato che viene compensato il dDeltaProbe nella tastatura. il dDeltaProf risulta essere uguale a dExtraY
|
|
dDeltaProf = dExtraY
|
|
-- se profilo bull nose verifico in base al raggio
|
|
elseif sProfName == '1B' or sProfName == '2B' or sProfName == '3B' or sProfName == '4B' or
|
|
sProfName == '5B' or sProfName == '6B' or sProfName == '7B' or sProfName == '8B' then
|
|
|
|
nSideType = 3
|
|
-- calcolo punto massimo ingombro profilo
|
|
local dAltProf = tsDoubleData.dThickDoor/2
|
|
local dAltcalc = 0
|
|
|
|
-- se punto max è sotto il minimo riferimento
|
|
if dAltProf < ( tMainTabPar.AR - tMainTabPar.TR) then
|
|
dAltcalc = tMainTabPar.AR - tMainTabPar.TR - dAltProf
|
|
-- se punto max è sopra il massimo riferimento
|
|
elseif dAltProf > tMainTabPar.AR then
|
|
dAltcalc = dAltProf - tMainTabPar.AR
|
|
end
|
|
|
|
-- se punto massimo profilo non è compreso nel riferimento calcolo il delta Y
|
|
if dAltcalc > 0 then
|
|
dExtraY = tsDoubleData.dRadiusPrf - sqrt((tsDoubleData.dRadiusPrf*tsDoubleData.dRadiusPrf)-(dAltcalc*dAltcalc))
|
|
end
|
|
-- calcolo errore del probe tastando a metà spessore
|
|
dDeltaProbe = -dExtraY
|
|
-- dato che viene compensato il dDeltaProbe nella tastatura. il dDeltaProf risulta essere uguale a dExtraY
|
|
dDeltaProf = dExtraY
|
|
-- se profilo convex verifico in base al raggio
|
|
elseif sProfName == 'CV' then
|
|
|
|
nSideType = 4
|
|
-- calcolo punto minimo ingombro profilo
|
|
local dAltProf = tsDoubleData.dThickDoor/2
|
|
local dAltcalc = (tMainTabPar.TR/2)
|
|
-- calcolo il delta Y massimo del minimo ingombro profilo
|
|
local dMaxInsPrf = sqrt((tsDoubleData.dRadiusPrf*tsDoubleData.dRadiusPrf)-((dAltProf-tsDoubleData.dPlanePrf)*(dAltProf-tsDoubleData.dPlanePrf)))
|
|
|
|
-- se riferimento è sul max ingombro porta
|
|
if ( tsDoubleData.dThickDoor < tMainTabPar.AR) and ( tsDoubleData.dThickDoor > ( tMainTabPar.AR - tMainTabPar.TR)) then
|
|
dAltcalc = 0
|
|
-- se punto minimo ingombro profilo è sotto all'altezza media del riferimento
|
|
elseif dAltProf < ( tMainTabPar.AR - (tMainTabPar.TR/2)) then
|
|
dAltcalc = tMainTabPar.AR - dAltProf
|
|
-- se punto minimo ingombro profilo è sopra all'altezza media del riferimento
|
|
elseif dAltProf > ( tMainTabPar.AR - (tMainTabPar.TR/2)) then
|
|
dAltcalc = dAltProf - tMainTabPar.AR + tMainTabPar.TR
|
|
end
|
|
|
|
-- calcolo il delta Y
|
|
if dAltcalc > 0 then
|
|
dExtraY = sqrt((tsDoubleData.dRadiusPrf*tsDoubleData.dRadiusPrf)-(dAltcalc*dAltcalc)) - dMaxInsPrf
|
|
end
|
|
-- calcolo errore del probe tastando a metà spessore
|
|
-- dDeltaProbe = dRadiusPrf - dExtraY
|
|
-- dDeltaProf = dRadiusPrf - dMaxInsPrf
|
|
dDeltaProbe = tsDoubleData.dRadiusPrf - (dExtraY + dMaxInsPrf)
|
|
-- dato che viene compensato il dDeltaProbe nella tastatura. il dDeltaProf risulta essere uguale a dExtraY
|
|
dDeltaProf = dExtraY
|
|
end
|
|
end
|
|
|
|
if bCalcProfOppo then
|
|
if sProfOppoName == 'SQ' or sProfOppoName == 'EB' then
|
|
nSideOppoType = 0
|
|
-- se disposizione bevel down ( il nome è riferito alla prima disposizione) uso il riferimento in alto
|
|
elseif sProfOppoName == 'BU' or sProfOppoName == 'BUEB' then
|
|
nSideOppoType = 1
|
|
-- se abilitato il side probe
|
|
if nProbeMode == 0 and nPostProbeSet >= 3 then
|
|
-- calcolo errore del probe tastando dallo spessore - il parametro z extra probe
|
|
dDeltaProfOppo = tMainTabPar.EZPB * TAN3
|
|
else
|
|
-- calcolo errore del probe tastando a metà spessore - il parametro z extra p
|
|
dDeltaProfOppo = ((( tsDoubleData.dThickDoor / 2) - tMainTabPar.EZPB) * TAN3)
|
|
end
|
|
-- se disposizione bevel up ( il nome è riferito alla prima disposizione) uso il riferimento in basso
|
|
elseif sProfOppoName == 'BD' or sProfOppoName == 'BDEB' then
|
|
nSideOppoType = 2
|
|
-- se abilitato il side probe
|
|
if nProbeMode == 0 and nPostProbeSet >= 3 then
|
|
-- calcolo errore del probe tastando dallo spessore - il parametro z extra probe
|
|
dDeltaProfOppo = (( tsDoubleData.dThickDoor - tMainTabPar.EZPB) * TAN3)
|
|
else
|
|
-- calcolo errore del probe tastando a metà spessore + il parametro z extra probe
|
|
dDeltaProfOppo = ((( tsDoubleData.dThickDoor / 2) + tMainTabPar.EZPB) * TAN3)
|
|
end
|
|
elseif sProfOppoName == '1B' or sProfOppoName == '2B' or sProfOppoName == '3B' or sProfOppoName == '4B' or
|
|
sProfOppoName == '5B' or sProfOppoName == '6B' or sProfOppoName == '7B' or sProfOppoName == '8B' then
|
|
|
|
nSideOppoType = 3
|
|
-- se profilo convex verifico in base al raggio
|
|
elseif sProfOppoName == 'CV' then
|
|
|
|
nSideOppoType = 4
|
|
local dAltProfOppo
|
|
local dAltProfOppoTh
|
|
local dExtraYOppoTh
|
|
-- se abilitato il side probe
|
|
if nProbeMode == 0 and nPostProbeSet >= 3 then
|
|
-- calcolo punto minimo ingombro profilo
|
|
dAltProfOppoTh = tsDoubleData.dThickDoor/2 - tsDoubleData.dPlanePrf
|
|
-- calcolo errore del probe tastando a spessore completo - extra z
|
|
dAltProfOppo = (tsDoubleData.dThickDoor/2) - tMainTabPar.EZPB - tsDoubleData.dPlanePrf
|
|
-- calcolo il delta Y massimo del minimo ingombro profilo
|
|
dExtraYOppo = sqrt((tsDoubleData.dRadiusPrf*tsDoubleData.dRadiusPrf)-(dAltProfOppo*dAltProfOppo))
|
|
dExtraYOppoTh = sqrt((tsDoubleData.dRadiusPrf*tsDoubleData.dRadiusPrf)-(dAltProfOppoTh*dAltProfOppoTh))
|
|
-- calcolo errore del probe tastando dallo spessore - quota extra z
|
|
dDeltaProfOppo = dExtraYOppo - dExtraYOppoTh
|
|
else
|
|
-- calcolo punto minimo ingombro profilo
|
|
dAltProfOppo = tsDoubleData.dThickDoor/2 - tsDoubleData.dPlanePrf
|
|
-- calcolo il delta Y
|
|
dExtraYOppo = sqrt((tsDoubleData.dRadiusPrf*tsDoubleData.dRadiusPrf)-(dAltProfOppo*dAltProfOppo))
|
|
-- calcolo errore del probe tastando a metà spessore
|
|
dDeltaProfOppo = tsDoubleData.dRadiusPrf - dExtraYOppo
|
|
end
|
|
end
|
|
end
|
|
|
|
vExtraYDelta = Vector3d(0,-dExtraY,0)
|
|
-- scrivo le note
|
|
-- se sono ancora nella prima fase e non sono state fatte lavorazioni allora setto le note
|
|
-- ancora per la prima disposizione
|
|
if nNumPhase and nNumPhase == 1 and nNumMach == 0 then
|
|
EgtSetInfo( Pz, 'ExtraCalcMoveY', dExtraY)
|
|
EgtSetInfo( Pz, 'DoorProbeErrorY', dDeltaProbe)
|
|
EgtSetInfo( Pz, 'DoorProbeExtraPosZ', tMainTabPar.EZPB)
|
|
EgtSetInfo( Pz, 'DoorProbeThick', tMainTabPar.PTK)
|
|
EgtSetInfo( Pz, 'DoorProfErrorY', dDeltaProf)
|
|
EgtSetInfo( Pz, 'DoorProfOppoErrorY', dDeltaProfOppo)
|
|
EgtSetInfo( Pz, 'SideDisposition', DISPMODE)
|
|
EgtSetInfo( Pz, 'UseViseWithFrame', bUseVise)
|
|
-- scrivo nota lavorazione lato hinge
|
|
EgtSetInfo( Pz, 'SideHingeMach', nHingeMach)
|
|
-- per compatibilità scrivo nota tipo profilo su lato in battuta (inizialmente il lato hinge era sempre in battuta)
|
|
EgtSetInfo( Pz, 'SideHingeProf', nSideType)
|
|
-- scrivo profilo lato in battuta
|
|
EgtSetInfo( Pz, 'SideProfOnRef', nSideType)
|
|
-- scrivo profilo lato opposto
|
|
EgtSetInfo( Pz, 'SideProfOnOppo', nSideOppoType)
|
|
-- scrivo nota lavorazione lato lock
|
|
EgtSetInfo( Pz, 'SideLockMach', nLockMach)
|
|
-- scrivo nota con numero geometrie di ProbeZ o probeXY (in base ai settaggi di nProbeMode e nPostProbeSet)
|
|
EgtSetInfo( Pz, 'NumProbeZ', nNumProbeZ)
|
|
-- scrivo nota flag modalita remove scrap
|
|
EgtSetInfo( Pz, 'RemoveScrapMode', tMainTabPar.RSM)
|
|
-- scrivo nota altezza riferimento e spessore riferimento
|
|
EgtSetInfo( Pz, 'ReferenceHeight', tMainTabPar.AR)
|
|
EgtSetInfo( Pz, 'ReferenceTall', tMainTabPar.TR)
|
|
-- scrivo posizioni riferimenti
|
|
EgtSetInfo( Pz, 'ReferencePos1', tMainTabPar.REF1)
|
|
EgtSetInfo( Pz, 'ReferencePos2', tMainTabPar.REF2)
|
|
EgtSetInfo( Pz, 'ReferencePos3', tMainTabPar.REF3)
|
|
EgtSetInfo( Pz, 'ReferencePos4', tMainTabPar.REF4)
|
|
else
|
|
EgtSetInfo( Pz, 'ExtraCalcMoveY_2', dExtraY)
|
|
EgtSetInfo( Pz, 'DoorProbeErrorY_2', dDeltaProbe)
|
|
EgtSetInfo( Pz, 'DoorProbeExtraPosZ_2', tMainTabPar.EZPB)
|
|
EgtSetInfo( Pz, 'DoorProbeThick', tMainTabPar.PTK)
|
|
EgtSetInfo( Pz, 'DoorProfErrorY_2', dDeltaProf)
|
|
EgtSetInfo( Pz, 'DoorProfOppoErrorY_2', dDeltaProfOppo)
|
|
EgtSetInfo( Pz, 'SideDisposition_2', DISPMODE)
|
|
EgtSetInfo( Pz, 'UseViseWithFrame_2', bUseVise)
|
|
-- scrivo nota lavorazione lato hinge
|
|
EgtSetInfo( Pz, 'SideHingeMach_2', nHingeMach)
|
|
-- per compatibilità scrivo nota tipo profilo su lato in battuta (inizialmente il lato hinge era sempre in battuta)
|
|
EgtSetInfo( Pz, 'SideHingeProf_2', nSideType)
|
|
-- scrivo profilo lato in battuta
|
|
EgtSetInfo( Pz, 'SideProfOnRef_2', nSideType)
|
|
-- scrivo profilo lato opposto
|
|
EgtSetInfo( Pz, 'SideProfOnOppo_2', nSideOppoType)
|
|
-- scrivo nota lavorazione lato lock
|
|
EgtSetInfo( Pz, 'SideLockMach_2', nLockMach)
|
|
-- scrivo nota con numero geometrie di ProbeZ o probeXY (in base ai settaggi di nProbeMode e nPostProbeSet)
|
|
EgtSetInfo( Pz, 'NumProbeZ_2', nNumProbeZ)
|
|
-- scrivo nota altezza riferimento e spessore riferimento
|
|
EgtSetInfo( Pz, 'ReferenceHeight_2', tMainTabPar.AR)
|
|
EgtSetInfo( Pz, 'ReferenceTall_2', tMainTabPar.TR)
|
|
-- scrivo posizioni riferimenti
|
|
EgtSetInfo( Pz, 'ReferencePos1_2', tMainTabPar.REF1)
|
|
EgtSetInfo( Pz, 'ReferencePos2_2', tMainTabPar.REF2)
|
|
EgtSetInfo( Pz, 'ReferencePos3_2', tMainTabPar.REF3)
|
|
EgtSetInfo( Pz, 'ReferencePos4_2', tMainTabPar.REF4)
|
|
end
|
|
local vExtraXY
|
|
local dExtraX = 0
|
|
dExtraY = 0
|
|
local nCorner = MCH_CR.BL
|
|
|
|
if sAssemb == 'framesx' then
|
|
dExtraX , dExtraY, nCorner = CalcDispositionRef( true, bTopOnRight, tsDoubleData.dLeftOffs, tsDoubleData.dRightOffs, tsDoubleData.dTopOffs,
|
|
tsDoubleData.dBottomOffs, bFlip, tMainTabPar.FTDD)
|
|
vExtraXY = Vector3d( dExtraX, dExtraY, 0)
|
|
-- Muovo frame nella posizione di origine
|
|
bMoveRaw = EgtMoveToCornerRawPart( nRaw, ( Ori + vExtraYDelta + vExtraXY), nCorner)
|
|
elseif sAssemb == 'framedx' then
|
|
dExtraX , dExtraY, nCorner = CalcDispositionRef( false, bTopOnRight, tsDoubleData.dLeftOffs, tsDoubleData.dRightOffs, tsDoubleData.dTopOffs,
|
|
tsDoubleData.dBottomOffs, bFlip, tMainTabPar.FTDD)
|
|
vExtraXY = Vector3d( dExtraX, dExtraY, 0)
|
|
-- Muovo frame nella posizione di origine
|
|
bMoveRaw = EgtMoveToCornerRawPart( nRaw, ( Ori + vExtraYDelta + vExtraXY), nCorner)
|
|
elseif sAssemb == 'frametop' then
|
|
dExtraX , dExtraY, nCorner = CalcDispositionRef( true, bTopOnRight, tsDoubleData.dLeftOffs, tsDoubleData.dRightOffs, tsDoubleData.dTopOffs,
|
|
tsDoubleData.dBottomOffs, bFlip, tMainTabPar.FTDD)
|
|
vExtraXY = Vector3d( dExtraX, dExtraY, 0)
|
|
-- Muovo frame nella posizione di origine
|
|
bMoveRaw = EgtMoveToCornerRawPart( nRaw, ( Ori + vExtraYDelta + vExtraXY), nCorner)
|
|
elseif sAssemb == 'framebot' then
|
|
dExtraX , dExtraY, nCorner = CalcDispositionRef( false, bTopOnRight, tsDoubleData.dLeftOffs, tsDoubleData.dRightOffs, tsDoubleData.dTopOffs,
|
|
tsDoubleData.dBottomOffs, bFlip, tMainTabPar.FTDD)
|
|
vExtraXY = Vector3d( dExtraX, dExtraY, 0)
|
|
-- Muovo frame nella posizione di origine
|
|
bMoveRaw = EgtMoveToCornerRawPart( nRaw, ( Ori + vExtraYDelta + vExtraXY), nCorner)
|
|
else
|
|
-- Muovo porta con l'angolo in basso a ( destra o sinistra) nella posizione di origine
|
|
bMoveRaw = EgtMoveToCornerRawPart( nRaw, ( Ori + vExtraYDelta), EgtIf( DISPMODE > 0, MCH_CR.BL, MCH_CR.BR))
|
|
end
|
|
end
|
|
--debug
|
|
-- EgtSaveFile()
|
|
-- EgtMove(DGD.PZ, Point3d(0,0,nil) - ORIG())
|
|
|
|
--nTime = EgtStopCounter()
|
|
--if not DGD or not DGD.NCGEN then
|
|
-- EgtOutBox( string.format( 'tempo calcolato sec: %s', (nTime/1000)), 'Timex', 'Timex')
|
|
--end
|
|
|
|
-- inizializzo il contatore
|
|
--EgtStartCounter()
|
|
|
|
if not bMoveRaw then
|
|
bOk = false
|
|
DGD.EMC = ' ' .. EgtDoorsMsg[676]..EgtDoorsMsg[474] -- Error positioning raw part on table
|
|
break
|
|
end
|
|
|
|
if bFirstStep then
|
|
if bShiftMchng then
|
|
sNotePhase = 'SHIFT'
|
|
else
|
|
sNotePhase = 'NORMAL'
|
|
end
|
|
else
|
|
if bShiftMchng then
|
|
sNotePhase = 'FLIPSHIFT'
|
|
else
|
|
sNotePhase = 'FLIP'
|
|
end
|
|
end
|
|
|
|
-- salvo una nota con le info della disposizione traslata
|
|
EgtSetInfo( Pz, 'MachineNameFromCurrCamInfo', tMainTabPar.MN)
|
|
EgtSetInfo( Pz, 'DoorOnTable_' .. EgtNumToString( nNumPhase, 0) .. '_' .. tMainTabPar.MN, sDispMode)
|
|
EgtSetInfo( Pz, 'KindPhase_' .. EgtNumToString( nNumPhase, 0) .. '_' .. tMainTabPar.MN, sNotePhase)
|
|
-- salvo note per porta ribaltata rispetto al ddf e per disposizione lato top
|
|
EgtSetInfo( Pz, 'DispPhase_' .. EgtNumToString( nNumPhase, 0) , EgtIf( bFlip, 'F', 'N'))
|
|
EgtSetInfo( Pz, 'DispTopOn_' .. EgtNumToString( nNumPhase, 0) , EgtIf( bTopOnRight, 'R', 'L'))
|
|
|
|
if bFlip then -- se porta capovolta
|
|
if bTopOnRight then -- se top a destra
|
|
-- il lato sinistro appoggia sui riferimenti
|
|
OffsYSovr = tsDoubleData.dLeftOffs
|
|
OffsXSovr = EgtIf( DISPMODE > 0, tsDoubleData.dBottomOffs, tsDoubleData.dTopOffs)
|
|
else -- se top a sinistra
|
|
-- il lato destro appoggia sui riferimenti
|
|
OffsYSovr = tsDoubleData.dRightOffs
|
|
OffsXSovr = EgtIf( DISPMODE > 0, tsDoubleData.dTopOffs, tsDoubleData.dBottomOffs)
|
|
end
|
|
else -- altrimenti non è capovolta
|
|
if bTopOnRight then -- se top a destra
|
|
-- il lato destro appoggia sui riferimenti
|
|
OffsYSovr = tsDoubleData.dRightOffs
|
|
OffsXSovr = EgtIf( DISPMODE > 0, tsDoubleData.dBottomOffs, tsDoubleData.dTopOffs)
|
|
else -- se top a sinistra
|
|
-- il lato sinistro appoggia sui riferimenti
|
|
OffsYSovr = tsDoubleData.dLeftOffs
|
|
OffsXSovr = EgtIf( DISPMODE > 0, tsDoubleData.dTopOffs, tsDoubleData.dBottomOffs)
|
|
end
|
|
end
|
|
|
|
-- se frame riassegno il valore del sovramateriale perché viene tenuto a filo della ventosa
|
|
if bFrame then
|
|
if nCodeVacDisp == 1 then
|
|
if bUseVise then
|
|
OffsXSovr = EgtIf( DISPMODE > 0, abs( tMainTabPar.OR1fv:getX() - tMainTabPar.OR1:getX()), abs( tMainTabPar.OR2fv:getX() - tMainTabPar.OR2:getX()))
|
|
else
|
|
OffsXSovr = EgtIf( DISPMODE > 0, abs( tMainTabPar.OR1f:getX() - tMainTabPar.OR1:getX()), abs( tMainTabPar.OR2f:getX() - tMainTabPar.OR2:getX()))
|
|
end
|
|
elseif nCodeVacDisp == 2 then
|
|
OffsXSovr = EgtIf( DISPMODE > 0, abs( tMainTabPar.OR3f:getX() - tMainTabPar.OR1:getX()), abs( tMainTabPar.OR4f:getX() - tMainTabPar.OR2:getX()))
|
|
elseif nCodeVacDisp == 3 then
|
|
OffsXSovr = EgtIf( DISPMODE > 0, abs( tMainTabPar.OR5f:getX() - tMainTabPar.OR1:getX()), abs( tMainTabPar.OR6f:getX() - tMainTabPar.OR2:getX()))
|
|
end
|
|
end
|
|
|
|
-- Controllo dimensioni pezzo
|
|
-- se è un frame
|
|
if bFrame then
|
|
-- controllo se le dimensioni porta sono compresi nei valori minimi e massimi
|
|
bFailDim = CheckPieceDimension( bFrame, tsDoubleData.dLengthDoor, tsDoubleData.dWidthDoor, tsDoubleData.dThickDoor, 0, 0, 0, 0)
|
|
else
|
|
-- controllo se le dimensioni porta sono compresi nei valori minimi e massimi
|
|
bFailDim = CheckPieceDimension( bFrame, tsDoubleData.dLengthDoor, tsDoubleData.dWidthDoor, tsDoubleData.dThickDoor, OffsXSovr, OffsYSovr, vShift:getX(), vShift:getY())
|
|
end
|
|
|
|
if bFailDim then
|
|
|
|
DGD.ERR = 19
|
|
-- cancello e ricreo il file txt
|
|
EgtEraseFile( sFileDir..sFileName..'.txt')
|
|
--ricreo il file txt con la disposizione
|
|
WriteErrFile( sFileDir..sFileName..'.txt')
|
|
|
|
-- se lanciato da DMach stampo anche un messaggio a video
|
|
if not DGD or not DGD.NCGEN then
|
|
DoorOutLog( ' Err=' .. EgtNumToString( DGD.ERR, 0), 0)
|
|
DoorOutLog( DGD.EMC, 0)
|
|
EgtOutBox( ' Err=' .. EgtNumToString( DGD.ERR, 0) .. DGD.EMC, EgtDoorsMsg[476], EgtDoorsMsg[477]) -- Error on Nc part program generation
|
|
end
|
|
return false
|
|
end
|
|
|
|
-----------------------------------------------------------------------------------------------------------------
|
|
-- abilito/disabilito geometrie probe in base alla lavorazione o meno del fianco e dal tipo di profilo di questo
|
|
-----------------------------------------------------------------------------------------------------------------
|
|
-- se profilo hinge è da lavorare rinomino i percorsi di probe per non farli
|
|
if tsBoolData.bHingeMach then
|
|
-- recupero entità probe di fianco
|
|
local ProbeList = MB.FindEntitiesWithName( Pz, 'ProbeSidePoint')
|
|
local eProSide
|
|
-- ciclo su tutte le entità trovate
|
|
for j = 1, #ProbeList do
|
|
eProSide = EgtGetInfo( ProbeList[j], 'SideApplied', 'i') or 0
|
|
if eProSide == 1 then
|
|
EgtSetName( ProbeList[j], 'NO_ProbeSidePoint' )
|
|
end
|
|
end
|
|
-- se non da lavorare e profilo bevel dn cambio lo spessore a: spessore probe + extra probe z
|
|
elseif not tsBoolData.bHingeMach and ( tsStringData.sHingeTrim == 'BD' or tsStringData.sHingeTrim == 'BDEB') then
|
|
-- recupero entità probe di fianco
|
|
local ProbeList = MB.FindEntitiesWithName( Pz, 'ProbeSidePoint')
|
|
local eProSide
|
|
-- ciclo su tutte le entità trovate
|
|
for j = 1, #ProbeList do
|
|
eProSide = EgtGetInfo( ProbeList[j], 'SideApplied', 'i') or 0
|
|
if eProSide == 1 then
|
|
-- EgtModifyCurveThickness( ProbeList[j], 0)
|
|
EgtModifyCurveThickness( ProbeList[j], -tMainTabPar.EZPB)
|
|
EgtSetInfo( ProbeList[j], 'ProfSide', 'BD')
|
|
end
|
|
end
|
|
-- se profilo non lavorato e di tipo bullnose cambio lo spessore a metà porta + extra probe z
|
|
elseif not tsBoolData.bHingeMach and ( tsStringData.sHingeTrim == '1B' or tsStringData.sHingeTrim == '2B' or tsStringData.sHingeTrim == '3B' or tsStringData.sHingeTrim == '4B' or
|
|
tsStringData.sHingeTrim == '5B' or tsStringData.sHingeTrim == '6B' or tsStringData.sHingeTrim == '7B' or tsStringData.sHingeTrim == '8B') then
|
|
-- recupero entità probe di fianco
|
|
local ProbeList = MB.FindEntitiesWithName( Pz, 'ProbeSidePoint')
|
|
local eProSide
|
|
-- ciclo su tutte le entità trovate
|
|
for j = 1, #ProbeList do
|
|
eProSide = EgtGetInfo( ProbeList[j], 'SideApplied', 'i') or 0
|
|
if eProSide == 1 then
|
|
EgtModifyCurveThickness( ProbeList[j], -( tsDoubleData.dThickDoor/2 + tMainTabPar.EZPB))
|
|
end
|
|
end
|
|
-- in tutti gli altri profili setto l'affondamento a extra probe z
|
|
elseif not tsBoolData.bHingeMach then
|
|
-- recupero entità probe di fianco
|
|
local ProbeList = MB.FindEntitiesWithName( Pz, 'ProbeSidePoint')
|
|
local eProSide
|
|
-- ciclo su tutte le entità trovate
|
|
for j = 1, #ProbeList do
|
|
eProSide = EgtGetInfo( ProbeList[j], 'SideApplied', 'i') or 0
|
|
if eProSide == 1 then
|
|
EgtModifyCurveThickness( ProbeList[j], -tMainTabPar.EZPB)
|
|
-- EgtModifyCurveThickness( ProbeList[j], 0)
|
|
-- se profilo bevel up assegno nota
|
|
if tsStringData.sHingeTrim == 'BU' or tsStringData.sHingeTrim == 'BUEB' then
|
|
EgtSetInfo( ProbeList[j], 'ProfSide', 'BU')
|
|
end
|
|
end
|
|
end
|
|
end
|
|
-- se profilo lock è da lavorare rinomino i percorsi di probe per non farli
|
|
if tsBoolData.bLockMach then
|
|
-- recupero entità probe di fianco su lato secure
|
|
local ProbeList = MB.FindEntitiesWithName( Pz, 'ProbeSidePoint')
|
|
local eProSide
|
|
-- ciclo su tutte le entità trovate
|
|
for j = 1, #ProbeList do
|
|
eProSide = EgtGetInfo( ProbeList[j], 'SideApplied', 'i') or 0
|
|
if eProSide == 3 then
|
|
EgtSetName( ProbeList[j], 'NO_ProbeSidePoint' )
|
|
end
|
|
end
|
|
-- se non da lavorare e profilo bevel dn cambio lo spessore allo spessore probe + extra probe z
|
|
elseif not tsBoolData.bLockMach and ( tsStringData.sLockTrim == 'BD' or tsStringData.sLockTrim == 'BDEB') then
|
|
-- recupero entità probe di fianco
|
|
local ProbeList = MB.FindEntitiesWithName( Pz, 'ProbeSidePoint')
|
|
local eProSide
|
|
-- ciclo su tutte le entità trovate
|
|
for j = 1, #ProbeList do
|
|
eProSide = EgtGetInfo( ProbeList[j], 'SideApplied', 'i') or 0
|
|
if eProSide == 3 then
|
|
-- EgtModifyCurveThickness( ProbeList[j], 0)
|
|
EgtModifyCurveThickness( ProbeList[j], -tMainTabPar.EZPB)
|
|
EgtSetInfo( ProbeList[j], 'ProfSide', 'BD')
|
|
end
|
|
end
|
|
-- se profilo non lavorato e di tipo bullnose cambio lo spessore a metà porta + extra probe z
|
|
elseif not tsBoolData.bLockMach and ( tsStringData.sLockTrim == '1B' or tsStringData.sLockTrim == '2B' or tsStringData.sLockTrim == '3B' or tsStringData.sLockTrim == '4B' or
|
|
tsStringData.sLockTrim == '5B' or tsStringData.sLockTrim == '6B' or tsStringData.sLockTrim == '7B' or tsStringData.sLockTrim == '8B') then
|
|
-- recupero entità probe di fianco
|
|
local ProbeList = MB.FindEntitiesWithName( Pz, 'ProbeSidePoint')
|
|
local eProSide
|
|
-- ciclo su tutte le entità trovate
|
|
for j = 1, #ProbeList do
|
|
eProSide = EgtGetInfo( ProbeList[j], 'SideApplied', 'i') or 0
|
|
if eProSide == 3 then
|
|
EgtModifyCurveThickness( ProbeList[j], -( tsDoubleData.dThickDoor/2 + tMainTabPar.EZPB))
|
|
end
|
|
end
|
|
-- in tutti gli altri profili setto l'affondamento a extra probe z
|
|
elseif not tsBoolData.bLockMach then
|
|
-- recupero entità probe di fianco
|
|
local ProbeList = MB.FindEntitiesWithName( Pz, 'ProbeSidePoint')
|
|
local eProSide
|
|
-- ciclo su tutte le entità trovate
|
|
for j = 1, #ProbeList do
|
|
eProSide = EgtGetInfo( ProbeList[j], 'SideApplied', 'i') or 0
|
|
if eProSide == 3 then
|
|
EgtModifyCurveThickness( ProbeList[j], -tMainTabPar.EZPB)
|
|
-- EgtModifyCurveThickness( ProbeList[j], 0)
|
|
-- se profilo bevel up assegno nota
|
|
if tsStringData.sLockTrim == 'BU' or tsStringData.sLockTrim == 'BUEB' then
|
|
EgtSetInfo( ProbeList[j], 'ProfSide', 'BU')
|
|
end
|
|
end
|
|
end
|
|
end
|
|
-- se profilo top è da lavorare rinomino i percorsi di probe per non farli
|
|
if tsBoolData.bTopMach then
|
|
-- recupero entità probe di fianco su lato secure
|
|
local ProbeList = MB.FindEntitiesWithName( Pz, 'ProbeSidePoint')
|
|
local eProSide
|
|
-- ciclo su tutte le entità trovate
|
|
for j = 1, #ProbeList do
|
|
eProSide = EgtGetInfo( ProbeList[j], 'SideApplied', 'i') or 0
|
|
if eProSide == 2 then
|
|
EgtSetName( ProbeList[j], 'NO_ProbeSidePoint' )
|
|
end
|
|
end
|
|
-- se non da lavorare e profilo bevel dn cambio lo spessore allo spessore probe + extra probe z
|
|
elseif not tsBoolData.bTopMach and ( tsStringData.sTopTrim == 'BD' or tsStringData.sTopTrim == 'BDEB') then
|
|
-- recupero entità probe di fianco
|
|
local ProbeList = MB.FindEntitiesWithName( Pz, 'ProbeSidePoint')
|
|
local eProSide
|
|
-- ciclo su tutte le entità trovate
|
|
for j = 1, #ProbeList do
|
|
eProSide = EgtGetInfo( ProbeList[j], 'SideApplied', 'i') or 0
|
|
if eProSide == 2 then
|
|
-- EgtModifyCurveThickness( ProbeList[j], 0)
|
|
EgtModifyCurveThickness( ProbeList[j], -tMainTabPar.EZPB)
|
|
EgtSetInfo( ProbeList[j], 'ProfSide', 'BD')
|
|
end
|
|
end
|
|
-- se profilo non lavorato e di tipo bullnose cambio lo spessore a metà porta
|
|
elseif not tsBoolData.bTopMach and ( tsStringData.sTopTrim == '1B' or tsStringData.sTopTrim == '2B' or tsStringData.sTopTrim == '3B' or tsStringData.sTopTrim == '4B' or
|
|
tsStringData.sTopTrim == '5B' or tsStringData.sTopTrim == '6B' or tsStringData.sTopTrim == '7B' or tsStringData.sTopTrim == '8B') then
|
|
-- recupero entità probe di fianco
|
|
local ProbeList = MB.FindEntitiesWithName( Pz, 'ProbeSidePoint')
|
|
local eProSide
|
|
-- ciclo su tutte le entità trovate
|
|
for j = 1, #ProbeList do
|
|
eProSide = EgtGetInfo( ProbeList[j], 'SideApplied', 'i') or 0
|
|
if eProSide == 2 then
|
|
EgtModifyCurveThickness( ProbeList[j], -( tsDoubleData.dThickDoor/2 + tMainTabPar.EZPB))
|
|
end
|
|
end
|
|
-- in tutti gli altri profili setto l'affondamento a extra probe z
|
|
elseif not tsBoolData.bTopMach then
|
|
-- recupero entità probe di fianco
|
|
local ProbeList = MB.FindEntitiesWithName( Pz, 'ProbeSidePoint')
|
|
local eProSide
|
|
-- ciclo su tutte le entità trovate
|
|
for j = 1, #ProbeList do
|
|
eProSide = EgtGetInfo( ProbeList[j], 'SideApplied', 'i') or 0
|
|
if eProSide == 2 then
|
|
EgtModifyCurveThickness( ProbeList[j], -tMainTabPar.EZPB)
|
|
-- EgtModifyCurveThickness( ProbeList[j], 0)
|
|
-- se profilo bevel up assegno nota
|
|
if tsStringData.sTopTrim == 'BU' or tsStringData.sTopTrim == 'BUEB' then
|
|
EgtSetInfo( ProbeList[j], 'ProfSide', 'BU')
|
|
end
|
|
end
|
|
end
|
|
end
|
|
-- se profilo bottom è da lavorare oppure non da lavorare ma con profilo bevel up rinomino i percorsi di probe per non farli
|
|
if tsBoolData.bBottomMach then
|
|
-- recupero entità probe di fianco su lato secure
|
|
local ProbeList = MB.FindEntitiesWithName( Pz, 'ProbeSidePoint')
|
|
local eProSide
|
|
-- ciclo su tutte le entità trovate
|
|
for j = 1, #ProbeList do
|
|
eProSide = EgtGetInfo( ProbeList[j], 'SideApplied', 'i') or 0
|
|
if eProSide == 4 then
|
|
EgtSetName( ProbeList[j], 'NO_ProbeSidePoint' )
|
|
end
|
|
end
|
|
-- se non da lavorare e profilo bevel dn cambio lo spessore allo spessore probe + extra probe z
|
|
elseif not tsBoolData.bBottomMach and ( tsStringData.sBottomTrim == 'BD' or tsStringData.sBottomTrim == 'BDEB') then
|
|
-- recupero entità probe di fianco
|
|
local ProbeList = MB.FindEntitiesWithName( Pz, 'ProbeSidePoint')
|
|
local eProSide
|
|
-- ciclo su tutte le entità trovate
|
|
for j = 1, #ProbeList do
|
|
eProSide = EgtGetInfo( ProbeList[j], 'SideApplied', 'i') or 0
|
|
if eProSide == 4 then
|
|
-- EgtModifyCurveThickness( ProbeList[j], 0)
|
|
EgtModifyCurveThickness( ProbeList[j], -tMainTabPar.EZPB)
|
|
EgtSetInfo( ProbeList[j], 'ProfSide', 'BD')
|
|
end
|
|
end
|
|
-- se profilo non lavorato e di tipo bullnose cambio lo spessore a metà porta
|
|
elseif not tsBoolData.bBottomMach and ( tsStringData.sBottomTrim == '1B' or tsStringData.sBottomTrim == '2B' or tsStringData.sBottomTrim == '3B' or tsStringData.sBottomTrim == '4B' or
|
|
tsStringData.sBottomTrim == '5B' or tsStringData.sBottomTrim == '6B' or tsStringData.sBottomTrim == '7B' or tsStringData.sBottomTrim == '8B') then
|
|
-- recupero entità probe di fianco
|
|
local ProbeList = MB.FindEntitiesWithName( Pz, 'ProbeSidePoint')
|
|
local eProSide
|
|
-- ciclo su tutte le entità trovate
|
|
for j = 1, #ProbeList do
|
|
eProSide = EgtGetInfo( ProbeList[j], 'SideApplied', 'i') or 0
|
|
if eProSide == 4 then
|
|
EgtModifyCurveThickness( ProbeList[j], -( tsDoubleData.dThickDoor/2 + tMainTabPar.EZPB))
|
|
end
|
|
end
|
|
-- in tutti gli altri profili setto l'affondamento a extra probe z
|
|
elseif not tsBoolData.bBottomMach then
|
|
-- recupero entità probe di fianco
|
|
local ProbeList = MB.FindEntitiesWithName( Pz, 'ProbeSidePoint')
|
|
local eProSide
|
|
-- ciclo su tutte le entità trovate
|
|
for j = 1, #ProbeList do
|
|
eProSide = EgtGetInfo( ProbeList[j], 'SideApplied', 'i') or 0
|
|
if eProSide == 4 then
|
|
EgtModifyCurveThickness( ProbeList[j], -tMainTabPar.EZPB)
|
|
-- EgtModifyCurveThickness( ProbeList[j], 0)
|
|
-- se profilo bevel up assegno nota
|
|
if tsStringData.sBottomTrim == 'BU' or tsStringData.sBottomTrim == 'BUEB' then
|
|
EgtSetInfo( ProbeList[j], 'ProfSide', 'BU')
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-------------------------------------------
|
|
-- Inserimento riferimenti e ventose/morse
|
|
-------------------------------------------
|
|
|
|
if v == 1 then
|
|
-- Offset barra riferimenti mobile da riferimenti quando posizione 0
|
|
dMobOffs2 = 0
|
|
dMobOffs1 = dMobOffs2 / 2 -- è in posizione intermedia
|
|
-- Lunghezza minima per alzare prima ventosa da bordo sinistro
|
|
-- ( dall'angolo rettangolo al punto centrale ventose + 5.5 + distanza riferimento-rettangolo)
|
|
-- dDistMinX = 296.8 + 5.5 + 46.7
|
|
-- dall'angolo appoggio porta (riferimento) al punto centrale ventose + mezza larghezza ventosa (in X) + quota sicurezza
|
|
dDistMinX = tMainTabPar.DVL + 92.075 + DIST_MIN_VAC
|
|
-- Lunghezza minima per alzare prima ventosa da bordo destro
|
|
-- ( dall'angolo rettangolo al punto centrale ventose + 5.5 + distanza riferimento-rettangolo)
|
|
-- dDistMaxX = 185.1 + 5.5 + 46.7
|
|
-- dall'angolo appoggio porta (riferimento) al punto centrale ventose + mezza larghezza ventosa (in X) + quota sicurezza
|
|
dDistMaxX = tMainTabPar.DVR + 92.075 + DIST_MIN_VAC
|
|
-- Posizione ventose in alto
|
|
dVacOn = 1
|
|
-- Interasse ventose lungo la barra
|
|
dInterAx = 193.68
|
|
-- setto modaità due barre disabilitato
|
|
bUseOnly2Bars = false
|
|
|
|
-- Ventose
|
|
nTabId = EgtGetTableId( sTab)
|
|
nMobId1 = EgtGetFirstNameInGroup( nTabId or GDB_ID.NULL, 'MOBILE1')
|
|
nMobId2 = EgtGetFirstNameInGroup( nTabId or GDB_ID.NULL, 'MOBILE2')
|
|
nFixId = EgtGetFirstNameInGroup( nTabId or GDB_ID.NULL, 'FIXED')
|
|
-- Riferimenti: faccio una ricerca dedicata per via che non si conoscono ancora i nomi esatti
|
|
-- dei riferimenti inseriti
|
|
if tMainTabPar.CUC == 1 then
|
|
tRefArea = FindRefInTable( nTabId, 'REF_')
|
|
end
|
|
nDispId = EgtGetPhaseDisposition( nNumPhase)
|
|
|
|
-- se gruppi richiesti non trovati
|
|
if not nMobId1 or not nMobId2 or not nFixId then
|
|
bOk = false
|
|
DGD.EMC = ' ' .. EgtDoorsMsg[676]..EgtDoorsMsg[530] -- Error on MOBILE or FIXED table bar'
|
|
break
|
|
end
|
|
|
|
-- Posizionamento barra mobile
|
|
-- fisso
|
|
dFixval = EgtGetInfo( nFixId, 'Val', 'd')
|
|
-- scrivo il valore della barra fissa
|
|
EgtSetInfo( nDispId, 'FIX1', dFixval)
|
|
-- mobile 2
|
|
dOldVal = EgtGetInfo( nMobId2, 'Val', 'd')
|
|
|
|
if bFrame then -- se è un frame
|
|
dNewVal_2 = tMainTabPar.FPB
|
|
else
|
|
if tsDoubleData.dTopRadius then -- se la porta è ad arco calcolo la disposizione sulla terza barra simmetrica alla prima
|
|
if bFirstStep then
|
|
dNewVal_2 = b3Solid:getDimX() - dFixval + (2*OffsYSovr) + vShiftVac:getY() - dMobOffs2 -- calcolo la posizione simmetrica
|
|
-- dNewVal_2 = b3Solid:getDimX() - dFixval + (2*OffsYSovr) - vShift:getY() + vShiftVac:getY() - dMobOffs2 -- calcolo la posizione simmetrica
|
|
end
|
|
else
|
|
-- calcolo la disposizione sulla terza barra simmetrica alla prima
|
|
if bFirstStep then
|
|
dNewVal_2 = b3Solid:getDimX() - dFixval + (2*OffsYSovr) + vShiftVac:getY() - dMobOffs2 -- calcolo la posizione simmetrica
|
|
-- dNewVal_2 = b3Solid:getDimX() - dFixval + (2*OffsYSovr) - vShift:getY() + vShiftVac:getY() - dMobOffs2 -- calcolo la posizione simmetrica
|
|
-- prediligo la conservazione delle ventose sulla terza barra
|
|
-- dNewVal_2 = b3Solid:getDimX() - dFixval + OffsYSovr - vShift:getY() + vShiftVac:getY() - dMobOffs2
|
|
end
|
|
end
|
|
end
|
|
|
|
-- controllo che non supera la posizione massima raggiungibile
|
|
if dNewVal_2 > tMainTabPar.MPMB then
|
|
dNewVal_2 = tMainTabPar.MPMB
|
|
end
|
|
|
|
-- Se posizione raggiungibile
|
|
if ( dNewVal_2 - dFixval + (2*vShift:getY())) >= ( 2 * dMinDistGroup) then
|
|
-- mobile 2
|
|
if bFirstStep then
|
|
dNewVal_2 = dNewVal_2 + 2 * vShift:getY()
|
|
EgtMove( nMobId2, Vector3d( 0, dNewVal_2 - dOldVal, 0), GDB_RT.GLOB)
|
|
end
|
|
EgtSetInfo( nMobId2, 'Val', dNewVal_2)
|
|
EgtSetInfo( nDispId, 'MOB2', dNewVal_2)
|
|
-- mobile 1
|
|
if bFirstStep then
|
|
dOldVal = EgtGetInfo( nMobId1, 'Val', 'd')
|
|
dNewVal_1 = ( dNewVal_2 + dFixval) / 2
|
|
EgtMove( nMobId1, Vector3d( 0, dNewVal_1 - dOldVal, 0), GDB_RT.GLOB)
|
|
end
|
|
EgtSetInfo( nMobId1, 'Val', dNewVal_1)
|
|
EgtSetInfo( nDispId, 'MOB1', dNewVal_1)
|
|
else
|
|
-- controllo se con due barre è possibile
|
|
if ( dNewVal_2 - dFixval + (2*vShift:getY())) >= dMinDistGroup then
|
|
-- mobile 1
|
|
dOldVal = EgtGetInfo( nMobId1, 'Val', 'd')
|
|
-- se proprietà narrow stile attiva, aggiungo al movimento lo shift e la distanza riferimento ventosa
|
|
-- if bNarrowStile then
|
|
dNewVal_1 = dNewVal_2 + 2 * vShift:getY()
|
|
-- else
|
|
-- dNewVal_1 = dNewVal_2
|
|
-- end
|
|
EgtMove( nMobId1, Vector3d( 0, dNewVal_1 - dOldVal, 0), GDB_RT.GLOB)
|
|
EgtSetInfo( nMobId1, 'Val', dNewVal_1)
|
|
EgtSetInfo( nDispId, 'MOB1', dNewVal_1)
|
|
-- mobile 2
|
|
dOldVal = EgtGetInfo( nMobId2, 'Val', 'd')
|
|
dNewVal_2 = (dNewVal_1 * 2) - dFixval
|
|
EgtMove( nMobId2, Vector3d( 0, dNewVal_2 - dOldVal, 0), GDB_RT.GLOB)
|
|
EgtSetInfo( nMobId2, 'Val', dNewVal_2)
|
|
EgtSetInfo( nDispId, 'MOB2', dNewVal_2)
|
|
bUseOnly2Bars = true
|
|
else
|
|
-- mobile 2
|
|
EgtSetInfo( nDispId, 'MOB2', dOldVal)
|
|
-- mobile 1
|
|
dOldVal = EgtGetInfo( nMobId1, 'Val', 'd')
|
|
EgtSetInfo( nDispId, 'MOB1', dOldVal)
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Elevazione ventose con: altezza porta ( uso getDimY perché presa prima della disposizione porta) +
|
|
-- sovramateriale a contatto con il riferimento a sx - distanza ventosa
|
|
dCalcLen = b3Solid:getDimY() + OffsXSovr - EgtIf( DISPMODE > 0, dDistMinX, dDistMaxX)
|
|
-- calcolo positione top porta rispetto allo zero macchina
|
|
local nTabRef = EgtGetFirstNameInGroup( nTabId or GDB_ID.NULL, 'R1')
|
|
local pPiecePos = EgtSP( nTabRef, GDB_ID.ROOT) + Ori + vExtraYDelta
|
|
-- se il top porta è opposto al lato dei riferimenti
|
|
if (DISPMODE > 0 and bTopOnRight) or ( DISPMODE < 0 and not bTopOnRight) then
|
|
pPiecePos = pPiecePos + Vector3d( (b3Solid:getDimY() + OffsXSovr - DIST_MIN_VAC)*DISPMODE,0,0)
|
|
else -- se top porta è adiacente al lato dei riferimenti
|
|
pPiecePos = pPiecePos + Vector3d( (OffsXSovr + DIST_MIN_VAC)*DISPMODE,0,0)
|
|
end
|
|
|
|
-- predispongo regioni per verifica interferenza con lavorazioni passanti o da sotto
|
|
StartVacVerify( Ls, bFlip, nProbeMode, tsDoubleData.dThickDoor, bFlipFrame)
|
|
|
|
-- ciclo sulle ventose
|
|
local nInd = 1
|
|
local bFoundSpecialVac
|
|
-- tabelle per gestione conteggi inserimento ventose, gli indici tabella sono le barre (1 fissa, 2 intermedia, 3 mobile)
|
|
local tnCountFailed = {} -- tabella conteggio ventose non disposte
|
|
tnCountFailed[1] = 0
|
|
tnCountFailed[2] = 0
|
|
tnCountFailed[3] = 0
|
|
local tnIniFailed = {} -- tabella conteggio ventose iniziali non disposte
|
|
tnIniFailed[1] = 0
|
|
tnIniFailed[2] = 0
|
|
tnIniFailed[3] = 0
|
|
local tnMiddleFailed = {} -- tabella conteggio ventose intermedie non disposte
|
|
tnMiddleFailed[1] = 0
|
|
tnMiddleFailed[2] = 0
|
|
tnMiddleFailed[3] = 0
|
|
local tnEndFailed = {} -- tabella conteggio ventose finali non disposte
|
|
tnEndFailed[1] = 0
|
|
tnEndFailed[2] = 0
|
|
tnEndFailed[3] = 0
|
|
local tnMaxIniFailed = {} -- tabella contatore totale ventose iniziali non disposte
|
|
tnMaxIniFailed[1] = 0
|
|
tnMaxIniFailed[2] = 0
|
|
tnMaxIniFailed[3] = 0
|
|
local tnMaxMiddleFailed = {}-- tabella contatore totale ventose intermedie non disposte
|
|
tnMaxMiddleFailed[1] = 0
|
|
tnMaxMiddleFailed[2] = 0
|
|
tnMaxMiddleFailed[3] = 0
|
|
local tnMaxEndFailed = {} -- tabella contatore totale ventose finali non disposte
|
|
tnMaxEndFailed[1] = 0
|
|
tnMaxEndFailed[2] = 0
|
|
tnMaxEndFailed[3] = 0
|
|
|
|
-- tabella gestione ventose, gli indici tabella rappresentano le barre (1 fissa, 2 intermedia, 3 mobile)
|
|
local tsBaseDataVac1 = {} -- tabella nomi punti ventosa base
|
|
tsBaseDataVac1[1] = { tMainTabPar.P1T, tMainTabPar.V1T1, tMainTabPar.V1T1E, tMainTabPar.DTG, tMainTabPar.DBG, tMainTabPar.DSG, tMainTabPar.DTGN, tMainTabPar.DBGN, tMainTabPar.DSGN}
|
|
tsBaseDataVac1[2] = { tMainTabPar.P1T, tMainTabPar.V2T1, tMainTabPar.V2T1E, tMainTabPar.DTG, tMainTabPar.DBG, tMainTabPar.DSG, tMainTabPar.DTGN, tMainTabPar.DBGN, tMainTabPar.DSGN}
|
|
tsBaseDataVac1[3] = { tMainTabPar.P1T, tMainTabPar.V3T1, tMainTabPar.V3T1E, tMainTabPar.DTG, tMainTabPar.DBG, tMainTabPar.DSG, tMainTabPar.DTGN, tMainTabPar.DBGN, tMainTabPar.DSGN}
|
|
|
|
local tsBaseDataVac2 = {} -- tabella nomi punti ventosa secondo tipo
|
|
tsBaseDataVac2[1] = { tMainTabPar.P2T, tMainTabPar.V1T2, tMainTabPar.V1T2E, tMainTabPar.DTG, tMainTabPar.DBG, tMainTabPar.DSG, tMainTabPar.DTGN, tMainTabPar.DBGN, tMainTabPar.DSGN}
|
|
tsBaseDataVac2[2] = { tMainTabPar.P2T, tMainTabPar.V2T2, tMainTabPar.V2T2E, tMainTabPar.DTG, tMainTabPar.DBG, tMainTabPar.DSG, tMainTabPar.DTGN, tMainTabPar.DBGN, tMainTabPar.DSGN}
|
|
tsBaseDataVac2[3] = { tMainTabPar.P2T, tMainTabPar.V3T2, tMainTabPar.V3T2E, tMainTabPar.DTG, tMainTabPar.DBG, tMainTabPar.DSG, tMainTabPar.DTGN, tMainTabPar.DBGN, tMainTabPar.DSGN}
|
|
|
|
local tsBaseDataVac3 = {} -- tabella nomi punti ventosa terzo tipo
|
|
tsBaseDataVac3[1] = { tMainTabPar.P3T, tMainTabPar.V1T3, tMainTabPar.V1T3E, tMainTabPar.DTG, tMainTabPar.DBG, tMainTabPar.DSG, tMainTabPar.DTGN, tMainTabPar.DBGN, tMainTabPar.DSGN}
|
|
tsBaseDataVac3[2] = { tMainTabPar.P3T, tMainTabPar.V2T3, tMainTabPar.V2T3E, tMainTabPar.DTG, tMainTabPar.DBG, tMainTabPar.DSG, tMainTabPar.DTGN, tMainTabPar.DBGN, tMainTabPar.DSGN}
|
|
tsBaseDataVac3[3] = { tMainTabPar.P3T, tMainTabPar.V3T3, tMainTabPar.V3T3E, tMainTabPar.DTG, tMainTabPar.DBG, tMainTabPar.DSG, tMainTabPar.DTGN, tMainTabPar.DBGN, tMainTabPar.DSGN}
|
|
|
|
-- tabella gestione morse, gli indici tabella rappresentano le barre (1 fissa, 2 intermedia, 3 mobile)
|
|
local tsBaseDataVise1 = {} -- tabella nomi punti ventosa base
|
|
tsBaseDataVise1[1] = { tMainTabPar.P1T, tMainTabPar.VSF1, tMainTabPar.DTGV, tMainTabPar.DBGV, tMainTabPar.DSGV}
|
|
local tIdViseDisp = {}
|
|
|
|
---------------------------------------------------------------------------------------------
|
|
-- tabella delle tabelle dei tipi di ventose gestite, per ora si gestiscono 3 tipi
|
|
-- aggiungere nella tabella gli eventuali tipi da aggiungere
|
|
local ttBaseDataVac = {} -- tabella globale dei tipi di ventose di tutte le barre
|
|
ttBaseDataVac = { tsBaseDataVac1, tsBaseDataVac2, tsBaseDataVac3}
|
|
---------------------------------------------------------------------------------------------
|
|
-- tabella delle tabelle dei tipi di morse gestite, per ora si gestiscono 1 tipo
|
|
-- aggiungere nella tabella gli eventuali tipi da aggiungere
|
|
local ttBaseDataVise = {} -- tabella globale dei tipi di ventose di tutte le barre
|
|
ttBaseDataVise = { tsBaseDataVise1}
|
|
---------------------------------------------------------------------------------------------
|
|
-- tabella dei riferimenti, nel CurrCamInfo i dati sono ridondanti rispetto all'originale nel file mlde
|
|
local tBaseDataRef = {}
|
|
tBaseDataRef = { tMainTabPar.REF1, tMainTabPar.REF2, tMainTabPar.REF3, tMainTabPar.REF4}
|
|
---------------------------------------------------------------------------------------------
|
|
|
|
local tsBaseNameVac = {} -- tabella nomi ventose tipo unificato normale
|
|
tsBaseNameVac[1] = {'','',0}
|
|
tsBaseNameVac[2] = {'','',0}
|
|
tsBaseNameVac[3] = {'','',0}
|
|
---------------------------------------
|
|
local tsNoteRow = {} -- tabella per note da assegnare alle geometrie delle barre
|
|
tsNoteRow[1] = ''
|
|
tsNoteRow[2] = ''
|
|
tsNoteRow[3] = ''
|
|
|
|
-- questa tabella deve essere settata in base ai sottopezzi presenti nella cartella della macchina
|
|
-- e al disegno della macchina( deve avere nome dei punti, ecc.)
|
|
local tnNumVacInsert = {} -- tabella per numero di tipi di ventosa presenti sulle barre
|
|
tnNumVacInsert[1] = tMainTabPar.NTVB1 or 1
|
|
tnNumVacInsert[2] = tMainTabPar.NTVB2 or 1
|
|
tnNumVacInsert[3] = tMainTabPar.NTVB3 or 1
|
|
-- se ho un solo tipo di ventose sulla barra carico in questa tabella
|
|
local tnTypeSingleVacOnBar = {}
|
|
tnTypeSingleVacOnBar[1] = tMainTabPar.TSVB1
|
|
tnTypeSingleVacOnBar[2] = tMainTabPar.TSVB2
|
|
tnTypeSingleVacOnBar[3] = tMainTabPar.TSVB3
|
|
-- tabella che indica il tipo di ventosa corrente
|
|
local tnNumKindVac = {}
|
|
tnNumKindVac[1] = 1 -- solo valore di inizializzazione
|
|
tnNumKindVac[2] = 1 -- solo valore di inizializzazione
|
|
tnNumKindVac[3] = 1 -- solo valore di inizializzazione
|
|
---------------------------------------
|
|
-- tabella posizionamento ventose
|
|
local tPosRowSubPieceRow1 = {}
|
|
local tPosRowSubPieceRow2 = {}
|
|
local tPosRowSubPieceRow3 = {}
|
|
local tdYCommpos = {} -- tabella valori Y con sottopezzi identici
|
|
---------------------------------------
|
|
-- settaggio ventosa arco su porta ad arco:
|
|
-- annullo nome ventosa se porta ad arco con centro arco non oltre i 2"
|
|
-- annullo nome ventosa se c'é proprietà porta
|
|
if not tsDoubleData.dTopxDeltapos or ( tsDoubleData.dTopxDeltapos and abs(tsDoubleData.dTopxDeltapos) > 50.8) then
|
|
tMainTabPar.AVNM = ''
|
|
end
|
|
|
|
-- se porta narrowstile forzo ad utilizzare solo le ventose strette sulle barre esterne
|
|
if bNarrowStile then
|
|
tMainTabPar.FVR = true
|
|
end
|
|
|
|
while dCalcLen > 0 and nInd <= tMainTabPar.NTVR do
|
|
|
|
local nIndVac = EgtIf( DISPMODE > 0, nInd, ( tMainTabPar.NTVR - nInd + 1))
|
|
local sInd = EgtNumToString( nIndVac, 0)
|
|
|
|
if nCodeVacDisp <= 1 then
|
|
|
|
tPosRowSubPieceRow1[nIndVac] = CalcDispositionSubPieces( 1, nFixId, tMainTabPar.FVR, tsBaseNameVac, EgtIf( bUseVise, ttBaseDataVise, ttBaseDataVac),
|
|
sInd, tnNumVacInsert, tnNumKindVac, tdYCommpos, nInd,
|
|
tnCountFailed, tnMaxIniFailed, tnIniFailed, tnMaxMiddleFailed, tnMiddleFailed,
|
|
tnMaxEndFailed, tnEndFailed, tMainTabPar.NTVR, ( dCalcLen - dInterAx), bNarrowStile,
|
|
tabOri, tnTypeSingleVacOnBar, bFrameOnNarrow, bUseVise, tsDoubleData.dWidthDoor)
|
|
end
|
|
|
|
if nCodeVacDisp == 0 or nCodeVacDisp == 2 then
|
|
|
|
local nIdVac = 2
|
|
if bUseOnly2Bars then
|
|
nIdVac = 3
|
|
end
|
|
|
|
tPosRowSubPieceRow2[nIndVac] = CalcDispositionSubPieces( nIdVac, nMobId1, tMainTabPar.FVR, tsBaseNameVac, ttBaseDataVac,
|
|
sInd, tnNumVacInsert, tnNumKindVac, tdYCommpos, nInd,
|
|
tnCountFailed, tnMaxIniFailed, tnIniFailed, tnMaxMiddleFailed, tnMiddleFailed,
|
|
tnMaxEndFailed, tnEndFailed, tMainTabPar.NTVR, ( dCalcLen - dInterAx), bNarrowStile,
|
|
tabOri, tnTypeSingleVacOnBar, bFrameOnNarrow)
|
|
end
|
|
|
|
if ( nCodeVacDisp == 0 or nCodeVacDisp == 3) and not bUseOnly2Bars then
|
|
|
|
tPosRowSubPieceRow3[nIndVac] = CalcDispositionSubPieces( 3, nMobId2, tMainTabPar.FVR, tsBaseNameVac, ttBaseDataVac,
|
|
sInd, tnNumVacInsert, tnNumKindVac, tdYCommpos, nInd,
|
|
tnCountFailed, tnMaxIniFailed, tnIniFailed, tnMaxMiddleFailed, tnMiddleFailed,
|
|
tnMaxEndFailed, tnEndFailed, tMainTabPar.NTVR, ( dCalcLen - dInterAx), bNarrowStile,
|
|
tabOri, tnTypeSingleVacOnBar, bFrameOnNarrow)
|
|
end
|
|
|
|
-- aggiorno la lunghezza di calcolo e l'indice
|
|
dCalcLen = dCalcLen - dInterAx
|
|
nInd = nInd + 1
|
|
end -- end while
|
|
|
|
-- verifico la tabella di disposizione della barra centrale e le opportune verifiche per inserire la ventosa ad arco:
|
|
-- se non si utilizzano solo due barre e ho la ventosa ad arco
|
|
if not bUseOnly2Bars and tMainTabPar.AVNM and #tMainTabPar.AVNM > 0 then
|
|
tPosRowSubPieceRow2, bFoundSpecialVac = InsertSpecialSubPiece( tPosRowSubPieceRow2, tMainTabPar.NTVR, bTopOnRight, tMainTabPar.AVNM, tabOri,
|
|
tMainTabPar.ADTG, tMainTabPar.ADBG, tMainTabPar.ADSG, pPiecePos, 2,
|
|
tnMaxIniFailed, tnMaxMiddleFailed, tnMaxEndFailed, DISPMODE)
|
|
end
|
|
|
|
-- elimino geometrie per verifica
|
|
EndVacVerify()
|
|
|
|
for l = 1, tMainTabPar.NTVR do
|
|
|
|
local nIndVac = EgtIf( DISPMODE > 0, l, ( tMainTabPar.NTVR - l + 1))
|
|
|
|
if nCodeVacDisp <= 1 then -- porta o frame su prima linea vicino a riferimenti
|
|
local nIdVise = DispositionSubPieces( 1, nIndVac, tPosRowSubPieceRow1, tMainTabPar.FVR, tsBaseNameVac,
|
|
tdYCommpos, EgtIf( bUseVise, ttBaseDataVise, ttBaseDataVac), nIndVac, tabOri, tsNoteRow,
|
|
nDispId, nil, nil, nil, nil,
|
|
bUseVise, tsDoubleData.dWidthDoor)
|
|
if bUseVise and nIdVise then
|
|
table.insert( tIdViseDisp, { nIdVise, nIndVac})
|
|
end
|
|
end
|
|
|
|
if nCodeVacDisp == 0 or nCodeVacDisp == 2 then -- porta o frame su linea intermedia
|
|
local nIdVac = 2
|
|
if bUseOnly2Bars then
|
|
nIdVac = 3
|
|
end
|
|
DispositionSubPieces( nIdVac, nIndVac, tPosRowSubPieceRow2, tMainTabPar.FVR, tsBaseNameVac,
|
|
tdYCommpos, ttBaseDataVac, ( nIndVac + 1), tabOri, tsNoteRow,
|
|
nDispId, tMainTabPar.AVNM, pPiecePos, Pz, bFoundSpecialVac)
|
|
end
|
|
|
|
if nCodeVacDisp == 0 or nCodeVacDisp == 3 then -- porta o frame su ultima linea lontana dai riferimenti
|
|
local nIdVac = 3
|
|
if bUseOnly2Bars then
|
|
nIdVac = 2
|
|
end
|
|
|
|
DispositionSubPieces( nIdVac, nIndVac, tPosRowSubPieceRow3, tMainTabPar.FVR, tsBaseNameVac,
|
|
tdYCommpos, ttBaseDataVac, nIndVac, tabOri, tsNoteRow,
|
|
nDispId)
|
|
end
|
|
end
|
|
|
|
-- dispongo i riferimenti (utilizzati nella disposizione comportano di far correttamente risalire in Z un aggregato
|
|
-- se questo viene trovato in collisione mentre sta eseguendo un movimento in rapido da una lavorazione ad un altra)
|
|
if DISPMODE < 0 and tMainTabPar.CUC == 1 then
|
|
local nMaxDist = max( tBaseDataRef[1][4], tBaseDataRef[2][4], tBaseDataRef[3][4], tBaseDataRef[4][4])
|
|
EgtSetTableAreaOffset( nMaxDist, nMaxDist, nMaxDist, nMaxDist) -- area maggiorata
|
|
DispositionReferences( tBaseDataRef[1][1], tBaseDataRef[1][2], tBaseDataRef[1][3]) -- riferimento in testa dx
|
|
DispositionReferences( tBaseDataRef[2][1], tBaseDataRef[2][2], tBaseDataRef[2][3]) -- riferimento in basso dx
|
|
DispositionReferences( tBaseDataRef[3][1], tBaseDataRef[3][2], tBaseDataRef[3][3]) -- riferimento in basso sx
|
|
elseif tMainTabPar.CUC == 1 then
|
|
local nMaxDist = max( tBaseDataRef[1][4], tBaseDataRef[2][4], tBaseDataRef[3][4], tBaseDataRef[4][4])
|
|
EgtSetTableAreaOffset( nMaxDist, nMaxDist, nMaxDist, nMaxDist) -- area maggiorata
|
|
DispositionReferences( tBaseDataRef[2][1], tBaseDataRef[2][2], tBaseDataRef[2][3]) -- riferimento in basso dx
|
|
DispositionReferences( tBaseDataRef[3][1], tBaseDataRef[3][2], tBaseDataRef[3][3]) -- riferimento in basso sx
|
|
DispositionReferences( tBaseDataRef[4][1], tBaseDataRef[4][2], tBaseDataRef[4][3]) -- riferimento in testa a sx
|
|
end
|
|
|
|
--nTime = EgtStopCounter()
|
|
--if not DGD or not DGD.NCGEN then
|
|
-- EgtOutBox( string.format( 'tempo calcolato sec: %s', (nTime/1000)), 'Timey', 'Timey')
|
|
--end
|
|
|
|
-- inizializzo il contatore
|
|
--EgtStartCounter()
|
|
|
|
-- scrivo nota linea di ventose
|
|
if #tsNoteRow[1] > 0 then
|
|
EgtSetInfo( Pz, 'FixVacRow_Phase_'..EgtNumToString( nNumPhase, 0), tsNoteRow[1])
|
|
end
|
|
|
|
if bUseOnly2Bars then
|
|
if #tsNoteRow[2] > 0 then
|
|
EgtSetInfo( Pz, 'Mob2VacRow_Phase_'..EgtNumToString( nNumPhase, 0), tsNoteRow[2])
|
|
end
|
|
if #tsNoteRow[3] > 0 then
|
|
EgtSetInfo( Pz, 'Mob1VacRow_Phase_'..EgtNumToString( nNumPhase, 0), tsNoteRow[3])
|
|
end
|
|
else
|
|
if #tsNoteRow[2] > 0 then
|
|
EgtSetInfo( Pz, 'Mob1VacRow_Phase_'..EgtNumToString( nNumPhase, 0), tsNoteRow[2])
|
|
end
|
|
if #tsNoteRow[3] > 0 then
|
|
EgtSetInfo( Pz, 'Mob2VacRow_Phase_'..EgtNumToString( nNumPhase, 0), tsNoteRow[3])
|
|
end
|
|
end
|
|
|
|
-- scrivo note con i valori di partenza della prima ventosa in basso a destra
|
|
EgtSetInfo( Pz, 'FixValX', tMainTabPar.DVR)
|
|
EgtSetInfo( Pz, 'FixValY', dFixval)
|
|
EgtSetInfo( Pz, 'UseOnly2Bars', bUseOnly2Bars)
|
|
-- scrivo la nota relativa all'attivazione o meno del controllo collisioni
|
|
EgtSetInfo( Pz, 'EnableCollisionDetect', tMainTabPar.ECD)
|
|
|
|
-- verifico se numero di ventose sufficienti e do errore nel caso contrario
|
|
bOk, DGD.EMC = CheckEnoughVacuums( ( nInd - 1), nCodeVacDisp, tnMaxIniFailed, tnMaxMiddleFailed, tnMaxEndFailed,
|
|
bUseOnly2Bars, tsDoubleData.dTopRadius, bTopOnRight, bUseVise,
|
|
tIdViseDisp)
|
|
if DGD.EMC and #DGD.EMC > 0 then -- se ho messaggio di errore lo mando una riga sotto per stamparlo correttamente
|
|
DGD.EMC = '\n' .. DGD.EMC
|
|
end
|
|
if not bOk then break end
|
|
|
|
----------------------
|
|
----------------------
|
|
-- *** Lavorazioni ***
|
|
----------------------
|
|
----------------------
|
|
|
|
local bMakeGhost = EgtIf( bFirstStep, true, false)
|
|
-- ricavo minimo e massimo del solido del pezzo
|
|
b3SolidOnTab = EgtGetBBoxGlob( Ls, GDB_BB.EXACT)
|
|
pMin = b3SolidOnTab:getMin()
|
|
pMax = b3SolidOnTab:getMax()
|
|
|
|
if v == 1 then -- solo il primo pezzo
|
|
-- print Machining table
|
|
for i = nIndexStartMach, #tLocMach do
|
|
DoorOutLog( 'L'..EgtNumToString( i, 0) .. ' EN='.. (tLocMach[i].On or ' ') ..' N='.. tLocMach[i].Name .. ' O='.. (tLocMach[i].Oper or ' ') ..
|
|
' M='.. (tLocMach[i].Mach or ' ') .. ' MAC='.. (tLocMach[i].MachName or ' '), -1)
|
|
end
|
|
end
|
|
|
|
-- solo il primo giro aggiusto i profili bevel per essere coerente con la sequenza di tabella.
|
|
-- si è inserito il controllo che non sia anche una porta shiftata per non lavorarla in prima fase
|
|
-- e poi ri-disporla in una eventuale seconda fase
|
|
-- inserisco una modifica al controllo shift ma solo se non dipende dalle property
|
|
-- if bFirstStep and ( not bShiftMchng or bSmallShiftedDoor) and nProbeMode ~= 1 then
|
|
if bFirstStep and ( ( not bShiftMchng ) or ( bShiftMchng and bNarrowStile) or bSmallShiftedDoor) and nProbeMode ~= 1 then
|
|
for i = 1, #tLocMach do
|
|
if tLocMach[i].On ~= 0 then
|
|
sLocMachId = tLocMach[i].MachId
|
|
if not sLocMachId then sLocMachId = 1 end
|
|
|
|
if sLocMachId == nNumMachFromTable then
|
|
-- Recupero le entità
|
|
local EntList = MB.FindEntitiesWithName( Pz, tLocMach[i].Name)
|
|
-- Applico le lavorazioni
|
|
for j = 1, #EntList do
|
|
-- OPERAZIONI
|
|
if tLocMach[i].Oper and tLocMach[i].Oper == 'AdjustBevel' then
|
|
MB.AdjustBevel( EntList[j], tLocMach[i].Name, bFirstStep, bNoVertProf)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- conteggio lavorazioni saltate
|
|
nNumMachSkipResult = 0
|
|
if v == 1 then -- solo il primo pezzo
|
|
-- variabile per conteggio lavorazioni
|
|
nNumMach = 0
|
|
nNumSkip = 0
|
|
end
|
|
|
|
-- se porta ribatata inverto anche le variabili contatori lavorazioni sopra e sotto
|
|
if bFlip then
|
|
local nValAppo = nNumGeomBottom
|
|
nNumGeomBottom = nNumGeomTop
|
|
nNumGeomTop = nValAppo
|
|
end
|
|
-- local bEnBreak = false
|
|
bEnBreak = false
|
|
|
|
-- Machining adding, only for selected machine
|
|
-- faccio tutto in un unico giro per non dover avere due contatori di break, uno per le operazioni e uno per le lavorazioni
|
|
for i = nIndexStartMach, #tLocMach do
|
|
|
|
-- se devo uscire dal ciclo
|
|
if bEnBreak then break end
|
|
|
|
if tLocMach[i].On ~= 0 then
|
|
|
|
sLocMachId = tLocMach[i].MachId
|
|
if not sLocMachId then sLocMachId = 1 end
|
|
|
|
if sLocMachId == nNumMachFromTable then
|
|
-- Recupero le entità
|
|
local sHide = EgtIf( bFirstStep, '', DGD.GHT)
|
|
local EntList = MB.FindEntitiesWithName( Pz, tLocMach[i].Name..sHide)
|
|
-- -- solo per il ProbeSidePoint non cerco il percorso _HIDE in seconda fase
|
|
-- if tLocMach[i].Name == 'ProbeSidePoint' then
|
|
-- EntList = MB.FindEntitiesWithName( Pz, tLocMach[i].Name)
|
|
-- else
|
|
-- EntList = MB.FindEntitiesWithName( Pz, tLocMach[i].Name..sHide)
|
|
-- end
|
|
-- Applico le lavorazioni
|
|
for j = 1, #EntList do
|
|
|
|
local nNewIdEnt
|
|
local nLocMach
|
|
|
|
-- OPERAZIONI
|
|
if tLocMach[i].Oper then
|
|
|
|
if tLocMach[i].Oper == 'AdjustBevel' and nProbeMode ~= 1 then
|
|
|
|
bLocMach, _, nNewIdEnt = MB.AdjustBevel( EntList[j], tLocMach[i].Name, bFirstStep, bNoVertProf, bMakeGhost)
|
|
|
|
if bLocMach then
|
|
|
|
local bInsLav = false
|
|
-- faccio il test per vedere se la lavorazione è applicabile
|
|
local nMach = EgtGetInfo( nNewIdEnt, 'Mach', 'i') or 1
|
|
nLocMach = nMach
|
|
|
|
if nMach == 1 then
|
|
bInsLav = MB.TestMachining( tLocMach[i].Mach, nNewIdEnt)
|
|
if not bInsLav then
|
|
nNumMachSkipResult = nNumMachSkip + 1
|
|
EgtSetInfo( nNewIdEnt, 'Mach', 12)
|
|
end
|
|
elseif nMach == 2 then
|
|
bInsLav = MB.TestMachining( tLocMach[i].MachUp, nNewIdEnt)
|
|
if not bInsLav then
|
|
nNumMachSkipResult = nNumMachSkip + 1
|
|
EgtSetInfo( nNewIdEnt, 'Mach', 11)
|
|
end
|
|
elseif nMach == 3 then
|
|
bInsLav = MB.TestMachining( tLocMach[i].MachDw, nNewIdEnt)
|
|
if not bInsLav then
|
|
nNumMachSkipResult = nNumMachSkip + 1
|
|
EgtSetInfo( nNewIdEnt, 'Mach', 13)
|
|
end
|
|
end
|
|
|
|
-- se la lavorazione è applicabile e non scatena lo shift
|
|
-- if bInsLav and ( bShiftMchng or not tLocMach[i].Shift or tLocMach[i].Shift == 0) then
|
|
-- se la lavorazione è applicabile
|
|
if bInsLav then
|
|
-- ottengo il nome del lato lavorato
|
|
local sEdge = EgtGetName( EgtGetParent( EntList[j]))
|
|
if sEdge then
|
|
if #tsMachProf[v] > 0 then
|
|
tsMachProf[v] = tsMachProf[v] .. ',' .. sEdge
|
|
else
|
|
tsMachProf[v] = sEdge
|
|
end
|
|
end
|
|
|
|
-- in base a quale lato è verifico se il sovramateriale supera il valore massimo e genero sgrossatura
|
|
if string.lower( sEdge) == 'left' then
|
|
local dOffsLoc = 0
|
|
if tsBoolData.bAtRight then
|
|
if tsStringData.sHingeTrim == 'BD' or tsStringData.sHingeTrim == 'BU' or
|
|
tsStringData.sHingeTrim == 'BDEB' or tsStringData.sHingeTrim == 'BUEB' then
|
|
dOffsLoc = tsDoubleData.dThickDoor * TAN3
|
|
elseif tsStringData.sHingeTrim == 'CV' then
|
|
-- calcolo minimo ingombro profilo
|
|
local dAltProf = tsDoubleData.dThickDoor/2 - tsPlaneProf[1]
|
|
local dMaxInsPrf = sqrt((tsRadiusProf[1]*tsRadiusProf[1])-(dAltProf*dAltProf))
|
|
dOffsLoc = tsRadiusProf[1] - dMaxInsPrf
|
|
-- assegno al nuovo percorso il delta tra il fondo profilo e il bordo porta
|
|
EgtSetInfo( nNewIdEnt, 'OFFSTOPATH', dOffsLoc)
|
|
end
|
|
elseif not tsBoolData.bAtRight then
|
|
if tsStringData.sLockTrim == 'BD' or tsStringData.sLockTrim == 'BU' or
|
|
tsStringData.sLockTrim == 'BDEB' or tsStringData.sLockTrim == 'BUEB' then
|
|
dOffsLoc = tsDoubleData.dThickDoor * TAN3
|
|
elseif tsStringData.sLockTrim == 'CV' then
|
|
-- calcolo minimo ingombro profilo
|
|
local dAltProf = tsDoubleData.dThickDoor/2 - tsPlaneProf[2]
|
|
local dMaxInsPrf = sqrt((tsRadiusProf[2]*tsRadiusProf[2])-(dAltProf*dAltProf))
|
|
dOffsLoc = tsRadiusProf[2] - dMaxInsPrf
|
|
-- assegno al nuovo percorso il delta tra il fondo profilo e il bordo porta
|
|
EgtSetInfo( nNewIdEnt, 'OFFSTOPATH', dOffsLoc)
|
|
end
|
|
end
|
|
MB.MakeRoughPaths( tsDoubleData.dLeftOffs, tMainTabPar.MOM, tMainTabPar.SOM, nNewIdEnt, false, bFlip, nil, dOffsLoc, tMainTabPar.RSM)
|
|
elseif string.lower( sEdge) == 'right' then
|
|
local dOffsLoc = 0
|
|
if tsBoolData.bAtRight then
|
|
if tsStringData.sLockTrim == 'BD' or tsStringData.sLockTrim == 'BU' or
|
|
tsStringData.sLockTrim == 'BDEB' or tsStringData.sLockTrim == 'BUEB' then
|
|
dOffsLoc = tsDoubleData.dThickDoor * TAN3
|
|
elseif tsStringData.sLockTrim == 'CV' then
|
|
-- calcolo minimo ingombro profilo
|
|
local dAltProf = tsDoubleData.dThickDoor/2 - tsPlaneProf[2]
|
|
local dMaxInsPrf = sqrt((tsRadiusProf[2]*tsRadiusProf[2])-(dAltProf*dAltProf))
|
|
dOffsLoc = tsRadiusProf[2] - dMaxInsPrf
|
|
-- assegno al nuovo percorso il delta tra il fondo profilo e il bordo porta
|
|
EgtSetInfo( nNewIdEnt, 'OFFSTOPATH', dOffsLoc)
|
|
end
|
|
elseif not tsBoolData.bAtRight then
|
|
if tsStringData.sHingeTrim == 'BD' or tsStringData.sHingeTrim == 'BU' or
|
|
tsStringData.sHingeTrim == 'BDEB' or tsStringData.sHingeTrim == 'BUEB' then
|
|
dOffsLoc = tsDoubleData.dThickDoor * TAN3
|
|
elseif tsStringData.sHingeTrim == 'CV' then
|
|
-- calcolo minimo ingombro profilo
|
|
local dAltProf = tsDoubleData.dThickDoor/2 - tsPlaneProf[1]
|
|
local dMaxInsPrf = sqrt((tsRadiusProf[1]*tsRadiusProf[1])-(dAltProf*dAltProf))
|
|
dOffsLoc = tsRadiusProf[1] - dMaxInsPrf
|
|
-- assegno al nuovo percorso il delta tra il fondo profilo e il bordo porta
|
|
EgtSetInfo( nNewIdEnt, 'OFFSTOPATH', dOffsLoc)
|
|
end
|
|
end
|
|
MB.MakeRoughPaths( tsDoubleData.dRightOffs, tMainTabPar.MOM, tMainTabPar.SOM, nNewIdEnt, false, bFlip, nil, dOffsLoc, tMainTabPar.RSM)
|
|
elseif string.lower( sEdge) == 'top' then
|
|
local dOffsLoc = 0
|
|
if tsStringData.sTopTrim == 'BD' or tsStringData.sTopTrim == 'BU' or
|
|
tsStringData.sTopTrim == 'BDEB' or tsStringData.sTopTrim == 'BUEB' then
|
|
dOffsLoc = tsDoubleData.dThickDoor * TAN3
|
|
elseif tsStringData.sTopTrim == 'CV' then
|
|
-- calcolo minimo ingombro profilo
|
|
local dAltProf = tsDoubleData.dThickDoor/2 - tsPlaneProf[3]
|
|
local dMaxInsPrf = sqrt((tsRadiusProf[3]*tsRadiusProf[3])-(dAltProf*dAltProf))
|
|
dOffsLoc = tsRadiusProf[3] - dMaxInsPrf
|
|
-- assegno al nuovo percorso il delta tra il fondo profilo e il bordo porta
|
|
EgtSetInfo( nNewIdEnt, 'OFFSTOPATH', dOffsLoc)
|
|
end
|
|
MB.MakeRoughPaths( tsDoubleData.dTopOffs, tMainTabPar.MOM, tMainTabPar.SOM, nNewIdEnt, true, bFlip, nil, dOffsLoc, tMainTabPar.RSM)
|
|
elseif string.lower( sEdge) == 'bottom' then
|
|
local dOffsLoc = 0
|
|
if tsStringData.sBottomTrim == 'BD' or tsStringData.sBottomTrim == 'BU' or
|
|
tsStringData.sBottomTrim == 'BDEB' or tsStringData.sBottomTrim == 'BUEB' then
|
|
dOffsLoc = tsDoubleData.dThickDoor * TAN3
|
|
end
|
|
MB.MakeRoughPaths( tsDoubleData.dBottomOffs, tMainTabPar.MOM, tMainTabPar.SOM, nNewIdEnt, true, bFlip, nil, dOffsLoc, tMainTabPar.RSM)
|
|
end
|
|
elseif not bInsLav or (nNumMachSkipResult > nNumMachSkip) then -- se lavorazione skippata la inserisco nella tabella
|
|
if bFirstStep then
|
|
-- inserisco in tabella solo se non già presente
|
|
tSecMachTab = AddMachIntable( tLocMach[i], tSecMachTab, i)
|
|
else
|
|
bOk = false
|
|
end
|
|
nNumMachSkip = nNumMachSkipResult
|
|
end
|
|
else
|
|
bOk = false
|
|
end
|
|
elseif tLocMach[i].Oper == 'AdjustVertCurve' and nProbeMode ~= 1 then
|
|
bOk, nNewIdEnt = MB.AdjustVertCurve( EntList[j], bMakeGhost)
|
|
elseif tLocMach[i].Oper == 'AdjustRoughCurve' and nProbeMode ~= 1 then
|
|
bOk, nNewIdEnt = MB.AdjustThrouCurve( EntList[j], bMakeGhost, true)
|
|
elseif tLocMach[i].Oper == 'AdjResizeCurve' and nProbeMode ~= 1 then
|
|
|
|
if bSteelDoor or bAlumDoor then
|
|
bLocMach, nNewIdEnt = MB.AdjPrfThrouCurveNew( EntList[j], bMakeGhost, true, bNoVertProf)
|
|
else
|
|
bLocMach, nNewIdEnt = MB.AdjPrfThrouCurveNew( EntList[j], bMakeGhost, false, bNoVertProf)
|
|
end
|
|
|
|
if bLocMach then
|
|
|
|
local bInsLav = false
|
|
-- faccio un test per vedere che la lavorazione è applicabile
|
|
local nMach = EgtGetInfo( nNewIdEnt, 'Mach', 'i') or 1
|
|
nLocMach = nMach
|
|
|
|
if nMach == 1 then
|
|
bInsLav = MB.TestMachining( tLocMach[i].Mach, nNewIdEnt)
|
|
elseif nMach == 2 then
|
|
bInsLav = MB.TestMachining( tLocMach[i].MachUp, nNewIdEnt)
|
|
elseif nMach == 3 then -- il metodo non dovrebbe assegnare il valore 3
|
|
bInsLav = MB.TestMachining( tLocMach[i].MachDw, nNewIdEnt)
|
|
nNumMachSkipResult = nNumMachSkip + 1
|
|
end
|
|
|
|
-- se la lavorazione è applicabile
|
|
if bInsLav then
|
|
-- ottengo il nome del lato lavorato
|
|
local sEdge = EgtGetName( EgtGetParent( EntList[j]))
|
|
if sEdge then
|
|
if #tsMachProf[v] > 0 then
|
|
tsMachProf[v] = tsMachProf[v] .. ',' .. sEdge
|
|
else
|
|
tsMachProf[v] = sEdge
|
|
end
|
|
end
|
|
|
|
-- in base a quale lato è verifico se non è contro il riferimento e se devo compensare l'offset del bevel
|
|
if string.lower( sEdge) == 'left' then
|
|
local dOffsLoc = 0
|
|
-- se lato sinistro è contro i riferimenti disabilito la lavorazione
|
|
if ( tsBoolData.bAtRight and bHingeOnRef) or ( not tsBoolData.bAtRight and not bHingeOnRef) then
|
|
EgtSetInfo( nNewIdEnt, 'Mach', 42)
|
|
else
|
|
if tsBoolData.bAtRight and ( tsStringData.sHingeTrim == 'BD' or tsStringData.sHingeTrim == 'BDEB') then
|
|
dOffsLoc = tsDoubleData.dThickDoor * TAN3
|
|
elseif not tsBoolData.bAtRight and ( tsStringData.sLockTrim == 'BD' or tsStringData.sLockTrim == 'BDEB') then
|
|
dOffsLoc = tsDoubleData.dThickDoor * TAN3
|
|
end
|
|
EgtSetInfo( nNewIdEnt, 'OL', dOffsLoc)
|
|
end
|
|
elseif string.lower( sEdge) == 'right' then
|
|
local dOffsLoc = 0
|
|
-- se lato destro è contro i riferimenti disabilito la lavorazione
|
|
if ( tsBoolData.bAtRight and not bHingeOnRef) or ( not tsBoolData.bAtRight and bHingeOnRef) then
|
|
EgtSetInfo( nNewIdEnt, 'Mach', 42)
|
|
else
|
|
if tsBoolData.bAtRight and ( tsStringData.sLockTrim == 'BD' or tsStringData.sLockTrim == 'BDEB') then
|
|
dOffsLoc = tsDoubleData.dThickDoor * TAN3
|
|
elseif not tsBoolData.bAtRight and ( tsStringData.sHingeTrim == 'BD' or tsStringData.sHingeTrim == 'BDEB') then
|
|
dOffsLoc = tsDoubleData.dThickDoor * TAN3
|
|
end
|
|
EgtSetInfo( nNewIdEnt, 'OL', dOffsLoc)
|
|
end
|
|
elseif string.lower( sEdge) == 'top' then
|
|
local dOffsLoc = 0
|
|
-- se lato top è contro i riferimenti disabilito la lavorazione
|
|
if bTopOnRef then
|
|
EgtSetInfo( nNewIdEnt, 'Mach', 42)
|
|
else
|
|
if tsStringData.sTopTrim == 'BD' or tsStringData.sTopTrim == 'BU' or
|
|
tsStringData.sTopTrim == 'BDEB' or tsStringData.sTopTrim == 'BUEB' then
|
|
dOffsLoc = tsDoubleData.dThickDoor * TAN3
|
|
end
|
|
EgtSetInfo( nNewIdEnt, 'OL', dOffsLoc)
|
|
end
|
|
elseif string.lower( sEdge) == 'bottom' then
|
|
local dOffsLoc = 0
|
|
-- se lato bottom è contro i riferimenti disabilito la lavorazione
|
|
if not bTopOnRef then
|
|
EgtSetInfo( nNewIdEnt, 'Mach', 42)
|
|
else
|
|
if tsStringData.sBottomTrim == 'BD' or tsStringData.sBottomTrim == 'BU' or
|
|
tsStringData.sBottomTrim == 'BDEB' or tsStringData.sBottomTrim == 'BUEB' then
|
|
dOffsLoc = tsDoubleData.dThickDoor * TAN3
|
|
end
|
|
EgtSetInfo( nNewIdEnt, 'OL', dOffsLoc)
|
|
end
|
|
end
|
|
end
|
|
if nNumMachSkipResult > nNumMachSkip then -- se lavorazione skippata la inserisco nella tabella
|
|
if bFirstStep then
|
|
-- inserisco in tabella solo se non già presente
|
|
tSecMachTab = AddMachIntable( tLocMach[i], tSecMachTab, i)
|
|
end
|
|
nNumMachSkip = nNumMachSkipResult
|
|
end
|
|
else
|
|
bOk = false
|
|
end
|
|
elseif tLocMach[i].Oper == 'AdjustThrouCurve' or tLocMach[i].Oper == 'AdjPrfThrouCurve' and nProbeMode ~= 1 then
|
|
|
|
if tLocMach[i].Oper == 'AdjustThrouCurve' then
|
|
bLocMach, nNewIdEnt = MB.AdjustThrouCurve( EntList[j], bMakeGhost)
|
|
else -- altrimenti
|
|
if bSkinned or bSteelDoor or bAlumDoor then
|
|
bLocMach, nNewIdEnt = MB.AdjPrfThrouCurveNew( EntList[j], bMakeGhost, true, bNoVertProf)
|
|
else
|
|
bLocMach, nNewIdEnt = MB.AdjPrfThrouCurveNew( EntList[j], bMakeGhost, false, bNoVertProf)
|
|
end
|
|
end
|
|
|
|
if bLocMach then
|
|
|
|
local bInsLav = false
|
|
-- faccio un test per vedere che la lavorazione è applicabile
|
|
local nMach = EgtGetInfo( nNewIdEnt, 'Mach', 'i') or 1
|
|
nLocMach = nMach
|
|
|
|
if nMach == 1 then
|
|
bInsLav = MB.TestMachining( tLocMach[i].Mach, nNewIdEnt)
|
|
elseif nMach == 2 then
|
|
bInsLav = MB.TestMachining( tLocMach[i].MachUp, nNewIdEnt)
|
|
elseif nMach == 3 then -- il metodo non dovrebbe assegnare il valore 3
|
|
bInsLav = MB.TestMachining( tLocMach[i].MachDw, nNewIdEnt)
|
|
nNumMachSkipResult = nNumMachSkip + 1
|
|
end
|
|
|
|
-- se la lavorazione è applicabile e non scatena lo shift
|
|
-- if bInsLav and ( bShiftMchng or not tLocMach[i].Shift or tLocMach[i].Shift == 0) then
|
|
-- se la lavorazione è applicabile
|
|
if bInsLav then
|
|
-- ottengo il nome del lato lavorato
|
|
local sEdge = EgtGetName( EgtGetParent( EntList[j]))
|
|
if sEdge then
|
|
if #tsMachProf[v] > 0 then
|
|
tsMachProf[v] = tsMachProf[v] .. ',' .. sEdge
|
|
else
|
|
tsMachProf[v] = sEdge
|
|
end
|
|
end
|
|
|
|
-- in base a quale lato è verifico se il sovramateriale supera il valore massimo e genero sgrossatura
|
|
if string.lower( sEdge) == 'left' then
|
|
local dOffsLoc = 0
|
|
if tsBoolData.bAtRight then
|
|
if tsStringData.sHingeTrim == 'BD' or tsStringData.sHingeTrim == 'BU' or
|
|
tsStringData.sHingeTrim == 'BDEB' or tsStringData.sHingeTrim == 'BUEB' then
|
|
dOffsLoc = tsDoubleData.dThickDoor * TAN3
|
|
elseif tsStringData.sHingeTrim == 'CV' then
|
|
-- calcolo minimo ingombro profilo
|
|
local dAltProf = tsDoubleData.dThickDoor/2 - tsPlaneProf[1]
|
|
local dMaxInsPrf = sqrt((tsRadiusProf[1]*tsRadiusProf[1])-(dAltProf*dAltProf))
|
|
dOffsLoc = tsRadiusProf[1] - dMaxInsPrf
|
|
-- assegno al nuovo percorso il delta tra il fondo profilo e il bordo porta
|
|
EgtSetInfo( nNewIdEnt, 'OFFSTOPATH', dOffsLoc)
|
|
end
|
|
elseif not tsBoolData.bAtRight then
|
|
if tsStringData.sLockTrim == 'BD' or tsStringData.sLockTrim == 'BU' or
|
|
tsStringData.sLockTrim == 'BDEB' or tsStringData.sLockTrim == 'BUEB' then
|
|
dOffsLoc = tsDoubleData.dThickDoor * TAN3
|
|
elseif tsStringData.sLockTrim == 'CV' then
|
|
-- calcolo minimo ingombro profilo
|
|
local dAltProf = tsDoubleData.dThickDoor/2 - tsPlaneProf[2]
|
|
local dMaxInsPrf = sqrt((tsRadiusProf[2]*tsRadiusProf[2])-(dAltProf*dAltProf))
|
|
dOffsLoc = tsRadiusProf[2] - dMaxInsPrf
|
|
-- assegno al nuovo percorso il delta tra il fondo profilo e il bordo porta
|
|
EgtSetInfo( nNewIdEnt, 'OFFSTOPATH', dOffsLoc)
|
|
end
|
|
end
|
|
MB.MakeRoughPaths( tsDoubleData.dLeftOffs, tMainTabPar.MOM, tMainTabPar.SOM, nNewIdEnt, false, bFlip, nil, dOffsLoc, tMainTabPar.RSM)
|
|
elseif string.lower( sEdge) == 'right' then
|
|
local dOffsLoc = 0
|
|
if tsBoolData.bAtRight then
|
|
if tsStringData.sLockTrim == 'BD' or tsStringData.sLockTrim == 'BU' or
|
|
tsStringData.sLockTrim == 'BDEB' or tsStringData.sLockTrim == 'BUEB' then
|
|
dOffsLoc = tsDoubleData.dThickDoor * TAN3
|
|
elseif tsStringData.sLockTrim == 'CV' then
|
|
-- calcolo minimo ingombro profilo
|
|
local dAltProf = tsDoubleData.dThickDoor/2 - tsPlaneProf[2]
|
|
local dMaxInsPrf = sqrt((tsRadiusProf[2]*tsRadiusProf[2])-(dAltProf*dAltProf))
|
|
dOffsLoc = tsRadiusProf[2] - dMaxInsPrf
|
|
-- assegno al nuovo percorso il delta tra il fondo profilo e il bordo porta
|
|
EgtSetInfo( nNewIdEnt, 'OFFSTOPATH', dOffsLoc)
|
|
end
|
|
elseif not tsBoolData.bAtRight then
|
|
if tsStringData.sHingeTrim == 'BD' or tsStringData.sHingeTrim == 'BU' or
|
|
tsStringData.sHingeTrim == 'BDEB' or tsStringData.sHingeTrim == 'BUEB' then
|
|
dOffsLoc = tsDoubleData.dThickDoor * TAN3
|
|
elseif tsStringData.sHingeTrim == 'CV' then
|
|
-- calcolo minimo ingombro profilo
|
|
local dAltProf = tsDoubleData.dThickDoor/2 - tsPlaneProf[1]
|
|
local dMaxInsPrf = sqrt((tsRadiusProf[1]*tsRadiusProf[1])-(dAltProf*dAltProf))
|
|
dOffsLoc = tsRadiusProf[1] - dMaxInsPrf
|
|
-- assegno al nuovo percorso il delta tra il fondo profilo e il bordo porta
|
|
EgtSetInfo( nNewIdEnt, 'OFFSTOPATH', dOffsLoc)
|
|
end
|
|
end
|
|
MB.MakeRoughPaths( tsDoubleData.dRightOffs, tMainTabPar.MOM, tMainTabPar.SOM, nNewIdEnt, false, bFlip, nil, dOffsLoc, tMainTabPar.RSM)
|
|
elseif string.lower( sEdge) == 'top' then
|
|
local dOffsLoc = 0
|
|
if tsStringData.sTopTrim == 'BD' or tsStringData.sTopTrim == 'BU' or
|
|
tsStringData.sTopTrim == 'BDEB' or tsStringData.sTopTrim == 'BUEB' then
|
|
dOffsLoc = tsDoubleData.dThickDoor * TAN3
|
|
elseif tsStringData.sTopTrim == 'CV' then
|
|
-- calcolo minimo ingombro profilo
|
|
local dAltProf = tsDoubleData.dThickDoor/2 - tsPlaneProf[3]
|
|
local dMaxInsPrf = sqrt((tsRadiusProf[3]*tsRadiusProf[3])-(dAltProf*dAltProf))
|
|
dOffsLoc = tsRadiusProf[3] - dMaxInsPrf
|
|
-- assegno al nuovo percorso il delta tra il fondo profilo e il bordo porta
|
|
EgtSetInfo( nNewIdEnt, 'OFFSTOPATH', dOffsLoc)
|
|
end
|
|
MB.MakeRoughPaths( tsDoubleData.dTopOffs, tMainTabPar.MOM, tMainTabPar.SOM, nNewIdEnt, true, bFlip, nil, dOffsLoc, tMainTabPar.RSM)
|
|
elseif string.lower( sEdge) == 'bottom' then
|
|
local dOffsLoc = 0
|
|
if tsStringData.sBottomTrim == 'BD' or tsStringData.sBottomTrim == 'BU' or
|
|
tsStringData.sBottomTrim == 'BDEB' or tsStringData.sBottomTrim == 'BUEB' then
|
|
dOffsLoc = tsDoubleData.dThickDoor * TAN3
|
|
end
|
|
MB.MakeRoughPaths( tsDoubleData.dBottomOffs, tMainTabPar.MOM, tMainTabPar.SOM, nNewIdEnt, true, bFlip, nil, dOffsLoc, tMainTabPar.RSM)
|
|
end
|
|
end
|
|
if nNumMachSkipResult > nNumMachSkip then -- se lavorazione skippata la inserisco nella tabella
|
|
if bFirstStep then
|
|
-- inserisco in tabella solo se non già presente
|
|
tSecMachTab = AddMachIntable( tLocMach[i], tSecMachTab, i)
|
|
end
|
|
nNumMachSkip = nNumMachSkipResult
|
|
end
|
|
else
|
|
bOk = false
|
|
end
|
|
elseif tLocMach[i].Oper == 'AdjustThrouIsle' and nProbeMode ~= 1 then
|
|
bLocMach, nNumMachSkipResult, nNewIdEnt = MB.AdjustThrouIsle( EntList[j], b3Solid:getDimZ(), pMin, pMax, nNumMachSkip, bFirstStep, bWorkUnder, bMakeGhost, tMainTabPar.ETM)
|
|
if not bLocMach then -- se operazione fallita
|
|
bOk = false
|
|
end
|
|
if nNumMachSkipResult > nNumMachSkip then -- se lavorazione skippata la inserisco nella tabella
|
|
if bFirstStep then
|
|
-- inserisco in tabella solo se non già presente
|
|
tSecMachTab = AddMachIntable( tLocMach[i], tSecMachTab, i)
|
|
local nMach = EgtGetInfo( nNewIdEnt, 'Mach', 'i') or 1
|
|
if nMach == 11 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { 1 ,tLocMach[i].Mach})
|
|
elseif nMach == 12 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { 2 ,tLocMach[i].MachUp})
|
|
elseif nMach == 13 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { 3 ,tLocMach[i].MachDw})
|
|
end
|
|
end
|
|
nNumMachSkip = nNumMachSkipResult
|
|
else -- se non skippata provo a verificare se la lavorazione è applicabile
|
|
|
|
if bOk then
|
|
|
|
local bInsLav = true
|
|
local bMachBox
|
|
-- faccio un test per vedere che la lavorazione è applicabile
|
|
local nMach = EgtGetInfo( nNewIdEnt, 'Mach', 'i') or 1
|
|
nLocMach = nMach
|
|
|
|
if nMach == 1 then
|
|
bInsLav, _, bMachBox = MB.TestMachining( tLocMach[i].Mach, nNewIdEnt, bUseVise)
|
|
elseif nMach == 2 then
|
|
bInsLav, _, bMachBox = MB.TestMachining( tLocMach[i].MachUp, nNewIdEnt, true)
|
|
elseif nMach == 3 then -- il metodo AdjustThrouIsle non dovrebbe restituire il 3
|
|
bInsLav, _, bMachBox = MB.TestMachining( tLocMach[i].MachDw, nNewIdEnt, bUseVise)
|
|
end
|
|
|
|
-- se la lavorazione è applicabile ma è da sotto, verifico l'ingombro della lavorazione
|
|
if bInsLav and nMach == 2 and bMachBox and not bMachBox:isEmpty() and tMainTabPar.CUC == 1 then
|
|
bInsLav = VerifyRowCollision( tRefArea, bMachBox)
|
|
end
|
|
-- se utilizza lavorazione da sotto con le morse disabilito la lavorazione
|
|
if nMach == 2 and bUseVise then
|
|
bInsLav = false
|
|
end
|
|
-- verifico le collisioni con le morse
|
|
if bInsLav and bUseVise and bMachBox and not bMachBox:isEmpty() then
|
|
tsNoteRow[1] = VerifyViseCollision( tIdViseDisp, bMachBox, Pz, nNumPhase, DISPMODE, tMainTabPar.NTVR, tsNoteRow[1], 2)
|
|
end
|
|
-- se la lavorazione non è applicabile
|
|
if not bInsLav then
|
|
if bFirstStep then
|
|
-- inserisco in tabella solo se non già presente
|
|
tSecMachTab = AddMachIntable( tLocMach[i], tSecMachTab, i)
|
|
if nMach == 1 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { 2 ,tLocMach[i].MachUp})
|
|
elseif nMach == 2 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { 1 ,tLocMach[i].Mach})
|
|
elseif nMach == 3 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { nMach ,tLocMach[i].MachDw})
|
|
end
|
|
end
|
|
-- aumento di 1 il numero di lavorazioni skippate
|
|
nNumMachSkip = nNumMachSkip + 1
|
|
-- ricambio la nota come non lavorabile in questa fase
|
|
if nMach == 1 then
|
|
EgtSetInfo( nNewIdEnt, 'Mach', 12)
|
|
elseif nMach == 2 then
|
|
EgtSetInfo( nNewIdEnt, 'Mach', 11)
|
|
else
|
|
EgtSetInfo( nNewIdEnt, 'Mach', nMach + 10)
|
|
end
|
|
-- incremento il numero di lavorazioni da sotto
|
|
nNumGeomBottom = nNumGeomBottom + 1
|
|
end
|
|
else
|
|
EgtSetInfo( nNewIdEnt, 'Mach', 31)
|
|
end
|
|
end
|
|
elseif tLocMach[i].Oper == 'AdjustProbeMill' and nProbeMode == 0 and nPostProbeSet > 2 then
|
|
local sMachRetured
|
|
bLocMach, nNumMachSkipResult, nNewIdEnt = MB.AdjustProbeMill( EntList[j], b3Solid:getDimZ(), pMin, pMax, nNumMachSkip,
|
|
bFirstStep, NO_WORK_UNDERSQUARE, bMakeGhost, NO_WORK_UPSQUARE, tMainTabPar.PTK,
|
|
tMainTabPar.EZPB)
|
|
if not bLocMach then -- se operazione fallita
|
|
bOk = false
|
|
end
|
|
if nNumMachSkipResult > nNumMachSkip then -- se lavorazione skippata la inserisco nella tabella
|
|
if bFirstStep then
|
|
-- inserisco in tabella solo se non già presente
|
|
tSecMachTab = AddMachIntable( tLocMach[i], tSecMachTab, i)
|
|
local nMach = EgtGetInfo( nNewIdEnt, 'Mach', 'i') or 1
|
|
if nMach == 11 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { 1 ,tLocMach[i].Mach})
|
|
elseif nMach == 12 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { 2 ,tLocMach[i].MachUp})
|
|
elseif nMach == 13 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { 3 ,tLocMach[i].MachDw})
|
|
end
|
|
end
|
|
nNumMachSkip = nNumMachSkipResult
|
|
else -- se non skippata provo a verificare se la lavorazione è applicabile
|
|
|
|
if bOk then
|
|
|
|
local bInsLav = false
|
|
-- faccio un test per vedere che la lavorazione è applicabile
|
|
local nMach = EgtGetInfo( nNewIdEnt, 'Mach', 'i') or 1
|
|
nLocMach = nMach
|
|
|
|
if nMach == 1 then
|
|
bInsLav, sMachRetured = MB.TestMachining( tLocMach[i].Mach, nNewIdEnt)
|
|
elseif nMach == 2 then
|
|
bInsLav, sMachRetured = MB.TestMachining( tLocMach[i].MachUp, nNewIdEnt, true)
|
|
elseif nMach == 3 then
|
|
bInsLav, sMachRetured = MB.TestMachining( tLocMach[i].MachDw, nNewIdEnt)
|
|
end
|
|
|
|
if not bInsLav then
|
|
if bFirstStep then
|
|
-- inserisco in tabella solo se non già presente
|
|
tSecMachTab = AddMachIntable( tLocMach[i], tSecMachTab, i)
|
|
if nMach == 1 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { nMach ,tLocMach[i].Mach})
|
|
elseif nMach == 2 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { 3 ,tLocMach[i].MachDw})
|
|
elseif nMach == 3 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { 2 ,tLocMach[i].MachUp})
|
|
end
|
|
end
|
|
-- se c'è nome lavorazione aumento di 1 il numero di lavorazioni skippate
|
|
if sMachRetured then
|
|
nNumMachSkip = nNumMachSkip + 1
|
|
end
|
|
-- ricambio la nota come non lavorabile in questa fase
|
|
if nMach == 1 then
|
|
EgtSetInfo( nNewIdEnt, 'Mach', 11)
|
|
elseif nMach == 2 then
|
|
EgtSetInfo( nNewIdEnt, 'Mach', 13)
|
|
elseif nMach == 3 then
|
|
EgtSetInfo( nNewIdEnt, 'Mach', 12)
|
|
end
|
|
|
|
-- se lavorazione presente incremento il numero di lavorazioni da sotto
|
|
if sMachRetured then
|
|
nNumGeomBottom = nNumGeomBottom + 1
|
|
end
|
|
else -- se è andata a buon punto setto nota alla porta
|
|
EgtSetInfo( Pz, 'ExistsProbeXY', true) -- presenza del probe in XY
|
|
end
|
|
else
|
|
EgtSetInfo( nNewIdEnt, 'Mach', 31)
|
|
end
|
|
end
|
|
elseif tLocMach[i].Oper == 'AdjustHorizDrillX' and nProbeMode ~= 1 then
|
|
bLocMach, nNewIdEnt = MB.AdjustHorizDrillX( EntList[j], bMakeGhost, true, nProbeMode)
|
|
if not bLocMach then
|
|
bOk = false
|
|
end
|
|
elseif tLocMach[i].Oper == 'AdjustHorizDrillY' and nProbeMode ~= 1 then
|
|
bLocMach, nNewIdEnt = MB.AdjustHorizDrillY( EntList[j], bMakeGhost, true, nProbeMode)
|
|
if not bLocMach then
|
|
bOk = false
|
|
end
|
|
elseif tLocMach[i].Oper == 'AdjustHorizAS' and nProbeMode ~= 1 then
|
|
bLocMach, nNewIdEnt = MB.AdjustHorizAS( EntList[j], bMakeGhost)
|
|
if not bLocMach then
|
|
bOk = false
|
|
end
|
|
elseif tLocMach[i].Oper == 'AdjustHorNegativeAS' and nProbeMode ~= 1 then
|
|
bLocMach, nNewIdEnt = MB.AdjustHorNegativeAS( EntList[j], bMakeGhost)
|
|
if not bLocMach then
|
|
bOk = false
|
|
end
|
|
elseif tLocMach[i].Oper == 'AdjustMortise' and nProbeMode ~= 1 then
|
|
bLocMach, nNumMachSkipResult, nNewIdEnt = MB.AdjustMortise( EntList[j], nNumMachSkip, NO_WORK_UNDERSQUARE, bMakeGhost, NO_WORK_UPSQUARE,
|
|
bForceHorizontalDir)
|
|
if not bLocMach then -- se operazione fallita
|
|
bOk = false
|
|
end
|
|
if nNumMachSkipResult > nNumMachSkip then -- se lavorazione skippata la inserisco nella tabella
|
|
if bFirstStep then
|
|
-- inserisco in tabella solo se non già presente
|
|
tSecMachTab = AddMachIntable( tLocMach[i], tSecMachTab, i)
|
|
local nMach = EgtGetInfo( nNewIdEnt, 'Mach', 'i') or 1
|
|
if nMach == 11 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { 1 ,tLocMach[i].Mach})
|
|
elseif nMach == 12 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { 2 ,tLocMach[i].MachUp})
|
|
elseif nMach == 13 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { 3 ,tLocMach[i].MachDw})
|
|
end
|
|
end
|
|
nNumMachSkip = nNumMachSkipResult
|
|
else -- se non skippata provo a verificare se la lavorazione è applicabile
|
|
|
|
if bOk then
|
|
|
|
local bInsLav = false
|
|
-- faccio un test per vedere che la lavorazione è applicabile
|
|
local nMach = EgtGetInfo( nNewIdEnt, 'Mach', 'i') or 1
|
|
nLocMach = nMach
|
|
|
|
if nMach == 1 then
|
|
bInsLav, sMachRetured = MB.TestMachining( tLocMach[i].Mach, nNewIdEnt)
|
|
elseif nMach == 2 then
|
|
bInsLav, sMachRetured = MB.TestMachining( tLocMach[i].MachUp, nNewIdEnt)
|
|
elseif nMach == 3 then
|
|
bInsLav, sMachRetured = MB.TestMachining( tLocMach[i].MachDw, nNewIdEnt)
|
|
end
|
|
|
|
if not bInsLav then
|
|
if bFirstStep then
|
|
-- inserisco in tabella solo se non già presente
|
|
tSecMachTab = AddMachIntable( tLocMach[i], tSecMachTab, i)
|
|
if nMach == 1 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { 2 ,tLocMach[i].MachUp})
|
|
elseif nMach == 2 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { 1 ,tLocMach[i].Mach})
|
|
elseif nMach == 3 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { nMach ,tLocMach[i].MachDw})
|
|
end
|
|
end
|
|
-- se c'è nome lavorazione aumento di 1 il numero di lavorazioni skippate
|
|
if sMachRetured then
|
|
nNumMachSkip = nNumMachSkip + 1
|
|
end
|
|
-- ricambio la nota come non lavorabile in questa fase
|
|
if nMach == 1 then
|
|
EgtSetInfo( nNewIdEnt, 'Mach', 12)
|
|
elseif nMach == 2 then
|
|
EgtSetInfo( nNewIdEnt, 'Mach', 11)
|
|
else
|
|
EgtSetInfo( nNewIdEnt, 'Mach', nMach + 10)
|
|
end
|
|
|
|
-- se lavorazione presente incremento il numero di lavorazioni da sotto
|
|
if sMachRetured then
|
|
nNumGeomBottom = nNumGeomBottom + 1
|
|
end
|
|
end
|
|
else
|
|
EgtSetInfo( nNewIdEnt, 'Mach', 31)
|
|
end
|
|
end
|
|
elseif tLocMach[i].Oper == 'AdjustVertHole' and nProbeMode ~= 1 then
|
|
local nTypeGeom
|
|
bLocMach, nNumMachSkipResult, nNewIdEnt, nTypeGeom = MB.AdjustVertHole( EntList[j], b3Solid:getDimZ(), pMin, pMax, nNumMachSkip, bFirstStep, bWorkUnder, bMakeGhost, tMainTabPar.ETM)
|
|
if not bLocMach then
|
|
bOk = false
|
|
end
|
|
if nNumMachSkipResult > nNumMachSkip then -- se lavorazione skippata la inserisco nella tabella
|
|
if bFirstStep then
|
|
-- inserisco in tabella solo se non già presente
|
|
tSecMachTab = AddMachIntable( tLocMach[i], tSecMachTab, i)
|
|
local nMach = EgtGetInfo( nNewIdEnt, 'Mach', 'i') or 1
|
|
if nMach == 11 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { 1 ,tLocMach[i].Mach})
|
|
elseif nMach == 12 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { 2 ,tLocMach[i].MachUp})
|
|
elseif nMach == 13 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { 3 ,tLocMach[i].MachDw})
|
|
end
|
|
end
|
|
nNumMachSkip = nNumMachSkipResult
|
|
else -- se non skippata provo a verificare se la lavorazione è applicabile
|
|
|
|
local bInsLav = true
|
|
local bInsLavSec = true
|
|
local bMachBox
|
|
-- faccio un test per vedere che la lavorazione è applicabile
|
|
local nMach = EgtGetInfo( nNewIdEnt, 'Mach', 'i') or 1
|
|
nLocMach = nMach
|
|
|
|
if nMach == 1 then
|
|
bInsLav, _, bMachBox = MB.TestMachining( tLocMach[i].Mach, nNewIdEnt, bUseVise)
|
|
-- se lavorazione non è applicabile ma di tipo passante e con la possibilità di lavorazione da sotto
|
|
-- provo subito la seconda opzione
|
|
if not bInsLav and ( nTypeGeom == 1 or nTypeGeom == 2) and bWorkUnder then
|
|
bInsLavSec, _, bMachBox = MB.TestMachining( tLocMach[i].MachUp, nNewIdEnt, true)
|
|
if bInsLavSec and bMachBox and not bMachBox:isEmpty() and tMainTabPar.CUC == 1 then
|
|
bInsLavSec = VerifyRowCollision( tRefArea, bMachBox)
|
|
end
|
|
if bInsLavSec then
|
|
nMach = 2
|
|
nLocMach = nMach
|
|
EgtSetInfo( nNewIdEnt, 'Mach', 2)
|
|
end
|
|
end
|
|
elseif nMach == 2 then
|
|
bInsLav, _, bMachBox = MB.TestMachining( tLocMach[i].MachUp, nNewIdEnt, true)
|
|
elseif nMach == 3 then -- il metodo AdjustVertHole non dovrebbe restituire il 3
|
|
bInsLav, _, bMachBox = MB.TestMachining( tLocMach[i].MachDw, nNewIdEnt, bUseVise)
|
|
end
|
|
|
|
-- se la lavorazione è applicabile ma è da sotto, verifico l'ingombro della lavorazione
|
|
if bInsLav and nMach == 2 and bMachBox and not bMachBox:isEmpty() and tMainTabPar.CUC == 1 then
|
|
bInsLav = VerifyRowCollision( tRefArea, bMachBox)
|
|
end
|
|
-- se utilizza lavorazione da sotto con le morse disabilito la lavorazione
|
|
if nMach == 2 and bUseVise then
|
|
bInsLav = false
|
|
end
|
|
-- verifico le collisioni con le morse
|
|
if bInsLav and bUseVise and bMachBox and not bMachBox:isEmpty() then
|
|
tsNoteRow[1] = VerifyViseCollision( tIdViseDisp, bMachBox, Pz, nNumPhase, DISPMODE, tMainTabPar.NTVR, tsNoteRow[1], 2)
|
|
end
|
|
-- se la lavorazione non è applicabile da entrambe i lati
|
|
if not bInsLav and not bInsLavSec then
|
|
-- setto la nota per non lavorare la geometria da nessuna parte
|
|
EgtSetInfo( nNewIdEnt, 'Mach', 21)
|
|
EgtSetInfo( nNewIdEnt, 'Mach2nd', 1)
|
|
nLocMach = 21
|
|
-- se la lavorazione non è applicabile da un lato
|
|
elseif not bInsLav then
|
|
if bFirstStep then
|
|
-- inserisco in tabella solo se non già presente
|
|
tSecMachTab = AddMachIntable( tLocMach[i], tSecMachTab, i)
|
|
if nMach == 1 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { 2 ,tLocMach[i].MachUp})
|
|
elseif nMach == 2 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { 1 ,tLocMach[i].Mach})
|
|
elseif nMach == 3 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { nMach ,tLocMach[i].MachDw})
|
|
end
|
|
end
|
|
-- aumento di 1 il numero di lavorazioni skippate
|
|
nNumMachSkip = nNumMachSkip + 1
|
|
-- ricambio la nota come non lavorabile in questa fase
|
|
if nMach == 1 then
|
|
EgtSetInfo( nNewIdEnt, 'Mach', 12)
|
|
elseif nMach == 2 then
|
|
EgtSetInfo( nNewIdEnt, 'Mach', 11)
|
|
else
|
|
EgtSetInfo( nNewIdEnt, 'Mach', nMach + 10)
|
|
end
|
|
-- incremento il numero di lavorazioni da sotto
|
|
nNumGeomBottom = nNumGeomBottom + 1
|
|
end
|
|
end
|
|
elseif tLocMach[i].Oper == 'AdjustHole' and nProbeMode ~= 1 then
|
|
bLocMach, nNewIdEnt = MB.AdjustHole( EntList[j], bMakeGhost, bForceHorizontalDir)
|
|
if not bLocMach then
|
|
bOk = false
|
|
end
|
|
elseif tLocMach[i].Oper == 'AdjPreHoleAndPocket' and nProbeMode ~= 1 then
|
|
bLocMach, nNewIdEnt = MB.AdjPreHoleAndPocket( EntList[j], bMakeGhost, nil, nil, (bExtruded or bSkinned))
|
|
if not bLocMach then
|
|
bOk = false
|
|
end
|
|
elseif tLocMach[i].Oper == 'AdjustProbeHole' and nProbeMode == 1 then
|
|
local sMachRetured
|
|
bLocMach, nNumMachSkipResult, nNewIdEnt = MB.AdjustProbeHole( EntList[j], b3Solid:getDimZ(), pMin, pMax, nNumMachSkip, bFirstStep, false, bMakeGhost)
|
|
if not bLocMach then
|
|
bOk = false
|
|
end
|
|
if nNumMachSkipResult > nNumMachSkip then -- se lavorazione skippata la inserisco nella tabella
|
|
if bFirstStep then
|
|
-- inserisco in tabella solo se non già presente
|
|
tSecMachTab = AddMachIntable( tLocMach[i], tSecMachTab, i)
|
|
local nMach = EgtGetInfo( nNewIdEnt, 'Mach', 'i') or 1
|
|
if nMach == 11 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { 1 ,tLocMach[i].Mach})
|
|
elseif nMach == 12 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { 2 ,tLocMach[i].MachUp})
|
|
elseif nMach == 13 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { 3 ,tLocMach[i].MachDw})
|
|
end
|
|
end
|
|
nNumMachSkip = nNumMachSkipResult
|
|
else -- se non skippata provo a verificare se la lavorazione è applicabile
|
|
|
|
local bInsLav = true
|
|
-- faccio un test per vedere che la lavorazione è applicabile
|
|
local nMach = EgtGetInfo( nNewIdEnt, 'Mach', 'i') or 1
|
|
nLocMach = nMach
|
|
|
|
if nMach == 1 then
|
|
bInsLav, sMachRetured = MB.TestMachining( tLocMach[i].Mach, nNewIdEnt)
|
|
elseif nMach == 2 then
|
|
bInsLav, sMachRetured = MB.TestMachining( tLocMach[i].MachUp, nNewIdEnt)
|
|
elseif nMach == 3 then -- il metodo AdjustProbeHole non dovrebbe restituire il 3
|
|
bInsLav, sMachRetured = MB.TestMachining( tLocMach[i].MachDw, nNewIdEnt)
|
|
end
|
|
|
|
-- se la lavorazione è applicabile setto la nota sul pezzo
|
|
if bInsLav then
|
|
EgtSetInfo( Pz, 'ExistsProbeZ', true) -- presenza del probe in Z
|
|
else -- altrimenti la lavorazione non è applicabile
|
|
|
|
if bFirstStep then
|
|
-- inserisco in tabella solo se non già presente
|
|
tSecMachTab = AddMachIntable( tLocMach[i], tSecMachTab, i)
|
|
if nMach == 1 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { 2 ,tLocMach[i].MachUp})
|
|
elseif nMach == 2 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { 1 ,tLocMach[i].Mach})
|
|
elseif nMach == 3 then
|
|
EgtSetInfo( nNewIdEnt, 'JoinMach', { nMach ,tLocMach[i].MachDw})
|
|
end
|
|
end
|
|
-- se c'è nome lavorazione aumento di 1 il numero di lavorazioni skippate
|
|
if sMachRetured then
|
|
nNumMachSkip = nNumMachSkip + 1
|
|
end
|
|
-- ricambio la nota come non lavorabile in questa fase
|
|
if nMach == 1 then
|
|
EgtSetInfo( nNewIdEnt, 'Mach', 12)
|
|
elseif nMach == 2 then
|
|
EgtSetInfo( nNewIdEnt, 'Mach', 11)
|
|
else
|
|
EgtSetInfo( nNewIdEnt, 'Mach', nMach + 10)
|
|
end
|
|
|
|
-- se lavorazione presente incremento il numero di lavorazioni da sotto
|
|
if sMachRetured then
|
|
nNumGeomBottom = nNumGeomBottom + 1
|
|
end
|
|
end
|
|
end
|
|
elseif tLocMach[i].Oper == 'AdjustBladeVertCurve' and nProbeMode ~= 1 then
|
|
bOk, nNewIdEnt = MB.AdjustBladeVertCurve( EntList[j], bMakeGhost)
|
|
elseif tLocMach[i].Oper == 'AdjustSplitDoor' and nProbeMode ~= 1 then
|
|
if not bGetSplitCuts then
|
|
tSplitDoorEnt = EntList
|
|
table.insert( tSplitDataInf, { tLocMach[i].Name, nNumGroup, tLocMach[i].Mach, tLocMach[i].MachUp, tLocMach[i].MachDw, nNumMach, bMakeGhost})
|
|
bGetSplitCuts = true
|
|
end
|
|
elseif tLocMach[i].Oper == 'AdjustConeCleanPaths' and nProbeMode ~= 1 then
|
|
bOk, nNewIdEnt = MB.AdjustConeCleanPaths( EntList[j], bMakeGhost, nil, Ls)
|
|
elseif tLocMach[i].Oper == 'AdjustVertAsOnHeads' and nProbeMode ~= 1 then
|
|
bLocMach, nNewIdEnt = MB.AdjustVertAsOnHeads( EntList[j], bMakeGhost)
|
|
if not bLocMach then
|
|
bOk = false
|
|
end
|
|
end
|
|
else -- se nessuna operazione
|
|
if nProbeMode ~= 1 then
|
|
nNewIdEnt = MB.MakeGhostCopy( EntList[j])
|
|
if bUseVise then
|
|
local bInsLav, _, bMachBox = MB.TestMachining( tLocMach[i].Mach, nNewIdEnt, bUseVise)
|
|
-- verifico le collisioni con le morse
|
|
if bInsLav and bMachBox and not bMachBox:isEmpty() then
|
|
tsNoteRow[1] = VerifyViseCollision( tIdViseDisp, bMachBox, Pz, nNumPhase, DISPMODE, tMainTabPar.NTVR, tsNoteRow[1], 2)
|
|
end
|
|
-- se la lavorazione non è applicabile
|
|
-- if not bInsLav then
|
|
-- if bFirstStep then
|
|
-- -- inserisco in tabella solo se non già presente
|
|
-- tSecMachTab = AddMachIntable( tLocMach[i], tSecMachTab, i)
|
|
-- end
|
|
-- -- aumento di 1 il numero di lavorazioni skippate
|
|
-- nNumMachSkip = nNumMachSkip + 1
|
|
-- -- ricambio la nota come non lavorabile in questa fase
|
|
-- if nMach == 1 then
|
|
-- EgtSetInfo( nNewIdEnt, 'Mach', 12)
|
|
-- elseif nMach == 2 then
|
|
-- EgtSetInfo( nNewIdEnt, 'Mach', 11)
|
|
-- else
|
|
-- EgtSetInfo( nNewIdEnt, 'Mach', nMach + 10)
|
|
-- end
|
|
-- -- incremento il numero di lavorazioni da sotto
|
|
-- nNumGeomBottom = nNumGeomBottom + 1
|
|
-- end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- LAVORAZIONI
|
|
|
|
local nMach
|
|
if nNewIdEnt then
|
|
nMach = EgtGetInfo( nNewIdEnt, 'Mach', 'i') or 1
|
|
else
|
|
nMach = 0
|
|
end
|
|
local bScroll = true
|
|
if nMach > 30 and nMach < 40 then nMach = nMach - 30 end
|
|
|
|
-- se prima lavorazione, valida, con chiave Shift abilitata, esco dal giro
|
|
--[[
|
|
if ( nMach > 0 and nMach < 10) and
|
|
not bShiftMchng and
|
|
tLocMach[i].Shift == 1 then
|
|
|
|
bShiftMchng = true -- flag per traslazione Y
|
|
nIndexStartMach = i -- ripartenza da questa posizione
|
|
bScroll = false -- salto l'applicazione delle lavorazioni in seguito
|
|
bEnBreak = true -- blocco il for della scansione tabella
|
|
-- se fase di ripresa rimetto la nota mach disabilitata
|
|
if not bFirstStep then
|
|
nMach = nMach + 10
|
|
EgtSetInfo( EntList[j], 'Mach', nMach)
|
|
nNumMachSkip = nNumMachSkip + 1
|
|
end
|
|
end
|
|
--]]
|
|
|
|
if not bScroll then
|
|
break -- esco dal ciclo for j
|
|
else
|
|
if nMach > 0 and nMach < 4 then -- se è fuori range non ci entro nemmeno
|
|
|
|
-- carico id entità in una tabella
|
|
local tListSameMach = {}
|
|
table.insert( tListSameMach, nNewIdEnt)
|
|
|
|
local bCalMach = true
|
|
-- se non primo passo e nota JoinMach differisce dal mach e dalla lavorazione
|
|
if not bFirstStep then
|
|
|
|
local sJoinMach = EgtGetInfo( nNewIdEnt, 'JoinMach')
|
|
|
|
if sJoinMach and #sJoinMach > 1 then
|
|
local tJoinMach = EgtSplitString( sJoinMach)
|
|
|
|
if tJoinMach and #tJoinMach == 2 then
|
|
local nNumMachRef = tonumber( tJoinMach[1])
|
|
local sMachRefJoin = tJoinMach[2]
|
|
if nNumMachRef ~= nMach then
|
|
bCalMach = false
|
|
elseif nNumMachRef == 1 and sMachRefJoin and tLocMach[i].Mach and tLocMach[i].Mach ~= sMachRefJoin then
|
|
bCalMach = false
|
|
elseif nNumMachRef == 2 and sMachRefJoin and tLocMach[i].MachUp and tLocMach[i].MachUp ~= sMachRefJoin then
|
|
bCalMach = false
|
|
elseif nNumMachRef == 3 and sMachRefJoin and tLocMach[i].MachDw and tLocMach[i].MachDw ~= sMachRefJoin then
|
|
bCalMach = false
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
bOk, nNumMach = InsertMachiningByMachNum( tListSameMach, nMach, tLocMach[i].Name, nNumGroup, tLocMach[i].Mach,
|
|
tLocMach[i].MachUp, tLocMach[i].MachDw, bOk, nNumMach, false,
|
|
NOT_GEN_MACH, nil, tMainTabPar.BPLI, tMainTabPar.PRF, bCalMach)
|
|
elseif nNewIdEnt then
|
|
local sLocMachName
|
|
if not nLocMach or nLocMach == 1 then
|
|
sLocMachName = tLocMach[i].Mach
|
|
elseif nLocMach == 2 then
|
|
sLocMachName = tLocMach[i].MachUp
|
|
elseif nLocMach == 3 then
|
|
sLocMachName = tLocMach[i].MachDw
|
|
elseif nLocMach == 21 then -- caso particolare quando falliscono sia la lavorazione top che bottom
|
|
if tLocMach[i].Mach then -- se non è nil
|
|
sLocMachName = tLocMach[i].Mach
|
|
else
|
|
sLocMachName = 'no machining'
|
|
end
|
|
if tLocMach[i].MachUp then -- se non è nil
|
|
sLocMachName = sLocMachName .. ' + ' .. tLocMach[i].MachUp
|
|
else
|
|
sLocMachName = sLocMachName .. ' + ' .. 'no machining'
|
|
end
|
|
end
|
|
DoorOutLog( EgtDoorsMsg[497]..EgtNumToString( nNewIdEnt, 0)..' '.. EgtDoorsMsg[638] ..tLocMach[i].Name.. EgtDoorsMsg[595].. EgtIf( sLocMachName, sLocMachName, '') ..
|
|
EgtDoorsMsg[596]..EgtNumToString( nNumPhase, 0), 0)
|
|
nNumSkip = nNumSkip + 1
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- se utilizzo morse faccio l'ultimo controllo ed eventuale scrematura del numero delle morse
|
|
if bUseVise and #tIdViseDisp > 3 then
|
|
ReduceViseNumber( tIdViseDisp, 3, Pz, nNumPhase, DISPMODE, tMainTabPar.NTVR, tsNoteRow[1], 2)
|
|
elseif bUseVise and #tIdViseDisp < 3 then
|
|
local sMess = ' ' .. EgtDoorsMsg[683]
|
|
if DGD.EMC and #DGD.EMC > 0 then -- se ho messaggio di errore lo mando una riga sotto per stamparlo correttamente
|
|
DGD.EMC = '\n' .. sMess
|
|
else
|
|
DGD.EMC = sMess
|
|
end
|
|
bOk = false
|
|
break
|
|
end
|
|
end -- end for per ogni pezzo
|
|
|
|
local i = 1
|
|
while i <= #tLocMachOrd and not bEnBreak do
|
|
|
|
-- carico tutto il gruppo in una tabella
|
|
local tGroup = {}
|
|
local nNumGrp = tLocMachOrd[i].Group
|
|
local sProperty = tLocMachOrd[i].Property
|
|
tGroup, i = MB.GetGroup( tLocMachOrd, i, nNumGrp, sProperty)
|
|
|
|
if sProperty and nNumGrp > 0 then -- se esiste proprietà del gruppo e gruppo non 0
|
|
|
|
if sProperty == 'MinDist' or sProperty == 'MinDistByPiece' then -- ottimizzare alla minima distanza
|
|
|
|
-- prendo l'ultima lavorazione inserita ( lavorazione o disposizione)
|
|
local LastMch = EgtGetLastOperation()
|
|
local EndLastMach
|
|
|
|
-- se l'ultima lavorazione non sia nulla o non sia disposizione mi faccio dare il punto finale
|
|
if EgtGetOperationType(LastMch) ~= MCH_OY.DISP and EgtGetOperationType(LastMch) ~= MCH_OY.NONE then
|
|
EgtSetCurrMachining( LastMch)
|
|
EndLastMach = EgtGetMachiningEndPoint()
|
|
end
|
|
|
|
local nPz
|
|
local nTotPz
|
|
|
|
if sProperty == 'MinDistByPiece' then
|
|
nTotPz = #tPz
|
|
else
|
|
nTotPz = 1
|
|
end
|
|
|
|
for v = 1, nTotPz do
|
|
|
|
local nPz
|
|
|
|
if sProperty == 'MinDistByPiece' then
|
|
nPz = tPz[v]
|
|
else
|
|
nPz = tPz
|
|
end
|
|
|
|
local tMachining = {}
|
|
|
|
-- creo lavorazioni del gruppo
|
|
for k = 1, #tGroup do
|
|
|
|
-- Recupero le entità
|
|
local EntList = MB.FindEntitiesWithName( nPz, tGroup[k].Name..DGD.GHT)
|
|
local bAdjustHead = false
|
|
|
|
-- Applico le lavorazioni
|
|
for j = 1, #EntList do
|
|
|
|
-- LAVORAZIONI
|
|
local nMach = EgtGetInfo( EntList[j], 'Mach', 'i') or 1
|
|
nMach = nMach - 30 -- se lavorazione corretta ottengo 1
|
|
local nMach2nd = EgtGetInfo( EntList[j], 'Mach2nd', 'i') or 0
|
|
local sMachining = EgtGetInfo( EntList[j], 'Machining')
|
|
-- con questa tabella non ci sono seconde o terze lavorazioni, solo la prima
|
|
if nMach > 0 and nMach < 4 then nMach = 1 end
|
|
|
|
-- se è fuori range o non corrispondono le lavorazioni
|
|
if sMachining and nMach == 1 and nMach2nd == 0 and sMachining == tGroup[k].Mach then
|
|
|
|
-- cerco di unire più entità nella stessa lavorazione ( non da sotto e non oltre una certa distanza)
|
|
local tListSameMach = MB.FindEntitiesCompMach( EntList[j], EntList, sMachining, tGroup[k].Join, tMainTabPar.MDC)
|
|
|
|
-- se più di 1 entità le ordino
|
|
if #tListSameMach > 1 then
|
|
tListSameMach = MB.OrderEnt( tListSameMach, EndLastMach)
|
|
EndLastMach = EgtSP( tListSameMach[#tListSameMach], GDB_ID.ROOT )
|
|
end
|
|
|
|
bOk, nNumMach, tMachining = InsertMachiningByMachNum( tListSameMach, nMach, tGroup[k].Name, nNumGrp, tGroup[k].Mach,
|
|
tGroup[k].MachUp, tGroup[k].MachDw, bOk, nNumMach, bAdjustHead,
|
|
GEN_MACH, tMachining, tMainTabPar.BPLI, tMainTabPar.PRF)
|
|
|
|
-- se ho assegnato lavorazione a più entità, marco quelle che ho già fatto
|
|
SetInfoTable( tListSameMach, 'Mach2nd', 1)
|
|
|
|
local nNewMach = EgtGetInfo( tListSameMach[1], 'Mach', 'i') or 1
|
|
if nNewMach > 30 and nNewMach < 40 then
|
|
SetInfoTable( tListSameMach, 'Mach', nNewMach-20) -- assegno nota per non lavorarla di nuovo
|
|
elseif nNewMach > 40 and nNewMach < 50 then
|
|
SetInfoTable( tListSameMach, 'Mach', nNewMach-30) -- assegno nota per non lavorarla di nuovo
|
|
end
|
|
end
|
|
end
|
|
|
|
-- 11/01/2019 commento la cancellazione della nota per evitare di lavorare una seconda volta una geometria già lavorata
|
|
-- tolgo di mezzo le note secondarie
|
|
-- for j = 1, #EntList do
|
|
-- EgtRemoveInfo( EntList[j], 'Mach2nd')
|
|
-- end
|
|
end
|
|
|
|
-- ordino le lavorazioni
|
|
if #tMachining > 1 then
|
|
|
|
-- Tavole per fresature da ordinare
|
|
local TabMill = {}
|
|
local TabMStEnP = {}
|
|
local TabZMach = {}
|
|
|
|
for k = 1, #tMachining do
|
|
-- Se appartiene alla fase corrente e fresatura non vuota
|
|
if EgtGetOperationPhase( tMachining[k][1]) == nNumPhase then
|
|
EgtSetCurrMachining( tMachining[k][1])
|
|
local ptStart = EgtGetMachiningStartPoint()
|
|
local ptEnd = EgtGetMachiningEndPoint()
|
|
if ptStart and ptEnd then
|
|
table.insert( TabMill, tMachining[k][1])
|
|
table.insert( TabMStEnP, { ptStart, ptEnd})
|
|
MB.InsZedByTool( TabZMach, tMachining, k)
|
|
end
|
|
end
|
|
end
|
|
-- calcolo ordinamento
|
|
EgtSpInit()
|
|
for k = 1, #TabMill do
|
|
EgtSpAddPoint( TabMStEnP[k][1]:getX(), TabMStEnP[k][1]:getY(), TabZMach[k], 0, 0,
|
|
TabMStEnP[k][2]:getX(), TabMStEnP[k][2]:getY(), TabZMach[k], 0, 0)
|
|
end
|
|
if EndLastMach then
|
|
EgtSpSetOpenBound(true,SHP_OB.NEAR_PNT,EndLastMach:getX(),EndLastMach:getY(),0,90,90)
|
|
else
|
|
EgtSpSetOpenBound(true,SHP_OB.NEAR_PNT,-2000,0,0,90,90)
|
|
end
|
|
local vMillOrd = EgtSpCalculate(SHP_TY.OPEN)
|
|
EgtSpTerminate()
|
|
-- applico ordinamento calcolato
|
|
-- parto da LastMch precedente
|
|
if vMillOrd then
|
|
for k = 1, #vMillOrd do
|
|
EgtRelocateGlob(TabMill[vMillOrd[k]],LastMch,GDB_IN.AFTER)
|
|
LastMch = TabMill[vMillOrd[k]]
|
|
end
|
|
end
|
|
end
|
|
end -- end for
|
|
elseif sProperty == 'Layer' then -- lavorazione layer
|
|
|
|
for v = 1, #tPz do
|
|
|
|
local nPz = tPz[v]
|
|
|
|
-- ottengo tutte le entità del gruppo
|
|
local EntListGrp = MB.LoadEntitiesFromGroup( tGroup, nPz, DGD.GHT)
|
|
|
|
-- Applico le lavorazioni
|
|
for j = 1, #EntListGrp do
|
|
|
|
local nParendId = EgtGetParent(EntListGrp[j])
|
|
|
|
-- Recupero la prima entità del layer padre
|
|
local EntList = MB.FindEntities( nParendId, true)
|
|
|
|
-- LAVORAZIONI
|
|
local nMach = 1
|
|
|
|
-- riciclo per prendere tutte le entità di un gruppo che devono essere lavorate assieme
|
|
bOk, nNumMach = MakeGroupMachining( EntList, nParendId, tGroup, nMach, nNumGrp,
|
|
nNumMach, bOk, DGD.GHT, tMainTabPar.MDC, EndLastMach,
|
|
tMainTabPar.BPLI, tMainTabPar.PRF)
|
|
end
|
|
end -- end for
|
|
elseif sProperty == '' then -- proprietà nulla
|
|
|
|
-- creo lavorazioni del gruppo
|
|
for k = 1, #tGroup do
|
|
|
|
-- Recupero le entità
|
|
local EntList = MB.FindEntitiesWithName( tPz, tGroup[k].Name..DGD.GHT)
|
|
local bAdjustHead = false
|
|
|
|
-- Applico le lavorazioni
|
|
for j = 1, #EntList do
|
|
|
|
-- LAVORAZIONI
|
|
local nMach = EgtGetInfo( EntList[j], 'Mach', 'i') or 1
|
|
nMach = nMach - 30 -- se lavorazione corretta ottengo 1
|
|
local nMach2nd = EgtGetInfo( EntList[j], 'Mach2nd', 'i') or 0
|
|
local sMachining = EgtGetInfo( EntList[j], 'Machining')
|
|
-- con questa tabella non ci sono seconde o terze lavorazioni, solo la prima
|
|
if nMach > 0 and nMach < 4 then nMach = 1 end
|
|
|
|
if sMachining and nMach == 1 and nMach2nd == 0 and sMachining == tGroup[k].Mach then
|
|
|
|
-- cerco di unire più entità nella stessa lavorazione ( non da sotto e non oltre una certa distanza)
|
|
local tListSameMach = MB.FindEntitiesCompMach( EntList[j], EntList, sMachining, tGroup[k].Join, tMainTabPar.MDC)
|
|
|
|
-- se più di 1 entità le ordino
|
|
if #tListSameMach > 1 then
|
|
tListSameMach = MB.OrderEnt( tListSameMach, EndLastMach)
|
|
EndLastMach = EgtSP( tListSameMach[#tListSameMach], GDB_ID.ROOT )
|
|
end
|
|
|
|
bOk, nNumMach = InsertMachiningByMachNum( tListSameMach, nMach, tGroup[k].Name, nNumGrp, tGroup[k].Mach,
|
|
tGroup[k].MachUp, tGroup[k].MachDw, bOk, nNumMach, bAdjustHead,
|
|
GEN_MACH, nil, tMainTabPar.BPLI, tMainTabPar.PRF)
|
|
|
|
-- se ho assegnato lavorazione a più entità, marco quelle che ho già fatto
|
|
SetInfoTable( tListSameMach, 'Mach2nd', 1)
|
|
|
|
local nNewMach = EgtGetInfo( tListSameMach[1], 'Mach', 'i') or 1
|
|
if nNewMach > 30 and nNewMach < 40 then
|
|
SetInfoTable( tListSameMach, 'Mach', nNewMach-20) -- assegno nota per non lavorarla di nuovo
|
|
elseif nNewMach > 40 and nNewMach < 50 then
|
|
SetInfoTable( tListSameMach, 'Mach', nNewMach-30) -- assegno nota per non lavorarla di nuovo
|
|
end
|
|
end
|
|
end
|
|
|
|
-- 11/01/2019 commento la cancellazione della nota per evitare di lavorare una seconda volta una geometria già lavorata
|
|
-- tolgo di mezzo le note secondarie
|
|
-- for j = 1, #EntList do
|
|
-- EgtRemoveInfo( EntList[j], 'Mach2nd')
|
|
-- end
|
|
end
|
|
end
|
|
elseif nNumGrp == 0 then -- se lavorazioni in gruppo 0 do errore
|
|
DGD.ERR = -15
|
|
if DGD.EMC and #DGD.EMC > 0 then
|
|
DGD.EMC = DGD.EMC .. ' ' .. string.format(EgtDoorsMsg[639], tGroup[1].Name) -- con gruppo 0 c'è solo un'istanza
|
|
else
|
|
DGD.EMC = '\n' .. ' ' .. string.format(EgtDoorsMsg[639], tGroup[1].Name) -- con gruppo 0 c'è solo un'istanza
|
|
end
|
|
if DGD.ERM and #DGD.ERM > 0 then
|
|
DGD.ERM = DGD.ERM .. ' ' .. string.format(EgtDoorsMsg[639], tGroup[1].Name) -- con gruppo 0 c'è solo un'istanza
|
|
else
|
|
DGD.ERM = ' ' .. string.format(EgtDoorsMsg[639], tGroup[1].Name) -- con gruppo 0 c'è solo un'istanza
|
|
end
|
|
end
|
|
|
|
i = i + 1
|
|
end
|
|
|
|
-- se ci sono state lavorazioni accodo la disposizione delle fase
|
|
if nNumMach > 0 then
|
|
sTotDispMode = sTotDispMode .. ' ' .. sDispMode .. '\n'
|
|
else -- altrimenti nessuna lavorazione
|
|
|
|
if not bFirstStep then -- se non è il primo giro elimino la fase vuota
|
|
|
|
-- se ho più di una fase elimino l'ultima fase
|
|
if nNumPhase > 1 then
|
|
EgtRemoveLastPhase()
|
|
end
|
|
|
|
-- setto corrente fase precedente
|
|
if nPrevPhase then
|
|
EgtSetCurrPhase(nPrevPhase)
|
|
nNumPhase = nPrevPhase
|
|
end
|
|
end
|
|
end
|
|
|
|
-- se sono al primissimo giro
|
|
if not bGenFirstStep then
|
|
|
|
-- la lavorazione di traslazione ha priorità sul ribaltamento
|
|
-- se trovata traslazione setto il flag per il prossimo giro
|
|
if bShiftMchng then
|
|
bGenFirstStep = true
|
|
if not bFirstStep then -- se sono già in ripresa porta resetto il contatore di lavorazioni saltate
|
|
nNumMachSkip = 0 -- resetto per il prossimo giro
|
|
end
|
|
else
|
|
-- se nessuna geometria skippata esco
|
|
if nNumMachSkip and nNumMachSkip == 0 then bWork = false end
|
|
|
|
-- se lavorazioni skippate abilito il ribaltamento porta in altra fase
|
|
if nNumMachSkip and nNumMachSkip > 0 then
|
|
-- se già con pezzo non in prima fase ( non shiftato) o pezzo frame, esco
|
|
if not bFirstStep or bFrame then
|
|
bWork = false
|
|
else
|
|
bFirstStep = false
|
|
end
|
|
nNumMachSkip = 0 -- resetto per il prossimo giro
|
|
end
|
|
end
|
|
else -- altrimenti ho già fatto un giro e ho trovato la traslazione
|
|
-- se nessuna geometria skippata esco
|
|
if nNumMachSkip == 0 then bWork = false end
|
|
-- se lavorazioni skippate abilito il ribaltamento porta in altra fase
|
|
if nNumMachSkip and nNumMachSkip > 0 then
|
|
nNumMachSkip = 0 -- resetto per il prossimo giro
|
|
if bFirstStep then -- se ho terminato il giro con eventuale traslazione disabilito la traslazione
|
|
-- disativo la traslazione sul giro successvo
|
|
bShiftMchng = false
|
|
-- disattivo il flag che indica di disporre la porta subito traslata
|
|
bSmallShiftedDoor = false
|
|
end
|
|
bFirstStep = false
|
|
end
|
|
end
|
|
|
|
-- controllo di sicurezza
|
|
if nNumCycle > 4 then bWork = false end
|
|
|
|
nNumCycle = nNumCycle + 1
|
|
|
|
-- se deve uscire dal ciclo, prima di farlo, eseguo l'eventuale split della porta
|
|
if not bWork then
|
|
|
|
-- gestione taglio longitudinale split door
|
|
-- per ogni pezzo passato
|
|
for v = 1, #tPz do
|
|
|
|
Pz = tPz[v]
|
|
sAssemb = tsAssemb[v]
|
|
-- assegnamento variabili
|
|
bFrame = sAssemb and string.find( sAssemb, 'frame') == 1
|
|
|
|
-- se è una porta
|
|
if not bFrame then
|
|
|
|
local EntList = tSplitDoorEnt
|
|
|
|
if #EntList == 1 then
|
|
-- acquisisco nota direzione taglio e la confronto con il parametro del currcaminfo
|
|
local sDirCut = EgtGetInfo( EntList[1], 'DirectionCut', 's')
|
|
if sDirCut and
|
|
( ( sDirCut == 'H' and string.find( tMainTabPar.CDA, 'H')) or
|
|
( sDirCut == 'W' and string.find( tMainTabPar.CDA, 'W'))) then
|
|
|
|
bLocMach, nNewIdEnt = MB.AdjustThrouCurve( EntList[1], tSplitDataInf[1][7])
|
|
|
|
if bLocMach then
|
|
|
|
local bInsLav = false
|
|
|
|
local nMach = EgtGetInfo( nNewIdEnt, 'Mach', 'i') or 1
|
|
|
|
nLocMach = nMach
|
|
if nMach == 1 then
|
|
|
|
-- carico id entità in una tabella
|
|
local tListSameMach = {}
|
|
table.insert( tListSameMach, nNewIdEnt)
|
|
|
|
bOk, nNumMach = InsertMachiningByMachNum( tListSameMach, nMach, tSplitDataInf[1][1], tSplitDataInf[1][2], tSplitDataInf[1][3],
|
|
tSplitDataInf[1][4], tSplitDataInf[1][5], bOk, tSplitDataInf[1][6], false,
|
|
NGEN_MACH, nil, tMainTabPar.BPLI, tMainTabPar.PRF)
|
|
end
|
|
else
|
|
bOk = false
|
|
end
|
|
end
|
|
-- se ho più di un taglio do errore
|
|
elseif #EntList > 1 then
|
|
-- se lanciato da DMach stampo anche un messaggio a video
|
|
if not DGD or not DGD.NCGEN then
|
|
if DGD.EMC and #DGD.EMC > 0 then
|
|
EgtOutBox( DGD.EMC .. '\n' .. EgtDoorsMsg[695], EgtDoorsMsg[476], EgtDoorsMsg[477])
|
|
else
|
|
EgtOutBox( EgtDoorsMsg[695], EgtDoorsMsg[476], EgtDoorsMsg[477])
|
|
end
|
|
else
|
|
-- scrivo messaggio nei file log
|
|
DoorOutLog( EgtDoorsMsg[695], 0)
|
|
end
|
|
|
|
-- Salvo progetto
|
|
EgtSaveFile()
|
|
|
|
return false, nNumGroup
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end -- end while
|
|
|
|
--nTime = EgtStopCounter()
|
|
--if not DGD or not DGD.NCGEN then
|
|
-- EgtOutBox( string.format( 'tempo calcolato sec: %s', (nTime/1000)), 'Time2', 'Time2')
|
|
--end
|
|
|
|
-- inizializzo il contatore
|
|
--EgtStartCounter()
|
|
|
|
--------------------------
|
|
--------------------------
|
|
-- *** Tools Setup ***
|
|
--------------------------
|
|
--------------------------
|
|
-- provo a importare l'attrezzaggio di default, se fallisce passo gli altri
|
|
bSetUp = EgtImportSetup()
|
|
sListTool = ''
|
|
|
|
if bSetUp then -- se importato quello di default
|
|
|
|
sSetup = EgtGetDefaultSetupName()
|
|
-- verifico se l'attrezzaggio è idoneo
|
|
bSetUp, tListError = EgtVerifyCurrSetup()
|
|
-- se attrezzaggio andato a buon fine setto il nome dell'attrezzaggio di default
|
|
if bSetUp then
|
|
-- assegno nota con il nome del file setup assegnato
|
|
EgtSetInfo( EgtGetCurrSetup(), 'Name', sSetup)
|
|
else -- preparo la lista degli utensili mancanti
|
|
sListTool = string.format( EgtDoorsMsg[552], sSetup) .. ' (Default)'
|
|
sListTool = sListTool .. '\n ' .. EgtDoorsMsg[553]
|
|
for k = 1, #tListError do
|
|
sListTool = sListTool .. '\n ' .. tListError[k]
|
|
end
|
|
end
|
|
else
|
|
sListTool = sListTool .. '\n ' .. string.format( EgtDoorsMsg[554], ' ') .. ' (from Default)'
|
|
end
|
|
|
|
-- se fallito quello di default o utensili mancanti provo quelli indicati nel CurrCamInfo
|
|
if not bSetUp then
|
|
|
|
local sDefSetUp = sSetup -- mi tengo via il nome dell'attrezzaggio di default
|
|
local nContImport = 0
|
|
|
|
-- ciclo tra quelli disponibili
|
|
for k = 1, 30 do
|
|
|
|
if not bSetUp then
|
|
if k == 1 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup1
|
|
elseif k == 2 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup2
|
|
elseif k == 3 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup3
|
|
elseif k == 4 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup4
|
|
elseif k == 5 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup5
|
|
elseif k == 6 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup6
|
|
elseif k == 7 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup7
|
|
elseif k == 8 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup8
|
|
elseif k == 9 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup9
|
|
elseif k == 10 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup10
|
|
elseif k == 11 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup11
|
|
elseif k == 12 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup12
|
|
elseif k == 13 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup13
|
|
elseif k == 14 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup14
|
|
elseif k == 15 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup15
|
|
elseif k == 16 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup16
|
|
elseif k == 17 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup17
|
|
elseif k == 18 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup18
|
|
elseif k == 19 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup19
|
|
elseif k == 20 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup20
|
|
elseif k == 21 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup21
|
|
elseif k == 22 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup22
|
|
elseif k == 23 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup23
|
|
elseif k == 24 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup24
|
|
elseif k == 25 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup25
|
|
elseif k == 26 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup26
|
|
elseif k == 27 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup27
|
|
elseif k == 28 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup28
|
|
elseif k == 29 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup29
|
|
elseif k == 30 then
|
|
sSetup = mCamData[nNumMachFromCam].Setup30
|
|
end
|
|
-- se nome attrezzaggio non è vuoto
|
|
if sSetup and #sSetup > 0 then
|
|
bSetUp = EgtImportSetup(sSetup)
|
|
end
|
|
|
|
if bSetUp then -- se importato il fle da CurrCamInfo
|
|
nContImport = nContImport + 1
|
|
-- verifico se l'attrezzaggio è idoneo
|
|
bSetUp, tListError = EgtVerifyCurrSetup()
|
|
|
|
if bSetUp then -- se è andato bene
|
|
-- assegno nota con il nome del file setup assegnato
|
|
EgtSetInfo( EgtGetCurrSetup(), 'Name', sSetup)
|
|
break
|
|
else -- se utensili mancanti prendo la lista e passo al successivo
|
|
sListTool = sListTool .. '\n ' .. string.format( EgtDoorsMsg[552], sSetup) .. string.format(' (from CurrCamInfo Setup%s)', k)
|
|
sListTool = sListTool .. '\n ' .. EgtDoorsMsg[553]
|
|
for k = 1, #tListError do
|
|
sListTool = sListTool .. '\n ' .. tListError[k]
|
|
end
|
|
end
|
|
else -- se non importato carico il messaggio di errore e passo al successivo
|
|
sListTool = sListTool .. '\n ' .. string.format( EgtDoorsMsg[554], sSetup) .. string.format(' (from CurrCamInfo Setup%s)', k)
|
|
end
|
|
end
|
|
end
|
|
|
|
-- se nessuno è andato bene verifico se il primo era stato importato
|
|
if not bSetUp then
|
|
-- se ho importato almeno un attrezzaggio do errore
|
|
if ( sDefSetUp and #sDefSetUp > 0) or
|
|
nContImport > 0 then
|
|
if DGD.EMC and #DGD.EMC > 0 then
|
|
DGD.EMC = DGD.EMC .. '\n' .. ' ' .. EgtDoorsMsg[551]
|
|
else
|
|
DGD.EMC = ' ' .. EgtDoorsMsg[551]
|
|
end
|
|
bOk = false
|
|
if #sListTool > 0 then
|
|
DGD.EMC = DGD.EMC .. sListTool
|
|
end
|
|
else -- setup default non definito
|
|
-- assegno ugualmente un attrezzaggio vuoto
|
|
EgtSetInfo( EgtGetCurrSetup(), 'Name', EgtDoorsMsg[555])
|
|
end
|
|
end
|
|
end
|
|
|
|
if nNumGroup > 1 then sNumGroup = '_'..EgtNumToString(nNumGroup, 0) end
|
|
|
|
-- Eventuale messaggio di errore
|
|
if not bOk then
|
|
|
|
DoorOutLog( string.format(EgtDoorsMsg[494], tMainTabPar.MN), 0) -- inizio lavorazione su macchina
|
|
|
|
DGD.ERR = 20
|
|
DoorOutLog( ' Err=' .. EgtNumToString( DGD.ERR, 0), 1)
|
|
|
|
-- stampo gli errori del machiningBase
|
|
if DGD.EMC and #DGD.EMC > 0 then
|
|
DoorOutLog( DGD.EMC, 0)
|
|
end
|
|
|
|
DoorOutLog( string.format( EgtDoorsMsg[475], tMainTabPar.MN), 0) -- Error on machining calculation
|
|
|
|
-- cancello il file cn e il txt
|
|
EgtEraseFile( sFileDir..sFileName..sNumGroup..'.cnc')
|
|
EgtEraseFile( sFileDir..sFileName..sNumGroup..'.txt')
|
|
-- cancello eventuali file immagini
|
|
EgtEraseFile( sFileDir..sFileName..sNumGroup..'_TableView'..'.html')
|
|
EgtEraseFile( sFileDir..sFileName..sNumGroup..'_TableView'..'.png')
|
|
|
|
--ricreo il file txt con l'errore
|
|
WriteErrFile( sFileDir..sFileName..sNumGroup..'.txt', string.format( EgtDoorsMsg[475], tMainTabPar.MN))
|
|
|
|
if not DGD.NCGEN then -- modificato not DGD con not DGD.NCGEN perche ho incluso EgtDoorsData dove esiste DGD
|
|
if DGD.EMC and #DGD.EMC > 0 then
|
|
EgtOutBox( DGD.EMC .. '\n' .. string.format( EgtDoorsMsg[475], tMainTabPar.MN), EgtDoorsMsg[476], EgtDoorsMsg[477]) -- Error on machining calculation
|
|
else
|
|
EgtOutBox( string.format( EgtDoorsMsg[475], tMainTabPar.MN), EgtDoorsMsg[476], EgtDoorsMsg[477]) -- Error on machining calculation
|
|
end
|
|
end
|
|
|
|
-- Salvo progetto
|
|
EgtSaveFile()
|
|
|
|
return false, nNumGroup
|
|
end
|
|
|
|
-- Applica tutte le lavorazioni ( che comprende anche l'aggiornamento, EgtUpdateAllMachinings con il calcolo assi macchina e movimenti tra lavorazioni e finale)
|
|
EgtApplyAllMachinings( false, false)
|
|
|
|
local nNumMachErr, sErrMach = EgtGetLastMachMgrError()
|
|
local bMachOk = true
|
|
|
|
-- Salvo progetto
|
|
EgtSaveFile()
|
|
|
|
-- controllo collisioni
|
|
local bSimOk
|
|
|
|
if nNumMachErr == 0 then
|
|
|
|
-- Simulation for collision check
|
|
if tMainTabPar.ECD == 1 then
|
|
DoorOutLog( ' +++ Simulating with collision check >>>', 0)
|
|
EgtOutText( 'Start hidden simulation to find collision, It keep some time')
|
|
local nErr, sErr
|
|
bSimOk, nErr, sErr = EgtSimulate()
|
|
if not bSimOk then
|
|
if nErr == MCH_SHE.INIT then
|
|
DGD.ERR = 33
|
|
DGD.EMC = DGD.EMC .. string.format(EgtDoorsMsg[686], sErr)
|
|
EgtOutBox( string.format(EgtDoorsMsg[686], sErr), 'Simulation', 'Simulation')
|
|
elseif nErr == MCH_SHE.COLLISION then
|
|
DGD.ERR = 33
|
|
DGD.EMC = DGD.EMC .. string.format(EgtDoorsMsg[687], sErr)
|
|
EgtOutBox( string.format(EgtDoorsMsg[687], sErr), 'Collision', 'Collision')
|
|
elseif nErr == MCH_SHE.OUTSTROKE then
|
|
DGD.ERR = 33
|
|
DGD.EMC = DGD.EMC .. string.format(EgtDoorsMsg[688], sErr)
|
|
EgtOutBox( string.format(EgtDoorsMsg[688], sErr), 'Outstroke', 'Outstroke')
|
|
else
|
|
DGD.ERR = 33
|
|
DGD.EMC = DGD.EMC .. string.format(EgtDoorsMsg[689], sErr)
|
|
EgtOutBox( string.format(EgtDoorsMsg[689], sErr), 'Simulation', 'Simulation')
|
|
end
|
|
end
|
|
EgtOutText( 'hidden simulation finished')
|
|
else
|
|
bSimOk = true
|
|
end
|
|
else
|
|
bMachOk = false
|
|
DGD.ERR = 36
|
|
DGD.EMC = DGD.EMC .. string.format(EgtDoorsMsg[713], sErrMach)
|
|
EgtOutBox( string.format(EgtDoorsMsg[713], sErrMach), 'Machining error', 'Machining error')
|
|
end
|
|
|
|
if bMachOk and bSimOk then
|
|
-- Estimation
|
|
bOk = EgtEstimate( sFileDir..sFileName..sNumGroup..'.html', 'EgtCam5 - '..sFilePath)
|
|
-- NC code generation
|
|
bOk = EgtGenerate( sFileDir..sFileName..sNumGroup..EgtIf( nProbeMode ~= 1,'.cnc','.prb'), 'EgtCam5 - '..sFilePath)
|
|
else
|
|
bOk = false
|
|
end
|
|
|
|
if bOk then
|
|
|
|
if not DGD.ERR then DGD.ERR = 0 end
|
|
DoorOutLog( string.format( '\n'..EgtDoorsMsg[494], tMainTabPar.MN), 0) -- inizio lavorazione su macchina
|
|
DoorOutLog( ' Err=' .. EgtNumToString( DGD.ERR, 0), 1)
|
|
if not DGD.NCGEN then
|
|
if DGD.ERM and #DGD.ERM > 0 then
|
|
DoorOutLog( DGD.ERM, 0) -- stampo la disposizione nel log
|
|
end
|
|
end
|
|
DoorOutLog( sTotDispMode, 0) -- stampo la disposizione nel log
|
|
|
|
-- esportazione vista tavola
|
|
local bExport
|
|
|
|
-- se esportazione vista pezzo in png o esportazione vista tavola tipo html (vista 3d)
|
|
if tMainTabPar.ETV >= 1 and tMainTabPar.ETV <= 3 then
|
|
|
|
local sIniFilePath
|
|
local nPieceToZoom
|
|
local dWidthImg, dHeightImg
|
|
|
|
-- se esportazione vista tavola tipo png (vista 2d)
|
|
if tMainTabPar.ETV == 1 or tMainTabPar.ETV == 3 then
|
|
-- ottengo la risoluzione di esportazione
|
|
sIniFilePath = EgtGetIniFile() -- percorso del file ini dell'EgtCam5
|
|
dWidthImg = EgtGetStringFromIni( 'Export', 'ImgWidth', '1920', sIniFilePath)
|
|
dHeightImg = EgtGetStringFromIni( 'Export', 'ImgHeight', '1080', sIniFilePath)
|
|
end
|
|
|
|
for v = 1, #tMchId do
|
|
-- acquisisco il numero di fase
|
|
local nCurrPhase = EgtGetCurrPhase()
|
|
-- esco dal machining
|
|
EgtResetCurrMachGroup()
|
|
-- acquisisco il numero complessivo di tavole e su quale tavola è disposto il pezzo
|
|
local nTableUsed = EgtGetInfo( tMchId[v][3], 'TableUsed', 'i')
|
|
-- cerco nel GDB_ID.ROOT la macchina e il gruppo di lavoro
|
|
local nMachAux = EgtGetNameInGroup( GDB_ID.ROOT, 'MachAux')
|
|
if nMachAux and #nMachAux == 1 then
|
|
local nIdMachine = EgtGetFirstInGroup( nMachAux[1])
|
|
local sNameInMachAux
|
|
while nIdMachine do
|
|
sNameInMachAux = EgtGetName(nIdMachine) or ''
|
|
-- se trovata macchina
|
|
if #sNameInMachAux > 0 and sNameInMachAux == tMchId[v][1] then
|
|
break
|
|
else
|
|
nIdMachine = EgtGetNext( nIdMachine)
|
|
end
|
|
end
|
|
-- se trovato nome macchina
|
|
if nIdMachine then
|
|
-- rendo visiblie il gruppo
|
|
EgtSetStatus( nIdMachine, GDB_ST.ON)
|
|
-- lascio abilitata solo la tavole
|
|
local nGenGroup = EgtGetNameInGroup( nIdMachine, 'Base')
|
|
if nGenGroup and #nGenGroup == 1 then
|
|
local nSubGenGroup = EgtGetFirstInGroup( nGenGroup[1])
|
|
while nSubGenGroup do
|
|
-- acquisisco il nome del grippo
|
|
local sNameSubGenGroup = EgtGetName(nSubGenGroup)
|
|
if sNameSubGenGroup then
|
|
local sTabName = 'tab'
|
|
-- se ho più tavole verifico di abilitare quella utilizzata
|
|
if nTableUsed == 1 then
|
|
sTabName = 'tab1'
|
|
elseif nTableUsed == 2 then
|
|
sTabName = 'tab2'
|
|
end
|
|
-- Se nel nome non è presente la parte tavola la nascondo
|
|
if not string.find( string.lower(sNameSubGenGroup), 'tab') then
|
|
EgtSetStatus( nSubGenGroup, GDB_ST.OFF)
|
|
-- ho una componente tavola
|
|
else
|
|
-- se ho più tavola
|
|
if NUMTABLE > 1 then
|
|
-- nascondo la tavola non utilizzata
|
|
if not string.find( string.lower(sNameSubGenGroup), sTabName) then
|
|
EgtSetStatus( nSubGenGroup, GDB_ST.OFF)
|
|
else
|
|
-- altrimenti tango traccia della tavola utilizzata per fare lo zoom
|
|
nPieceToZoom = nSubGenGroup
|
|
end
|
|
-- altrimenti una tavola sola
|
|
else
|
|
-- se ho trovato la tavola
|
|
if string.find( string.lower(sNameSubGenGroup), sTabName) then
|
|
nPieceToZoom = nSubGenGroup
|
|
-- altrimenti se ho trovato la tavola provo con la standard
|
|
elseif string.find( string.lower(sNameSubGenGroup), 'tab') then
|
|
nPieceToZoom = nSubGenGroup
|
|
-- altrimenti nascondo l'oggetto
|
|
else
|
|
EgtSetStatus( nSubGenGroup, GDB_ST.OFF)
|
|
end
|
|
end
|
|
end
|
|
-- se non ha un nome lo nascondo in ogni caso
|
|
else
|
|
EgtSetStatus( nSubGenGroup, GDB_ST.OFF)
|
|
end
|
|
nSubGenGroup = EgtGetNext( nSubGenGroup)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
local nMachBase = EgtGetNameInGroup( GDB_ID.ROOT, 'MachBase')
|
|
if nMachBase and #nMachBase == 1 then
|
|
local nIdMachGroup = EgtGetFirstInGroup( nMachBase[1])
|
|
local sNameInMachBase
|
|
-- ottengo il nome del gruppo
|
|
local sMachIdName = EgtGetName(tMchId[v][2])
|
|
while nIdMachGroup do
|
|
sNameInMachBase = EgtGetName(nIdMachGroup) or ''
|
|
-- se trovato gruppo lavoro
|
|
if #sNameInMachBase > 0 and sNameInMachBase == sMachIdName then
|
|
break
|
|
else
|
|
nIdMachGroup = EgtGetNext( nIdMachGroup)
|
|
end
|
|
end
|
|
-- se trovato nome gruppo lavoro
|
|
if nIdMachGroup then
|
|
-- rendo visiblie il gruppo
|
|
EgtSetStatus( nIdMachGroup, GDB_ST.ON)
|
|
end
|
|
end
|
|
local nVMill = EgtGetNameInGroup( GDB_ID.ROOT, 'VMill')
|
|
-- nascondo i pezzi
|
|
local nPieceId = EgtGetFirstInGroup( GDB_ID.ROOT)
|
|
-- se sono presenti i due gruppi
|
|
if nMachBase and #nMachBase == 1 and nMachAux and #nMachAux == 1 then
|
|
-- ottengo il nome del pezzo
|
|
local sPieceNameToDis = EgtGetName(tMchId[v][3])
|
|
while nPieceId do
|
|
-- se pezzo esiste ed è diverso dagli altri
|
|
if nPieceId ~= nMachBase[1] and nPieceId ~= nMachAux[1] then
|
|
-- rendo non visiblie il gruppo
|
|
EgtSetStatus( nPieceId, GDB_ST.OFF)
|
|
end
|
|
nPieceId = EgtGetNext( nPieceId)
|
|
end
|
|
end
|
|
-- se esportazione html
|
|
if tMainTabPar.ETV == 2 or tMainTabPar.ETV == 3 then
|
|
-- esporto html
|
|
local sExport = sFileDir..sFileName..sNumGroup.. '_TableView' ..'.html'
|
|
bExport = EgtExportThreeJS( GDB_ID.ROOT, sExport, 393)
|
|
end
|
|
-- se esportazione vista tavola tipo png (vista 2d)
|
|
if tMainTabPar.ETV == 1 or tMainTabPar.ETV == 3 then
|
|
if nPieceToZoom then
|
|
EgtZoomObject( nPieceToZoom)
|
|
else
|
|
EgtZoom( SCE_ZM.OUT)
|
|
end
|
|
local sExport = sFileDir..sFileName..sNumGroup.. '_TableView' ..'.png'
|
|
local cColor3d1, cColor3d2 = EgtGetBackground()
|
|
if cColor3d1 and cColor3d2 then
|
|
bExport = EgtGetImage( SCE_SM.SH, cColor3d1, cColor3d2, dWidthImg, dHeightImg, sExport)
|
|
end
|
|
end
|
|
-- riporto tutto come prima, per prima la macchina nel MachAux
|
|
if nMachAux and #nMachAux == 1 then
|
|
local nIdMachine = EgtGetFirstInGroup( nMachAux[1])
|
|
-- nascono tutte le macchine
|
|
while nIdMachine do
|
|
EgtSetStatus( nIdMachine, GDB_ST.OFF)
|
|
nIdMachine = EgtGetNext( nIdMachine)
|
|
end
|
|
end
|
|
-- nascono i gruppi nel MachBase
|
|
if nMachBase and #nMachBase == 1 then
|
|
local nIdMachGroup = EgtGetFirstInGroup( nMachBase[1])
|
|
-- nascono tutti i gruppi di lavoro
|
|
while nIdMachGroup do
|
|
EgtSetStatus( nIdMachGroup, GDB_ST.OFF)
|
|
nIdMachGroup = EgtGetNext( nIdMachGroup)
|
|
end
|
|
end
|
|
-- rendo visibile i pezzi
|
|
local nPieceId = EgtGetFirstInGroup( GDB_ID.ROOT)
|
|
-- se sono presenti i due/tre gruppi
|
|
if nMachBase and #nMachBase == 1 and nMachAux and #nMachAux == 1 then
|
|
while nPieceId do
|
|
-- se pezzo esiste ed è diverso dagli altri
|
|
if nPieceId ~= nMachBase[1] and nPieceId ~= nMachAux[1] then
|
|
if nVMill then
|
|
if nPieceId ~= nVMill[1] then
|
|
-- rendo visiblie il gruppo
|
|
EgtSetStatus( nPieceId, GDB_ST.ON)
|
|
end
|
|
else
|
|
-- rendo visiblie il gruppo
|
|
EgtSetStatus( nPieceId, GDB_ST.ON)
|
|
end
|
|
end
|
|
nPieceId = EgtGetNext( nPieceId)
|
|
end
|
|
end
|
|
-- rientro nel machining
|
|
EgtSetCurrMachGroup( tMchId[v][2])
|
|
EgtSetCurrPhase(nCurrPhase)
|
|
end
|
|
EgtSaveFile()
|
|
end
|
|
|
|
-- cancello e ricreo il file txt
|
|
EgtEraseFile( sFileDir..sFileName..sNumGroup..'.txt')
|
|
--ricreo il file txt con la disposizione
|
|
WriteErrFile( sFileDir..sFileName..sNumGroup..'.txt', sTotDispMode)
|
|
else -- altrimenti errore cn
|
|
|
|
-- se le lavorazioni e la simulazione sono corrette ma errore nella generazione
|
|
if bMachOk and bSimOk then
|
|
DGD.ERR = 20
|
|
DGD.EMC = DGD.EMC .. string.format(EgtDoorsMsg[478], tMainTabPar.MN, sSetup)
|
|
end
|
|
|
|
-- cancello eventuali file immagini
|
|
EgtEraseFile( sFileDir..sFileName..sNumGroup..'_TableView'..'.html')
|
|
EgtEraseFile( sFileDir..sFileName..sNumGroup..'_TableView'..'.png')
|
|
|
|
-- cancello e ricreo il file txt
|
|
EgtEraseFile( sFileDir..sFileName..sNumGroup..'.txt')
|
|
--ricreo il file txt con la disposizione
|
|
WriteErrFile( sFileDir..sFileName..sNumGroup..'.txt')
|
|
|
|
-- se le lavorazioni sono corrette ma errore nella simulazione o generazione
|
|
if bMachOk then
|
|
-- se la simulazione è stata corretta ma errore nella generazione
|
|
if bSimOk then
|
|
-- scrivo messaggio nei file log
|
|
DoorOutLog( string.format(EgtDoorsMsg[478], tMainTabPar.MN, sSetup), 0) -- Error on Nc part program generation
|
|
|
|
-- se lanciato da DMach stampo anche un messaggio a video
|
|
if not DGD or not DGD.NCGEN then
|
|
DoorOutLog( ' Err=' .. EgtNumToString( DGD.ERR, 0), 0)
|
|
EgtOutBox( string.format(EgtDoorsMsg[478], tMainTabPar.MN, sSetup), EgtDoorsMsg[476], EgtDoorsMsg[477]) -- Error on Nc part program generation
|
|
end
|
|
-- altrimenti errore in simulazione
|
|
else
|
|
-- scrivo messaggio nei file log
|
|
DoorOutLog( EgtDoorsMsg[690], 0) -- Error on simulation
|
|
|
|
-- se lanciato da DMach stampo anche un messaggio a video
|
|
if not DGD or not DGD.NCGEN then
|
|
DoorOutLog( ' Err=' .. EgtNumToString( DGD.ERR, 0), 0)
|
|
EgtOutBox( EgtDoorsMsg[690], EgtDoorsMsg[476], EgtDoorsMsg[477]) -- Error on simulation
|
|
end
|
|
end
|
|
-- altrimenti errore nelle lavorazioni
|
|
else
|
|
-- scrivo messaggio nei file log
|
|
DoorOutLog( EgtDoorsMsg[714], 0) -- Error on machining generation
|
|
|
|
-- se lanciato da DMach stampo anche un messaggio a video
|
|
if not DGD or not DGD.NCGEN then
|
|
DoorOutLog( ' Err=' .. EgtNumToString( DGD.ERR, 0), 0)
|
|
EgtOutBox( EgtDoorsMsg[714], EgtDoorsMsg[476], EgtDoorsMsg[477]) -- Error on machining generation
|
|
end
|
|
end
|
|
return false, nNumGroup
|
|
end
|
|
|
|
--nTime = EgtStopCounter()
|
|
--if not DGD or not DGD.NCGEN then
|
|
-- EgtOutBox( string.format( 'tempo calcolato sec: %s', (nTime/1000)), 'Time3', 'Time3')
|
|
--end
|
|
|
|
-- reset librerie locali
|
|
package.loaded[MachiningsTable] = nil
|
|
package.loaded[MachiningsTableOrd] = nil
|
|
|
|
return true, nNumGroup
|
|
end
|
|
|
|
return MachiningLoc
|