Files
Dario Sassi 6eaba8a577 DataBeam :
- primo rilascio.
2019-04-01 15:18:51 +00:00

31 lines
969 B
Lua

-- Swap.lua by Egaltech s.r.l. 2017/11/02
-- Gestione scambio testa coda 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', 'Swap 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, 'Swap Trave', 'ERROR')
return
end
-- eseguo rotazione di 180 gradi attorno asse Z
EgtRotate( nPartId, b3Solid:getCenter(), Z_AX(), 180, GDB_RT.GLOB)
EgtDraw()
-- end