diff --git a/LuaLibs/ImportNgeFile.lua b/LuaLibs/ImportNgeFile.lua index c544630..56de604 100644 --- a/LuaLibs/ImportNgeFile.lua +++ b/LuaLibs/ImportNgeFile.lua @@ -90,23 +90,23 @@ function ImportNgeFile.Draw( CustGeomPath, CustGeomFile ) -- applico la scala if nNewLayer then - -- se è in mm - local dCompare = 1 - if DGD.bMM then - dCompare = 1 - else - dCompare = 25.4 - end -- se ha la nota che permette di scalare local bScale = EgtGetInfo( nNewPart, 'AllowScale', 'b') or false - - -- se inferiore ai 10" - if bScale and abs(DGD.LENGTH)/dCompare <= 10 and abs(DGD.WIDTH)/dCompare <= 10 then - local dLength = EgtIf( DGD.bMM, abs(DGD.LENGTH), abs(DGD.LENGTH)/dCompare) - local dWidth = EgtIf( DGD.bMM, abs(DGD.WIDTH), abs(DGD.WIDTH)/dCompare) - EgtScale(nNewPart,{{0,0,0},{1,0,0},{0,1,0},{0,0,1}}, dWidth, dLength, 1, GDB_RT.GLOB) + if bScale then + local dLength = abs( DGD.LENGTH) / EgtIf( DGD.bMM, 1, GEO.ONE_INCH) + local dWidth = abs( DGD.WIDTH) / EgtIf( DGD.bMM, 1, GEO.ONE_INCH) + -- se inferiore a 10 (come numero indipendente da unità di misura) + if bScale and dLength <= 10 and dWidth <= 10 then + EgtScale(nNewPart,{{0,0,0},{1,0,0},{0,1,0},{0,0,1}}, dWidth, dLength, 1, GDB_RT.GLOB) + end end end + + -- recupero eventuale flag di mirror + local sMirr = EgtGetInfo( nNewLayer, 'Mirror') + if sMirr then + EgtSetInfo( Lg, 'Mirror', sMirr) + end -- riloco tutti i nuovi layer dal nuovo pezzo al pezzo corrente while nNewLayer do diff --git a/Main.lua b/Main.lua index acb9af8..5743045 100644 --- a/Main.lua +++ b/Main.lua @@ -6279,16 +6279,28 @@ local function MoveGeomDecoration( nGeomId, sFace, sSideLk) local ptPos local ptRef local dZedPos = 0 - local nNewEnt - if string.lower(sFace) == 'keyway' then -- se specificato face su lato keyway (davanti) + local bMirror = ( EgtGetInfo( nGeomId, 'Mirror', 'i') ~= 0) + + local b3Box = EgtGetBBox( nGeomId, GDB_BB.STANDARD) + EgtOutLog( 'Decoration Box ='.. tostring( b3Box)) + + if string.lower( sFace) == 'keyway' then -- se specificato face su lato keyway (davanti) dZedPos = DGD.dT - elseif string.lower(sFace) == 'secure' then -- se specificato face su lato secure (dietro) - -- faccio il mirror di tutte le geometrie su asse Z - nNewEnt = EgtGetFirstInGroup( nGeomId) -- ottengo nuova entità + elseif string.lower( sFace) == 'secure' then -- se specificato face su lato secure (dietro) + -- faccio il mirror di tutte le geometrie rispetto al piano XY + local nNewEnt = EgtGetFirstInGroup( nGeomId) while nNewEnt do - EgtMirror( nNewEnt, ORIG(), Z_AX()) -- faccio il mirror su asse Z - nNewEnt = EgtGetNext(nNewEnt) + EgtMirror( nNewEnt, ORIG(), Z_AX()) + nNewEnt = EgtGetNext( nNewEnt) + end + -- se non richiesto mirror, per annullarne l'effetto + if not bMirror then + local nNewEnt = EgtGetFirstInGroup( nGeomId) + while nNewEnt do + EgtMirror( nNewEnt, Point3d( DGD.dW / 2, 0, 0), X_AX()) + nNewEnt = EgtGetNext( nNewEnt) + end end end @@ -6306,11 +6318,20 @@ local function MoveGeomDecoration( nGeomId, sFace, sSideLk) else ptPos = Point3d( DGD.dW, 0, dZedPos) end - -- faccio il mirror di tutte le geometrie in X - nNewEnt = EgtGetFirstInGroup( nGeomId) -- ottengo nuova entità - while nNewEnt do - EgtMirror( nNewEnt, ORIG(), X_AX()) -- faccio il mirror in X - nNewEnt = EgtGetNext(nNewEnt) + -- se ammesso, faccio il mirror di tutte le geometrie sul piano YZ + if bMirror then + local nNewEnt = EgtGetFirstInGroup( nGeomId) + while nNewEnt do + EgtMirror( nNewEnt, ORIG(), X_AX()) + nNewEnt = EgtGetNext( nNewEnt) + end + else + local vtMove = Vector3d( - 2 * b3Box:getCenter():getX(), 0, 0) + local nNewEnt = EgtGetFirstInGroup( nGeomId) + while nNewEnt do + EgtMove( nNewEnt, vtMove) + nNewEnt = EgtGetNext( nNewEnt) + end end end diff --git a/Version.lua b/Version.lua index 45230c0..235e052 100644 --- a/Version.lua +++ b/Version.lua @@ -1,6 +1,6 @@ --- Version.lua by EgalWare s.r.l. 2025/05/05 +-- Version.lua by EgalWare s.r.l. 2025/05/13 -- Gestione della versione di Doors NAME = 'Doors' -VERSION = '2.7e1' +VERSION = '2.7e2' MIN_EXE = '2.6k4'