diff --git a/LuaLibs/EgtDoorsMsg.lua b/LuaLibs/EgtDoorsMsg.lua index 56590fc..0015896 100644 --- a/LuaLibs/EgtDoorsMsg.lua +++ b/LuaLibs/EgtDoorsMsg.lua @@ -438,7 +438,7 @@ else -- default 'ENG' EgtDoorsMsg[528] = " Disposition for Cms-PF122R8RR :" EgtDoorsMsg[529] = " Disposition for Multiax-N1216 :" EgtDoorsMsg[530] = " Error on MOBILE or FIXED table bar" - EgtDoorsMsg[531] = " Error on vacuum disposition: the active vacuums are not enought. Check the cutout geometries or hardware machinings near vacuums" + EgtDoorsMsg[531] = " Error on vacuum disposition: the active vacuums are not enough. Check the cutout geometries or hardware machinings near vacuums" EgtDoorsMsg[532] = " Error on vacuum disposition: too many disabled vacuums on left side door. Check the cutout geometries or hardware machinings near vacuums" EgtDoorsMsg[533] = " Error on vacuum disposition: too many disabled vacuums on middle door. Check the cutout geometries or hardware machinings near vacuums" EgtDoorsMsg[534] = " Error on vacuum disposition: too many disabled vacuums on right side door. Check the cutout geometries or hardware machinings near vacuums" @@ -560,7 +560,7 @@ else -- default 'ENG' EgtDoorsMsg[680] = " Error reading Profiles: radius parameters of top side arc makes the length of one side null. Check Top Arc parameters (into ddf file)" EgtDoorsMsg[681] = " Warning! (%s) Into model: %s of piece: %s the parameter %s value %s is modified to: %s because it's bigger or near than jamb thickness: %s " EgtDoorsMsg[682] = " Error in table setting. Verify the parameters nNumTableOnMachine and nNumTableForOtherMaterial into CurrcamInfo.lua file" - EgtDoorsMsg[683] = " Error on vise disposition: the active vises are not enought. Check the hardware machinings near vises" + EgtDoorsMsg[683] = " Error on vise disposition: the active vises are not enough. Check the hardware machinings near vises" EgtDoorsMsg[684] = " Error on vise disposition: too many disabled vises on left side frame. Check the hardware machinings near vises" EgtDoorsMsg[685] = " Error on vise disposition: too many disabled vises on right side frame. Check the hardware machinings near vises" EgtDoorsMsg[686] = " Error starting simulation: %s" diff --git a/Machining_4.lua b/Machining_4.lua index 1d3f32e..d1a7050 100644 --- a/Machining_4.lua +++ b/Machining_4.lua @@ -4178,26 +4178,31 @@ function MachiningLoc.Calc( tPz, tsAssemb, nNumMachFromTable, nNumMachFromCam, n -- riassegno la quantità di file che effettivamente potrebbero essere alzate nInd = nInd - 1 - -- casi di scarse ventose - if nInd > 0 and ( nMaxIniFailed == nInd or nMaxMiddleFailed == nInd or nMaxEndFailed == nInd) then -- tutte le ventose basse + -- casi di scarse ventose : + -- tutte le ventose basse + if nInd > 0 and ( nMaxIniFailed == nInd or nMaxMiddleFailed == nInd or nMaxEndFailed == nInd) then DGD.EMC = ' ' .. EgtDoorsMsg[531] bOk = false break - elseif nInd > 0 and nMaxIniFailed / nInd > 0.35 then -- ventose iniziali ( parte destra) + -- ventose iniziali ( parte destra) + elseif nInd > 0 and nMaxIniFailed / nInd > 0.35 then local nNumMsg = EgtIf( nDispMode > 0, 532, 534) DGD.EMC = ' ' .. EgtDoorsMsg[nNumMsg] bOk = false break - elseif nInd > 0 and nMaxMiddleFailed / nInd > 0.45 then -- ventose intermedie + -- ventose intermedie + elseif nInd > 0 and nMaxMiddleFailed / nInd > 0.45 then DGD.EMC = ' ' .. EgtDoorsMsg[533] bOk = false break - elseif nInd > 0 and nMaxEndFailed / nInd > 0.35 then -- ventose finale ( parte sinistra) + -- ventose finali ( parte sinistra) + elseif nInd > 0 and nMaxEndFailed / nInd > 0.35 then local nNumMsg = EgtIf( nDispMode > 0, 534, 532) DGD.EMC = ' ' .. EgtDoorsMsg[nNumMsg] bOk = false break - elseif ( nMaxIniFailed + nMaxMiddleFailed + nMaxEndFailed) >= nInd/2 then -- somma di vari intervalli + -- somma di vari intervalli + elseif ( nMaxIniFailed + nMaxMiddleFailed + nMaxEndFailed) >= nInd/2 then DGD.EMC = ' ' .. EgtDoorsMsg[531] bOk = false break diff --git a/Main.lua b/Main.lua index 8e718b9..acb9af8 100644 --- a/Main.lua +++ b/Main.lua @@ -1,16 +1,4 @@ --- --- 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 --- --- Main.lua by EgalWare s.r.l. 2016.05.28 +-- Main.lua by EgalWare s.r.l. 2025.05.06 -- Main creazione porte da descrizione DDF -- 2016.09.07 V1.001 FM Modificata gestione flush bolt -- 2016.09.14 V1.002 FM Aggiunta gestione log file @@ -113,6 +101,7 @@ -- 2022.08.31 V3.00d FM Manage groove applied on top angle -- 2022.11.15 V3.00e FM Manage side grove region as throu region and not as blind region -- 2023.04.26 V3.00f FM Manage new DDF format by new ddf version number parameter +-- 2023.04.27 Max num error message DGD.ERR = 28 -- 2023.05.11 V3.010 FM Read new ddf group 'options:' (actually not used) at the end of ddf file -- 2023.09.07 V3.011 FM try to delete the .tok file (it's a copy of .txt file) that dProd uses -- 2023.12.01 V3.012 FM Manage new CurrDoorCustomData parameter DGC.CVP to define a small line on both corner of Convex profile @@ -122,8 +111,7 @@ -- 2024.10.15 V3.016 FM Manage new DGC.NPM parameter to indicate new DGD.PROBE meaning -- 2024.10.31 V3.017 FM Manage probe id number and note 'ProbeId' on geometries that have hinge or lock probe geometry -- 202x.xx.xx V3.xxx FM Manage new CurrCamInfo parameter 'WideDoorWidth' to manage large wide doors stored into new DGD.Part parameter - --- 2023.04.27 Max num error message DGD.ERR = 28 +-- 2025.05.06 v2.7e1 DS Correzione funzione SubAndDeleteTempSurf. -- Intestazioni require( 'EgtBase') @@ -134,7 +122,6 @@ if not _G.DGD then _G.DGD = {} end ---local sBaseDir = EgtGetSourceDir() local sBaseDir = DGD.BASEDIR EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua') EgtAddToPackagePath( sBaseDir .. 'MTables\\?.mtl') @@ -236,17 +223,20 @@ end ----------------------------------------------------------------- -- *** Geometry Calc *** ----------------------------------------------------------------- -local function CalcSideRectTringle( nCat1, nCat2, nIpo) +local function CalcSideRectTringle( dCat1, dCat2, dIpo) - local nSide = 0 - if not nIpo then -- se non ho l'ipotenusa - nSide = sqrt((nCat1*nCat1)+(nCat2*nCat2)) - elseif not nCat1 then -- se manca cateto 1 - nSide = sqrt(abs((nIpo*nIpo)-(nCat2*nCat2))) -- use abs in case the sub results is near 0 but negative value - elseif not nCat2 then -- se manca cateto 2 - nSide = sqrt(abs((nIpo*nIpo)-(nCat1*nCat1))) -- use abs in case the sub results is near 0 but negative value + local dSide = 0 + -- se manca ipotenusa + if not dIpo then + dSide = sqrt( ( dCat1 * dCat1) + ( dCat2 * dCat2)) + -- se manca cateto 1 + elseif not dCat1 then + dSide = sqrt( max( ( dIpo * dIpo) - ( dCat2 * dCat2), 0)) + -- se manca cateto 2 + elseif not dCat2 then + dSide = sqrt( max( ( dIpo * dIpo) - ( dCat1 * dCat1), 0)) end - return nSide + return dSide end ----------------------------------------------------------------- @@ -7475,65 +7465,92 @@ end ----------------------------------------------------------------- local function SubAndDeleteTempSurf( nIdLs) - local nIdSurf - local sSurfName + -- ricerca delle superfici princiapli local nIdSurfUp local nIdSurfDw - local nIdSurfTmpUp - local nIdSurfTmpDw - local bFisrtUp = true - local bFisrtDw = true - - nIdSurf = EgtGetFirstInGroup( nIdLs) -- ottengo la prima superfice + local nIdSurf = EgtGetFirstInGroup( nIdLs) + while nIdSurf and ( not nIdSurfUp or not nIdSurfDw) do + -- nome della superficie + local sSurfName = EgtGetName( nIdSurf) + -- se trovata superfice up principale + if not nIdSurfUp and sSurfName and string.lower( sSurfName) == 'flat_up' then + nIdSurfUp = nIdSurf + end + -- se trovata superfice dw principale + if not nIdSurfDw and sSurfName and string.lower( sSurfName) == 'flat_dw' then + nIdSurfDw = nIdSurf + end + -- passo alla successiva + nIdSurf = EgtGetNext( nIdSurf) + end + + -- creo superfici temporanee di inviluppo rettangolare delle principali + local nIdRectHullUp + if nIdSurfUp then + local b3SurfUp = EgtGetBBox( nIdSurfUp, GDB_BB.STANDARD) + nIdRectHullUp = EgtSurfFrRectangle( nIdLs, b3SurfUp:getMin(), b3SurfUp:getMax()) + if EgtSurfFrNormVersor( nIdSurfUp) * EgtSurfFrNormVersor( nIdRectHullUp) < 0 then + EgtInvertSurf( nIdRectHullUp) + end + end + local nIdRectHullDw + if nIdSurfDw then + local b3SurfDw = EgtGetBBox( nIdSurfDw, GDB_BB.STANDARD) + nIdRectHullDw = EgtSurfFrRectangle( nIdLs, b3SurfDw:getMin(), b3SurfDw:getMax()) + if EgtSurfFrNormVersor( nIdSurfDw) * EgtSurfFrNormVersor( nIdRectHullDw) < 0 then + EgtInvertSurf( nIdRectHullDw) + end + end + -- ciclo sulle superfici del gruppo + nIdSurf = EgtGetFirstInGroup( nIdLs) while nIdSurf do - sSurfName = EgtGetName( nIdSurf) - local nNextId = EgtGetNext(nIdSurf) - - -- se trovata superfice up principale - if sSurfName and bFisrtUp and string.lower(sSurfName) == 'flat_up' then - nIdSurfUp = nIdSurf - bFisrtUp = false - end - - -- se trovata superfice dw principale - if sSurfName and bFisrtDw and string.lower(sSurfName) == 'flat_dw' then - nIdSurfDw = nIdSurf - bFisrtDw = false - end + local sSurfName = EgtGetName( nIdSurf) + local nNextId = EgtGetNext( nIdSurf) -- se superfice up temporanea la sottraggo alla principale e poi la elimino - if sSurfName and string.lower(sSurfName) == 'flat_up_tmp' then - nIdSurfTmpUp = nIdSurf + if nIdSurfUp and sSurfName and string.lower( sSurfName) == 'flat_up_tmp' then + local nIdSurfTmpUp = nIdSurf EgtSurfFrSubtract( nIdSurfUp, nIdSurfTmpUp) - EgtErase(nIdSurfTmpUp) + EgtErase( nIdSurfTmpUp) end -- se superfice dw temporanea la sottraggo alla principale e poi la elimino - if sSurfName and string.lower(sSurfName) == 'flat_dw_tmp' then - nIdSurfTmpDw = nIdSurf + if nIdSurfDw and sSurfName and string.lower( sSurfName) == 'flat_dw_tmp' then + local nIdSurfTmpDw = nIdSurf EgtSurfFrSubtract( nIdSurfDw, nIdSurfTmpDw) - EgtErase(nIdSurfTmpDw) + EgtErase( nIdSurfTmpDw) end -- se superfice up temporanea speciale (da percorsi di hatching) la sommo alla principale e poi la elimino - if sSurfName and string.lower(sSurfName) == 'flat_up_tmp_sp' then - nIdSurfTmpUp = nIdSurf - EgtSurfFrAdd( nIdSurfUp, nIdSurfTmpUp) - EgtErase(nIdSurfTmpUp) + if nIdSurfUp and nIdRectHullUp and sSurfName and string.lower( sSurfName) == 'flat_up_tmp_sp' then + local nIdSurfTmpUp = nIdSurf + EgtSurfFrIntersect( nIdSurfTmpUp, nIdRectHullUp) + if EgtExistsObj( nIdSurfTmpUp) then + EgtSurfFrAdd( nIdSurfUp, nIdSurfTmpUp) + EgtErase( nIdSurfTmpUp) + end end -- se superfice dw temporanea speciale (da percorsi di hatching) la sommo alla principale e poi la elimino - if sSurfName and string.lower(sSurfName) == 'flat_dw_tmp_sp' then - nIdSurfTmpDw = nIdSurf - EgtSurfFrAdd( nIdSurfDw, nIdSurfTmpDw) - EgtErase(nIdSurfTmpDw) + if nIdSurfUp and nIdRectHullDw and sSurfName and string.lower( sSurfName) == 'flat_dw_tmp_sp' then + local nIdSurfTmpDw = nIdSurf + EgtSurfFrIntersect( nIdSurfTmpDw, nIdRectHullDw) + if EgtExistsObj( nIdSurfTmpDw) then + EgtSurfFrAdd( nIdSurfDw, nIdSurfTmpDw) + EgtErase( nIdSurfTmpDw) + end end + -- passo alla successiva nIdSurf = nNextId end + -- cancello le superfici di inviluppo temporanee + EgtErase( nIdRectHullUp) + EgtErase( nIdRectHullDw) + return true end