diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 655f78a..c97ad29 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -250,7 +250,7 @@ end -- funzione che controlla validità delle combinazioni proposte local function IsCombinationAvailable( sCombination, nUnloadPos, bSquareSection) -- se non utilizzo BEAMWALL, forzo comportamento BASIC - if not BEAM.BeamWall or not BEAM.Rotation then + if not BEAM.BW or not BEAM.Rotation then BEAM.Rotation = {} BEAM.Rotation.Basic = true end diff --git a/Strategies/Standard/STR0005/STR0005.lua b/Strategies/Standard/STR0005/STR0005.lua index fd79dc1..65f24b3 100644 --- a/Strategies/Standard/STR0005/STR0005.lua +++ b/Strategies/Standard/STR0005/STR0005.lua @@ -18,6 +18,34 @@ local Strategy = {} local Blade = {} Blade.Result = {} +------------------------------------------------------------------------------------------------------------- +local function IsTwoFacesCommonEdgeTooLong( Proc, Part) + local bIsTwoFacesCommonEdgeTooLong = false + + -- controlli preventivi + if Proc.nFct ~= 2 then + error('IsTwoFacesCommonEdgeTooLong : feature must have two faces ') + end + + -- ricerca lato in comune + local nCommonEdge + for i = 1, #Proc.Faces[1].Edges do + if Proc.Faces[1].Edges[i].idAdjacentFace > -1 then + nCommonEdge = i + end + end + + -- se due facce, cubetti troppo lunghi in X non si possono fare + local ptEdge1, _, ptEdge2 = EgtSurfTmFacetOppositeSide( Proc.id, Proc.Faces[1].id, -Proc.Faces[1].Edges[nCommonEdge].vtN, GDB_ID.ROOT) + local b3BoxEdge = BBox3d( ptEdge1, ptEdge2) + local dEdgeLengthOnX = b3BoxEdge:getDimX() + if FeatureLib.IsMachiningLong( dEdgeLengthOnX, Part) then + bIsTwoFacesCommonEdgeTooLong = true + end + + return bIsTwoFacesCommonEdgeTooLong +end + ------------------------------------------------------------------------------------------------------------- function STR0005.Make( bAddMachining, Proc, Part, CustomParameters) -- carico parametri da default e li aggiorno con quelli passati dal chiamante (potrebbero non essere congruenti) @@ -74,6 +102,7 @@ function STR0005.Make( bAddMachining, Proc, Part, CustomParameters) local dFeatureMaxNotClampableLengthHead, dFeatureMaxNotClampableLengthTail = FeatureLib.GetFeatureMaxNotClampableLengths( Proc, Part) local bFeatureHindersClamping = FeatureLib.IsMachiningLong( max( dFeatureMaxNotClampableLengthHead, dFeatureMaxNotClampableLengthTail), Part, { dMaxSegmentLength = BeamData.LONGCUT_ENDLEN}) local bIsFeatureLong = FeatureLib.IsMachiningLong( Proc.b3Box:getDimX(), Part, { dMaxSegmentLength = BeamData.LONGCUT_ENDLEN}) + local bIsTwoFacesCommonEdgeTooLong = ( ( Proc.nFct == 2) and IsTwoFacesCommonEdgeTooLong( Proc, Part)) -- lavorazione con codolo if ( Proc.nFct > 2 and bIsFeatureLong) @@ -90,7 +119,11 @@ function STR0005.Make( bAddMachining, Proc, Part, CustomParameters) end -- lavorazione a cubetti / taglio singolo - if Proc.nFct < 3 and #Blade.Result == 0 and not bKeepWasteAttached then + if #Blade.Result == 0 + and Proc.nFct < 3 + and not bKeepWasteAttached + and not bIsTwoFacesCommonEdgeTooLong then + local dMinZTopBlade local dMaxNyTopBlade local BladeToWasteResult diff --git a/StrategyLibs/BLADETOWASTE.lua b/StrategyLibs/BLADETOWASTE.lua index c154b62..2a01ec8 100644 --- a/StrategyLibs/BLADETOWASTE.lua +++ b/StrategyLibs/BLADETOWASTE.lua @@ -593,6 +593,21 @@ function BLADETOWASTE.Make( ProcOrId, Part, OptionalParameters) -- controlli preventivi if Proc.nFct > 2 then error( 'BladeToWaste : max 2 faces supported') + elseif Proc.nFct == 2 then + -- ricerca lato in comune + local nCommonEdge + for i = 1, #Proc.Faces[1].Edges do + if Proc.Faces[1].Edges[i].idAdjacentFace > -1 then + nCommonEdge = i + end + end + -- se due facce, cubetti troppo lunghi in X non si possono fare + local ptEdge1, _, ptEdge2 = EgtSurfTmFacetOppositeSide( Proc.id, Proc.Faces[1].id, -Proc.Faces[1].Edges[nCommonEdge].vtN, GDB_ID.ROOT) + local b3BoxEdge = BBox3d( ptEdge1, ptEdge2) + local dEdgeLengthOnX = b3BoxEdge:getDimX() + if FeatureLib.IsMachiningLong( dEdgeLengthOnX, Part) then + error( 'BLADETOWASTE : common edge too long') + end end -- parametri opzionali e default