diff --git a/Beam.ini b/Beam.ini index a7ddf23..f296cf4 100644 --- a/Beam.ini +++ b/Beam.ini @@ -11,4 +11,5 @@ Button6=EnableFeatures.lua,Images\EnableFeatures.png,Abilita lavorazioni Button7=BeamMachinings,Images\BeamMachinings.png,Lista lavorazioni Button8=HideAll.lua,Images\HideAll.png,Nascondi tutte le travi non selezionate Button9=ShowAll.lua,Images\ShowAll.png,Visualizza tutte le travi -Button10=ShowBuilding.lua,Images\ShowBuilding.png,Visualizza struttura/Visualizza pezzi +Button10=ShowSolid.lua,Images\ShowSolid.png,Visualizza/Nascondi solido +Button11=ShowBuilding.lua,Images\ShowBuilding.png,Visualizza struttura/Visualizza pezzi diff --git a/DisableFeatures.lua b/DisableFeatures.lua index bf26326..d6d781e 100644 --- a/DisableFeatures.lua +++ b/DisableFeatures.lua @@ -1,4 +1,4 @@ --- DisableFeatures.lua by Egaltech s.r.l. 2018/04/25 +-- DisableFeatures.lua by Egaltech s.r.l. 2019/11/22 -- Gestione disabilitazione delle feature selezionate -- Intestazioni @@ -10,11 +10,15 @@ if EgtGetSelectedObjCount() == 0 then EgtOutBox( 'Nessuna lavorazione selezionata', 'Disabilita lavorazioni', 'ERROR') end +-- Elenco dei pezzi interessati +local vParts = {} + +-- Disabilito features selezionate local nId = EgtGetFirstSelectedObj() while nId do -- verifico sia una feature local nParentId = EgtGetParent( nId) - if EgtIsLayer( nParentId) and EgtGetName( nParentId) == 'Processings' and + if EgtIsLayer( nParentId or GDB_ID.NULL) and EgtGetName( nParentId) == 'Processings' and EgtGetInfo( nId, 'GRP', 'i') and EgtGetInfo( nId, 'PRC', 'i') then EgtSetInfo( nId, 'DO', 0) EgtSetColor( nId, Color3d( 160, 160, 160)) @@ -22,10 +26,22 @@ while nId do if nAuxId then EgtSetColor( nId + nAuxId, Color3d( 160, 160, 160)) end + table.insert( vParts, EgtGetParent( nParentId)) end nId = EgtGetNextSelectedObj() end +-- Cancello eventuale solido dei pezzi interessati +table.sort( vParts) +local PrevPartId = GDB_ID.NULL +for i = 1, #vParts do + if vParts[i] ~= PrevPartId then + local SolidLy = EgtGetFirstNameInGroup( vParts[i], 'Solid') + EgtErase( SolidLy or GDB_ID.NULL) + PrevPartId = vParts[i] + end +end + EgtDeselectAll() EgtZoom( SCE_ZM.ALL) diff --git a/EnableFeatures.lua b/EnableFeatures.lua index e077e94..517c5d3 100644 --- a/EnableFeatures.lua +++ b/EnableFeatures.lua @@ -1,4 +1,4 @@ --- DisableFeatures.lua by Egaltech s.r.l. 2018/04/25 +-- DisableFeatures.lua by Egaltech s.r.l. 2019/11/22 -- Gestione abilitazione delle feature selezionate -- Intestazioni @@ -10,11 +10,15 @@ if EgtGetSelectedObjCount() == 0 then EgtOutBox( 'Nessuna lavorazione selezionata', 'Abilita lavorazioni', 'ERROR') end +-- Elenco dei pezzi interessati +local vParts = {} + +-- Abilito features selezionate local nId = EgtGetFirstSelectedObj() while nId do -- verifico sia una feature local nParentId = EgtGetParent( nId) - if EgtIsLayer( nParentId) and EgtGetName( nParentId) == 'Processings' and + if EgtIsLayer( nParentId or GDB_ID.NULL) and EgtGetName( nParentId) == 'Processings' and EgtGetInfo( nId, 'GRP', 'i') and EgtGetInfo( nId, 'PRC', 'i') then EgtRemoveInfo( nId, 'DO') EgtResetColor( nId) @@ -22,10 +26,22 @@ while nId do if nAuxId then EgtResetColor( nId + nAuxId) end + table.insert( vParts, EgtGetParent( nParentId)) end nId = EgtGetNextSelectedObj() end +-- Cancello eventuale solido dei pezzi interessati +table.sort( vParts) +local PrevPartId = GDB_ID.NULL +for i = 1, #vParts do + if vParts[i] ~= PrevPartId then + local SolidLy = EgtGetFirstNameInGroup( vParts[i], 'Solid') + EgtErase( SolidLy or GDB_ID.NULL) + PrevPartId = vParts[i] + end +end + EgtDeselectAll() EgtZoom( SCE_ZM.ALL) diff --git a/Images/ShowSolid.png b/Images/ShowSolid.png new file mode 100644 index 0000000..383a95e Binary files /dev/null and b/Images/ShowSolid.png differ diff --git a/ShowSolid.lua b/ShowSolid.lua new file mode 100644 index 0000000..2663b15 --- /dev/null +++ b/ShowSolid.lua @@ -0,0 +1,65 @@ +-- ShowSolid.lua by Egaltech s.r.l. 2019/11/22 +-- Gestione calcolo solido di una Trave + +require( 'EgtBase') +_ENV = EgtProtectGlobal() +EgtEnableDebug( false) + +-- Funzione per visualizzazione del solido o standard +local function Show( PartId, bSolid) + local BoxLy = EgtGetFirstNameInGroup( PartId, 'Box') + EgtSetStatus( BoxLy or GDB_ID.NULL, EgtIf( bSolid, GDB_ST.OFF, GDB_ST.ON)) + local OutlineLy = EgtGetFirstNameInGroup( PartId, 'Outline') + EgtSetStatus( OutlineLy or GDB_ID.NULL, EgtIf( bSolid, GDB_ST.OFF, GDB_ST.ON)) + local ProcessingsLy = EgtGetFirstNameInGroup( PartId, 'Processings') + EgtSetStatus( ProcessingsLy or GDB_ID.NULL, EgtIf( bSolid, GDB_ST.OFF, GDB_ST.ON)) + local SolidLy = EgtGetFirstNameInGroup( PartId, 'Solid') + EgtSetStatus( SolidLy or GDB_ID.NULL, EgtIf( bSolid, GDB_ST.ON, GDB_ST.OFF)) +end + +-- Recupero il pezzo del primo oggetto selezionato +local ObjId = EgtGetFirstSelectedObj() +local PartId = EgtGetParent( EgtGetParent( ObjId or GDB_ID.NULL) or GDB_ID.NULL) +if not PartId or not EgtIsPart( PartId) then + EgtOutBox( 'Nessuna trave selezionata', 'Show Solid', 'ERROR') + return +end +EgtDeselectAll() + +-- Recupero il Box +local BoxLy = EgtGetFirstNameInGroup( PartId, 'Box') +local BoxId = EgtGetFirstNameInGroup( BoxLy or GDB_ID.NULL, 'Box') +if not BoxId then + EgtOutBox( 'Trave senza Box', 'Show Solid', 'ERROR') + return +end + +-- Verifico esistenza del solido +local SolidLy = EgtGetFirstNameInGroup( PartId, 'Solid') +if not SolidLy then + SolidLy = EgtGroup( PartId) + EgtSetName( SolidLy, 'Solid') +end +local SolidId = EgtGetFirstNameInGroup( SolidLy, 'Solid') +if not SolidId then + SolidId = EgtCopyGlob( BoxId, SolidLy) + EgtSetName( SolidId, 'Solid') + EgtSetAlpha( SolidId, 100) + Show( PartId, true) +else + Show( PartId, ( EgtGetStatus( SolidLy) == GDB_ST.OFF)) + EgtDraw() + return +end + +-- Ciclo sulle features +local ProcLy = EgtGetFirstNameInGroup( PartId, 'Processings') +local ProcId = EgtGetFirstInGroup( ProcLy) +while ProcId do + if EgtGetInfo( ProcId, 'DO', 'i') ~= 0 and EgtGetType( ProcId) == GDB_TY.SRF_MESH then + EgtSurfTmIntersect( SolidId, ProcId) + end + ProcId = EgtGetNext( ProcId) +end + +EgtDraw()