111496f5a7
- primo commit.
31 lines
977 B
Lua
31 lines
977 B
Lua
-- Swap.lua by Egaltech s.r.l. 2020/04/06
|
|
-- Gestione rotazione nel piano 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', 'Rotate 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, 'Rotate Parete', 'ERROR')
|
|
return
|
|
end
|
|
|
|
-- eseguo rotazione di 90 gradi attorno asse Z
|
|
EgtRotate( nPartId, b3Solid:getCenter(), Z_AX(), 90, GDB_RT.GLOB)
|
|
EgtDraw()
|
|
|
|
-- end |