diff --git a/LuaLibs/FaceData.lua b/LuaLibs/FaceData.lua index 5c29aef..bdcbea1 100644 --- a/LuaLibs/FaceData.lua +++ b/LuaLibs/FaceData.lua @@ -255,6 +255,7 @@ local function GetBottomFaces( Proc) CurrentEdge.idAdjacentFace = BottomFaces[1].Edges[i].Adj CurrentEdge.vtToolDirection = Vector3d( BottomFaces[1].Edges[i].Norm) CurrentEdge.dLength = BottomFaces[1].Edges[i].Len + CurrentEdge.dLengthOnX = CurrentEdge.dLength * CurrentEdge.vtToolDirection:getY() CurrentEdge.dElevation = BottomFaces[1].Edges[i].Elev CurrentEdge.bIsOpen = BottomFaces[1].Edges[i].Open CurrentEdge.bIsStartOpen = BottomFaces[1].Edges[nPreviousEdgeIndex].Open @@ -340,6 +341,7 @@ local function GetLongFaces( Proc, MainFaces) CurrentEdge.idAdjacentFace = LongFaces[i].Edges[j].Adj CurrentEdge.vtToolDirection = Vector3d( LongFaces[i].Edges[j].Norm) CurrentEdge.dLength = LongFaces[i].Edges[j].Len + CurrentEdge.dLengthOnX = CurrentEdge.dLength * CurrentEdge.vtToolDirection:getY() CurrentEdge.dElevation = LongFaces[i].Edges[j].Elev CurrentEdge.bIsOpen = LongFaces[i].Edges[j].Open CurrentEdge.bIsStartOpen = LongFaces[i].Edges[nPreviousEdgeIndex].Open @@ -426,6 +428,7 @@ local function GetSideFaces( Proc, MainFaces) CurrentEdge.idAdjacentFace = SideFaces[i].Edges[j].Adj CurrentEdge.vtToolDirection = Vector3d( SideFaces[i].Edges[j].Norm) CurrentEdge.dLength = SideFaces[i].Edges[j].Len + CurrentEdge.dLengthOnX = CurrentEdge.dLength * CurrentEdge.vtToolDirection:getY() CurrentEdge.dElevation = SideFaces[i].Edges[j].Elev CurrentEdge.bIsOpen = SideFaces[i].Edges[j].Open CurrentEdge.bIsStartOpen = SideFaces[i].Edges[nPreviousEdgeIndex].Open diff --git a/LuaLibs/FeatureLib.lua b/LuaLibs/FeatureLib.lua index c336db0..684e759 100644 --- a/LuaLibs/FeatureLib.lua +++ b/LuaLibs/FeatureLib.lua @@ -294,6 +294,21 @@ function FeatureLib.CalculateCompositeRating( StrategyResult) return StrategyResult end +------------------------------------------------------------------------------------------------------------- +function FeatureLib.MachiningNeedsSplitting( dMachiningLengthOnX, Part, OptionalParameters) + local bMachiningNeedsSplitting + + -- parametri opzionali + if not OptionalParameters then + OptionalParameters = {} + end + local dMaxSegmentLength = OptionalParameters.dMaxSegmentLength or BeamData.LONGCUT_MAXLEN + + bMachiningNeedsSplitting = ( dMachiningLengthOnX > dMaxSegmentLength + 10 * GEO.EPS_SMALL) + or ( dMachiningLengthOnX > 0.7 * Part.b3Solid:getDimX() + 10 * GEO.EPS_SMALL) + + return bMachiningNeedsSplitting +end ------------------------------------------------------------------------------------------------------------- function FeatureLib.GetFeatureSplittingPoints( Proc, Part, OptionalParameters) -- TODO overlap non serve a nulla?? in STR0002 รจ gestito dal chiamante @@ -313,7 +328,7 @@ function FeatureLib.GetFeatureSplittingPoints( Proc, Part, OptionalParameters) local dToolOverlapBetweenSegments = OptionalParameters.dToolOverlapBetweenSegments or BeamData.MILL_OVERLAP -- verifica spezzatura necessaria - if ( Proc.b3Box:getDimX() < dMaxSegmentLength + 10 * GEO.EPS_SMALL) and ( Proc.b3Box:getDimX() < 0.7 * Part.b3Solid:getDimX() + 10 * GEO.EPS_SMALL) then + if not FeatureLib.MachiningNeedsSplitting( Proc.b3Box:getDimX(), Part) then return {} end diff --git a/Strategies/Standard/STR0002/STR0002.lua b/Strategies/Standard/STR0002/STR0002.lua index 73d6ded..f4072b8 100644 --- a/Strategies/Standard/STR0002/STR0002.lua +++ b/Strategies/Standard/STR0002/STR0002.lua @@ -371,21 +371,21 @@ local function GetSplitSurfaces( Proc, Part) local nAddId = EgtCopyGlob( nOriginalTmId, nAddGrpId) or GDB_ID.NULL if i == 1 then -- prima superficie, va tagliata solo a destra - local ptSplit = vFeatureSplittingPoints[i] + Vector3d( BeamData.MILL_OVERLAP, 0, 0) + local ptSplit = vFeatureSplittingPoints[i] + Vector3d( BeamData.MILL_OVERLAP / 2, 0, 0) EgtCutSurfTmPlane( nAddId, ptSplit, X_AX(), true, GDB_RT.GLOB) else -- taglio della superficie corrente - lato sinistro - local ptSplit = vFeatureSplittingPoints[i - 1] + Vector3d( -BeamData.MILL_OVERLAP, 0, 0) + local ptSplit = vFeatureSplittingPoints[i - 1] + Vector3d( -BeamData.MILL_OVERLAP / 2, 0, 0) EgtCutSurfTmPlane( nAddId, ptSplit, -X_AX(), true, GDB_RT.GLOB) -- taglio della superficie corrente - lato destro - ptSplit = vFeatureSplittingPoints[i] + Vector3d( BeamData.MILL_OVERLAP, 0, 0) + ptSplit = vFeatureSplittingPoints[i] + Vector3d( BeamData.MILL_OVERLAP / 2, 0, 0) EgtCutSurfTmPlane( nAddId, ptSplit, X_AX(), true, GDB_RT.GLOB) end table.insert( vAddId, nAddId) end -- taglio ultima superficie, va tagliata solo a sinistra local nAddId = EgtCopyGlob( nOriginalTmId, nAddGrpId) or GDB_ID.NULL - local ptSplit = vFeatureSplittingPoints[#vFeatureSplittingPoints] + Vector3d( -BeamData.MILL_OVERLAP, 0, 0) + local ptSplit = vFeatureSplittingPoints[#vFeatureSplittingPoints] + Vector3d( -BeamData.MILL_OVERLAP / 2, 0, 0) EgtCutSurfTmPlane( nAddId, ptSplit, -X_AX(), true, GDB_RT.GLOB) table.insert( vAddId, nAddId) end