42 lines
923 B
Lua
42 lines
923 B
Lua
-- 2018/06/21
|
|
-- Unione booleana di due regioni
|
|
-- Istruzioni :
|
|
-- 1) selezionare le due
|
|
-- 2) eseguire il componente
|
|
|
|
-- Intestazioni
|
|
require( 'EgtBase')
|
|
_ENV = EgtProtectGlobal()
|
|
EgtEnableDebug( false)
|
|
|
|
|
|
-- Recupero primo oggetto selezionato (regione)
|
|
local nId1 = EgtGetFirstSelectedObj()
|
|
if not nId1 or EgtGetType( nId1) ~= GDB_TY.SRF_FRGN then
|
|
EgtOutText( 'Il primo oggetto selezionato non è una regione')
|
|
EgtPause( 1000)
|
|
return
|
|
end
|
|
|
|
-- Recupero secondo oggetto selezionato (regione)
|
|
local nId2 = EgtGetNextSelectedObj()
|
|
if not nId2 or EgtGetType( nId2) ~= GDB_TY.SRF_FRGN then
|
|
EgtOutText( 'Il secondo oggetto selezionato non è una regione')
|
|
EgtPause( 1000)
|
|
return
|
|
end
|
|
|
|
-- eseguo l'unione
|
|
local bOk = EgtSurfFrAdd( nId1, nId2)
|
|
|
|
-- cancello la seconda regione
|
|
if bOk then
|
|
EgtErase( nId2)
|
|
else
|
|
EgtOutText( 'La unione tra le regioni non è riuscita')
|
|
EgtPause( 1000)
|
|
return
|
|
end
|
|
|
|
EgtDraw()
|