diff --git a/BatchProcessNew.lua b/BatchProcessNew.lua index d64f244..1fff59b 100644 --- a/BatchProcessNew.lua +++ b/BatchProcessNew.lua @@ -492,6 +492,7 @@ if bToProcess then return end + -- TODO in caso di "GEN_sPiecesLoadingPosition = FULL_PRE_ROTATION" bisogna controllare anche sezione ribaltata di 90° -- Verifico sezione barra non troppo grande if not BeamData.MAX_WIDTH2 or not BeamData.MAX_HEIGHT2 then if ( dRawW > BeamData.MAX_WIDTH + 10 * GEO.EPS_SMALL or dRawH > BeamData.MAX_HEIGHT + 10 * GEO.EPS_SMALL) then @@ -694,13 +695,7 @@ if bToProcess then BeamExec.GetProcessings( PARTS, BEAM.FLAG == 10) BeamExec.GetCombinationMatrix( PARTS, BEAM.FLAG == 10) - BeamExec.ProcessMachinings( PARTS) - - -- scrittura variabili globali per interfaccia - if BEAM.FLAG == 10 then - BEAM.PREROTATE90 = PARTS[1].nInitialPosition - 1 - BEAM.PREINVERT = EgtIf( PARTS[1].bPartInCombiIsInverted, 1, 0) - end + BeamExec.ProcessMachinings( PARTS, BEAM.FLAG == 10) local sOutput = '' @@ -727,7 +722,7 @@ if bToProcess then BEAM.ERR = 0 BEAM.MSG = '---' end - BEAM.ROT = -( RESULT[i].nRotation or 1) + 1 + BEAM.ROT = -( ( RESULT[i].nRotation - ( BEAM.PREROTATE90 or 0)) or 1) + 1 BEAM.CUTID = RESULT[i].idCut BEAM.TASKID = RESULT[i].idTask WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID) @@ -743,7 +738,7 @@ if bToProcess then sOutput = sOutput .. string.format( '[%d,%d] %s\n', RESULT[i].idCut, RESULT[i].idTask, sMsg) BEAM.ERR = 19 BEAM.MSG = sMsg - BEAM.ROT = -( RESULT[i].nRotation or 1) + 1 + BEAM.ROT = -( ( RESULT[i].nRotation - ( BEAM.PREROTATE90 or 0)) or 1) + 1 BEAM.CUTID = RESULT[i].idCut BEAM.TASKID = RESULT[i].idTask WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID) @@ -769,7 +764,7 @@ if bToProcess then sOutput = sOutput .. string.format( '[%d,%d] %s\n', RESULT[i].idCut, RESULT[i].idTask, sMsg) BEAM.ERR = -19 BEAM.MSG = 'Incomplete : Completion index ' .. RESULT[i].ChosenStrategy.dCompletionIndex .. '/5\n' .. sMsg - BEAM.ROT = -( RESULT[i].nRotation or 1) + 1 + BEAM.ROT = -( ( RESULT[i].nRotation - ( BEAM.PREROTATE90 or 0)) or 1) + 1 BEAM.CUTID = RESULT[i].idCut BEAM.TASKID = RESULT[i].idTask WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID) diff --git a/FlipRot.lua b/FlipRot.lua index 988f70c..b1164d7 100644 --- a/FlipRot.lua +++ b/FlipRot.lua @@ -145,7 +145,7 @@ local function MyProcessFeatures() BeamExec.GetProcessings( PARTS, true) BeamExec.GetCombinationMatrix( PARTS, true) - BeamExec.ProcessMachinings( PARTS) + BeamExec.ProcessMachinings( PARTS, true) -- scrittura variabili globali per interfaccia BEAM.PREROTATE90 = PARTS[1].nInitialPosition - 1 diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 6c27d39..c5602fe 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -1614,7 +1614,7 @@ function BeamExec.GetCombinationMatrix( PARTS, bIsFlipRot) end ------------------------------------------------------------------------------------------------------------- -function BeamExec.ProcessMachinings( PARTS) +function BeamExec.ProcessMachinings( PARTS, bIsFlipRot) -- ciclo sui pezzi local nTotErr = 0 local Stats = {} @@ -1711,8 +1711,6 @@ function BeamExec.ProcessMachinings( PARTS) MACHININGS.Info.nSplitCutRotation = 1 end end - -- salvo sul PART la posizione di partenza che è stata scelta - PARTS[nPart].nInitialPosition = MatrixResult.nInitialPosition local nOffsetIndex = EgtIf( PARTS[nPart].bPartInCombiIsInverted, 4, 0) -- aggiunge tagli testa e coda in fasi opportune @@ -1720,36 +1718,34 @@ function BeamExec.ProcessMachinings( PARTS) if nRotHeadCut > 4 then nRotHeadCut = nRotHeadCut - 4 end - nRotHeadCut = nRotHeadCut + nOffsetIndex local nRotSplitCut = MatrixResult.nInitialPosition + MACHININGS.Info.nSplitCutRotation - 1 if nRotSplitCut > 4 then nRotSplitCut = nRotSplitCut - 4 end - nRotSplitCut = nRotSplitCut + nOffsetIndex -- setto nella Proc l'indice rotazione nella quale deve essere lavorata - PROCESSINGS[nPart].Rotation[nRotHeadCut][MatrixResult.nIndexHeadCutInVProc].nIndexRotation = nRotHeadCut - PROCESSINGS[nPart].Rotation[nRotSplitCut][MatrixResult.nIndexTailCutInVProc].nIndexRotation = nRotSplitCut + PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc].nIndexRotation = nRotHeadCut + PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc].nIndexRotation = nRotSplitCut -- si imposta flag rotazione per taglio di testa if MACHININGS.Info.nHeadCutRotation == 2 then - PROCESSINGS[nPart].Rotation[nRotHeadCut][MatrixResult.nIndexHeadCutInVProc].bSide = true + PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc].bSide = true elseif MACHININGS.Info.nHeadCutRotation == 3 then - PROCESSINGS[nPart].Rotation[nRotHeadCut][MatrixResult.nIndexHeadCutInVProc].bDown = true + PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc].bDown = true else - PROCESSINGS[nPart].Rotation[nRotHeadCut][MatrixResult.nIndexHeadCutInVProc].bStd = true + PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc].bStd = true end -- si imposta flag rotazione per taglio di coda if MACHININGS.Info.nSplitCutRotation == 2 then - PROCESSINGS[nPart].Rotation[nRotSplitCut][MatrixResult.nIndexTailCutInVProc].bSide = true + PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc].bSide = true elseif MACHININGS.Info.nSplitCutRotation == 3 then - PROCESSINGS[nPart].Rotation[nRotSplitCut][MatrixResult.nIndexTailCutInVProc].bDown = true + PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc].bDown = true else - PROCESSINGS[nPart].Rotation[nRotSplitCut][MatrixResult.nIndexTailCutInVProc].bStd = true + PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc].bStd = true end local vProcHeadTail = {} - table.insert( vProcHeadTail, PROCESSINGS[nPart].Rotation[nRotHeadCut][MatrixResult.nIndexHeadCutInVProc]) - table.insert( vProcHeadTail, PROCESSINGS[nPart].Rotation[nRotSplitCut][MatrixResult.nIndexTailCutInVProc]) + table.insert( vProcHeadTail, PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc]) + table.insert( vProcHeadTail, PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc]) MACHININGS = CalculateMachinings( vProcHeadTail, PARTS[nPart], MatrixResult.nInitialPosition) @@ -1772,6 +1768,42 @@ function BeamExec.ProcessMachinings( PARTS) nRawId = EgtGetNextRawPart( nRawId) end + + local nInitialPosition = MatrixResult.nInitialPosition + -- PREROTAZIONE PEZZO + if MatrixResult.nInitialPosition ~= 1 or PARTS[nPart].bPartInCombiIsInverted then + -- si esce dalle lavorazioni e si torna in disegna + local nCurrMachGroup = EgtGetCurrMachGroup() + EgtResetCurrMachGroup() + + -- salvo situazione precedente su lista BEAM ( scrittura variabili globali per interfaccia) + if bIsFlipRot then + BEAM.PREROTATE90 = MatrixResult.nInitialPosition - 1 + BEAM.PREINVERT = EgtIf( PARTS[nPart].bPartInCombiIsInverted, 1, 0) + end + + -- se c'è stata inversione, si inverte il pezzo anche in disegna + if PARTS[nPart].bPartInCombiIsInverted then + local ptInv = PARTS[nPart].b3PartOriginal:getMin() + Vector3d( PARTS[nPart].b3PartOriginal:getDimX() / 2, PARTS[nPart].b3PartOriginal:getDimY() / 2, 0) + EgtRotate( PARTS[nPart].id, ptInv, Z_AX(), 180, GDB_RT.GLOB) + PARTS[nPart].bIsInverted = true + end + + -- se c'è una prerotazione, si inverte il pezzo + if MatrixResult.nInitialPosition ~= 1 then + local ptRot = PARTS[nPart].b3PartOriginal:getMin() + Vector3d( 0, PARTS[nPart].b3PartOriginal:getDimY() / 2, PARTS[nPart].b3PartOriginal:getDimZ() / 2) + local nRotationDeg = 90 * ( MatrixResult.nInitialPosition - 1) + EgtRotate( PARTS[nPart].id, ptRot, X_AX(), nRotationDeg, GDB_RT.GLOB) + end + + -- si riattiva il MachGroup, i pezzi son rimasti dove erano + EgtSetCurrMachGroup( nCurrMachGroup) + end + + -- salvo sul PART la posizione di partenza che è stata scelta + PARTS[nPart].nInitialPosition = MatrixResult.nInitialPosition + + local bAreAllMachiningApplyOk local sErr local bSplitAlreadyExecuted = false @@ -1785,7 +1817,6 @@ function BeamExec.ProcessMachinings( PARTS) -- creazione effettiva delle lavorazioni MACHININGS.Info = {} local nCurrPosition = 1 - local nInitialPosition = MatrixResult.nInitialPosition -- se c'è almeno una lavorazione in posizionamento con trave ribaltata if MatrixResult.bSomeFeatureDown then local nRotation = EgtIf( nInitialPosition + 2 > 4, nInitialPosition + 2 - 4, nInitialPosition + 2) @@ -2090,48 +2121,46 @@ function BeamExec.ProcessAlternatives( PARTS) if nRotHeadCut > 4 then nRotHeadCut = nRotHeadCut - 4 end - nRotHeadCut = nRotHeadCut + nOffsetIndex local nRotSplitCut = MatrixResult.nInitialPosition + MACHININGS.Info.nSplitCutRotation - 1 if nRotSplitCut > 4 then nRotSplitCut = nRotSplitCut - 4 end - nRotSplitCut = nRotSplitCut + nOffsetIndex -- setto nella Proc l'indice rotazione nella quale deve essere lavorata - PROCESSINGS[nPart].Rotation[nRotHeadCut][MatrixResult.nIndexHeadCutInVProc].nIndexRotation = nRotHeadCut - PROCESSINGS[nPart].Rotation[nRotSplitCut][MatrixResult.nIndexTailCutInVProc].nIndexRotation = nRotSplitCut + PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc].nIndexRotation = nRotHeadCut + PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc].nIndexRotation = nRotSplitCut -- si imposta flag rotazione per taglio di testa if MACHININGS.Info.nHeadCutRotation == 2 then - PROCESSINGS[nPart].Rotation[nRotHeadCut][MatrixResult.nIndexHeadCutInVProc].bDown = nil - PROCESSINGS[nPart].Rotation[nRotHeadCut][MatrixResult.nIndexHeadCutInVProc].bSide = true - PROCESSINGS[nPart].Rotation[nRotHeadCut][MatrixResult.nIndexHeadCutInVProc].bStd = nil + PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc].bDown = nil + PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc].bSide = true + PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc].bStd = nil elseif MACHININGS.Info.nHeadCutRotation == 3 then - PROCESSINGS[nPart].Rotation[nRotHeadCut][MatrixResult.nIndexHeadCutInVProc].bDown = true - PROCESSINGS[nPart].Rotation[nRotHeadCut][MatrixResult.nIndexHeadCutInVProc].bSide = nil - PROCESSINGS[nPart].Rotation[nRotHeadCut][MatrixResult.nIndexHeadCutInVProc].bStd = nil + PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc].bDown = true + PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc].bSide = nil + PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc].bStd = nil else - PROCESSINGS[nPart].Rotation[nRotHeadCut][MatrixResult.nIndexHeadCutInVProc].bDown = nil - PROCESSINGS[nPart].Rotation[nRotHeadCut][MatrixResult.nIndexHeadCutInVProc].bSide = nil - PROCESSINGS[nPart].Rotation[nRotHeadCut][MatrixResult.nIndexHeadCutInVProc].bStd = true + PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc].bDown = nil + PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc].bSide = nil + PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc].bStd = true end -- si imposta flag rotazione per taglio di coda if MACHININGS.Info.nSplitCutRotation == 2 then - PROCESSINGS[nPart].Rotation[nRotSplitCut][MatrixResult.nIndexTailCutInVProc].bDown = nil - PROCESSINGS[nPart].Rotation[nRotSplitCut][MatrixResult.nIndexTailCutInVProc].bSide = true - PROCESSINGS[nPart].Rotation[nRotSplitCut][MatrixResult.nIndexTailCutInVProc].bStd = nil + PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc].bDown = nil + PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc].bSide = true + PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc].bStd = nil elseif MACHININGS.Info.nSplitCutRotation == 3 then - PROCESSINGS[nPart].Rotation[nRotSplitCut][MatrixResult.nIndexTailCutInVProc].bDown = true - PROCESSINGS[nPart].Rotation[nRotSplitCut][MatrixResult.nIndexTailCutInVProc].bSide = nil - PROCESSINGS[nPart].Rotation[nRotSplitCut][MatrixResult.nIndexTailCutInVProc].bStd = nil + PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc].bDown = true + PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc].bSide = nil + PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc].bStd = nil else - PROCESSINGS[nPart].Rotation[nRotSplitCut][MatrixResult.nIndexTailCutInVProc].bDown = nil - PROCESSINGS[nPart].Rotation[nRotSplitCut][MatrixResult.nIndexTailCutInVProc].bSide = nil - PROCESSINGS[nPart].Rotation[nRotSplitCut][MatrixResult.nIndexTailCutInVProc].bStd = true + PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc].bDown = nil + PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc].bSide = nil + PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc].bStd = true end local vProcHeadTail = {} - table.insert( vProcHeadTail, PROCESSINGS[nPart].Rotation[nRotHeadCut][MatrixResult.nIndexHeadCutInVProc]) - table.insert( vProcHeadTail, PROCESSINGS[nPart].Rotation[nRotSplitCut][MatrixResult.nIndexTailCutInVProc]) + table.insert( vProcHeadTail, PROCESSINGS[nPart].Rotation[nRotHeadCut+nOffsetIndex][MatrixResult.nIndexHeadCutInVProc]) + table.insert( vProcHeadTail, PROCESSINGS[nPart].Rotation[nRotSplitCut+nOffsetIndex][MatrixResult.nIndexTailCutInVProc]) MACHININGS = CalculateMachinings( vProcHeadTail, PARTS[nPart], MatrixResult.nInitialPosition) diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index c2a9d3c..9b9efe0 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -468,6 +468,11 @@ end function MachiningLib.FindMill( Proc, ToolSearchParameters) local ToolInfo = {} + -- direzione utensile e fipo fresa obbligatori, altrimenti si esce + if not ToolSearchParameters.vtToolDirection or not ToolSearchParameters.sMillShape then + return ToolInfo + end + local nBestToolIndex local dBestToolResidualDepth = 0 for i = 1, #TOOLS do @@ -1443,18 +1448,20 @@ function MachiningLib.AddOperations( MACHININGS, Part, sRotation) local nPhase = EgtGetCurrPhase() local idDisp = EgtGetPhaseDisposition( nPhase) + -- posizione iniziale considerando eventuiali prerotazioni + local nRealInitialPosition = Part.nInitialPosition if sRotation == 'DOWN' then - local nRotation = EgtIf( Part.nInitialPosition + 2 > 4, Part.nInitialPosition + 2 - 4, Part.nInitialPosition + 2) - 1 + local nRotation = EgtIf( nRealInitialPosition + 2 > 4, nRealInitialPosition + 2 - 4, nRealInitialPosition + 2) - 1 BeamLib.RotateRawPart( Part, nRotation) EgtSetInfo( idDisp, 'ROT', -2) EgtSetInfo( idDisp, 'TYPE', 'MID2') elseif sRotation == 'SIDE' then - local nRotation = EgtIf( Part.nInitialPosition + 1 > 4, Part.nInitialPosition + 1 - 4, Part.nInitialPosition + 1) - 1 + local nRotation = EgtIf( nRealInitialPosition + 1 > 4, nRealInitialPosition + 1 - 4, nRealInitialPosition + 1) - 1 BeamLib.RotateRawPart( Part, nRotation) EgtSetInfo( idDisp, 'ROT', -1) EgtSetInfo( idDisp, 'TYPE', 'MID2') else - local nRotation = Part.nInitialPosition - 1 + local nRotation = nRealInitialPosition - 1 BeamLib.RotateRawPart( Part, nRotation) EgtSetInfo( idDisp, 'TYPE', 'END') end diff --git a/Process.lua b/Process.lua index 344415e..e5f75a9 100644 --- a/Process.lua +++ b/Process.lua @@ -304,7 +304,7 @@ local function MyProcessFeatures() BeamExec.GetProcessings( PARTS, false) BeamExec.GetCombinationMatrix( PARTS, false) - BeamExec.ProcessMachinings( PARTS) + BeamExec.ProcessMachinings( PARTS, false) local nErrCnt = 0 local nWarnCnt = 0 local sOutput = '' diff --git a/Strategies/Standard/STR0002/STR0002.lua b/Strategies/Standard/STR0002/STR0002.lua index 297db4c..a0adee5 100644 --- a/Strategies/Standard/STR0002/STR0002.lua +++ b/Strategies/Standard/STR0002/STR0002.lua @@ -269,6 +269,8 @@ local function GetBestPocketingStrategy( Proc, Part) Milling.idProc = Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.id Milling.dElevation = ( Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Faces[1].dElevation * 2) + BeamData.MILL_OVERLAP Milling.bMachAppliedToTunnelFace = true + else + ToolSearchParameters.vtToolDirection = nil end ToolSearchParameters.AvailableToolList = MachiningLib.GetAvailableToolList( Proc, Strategy.Parameters.sPocketingList, 'Pocketing') Milling.ToolInfo = {} @@ -309,6 +311,8 @@ local function GetBestPocketingStrategy( Proc, Part) Milling.idFaceToMachine = Proc.MainFaces.SideFaces[1].id Milling.idProc = Proc.id Milling.dElevation = Proc.MainFaces.SideFaces[1].dElevation + else + ToolSearchParameters.vtToolDirection = nil end ToolSearchParameters.AvailableToolList = MachiningLib.GetAvailableToolList( Proc, Strategy.Parameters.sPocketingList, 'Pocketing') Milling.ToolInfo = {} diff --git a/Strategies/Standard/STR0003/STR0003.lua b/Strategies/Standard/STR0003/STR0003.lua index 979e752..3b9265d 100644 --- a/Strategies/Standard/STR0003/STR0003.lua +++ b/Strategies/Standard/STR0003/STR0003.lua @@ -228,6 +228,16 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters) bIsSplitFeature = true end + -- se arriva una feature senza MainFaces o MainEdges necessari la strategia non è applicabile + -- TODO riuniure a IsTopologyOk? + if not Proc.MainFaces + or not Proc.MainFaces.LongFaces[1] + or not Proc.MainFaces.LongFaces[1].MainEdges then + + Strategy.Result = FeatureLib.GetStrategyResultNotApplicable( 'Topology') + return false, Strategy.Result + end + -- altezza tasca local dPocketHeight = 0 if Proc.Topology.sFamily == 'Tunnel' then @@ -241,16 +251,6 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters) dPocketHeight = Proc.MainFaces.BottomFaces[1].MainEdges.SideEdges[1].dLength end - -- se arriva una feature senza MainFaces o MainEdges necessari la strategia non è applicabile - -- TODO riuniure a IsTopologyOk? - if not Proc.MainFaces - or not Proc.MainFaces.LongFaces[1] - or not Proc.MainFaces.LongFaces[1].MainEdges then - - Strategy.Result = FeatureLib.GetStrategyResultNotApplicable( 'Topology') - return false, Strategy.Result - end - -- riferimenti locali per leggibilità e performance local LongFace = Proc.MainFaces.LongFaces[1] local OppositeEdge1 = LongFace.MainEdges.OppositeEdges[1] diff --git a/Strategies/Standard/STR0004/STR0004.lua b/Strategies/Standard/STR0004/STR0004.lua index fd705a5..b67f076 100644 --- a/Strategies/Standard/STR0004/STR0004.lua +++ b/Strategies/Standard/STR0004/STR0004.lua @@ -132,6 +132,16 @@ function STR0004.Make( bAddMachining, Proc, Part, CustomParameters) bIsSplitFeature = true end + -- se arriva una feature senza MainFaces o MainEdges necessari la strategia non è applicabile + -- TODO riuniure a IsTopologyOk? + if not Proc.MainFaces + or not Proc.MainFaces.LongFaces[1] + or not Proc.MainFaces.LongFaces[1].MainEdges then + + Strategy.Result = FeatureLib.GetStrategyResultNotApplicable( 'Topology') + return false, Strategy.Result + end + -- altezza tasca local dPocketHeight = 0 if Proc.Topology.sFamily == 'Tunnel' then @@ -145,16 +155,6 @@ function STR0004.Make( bAddMachining, Proc, Part, CustomParameters) dPocketHeight = Proc.MainFaces.BottomFaces[1].MainEdges.SideEdges[1].dLength end - -- se arriva una feature senza MainFaces o MainEdges necessari la strategia non è applicabile - -- TODO riuniure a IsTopologyOk? - if not Proc.MainFaces - or not Proc.MainFaces.LongFaces[1] - or not Proc.MainFaces.LongFaces[1].MainEdges then - - Strategy.Result = FeatureLib.GetStrategyResultNotApplicable( 'Topology') - return false, Strategy.Result - end - -- riferimenti locali per leggibilità e performance local LongFace = Proc.MainFaces.LongFaces[1] local OppositeEdge1 = LongFace.MainEdges.OppositeEdges[1]