diff --git a/BatchProcess.lua b/BatchProcess.lua index a19ef4b..1a69cb0 100644 --- a/BatchProcess.lua +++ b/BatchProcess.lua @@ -1,7 +1,8 @@ --- BatchProcess.lua by Egaltech s.r.l. 2020/10/28 +-- BatchProcess.lua by Egaltech s.r.l. 2020/12/03 -- Gestione calcolo batch disposizione e lavorazioni per Pareti -- 2020/07/24 Nuvola di punti riferita allo Zero Tavola. -- 2020/10/28 Corretto spostamento pezzi per rotazioni (0 o 180) e inversioni( 0, 90, 180, o 270). +-- 2020/12/03 Ora riconosciute rotazioni di inversione con angoli negativi. -- Intestazioni @@ -266,7 +267,7 @@ if bToProcess then -- inversione local dInvAng = EgtGetInfo( vWall[i].Id, 'INVERTED', 'd') if dInvAng then - if abs( dInvAng - 180) > GEO.EPS_ANG_SMALL then + if abs( dInvAng - 180) > GEO.EPS_ANG_SMALL and abs( dInvAng + 180) > GEO.EPS_ANG_SMALL then local ptInvCen = b3Solid:getCenter() EgtRotate( vWall[i].Id, ptInvCen, Z_AX(), dInvAng - 180, GDB_RT.GLOB) b3Solid:rotate( ptInvCen, Z_AX(), dInvAng - 180) @@ -279,17 +280,17 @@ if bToProcess then if abs( dRotAng - 180) < GEO.EPS_ANG_SMALL then vWall[i].PosZ = vWall[i].PosZ - vWall[i].Box:getDimY() end - elseif abs( dInvAng - 90) < GEO.EPS_ANG_SMALL then + elseif abs( dInvAng - 90) < GEO.EPS_ANG_SMALL or abs( dInvAng + 270) < GEO.EPS_ANG_SMALL then vWall[i].PosZ = vWall[i].PosZ - vWall[i].Box:getDimY() if abs( dRotAng - 180) < GEO.EPS_ANG_SMALL then vWall[i].PosX = vWall[i].PosX - vWall[i].Box:getDimX() end - elseif abs( dInvAng - 180) < GEO.EPS_ANG_SMALL then + elseif abs( dInvAng - 180) < GEO.EPS_ANG_SMALL or abs( dInvAng + 180) < GEO.EPS_ANG_SMALL then vWall[i].PosX = vWall[i].PosX - vWall[i].Box:getDimX() if abs( dRotAng - 0) < GEO.EPS_ANG_SMALL then vWall[i].PosZ = vWall[i].PosZ - vWall[i].Box:getDimY() end - elseif abs( dInvAng - 270) < GEO.EPS_ANG_SMALL then + elseif abs( dInvAng - 270) < GEO.EPS_ANG_SMALL or abs( dInvAng + 90) < GEO.EPS_ANG_SMALL then if abs( dRotAng - 0) < GEO.EPS_ANG_SMALL then vWall[i].PosX = vWall[i].PosX - vWall[i].Box:getDimX() end diff --git a/Process.lua b/Process.lua index 341d715..1425ab3 100644 --- a/Process.lua +++ b/Process.lua @@ -1,6 +1,7 @@ --- Process.lua by Egaltech s.r.l. 2020/11/18 +-- Process.lua by Egaltech s.r.l. 2020/12/09 -- Gestione calcolo disposizione e lavorazioni per Pareti -- Si opera sulla macchina corrente +-- 2020/12/09 Come per BatchProcess.lua si gestiscono anche rotazioni di inversione con valori negativi. -- Intestazioni require( 'EgtBase') @@ -118,21 +119,33 @@ local function MyProcessInputData() -- inversione local dInvAng = EgtGetInfo( vWall[i].Id, 'INVERTED', 'd') if dInvAng then - if abs( dInvAng - 180) > GEO.EPS_ANG_SMALL and not EgtExistsInfo( vWall[i].Id, 'INVERTED_DONE') then + if abs( dInvAng - 180) > GEO.EPS_ANG_SMALL and abs( dInvAng + 180) > GEO.EPS_ANG_SMALL and not EgtExistsInfo( vWall[i].Id, 'INVERTED_DONE') then local ptInvCen = b3Solid:getCenter() EgtRotate( vWall[i].Id, ptInvCen, Z_AX(), dInvAng - 180, GDB_RT.GLOB) + b3Solid:rotate( ptInvCen, Z_AX(), dInvAng - 180) end EgtSetInfo( vWall[i].Id, 'INVERTED_DONE', dInvAng) end -- correzioni per rotazioni non centrate di produzioni di TS3 (quasi sempre 0 o 180 deg) if not bProj and dRotAng and dInvAng then - if abs( dInvAng) > GEO.EPS_ANG_SMALL then - vWall[i].PosX = vWall[i].PosX - vWall[i].Box:getDimX() - if abs( dRotAng) < GEO.EPS_ANG_SMALL then + if abs( dInvAng - 0) < GEO.EPS_ANG_SMALL then + if abs( dRotAng - 180) < GEO.EPS_ANG_SMALL then vWall[i].PosZ = vWall[i].PosZ - vWall[i].Box:getDimY() end - elseif abs( dRotAng) > GEO.EPS_ANG_SMALL then + elseif abs( dInvAng - 90) < GEO.EPS_ANG_SMALL or abs( dInvAng + 270) < GEO.EPS_ANG_SMALL then vWall[i].PosZ = vWall[i].PosZ - vWall[i].Box:getDimY() + if abs( dRotAng - 180) < GEO.EPS_ANG_SMALL then + vWall[i].PosX = vWall[i].PosX - vWall[i].Box:getDimX() + end + elseif abs( dInvAng - 180) < GEO.EPS_ANG_SMALL or abs( dInvAng + 180) < GEO.EPS_ANG_SMALL then + vWall[i].PosX = vWall[i].PosX - vWall[i].Box:getDimX() + if abs( dRotAng - 0) < GEO.EPS_ANG_SMALL then + vWall[i].PosZ = vWall[i].PosZ - vWall[i].Box:getDimY() + end + elseif abs( dInvAng - 270) < GEO.EPS_ANG_SMALL or abs( dInvAng + 90) < GEO.EPS_ANG_SMALL then + if abs( dRotAng - 0) < GEO.EPS_ANG_SMALL then + vWall[i].PosX = vWall[i].PosX - vWall[i].Box:getDimX() + end end end end