From 2fff4438c040551318b5e238b191d3437843b051 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 11 Nov 2024 11:52:21 +0100 Subject: [PATCH] =?UTF-8?q?-=20in=20STR0002=20overlap=20tra=20le=20passate?= =?UTF-8?q?=20portato=20a=201/2=20MILL=5FOVERLAP=20-=20in=20FaceData=20in?= =?UTF-8?q?=20ogni=20Edge=20si=20scrive=20ora=20la=20lunghezza=20proiettat?= =?UTF-8?q?a=20lungo=20X=20dLengthOnX=20-=20in=20FeatureLib=20aggiunta=20l?= =?UTF-8?q?a=20funzione=20MachiningNeedsSplitting=20per=20unificare=20il?= =?UTF-8?q?=20check=20di=20necessit=C3=A0=20spezzatura?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/FaceData.lua | 3 +++ LuaLibs/FeatureLib.lua | 17 ++++++++++++++++- Strategies/Standard/STR0002/STR0002.lua | 8 ++++---- 3 files changed, 23 insertions(+), 5 deletions(-) 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