-- Rotate.lua by Egaltech s.r.l. 2020/04/06 -- Gestione ribaltamento di una Parete -- Intestazioni require( 'EgtBase') _ENV = EgtProtectGlobal() EgtEnableDebug( false) -- recupero il pezzo del primo oggetto selezionato local nId = EgtGetFirstSelectedObj() local nPartId = EgtGetParent( EgtGetParent( nId or GDB_ID.NULL) or GDB_ID.NULL) if not nPartId or not EgtIsPart( nPartId) then EgtOutBox( 'Nessuna parete selezionata', 'Overturn Parete', 'ERROR') return end -- recupero il box del pezzo local Ls = EgtGetFirstNameInGroup( nPartId, 'Box') local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD) if not b3Solid then local sName = EgtGetName( nPartId) or ( 'Id=' .. tonumber( nPartId)) EgtOutBox( 'Box non definito per la parete ' .. sName, 'Overturn Parete', 'ERROR') return end -- eseguo rotazione di 180 gradi attorno asse X local ptRot = b3Solid:getMin() + Vector3d( 0, b3Solid:getDimY() / 2, b3Solid:getDimZ() / 2) EgtRotate( nPartId, ptRot, X_AX(), 180, GDB_RT.GLOB) EgtDraw() -- end