-- Rotate.lua by Egaltech s.r.l. 2017/11/04 -- Gestione rotazione di una Trave -- 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 trave selezionata', 'Rotate Trave', '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 trave ' .. sName, 'Rotate Trave', 'ERROR') return end -- eseguo rotazione di 90 gradi attorno asse X local ptRot = b3Solid:getMin() + Vector3d( 0, b3Solid:getDimZ() / 2, b3Solid:getDimZ() / 2) EgtRotate( nPartId, ptRot, X_AX(), 90, GDB_RT.GLOB) EgtDraw() -- end