-- 2018/06/20 -- Offset di una regione -- Istruzioni : -- 1) selezionare la regione -- 2) eseguire il componente -- 3) inserire i parametri richiesti nel dialogo. -- Intestazioni require( 'EgtBase') _ENV = EgtProtectGlobal() EgtEnableDebug( false) -- Recupero primo oggetto selezionato (regione da offsettare) 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 -- Chiedo i parametri di offset local vsVal = EgtDialogBox( 'Region Offset', { 'Distanza', '0.0'}, { 'Tipo', 'CB:Raccordo,Smusso,Estendi'}, { 'Copia', 'CB:True,*False'}) if not vsVal or #vsVal ~= 3 then return end local dDist = tonumber( vsVal[1]) local nType = GDB_OT.FILLET if vsVal[2] == 'Smusso' then nType = GDB_OT.CHAMFER elseif vsVal[2] == 'Estendi' then nType = GDB_OT.EXTEND end local bCopy = true if vsVal[3] == 'False' then bCopy = false end -- Se richiesta copia, la eseguo local nId2 = nId1 if bCopy then nId2 = EgtCopy( nId1, nId1, GDB_IN.AFTER) if not nId2 then EgtOutText( 'Errore nella copia della regione') EgtPause( 1000) end end -- Eseguo l'offset della superficie local bOk = EgtSurfFrOffset( nId2, dDist, nType) -- Se copia, sistemazioni finali if bCopy then if bOk then EgtSetAlpha( nId1, 30) else EgtErase( nId2) end end EgtDraw()