diff --git a/BatchProcessNew.lua b/BatchProcessNew.lua index 45b5c4b..fec450d 100644 --- a/BatchProcessNew.lua +++ b/BatchProcessNew.lua @@ -230,10 +230,13 @@ if BEAM.FLAG == 0 then -- TODO valutare se fare script separato elseif BEAM.FLAG == 9 then if type( BEAM.FEATUREID) == 'number' then + -- creo un gruppo temporaneo dove finiranno tutte le entità che non bisogna salvare, alla fine lo si cancella + local idTempGroup = BeamLib.CreateTempGroup() + local Part = {} Part.id = EgtGetParent( EgtGetParent( BEAM.FEATUREID)) Part.b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( Part.id, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) - + local Proc = FeatureLib.GetProcFromTrimesh( BEAM.FEATUREID, Part) Proc.nGrp = EgtGetInfo( Proc.id, 'GRP', 'i') Proc.nPrc = EgtGetInfo( Proc.id, 'PRC', 'i') @@ -251,8 +254,10 @@ elseif BEAM.FLAG == 9 then else BEAM.TOPOLOGY = 'NOT_IMPLEMENTED' end + + -- si cancella gruppo temporaneo contenente entità da cancellare + EgtErase( idTempGroup) end - return end @@ -372,6 +377,9 @@ if bToProcess then -- Altrimenti, opero sul progetto corrente else + -- creo un gruppo temporaneo dove finiranno tutte le entità che non bisogna salvare, alla fine lo si cancella + BeamLib.CreateTempGroup() + -- Recupero l'identificativo del gruppo di lavoro corrente local nMGrpId = EgtGetCurrMachGroup() -- Barra da creare @@ -416,6 +424,9 @@ if bToProcess then end end + -- creo un gruppo temporaneo dove finiranno tutte le entità che non bisogna salvare, alla fine lo si cancella + BeamLib.CreateTempGroup() + -- recupero parametri generali da progetto BeamExec.GetGeneralParameters() @@ -701,6 +712,10 @@ if bToProcess then end end + -- si cancella gruppo temporaneo contenente entità da cancellare + local idTempGroup = BeamLib.GetTempGroup() + EgtErase( idTempGroup) + -- Salvo il progetto EgtSaveFile( sNgeFile) -- copio come originale (per dichiarare progetto ricalcolato) diff --git a/LuaLibs/BasicCustomerStrategies.lua b/LuaLibs/BasicCustomerStrategies.lua index c68aec4..05bef53 100644 --- a/LuaLibs/BasicCustomerStrategies.lua +++ b/LuaLibs/BasicCustomerStrategies.lua @@ -101,6 +101,9 @@ local function GetStrategies_Essetre( Proc) --------------------------------------------------------------------- -- Feature : Saw Cut (0-13) elseif ID.IsSawCut( Proc) then + if Proc.Topology.sName == 'Cut-1-Through' or Proc.Topology.sName == 'Bevel-1-Through' then + Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}, { sStrategyId = 'STR0010'}} + end --------------------------------------------------------------------- -- Feature : Slot (0-16) elseif ID.IsSlot( Proc) then diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index d6a312d..f4a83b7 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -292,6 +292,19 @@ function BeamLib.CreateOrEmptyAddGroup( PartId) return true end +------------------------------------------------------------------------------------------------------------- +function BeamLib.CreateTempGroup() + local idTempGroup = EgtGroup( GDB_ID.ROOT) + EgtSetName( idTempGroup, "#TEMP_GROUP#") + return idTempGroup +end + +------------------------------------------------------------------------------------------------------------- +function BeamLib.GetTempGroup() + local idTempGroup = EgtGetFirstNameInGroup( GDB_ID.ROOT, "#TEMP_GROUP#") or nil + return idTempGroup +end + ------------------------------------------------------------------------------------------------------------- function BeamLib.GetAddGroup( PartId) -- recupero il nome del gruppo di lavoro corrente diff --git a/LuaLibs/FeatureLib.lua b/LuaLibs/FeatureLib.lua index a955bef..28a9c4c 100644 --- a/LuaLibs/FeatureLib.lua +++ b/LuaLibs/FeatureLib.lua @@ -32,8 +32,6 @@ function FeatureLib.GetProcFromTrimesh( idTrimesh, Part, ProcToCopyFrom) Proc.AffectedFaces = BeamLib.GetAffectedFaces( Proc, Part) Proc.AdjacencyMatrix = FaceData.GetAdjacencyMatrix( Proc) Proc.Faces = FaceData.GetFacesInfo( Proc, Part) - Proc.NotClampableLength = FeatureLib.CalculateFeatureNotClampableLengths( Proc, Part) - Proc.bHindersLaserMeasure = FeatureLib.CalculateFeatureHindersLaserMeasure( Proc, Part) -- TODO servono anche altri dati raccolti nel collect?? return Proc @@ -52,6 +50,39 @@ local function IsFeatureCuttingEntireLength( b3Proc, Part) ( b3Proc:getDimZ() > ( Part.b3Part:getDimZ() - 500 * GEO.EPS_SMALL) and b3Proc:getDimX() > ( Part.b3Part:getDimX() - 500 * GEO.EPS_SMALL))) end +------------------------------------------------------------------------------------------------------------- +-- restituisce vero se tutti i lati della faccia passata si trovano sul grezzo +local function AreAllFaceEdgesOnRaw( Part, Proc, idFace) + local bEdgeOnRaw = true + local idTempGroup = BeamLib.GetTempGroup() + local nLoopId, nLoopCnt = EgtExtractSurfTmFacetLoops( Proc.id, idFace, idTempGroup) + if nLoopCnt > 1 then + error( 'AreAllFaceEdgesOnRaw : too many loops') + end + + if nLoopId then + local dUmin, dUmax = EgtCurveDomain( nLoopId) + for dU = dUmin, dUmax-1 do + local ptMid = ( EgtUP( nLoopId, dU, GDB_ID.ROOT) + EgtUP( nLoopId, dU+1, GDB_ID.ROOT)) / 2 + -- se punto medio dell'entita NON si trova su faccia testa o coda + if ptMid:getX() < Part.b3Part:getMin():getX() + 100 * GEO.EPS_SMALL or ptMid:getX() > Part.b3Part:getMax():getX() - 100 * GEO.EPS_SMALL or + ptMid:getY() < Part.b3Part:getMin():getY() + 100 * GEO.EPS_SMALL or ptMid:getY() > Part.b3Part:getMax():getY() - 100 * GEO.EPS_SMALL or + ptMid:getZ() < Part.b3Part:getMin():getZ() + 100 * GEO.EPS_SMALL or ptMid:getZ() > Part.b3Part:getMax():getZ() - 100 * GEO.EPS_SMALL then + bEdgeOnRaw = true + else + bEdgeOnRaw = false + break + end + end + --for j = 1, nLoopCnt do + -- EgtErase( nLoopId + j - 1) + --end + end + return bEdgeOnRaw +end + + + --------------------------------------------------------------------- -- recupero topologia della feature function FeatureLib.NeedTopologyFeature( Proc, Part) @@ -87,9 +118,7 @@ function FeatureLib.NeedTopologyFeature( Proc, Part) elseif ID.IsStepJointNotch( Proc) then -- (0-80) return true -- feature con calcolo topologia da geometria SOLO se rispettano certe condizioni, altrimenti riconoscimento specifico - elseif ID.IsSawCut( Proc) and Proc.nFct == 1 then - --and ( IsFeatureCuttingEntireSection( Proc.b3Box, Part) - --or IsFeatureCuttingEntireLength( Proc.b3Box, Part)) then -- (0-13) + elseif ID.IsSawCut( Proc) and Proc.nFct == 1 and AreAllFaceEdgesOnRaw( Part, Proc, 0) then return true elseif ID.IsHipValleyRafterNotch( Proc) and Proc.nFct < 4 then -- (0-25) return true @@ -910,6 +939,11 @@ function FeatureLib.CalculateFeatureNotClampableLengths( Proc, Part) local dNotClampableLengthHead = 0 local dNotClampableLengthTail = 0 + -- se il grezzo non è definito, prendo il box del pezzo + if not Part.b3Raw then + Part.b3Raw = Part.b3Part + end + -- TODO se la feature ha più di 3 facce non viene mai calcolato!! Es. Tenone ecc.... if Proc.nFct < 3 then -- eventuale segnalazione ingombro di testa o coda diff --git a/Process.lua b/Process.lua index 0cab548..b67d4d9 100644 --- a/Process.lua +++ b/Process.lua @@ -79,6 +79,7 @@ PARTS = {} -- tabella contenente tutte le informazioni di ogni pezzo local BeamData = require( 'BeamData') -- carico librerie local BeamExec = require( 'BeamExec') +local BeamLib = require( 'BeamLib') -- Variabili di modulo local dRawW @@ -299,6 +300,9 @@ end -- *** Inserimento delle lavorazioni nelle travi *** ------------------------------------------------------------------------------------------------------------- local function MyProcessFeatures() + -- creo un gruppo temporaneo dove finiranno tutte le entità che non bisogna salvare, alla fine lo si cancella + local idTempGroup = BeamLib.CreateTempGroup() + BeamExec.GetProcessings( PARTS, bCalcBestPieceUnloadPosition) BeamExec.GetCombinationMatrix( PARTS, bCalcBestPieceUnloadPosition) BeamExec.ProcessMachinings( PARTS) @@ -342,6 +346,10 @@ local function MyProcessFeatures() end end end + + -- cancello gruppo temporaneo + EgtErase( idTempGroup) + if #sOutput > 0 then EgtOutLog( sOutput) end if nErrCnt > 0 then EgtOutBox( sOutput, 'Lavora Travi', 'ERRORS') diff --git a/Strategies/AvailableStrategyList.json b/Strategies/AvailableStrategyList.json index 52198bb..db173d1 100644 --- a/Strategies/AvailableStrategyList.json +++ b/Strategies/AvailableStrategyList.json @@ -61,7 +61,11 @@ "nPrc": 13, "nGrp": 0, "TopologyList" : [ - { "sName": "Feature", + { "sName": "Cut-1-Through", + "sImage": "ConfigStrategy\\Cut-1-Through.png", + "StrategyList" : [ { "sStrategyId": "STR0002" }, { "sStrategyId": "STR0005" }, { "sStrategyId": "STR0010" } ] + }, + { "sName": "Bevel-1-Through", "sImage": "ConfigStrategy\\Cut-1-Through.png", "StrategyList" : [ { "sStrategyId": "STR0002" }, { "sStrategyId": "STR0005" }, { "sStrategyId": "STR0010" } ] } diff --git a/Strategies/Standard/STR0012/STR0012.lua b/Strategies/Standard/STR0012/STR0012.lua index f1b933e..d0d06d4 100644 --- a/Strategies/Standard/STR0012/STR0012.lua +++ b/Strategies/Standard/STR0012/STR0012.lua @@ -82,6 +82,8 @@ function STR0012.Make( bAddMachining, Proc, Part, CustomParameters) EgtSurfTmRemoveFacet( idNewProc, nAddedFace) local NewProc = FeatureLib.GetProcFromTrimesh( idNewProc, Part, Proc) NewProc.Topology = FeatureLib.ClassifyTopology( NewProc, Part) + NewProc.NotClampableLength = FeatureLib.CalculateFeatureNotClampableLengths( NewProc, Part) + NewProc.bHindersLaserMeasure = FeatureLib.CalculateFeatureHindersLaserMeasure( NewProc, Part) -- TODO rimuovere??? codolo da implementare o no?? -- considerazioni necessarie a determinare se lavorare con codolo oppure no