41 lines
1.0 KiB
Lua
41 lines
1.0 KiB
Lua
-- 2018/06/20
|
|
-- Recupero dei bordi di una regione
|
|
-- Istruzioni :
|
|
-- 1) selezionare la regione
|
|
-- 2) eseguire il componente.
|
|
|
|
-- Intestazioni
|
|
require( 'EgtBase')
|
|
_ENV = EgtProtectGlobal()
|
|
EgtEnableDebug( false)
|
|
|
|
|
|
-- Recupero primo oggetto selezionato (superficie da cui recuperare i contorni)
|
|
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
|
|
|
|
-- verifico ci sia un layer corrente in cui mettere le curve
|
|
local nDestId = EgtGetCurrLayer()
|
|
if not nDestId then
|
|
EgtOutText( 'Non è definito il layer corrente dove mettere le curve')
|
|
EgtPause( 1000)
|
|
return
|
|
end
|
|
|
|
-- Recupero i contorni della regione
|
|
local nTotChunk = EgtSurfFrChunkCount( nId1)
|
|
for nChk = 1, nTotChunk do
|
|
local nCrvFstId = EgtExtractSurfFrChunkLoops( nId1, nChk - 1, nDestId)
|
|
if not nCrvFstId then
|
|
EgtOutText( 'La superficie non ha bordi (è chiusa)')
|
|
EgtPause( 1000)
|
|
return
|
|
end
|
|
end
|
|
|
|
EgtDraw()
|