diff --git a/LuaLibs/BasicCustomerStrategies.lua b/LuaLibs/BasicCustomerStrategies.lua index 0775998..4d96234 100644 --- a/LuaLibs/BasicCustomerStrategies.lua +++ b/LuaLibs/BasicCustomerStrategies.lua @@ -252,6 +252,7 @@ local function GetStrategies_Essetre( Proc) --------------------------------------------------------------------- -- Feature : Chamfer (0-36) elseif ID.IsChamfer( Proc) then + Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}, { sStrategyId = 'STR0010'}} --------------------------------------------------------------------- -- Feature : Block Haus Half Lap (0-37) elseif ID.IsHalfBlockHaus( Proc) then diff --git a/LuaLibs/FaceData.lua b/LuaLibs/FaceData.lua index 4bd64d9..9ae3bdd 100644 --- a/LuaLibs/FaceData.lua +++ b/LuaLibs/FaceData.lua @@ -369,7 +369,8 @@ local function GetBottomFaces( Proc) if Proc.Topology.sFamily == 'Tunnel' then return nil - elseif not ( Proc.Topology.sFamily == 'Rabbet' + elseif not ( Proc.Topology.sFamily == 'PseudoPocket' + or Proc.Topology.sFamily == 'Rabbet' or Proc.Topology.sFamily == 'VGroove' or Proc.Topology.sFamily == 'Groove' or Proc.Topology.sFamily == 'Pocket' @@ -706,7 +707,7 @@ function FaceData.GetMainFaces( Proc, Part) local MainFaces = {} -- CASO 1 : Feature tipo LapJoint - if Proc.Topology.sFamily == 'Rabbet' or Proc.Topology.sFamily == 'VGroove' or Proc.Topology.sFamily == 'Groove' or + if Proc.Topology.sFamily == 'PseudoPocket' or Proc.Topology.sFamily == 'Rabbet' or Proc.Topology.sFamily == 'VGroove' or Proc.Topology.sFamily == 'Groove' or Proc.Topology.sFamily == 'Pocket' or Proc.Topology.sFamily == 'Tunnel' or Proc.Topology.sFamily == 'Bevel' or Proc.Topology.sFamily == 'DoubleBevel' or Proc.Topology.sFamily == 'Cut' or Proc.Topology.sFamily == 'HeadCut' or Proc.Topology.sFamily == 'TailCut' then diff --git a/LuaLibs/FeatureLib.lua b/LuaLibs/FeatureLib.lua index 9fad706..5ac90dc 100644 --- a/LuaLibs/FeatureLib.lua +++ b/LuaLibs/FeatureLib.lua @@ -255,6 +255,9 @@ function FeatureLib.ClassifyTopology( Proc, Part) elseif Proc.nFct == 4 and bAllAnglesConcave and #vFacesByAdjNumber[2] == 4 and bIsAnyDimensionLongAsPart then sFamily = 'Tunnel' bIsThrough = true + elseif Proc.nFct == 4 and bAllAnglesConcave and #vFacesByAdjNumber[3] == 1 then + sFamily = 'PseudoPocket' + bIsThrough = false elseif Proc.nFct >= 4 and #vFacesByAdjNumber[1] == 2 and bIsAnyDimensionLongAsPart then sFamily = 'Strip' bIsThrough = true @@ -860,7 +863,7 @@ function FeatureLib.GetFeatureSplittingPoints( Proc, Part, OptionalParameters) if Part.dRestLength + Part.b3Part:getDimX() < BeamData.dMinRaw * 1.5 then dSplitXLeft = Part.b3Part:getMax():getX() - ( ( Part.dRestLength + Part.b3Part:getDimX()) / 2) else - dSplitXLeft = max( Proc.b3Box:getMin():getX() + ( BeamData.dMinRaw)/2 + 150, Part.b3Part:getMax():getX() - dMaxSegmentLengthOnEdges) + dSplitXLeft = max( Proc.b3Box:getMin():getX() + ( BeamData.dMinRaw) / 2 + 150, Part.b3Part:getMax():getX() - dMaxSegmentLengthOnEdges) end end dFeatureCentralLength = abs( dSplitXRight - dSplitXLeft) diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index da97f02..77f77c3 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -169,20 +169,20 @@ function MachiningLib.GetSplitMachinings( Machinings, SplittingPoints, Part) dStartAddLength, dEndAddLength = dEndAddLength, dStartAddLength end if j == 1 then - dEndAddLength = - ( SplittingPoints[j]:getX() - dEdgeMinX) + BeamData.MILL_OVERLAP + dEndAddLength = - ( SplittingPoints[j]:getX() - dEdgeMinX) + BeamData.MILL_OVERLAP / 2 if LeadOutForSplit then Machinings[nCurrentMachiningIndex].LeadOut = BeamLib.TableCopyDeep( LeadOutForSplit) end Machinings[nCurrentMachiningIndex].ptCenter = Point3d( SplittingPoints[j]:getX() + ( dEdgeMaxX - SplittingPoints[j]:getX()) / 2, 0, 0) elseif j == nParts then - dStartAddLength = - ( dEdgeMaxX - SplittingPoints[j - 1]:getX()) + BeamData.MILL_OVERLAP + dStartAddLength = - ( dEdgeMaxX - SplittingPoints[j - 1]:getX()) + BeamData.MILL_OVERLAP / 2 if LeadInForSplit then Machinings[nCurrentMachiningIndex].LeadIn = BeamLib.TableCopyDeep( LeadInForSplit) end Machinings[nCurrentMachiningIndex].ptCenter = Point3d( dEdgeMinX + ( SplittingPoints[j - 1]:getX() - dEdgeMinX) / 2, 0, 0) else - dStartAddLength = - ( dEdgeMaxX - SplittingPoints[j - 1]:getX()) + BeamData.MILL_OVERLAP - dEndAddLength = - ( SplittingPoints[j]:getX() - dEdgeMinX) + BeamData.MILL_OVERLAP + dStartAddLength = - ( dEdgeMaxX - SplittingPoints[j - 1]:getX()) + BeamData.MILL_OVERLAP / 2 + dEndAddLength = - ( SplittingPoints[j]:getX() - dEdgeMinX) + BeamData.MILL_OVERLAP / 2 if LeadInForSplit then Machinings[nCurrentMachiningIndex].LeadIn = BeamLib.TableCopyDeep( LeadInForSplit) end diff --git a/Strategies/AvailableStrategyList.json b/Strategies/AvailableStrategyList.json index da7af96..1799793 100644 --- a/Strategies/AvailableStrategyList.json +++ b/Strategies/AvailableStrategyList.json @@ -392,7 +392,7 @@ "TopologyList" : [ { "sName": "Feature", "sImage": "ConfigStrategy\\Chamfer.png", - "StrategyList" : [ ] + "StrategyList" : [ { "sStrategyId": "STR0002" }, { "sStrategyId": "STR0005" }, { "sStrategyId": "STR0010" } ] } ] }, diff --git a/Strategies/Standard/STR0002/STR0002.lua b/Strategies/Standard/STR0002/STR0002.lua index cb58210..0d387ba 100644 --- a/Strategies/Standard/STR0002/STR0002.lua +++ b/Strategies/Standard/STR0002/STR0002.lua @@ -27,7 +27,8 @@ local Strategy = {} ------------------------------------------------------------------------------------------------------------- local function IsTopologyOk( Proc) - if Proc.Topology.sName == 'Pocket-5-Blind' or + if Proc.Topology.sFamily == 'PseudoPocket' or + Proc.Topology.sName == 'Pocket-5-Blind' or Proc.Topology.sName == 'RafterNotch-5-Through' or Proc.Topology.sName == 'Tunnel-4-Through' or Proc.Topology.sName == 'Groove-4-Blind' or @@ -121,7 +122,7 @@ local function GetBestPocketingStrategy( Proc, Part) ToolSearchParameters.sType = 'MILL_STD' ToolSearchParameters.dMaxToolDiameter = min( Strategy.Parameters.dMaxCornerRadius * 2, Proc.FeatureInfo.dFaceLength / 2) -- imposto dati per cercare la fresa migliore - elseif Proc.Topology.sName == 'Pocket-5-Blind' then + elseif Proc.Topology.sName == 'Pocket-5-Blind' or Proc.Topology.sFamily == 'PseudoPocket' then local dFaceWidth, dFaceLength if Proc.MainFaces.BottomFaces[1].MainEdges then dFaceWidth = Proc.MainFaces.BottomFaces[1].MainEdges.LongEdges[1].dLength @@ -233,7 +234,7 @@ local function GetBestPocketingStrategy( Proc, Part) -- cerco utensile per lavorare di fianco 1 Milling = {} Milling.bIsApplicable = false - if Proc.Topology.sName ~= 'DoubleBevel-2-Through' + if Proc.Topology.sName ~= 'DoubleBevel-2-Through' and Proc.Topology.sFamily ~= 'PseudoPocket' and Proc.Topology.sName ~= 'Pocket-5-Blind' and Proc.Topology.sName ~= 'RafterNotch-5-Through' then if Proc.Topology.sName == 'Groove-4-Blind' then @@ -302,6 +303,7 @@ local function GetBestPocketingStrategy( Proc, Part) Milling.bIsApplicable = false if Proc.Topology.sName ~= 'DoubleBevel-2-Through' and Proc.Topology.sName ~= 'Pocket-5-Blind' + and Proc.Topology.sFamily ~= 'PseudoPocket' and Proc.Topology.sName ~= 'RafterNotch-5-Through' and Proc.Topology.sName ~= 'Groove-4-Blind' and Proc.Topology.sName ~= 'Bevel-3-Blind' then diff --git a/Strategies/Standard/STR0015/STR0015.lua b/Strategies/Standard/STR0015/STR0015.lua index ad09aaa..8eb4334 100644 --- a/Strategies/Standard/STR0015/STR0015.lua +++ b/Strategies/Standard/STR0015/STR0015.lua @@ -704,6 +704,21 @@ local function GetFeatureResult( Proc) return Result end +------------------------------------------------------------------------------------------------------------- +local function GetSCC( Proc, vtToolDirection) + local nSCC = MCH_SCC.NONE + + if Proc.AffectedFaces.bRight and not Proc.AffectedFaces.bLeft then + nSCC = MCH_SCC.ADIR_XP + elseif Proc.AffectedFaces.bLeft and not Proc.AffectedFaces.bRight then + nSCC = MCH_SCC.ADIR_XM + elseif vtToolDirection and AreSameOrOppositeVectorApprox( vtToolDirection, Z_AX()) then + nSCC = MCH_SCC.ADIR_YP + end + + return nSCC +end + ------------------------------------------------------------------------------------------------------------- function STR0015.Make( bAddMachining, Proc, Part, CustomParameters) -- carico parametri de default e li aggiorno con quelli passati dal chiamante (potrebbero non essere congruenti) @@ -814,53 +829,56 @@ function STR0015.Make( bAddMachining, Proc, Part, CustomParameters) if Strategy.Profile.Machinings then for i = 1, #Strategy.Profile.Machinings do - Strategy.Profile.Machinings[i].Geometry = {{ Proc.idAddAuxGeom, -1}} - Strategy.Profile.Machinings[i].nToolIndex = Strategy.Profile.Machinings[i].ToolInfo.nToolIndex - Strategy.Profile.Machinings[i].nType = MCH_MY.MILLING - Strategy.Profile.Machinings[i].Steps = MachiningLib.GetMachiningSteps( false, tonumber( Strategy.Profile.Machinings[i].sDepth), TOOLS[Strategy.Profile.Machinings[i].nToolIndex].dStep) - Strategy.Profile.Machinings[i].Steps.nStepType = MCH_MILL_ST.ONEWAY + local CurrentMachining = Strategy.Profile.Machinings[i] + + CurrentMachining.Geometry = {{ Proc.idAddAuxGeom, -1}} + CurrentMachining.nToolIndex = CurrentMachining.ToolInfo.nToolIndex + CurrentMachining.nType = MCH_MY.MILLING + CurrentMachining.Steps = MachiningLib.GetMachiningSteps( false, tonumber( CurrentMachining.sDepth), TOOLS[CurrentMachining.nToolIndex].dStep) + CurrentMachining.Steps.nStepType = MCH_MILL_ST.ONEWAY + CurrentMachining.nSCC = GetSCC( Proc, CurrentMachining.vtToolDirection) -- LeadIn / LeadOut - Strategy.Profile.Machinings[i].LeadIn.nType = MCH_MILL_LI.TANGENT - Strategy.Profile.Machinings[i].LeadOut.nType = MCH_MILL_LI.TANGENT - Strategy.Profile.Machinings[i].LeadIn.dTangentDistance = TOOLS[Strategy.Profile.Machinings[i].ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC - Strategy.Profile.Machinings[i].LeadIn.dPerpDistance = 0 - Strategy.Profile.Machinings[i].LeadIn.dStartAddLength = 0 - Strategy.Profile.Machinings[i].LeadOut.dTangentDistance = TOOLS[Strategy.Profile.Machinings[i].ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC - Strategy.Profile.Machinings[i].LeadOut.dPerpDistance = 0 - Strategy.Profile.Machinings[i].LeadOut.dEndAddLength = 0 + CurrentMachining.LeadIn.nType = MCH_MILL_LI.TANGENT + CurrentMachining.LeadOut.nType = MCH_MILL_LI.TANGENT + CurrentMachining.LeadIn.dTangentDistance = TOOLS[CurrentMachining.ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC + CurrentMachining.LeadIn.dPerpDistance = 0 + CurrentMachining.LeadIn.dStartAddLength = 0 + CurrentMachining.LeadOut.dTangentDistance = TOOLS[CurrentMachining.ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC + CurrentMachining.LeadOut.dPerpDistance = 0 + CurrentMachining.LeadOut.dEndAddLength = 0 if Proc.AffectedFaces.bLeft and Strategy.bCanMoveAfterSplit then - Strategy.Profile.Machinings[i].sStage = 'AfterTail' + CurrentMachining.sStage = 'AfterTail' end -- preparo attacco/uscita in caso di spezzatura arco - Strategy.Profile.Machinings[i].LeadInForSplit = BeamLib.TableCopyDeep( Strategy.Profile.Machinings[i].LeadIn) - Strategy.Profile.Machinings[i].LeadOutForSplit = BeamLib.TableCopyDeep( Strategy.Profile.Machinings[i].LeadOut) - Strategy.Profile.Machinings[i].LeadInForSplit.nType = MCH_MILL_LI.LINEAR - Strategy.Profile.Machinings[i].LeadOutForSplit.nType = MCH_MILL_LI.LINEAR - Strategy.Profile.Machinings[i].LeadInForSplit.dTangentDistance = 0 - Strategy.Profile.Machinings[i].LeadInForSplit.dPerpDistance = TOOLS[Strategy.Profile.Machinings[i].ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC - Strategy.Profile.Machinings[i].LeadOutForSplit.dTangentDistance = 0 - Strategy.Profile.Machinings[i].LeadOutForSplit.dPerpDistance = TOOLS[Strategy.Profile.Machinings[i].ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC + CurrentMachining.LeadInForSplit = BeamLib.TableCopyDeep( CurrentMachining.LeadIn) + CurrentMachining.LeadOutForSplit = BeamLib.TableCopyDeep( CurrentMachining.LeadOut) + CurrentMachining.LeadInForSplit.nType = MCH_MILL_LI.LINEAR + CurrentMachining.LeadOutForSplit.nType = MCH_MILL_LI.LINEAR + CurrentMachining.LeadInForSplit.dTangentDistance = 0 + CurrentMachining.LeadInForSplit.dPerpDistance = TOOLS[CurrentMachining.ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC + CurrentMachining.LeadOutForSplit.dTangentDistance = 0 + CurrentMachining.LeadOutForSplit.dPerpDistance = TOOLS[CurrentMachining.ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC -- sistemo il lato e la direzione di lavoro - if Strategy.Profile.Machinings[i].bOtherDirection then - Strategy.Profile.Machinings[i].bToolInvert = true - Strategy.Profile.Machinings[i].bInvert = EgtIf( TOOLS[Strategy.Profile.Machinings[i].ToolInfo.nToolIndex].bIsCCW, true, false) - Strategy.Profile.Machinings[i].nWorkside = EgtIf( TOOLS[Strategy.Profile.Machinings[i].ToolInfo.nToolIndex].bIsCCW, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT) + if CurrentMachining.bOtherDirection then + CurrentMachining.bToolInvert = true + CurrentMachining.bInvert = EgtIf( TOOLS[CurrentMachining.ToolInfo.nToolIndex].bIsCCW, true, false) + CurrentMachining.nWorkside = EgtIf( TOOLS[CurrentMachining.ToolInfo.nToolIndex].bIsCCW, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT) else - Strategy.Profile.Machinings[i].bInvert = EgtIf( TOOLS[Strategy.Profile.Machinings[i].ToolInfo.nToolIndex].bIsCCW, false, true) - Strategy.Profile.Machinings[i].nWorkside = EgtIf( TOOLS[Strategy.Profile.Machinings[i].ToolInfo.nToolIndex].bIsCCW, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT) + CurrentMachining.bInvert = EgtIf( TOOLS[CurrentMachining.ToolInfo.nToolIndex].bIsCCW, false, true) + CurrentMachining.nWorkside = EgtIf( TOOLS[CurrentMachining.ToolInfo.nToolIndex].bIsCCW, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT) end - Strategy.Profile.Machinings[i].ptEdge1 = EgtSP( Proc.idAddAuxGeom, GDB_ID.ROOT) - Strategy.Profile.Machinings[i].ptEdge2 = EgtEP( Proc.idAddAuxGeom, GDB_ID.ROOT) - Strategy.Profile.Machinings[i].dEdgeLength = EgtCurveLength( Proc.idAddAuxGeom) - Strategy.Profile.Machinings[i].vtEdgeDirection = EgtSV( Proc.idAddAuxGeom, GDB_ID.ROOT) + EgtMV( Proc.idAddAuxGeom, GDB_ID.ROOT) + EgtEV( Proc.idAddAuxGeom, GDB_ID.ROOT) - Strategy.Profile.Machinings[i].dLengthOnX = Proc.b3Box:getDimX() + CurrentMachining.ptEdge1 = EgtSP( Proc.idAddAuxGeom, GDB_ID.ROOT) + CurrentMachining.ptEdge2 = EgtEP( Proc.idAddAuxGeom, GDB_ID.ROOT) + CurrentMachining.dEdgeLength = EgtCurveLength( Proc.idAddAuxGeom) + CurrentMachining.vtEdgeDirection = EgtSV( Proc.idAddAuxGeom, GDB_ID.ROOT) + EgtMV( Proc.idAddAuxGeom, GDB_ID.ROOT) + EgtEV( Proc.idAddAuxGeom, GDB_ID.ROOT) + CurrentMachining.dLengthOnX = Proc.b3Box:getDimX() local MachiningToSplit = {} - table.insert( MachiningToSplit, Strategy.Profile.Machinings[i]) + table.insert( MachiningToSplit, CurrentMachining) local MachiningResult = MachiningLib.GetSplitMachinings( MachiningToSplit, FeatureSplittingPoints, Part) -- aggiunge lavorazione for j = 1, #MachiningResult do diff --git a/Strategies/Strategies.ini b/Strategies/Strategies.ini index 4886ae5..2cb5285 100644 --- a/Strategies/Strategies.ini +++ b/Strategies/Strategies.ini @@ -79,7 +79,7 @@ STR0015 = Profilo arcuato (Head Cambered Profile) ; Feature : French Ridge Lap 35,1,Feature, ; Feature : Chamfer -36,0,Feature, +36,0,Feature,STR0002,STR0005,STR0010 ; Feature : Block Haus Half Lap 37,0,Feature, ; Feature : Block Haus Front diff --git a/StrategyLibs/BLADEKEEPWASTE.lua b/StrategyLibs/BLADEKEEPWASTE.lua index 4273a1c..566a094 100644 --- a/StrategyLibs/BLADEKEEPWASTE.lua +++ b/StrategyLibs/BLADEKEEPWASTE.lua @@ -216,7 +216,7 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters) local CalculatedMachinings = {} -- controlli preventivi - if Proc.nFct > 3 and ( not Proc.Topology.sFamily == 'DoubleBevel') then + if Proc.nFct > 3 and Proc.Topology.sFamily ~= 'DoubleBevel' then Result = FeatureLib.GetStrategyResultNotApplicable( 'BladeKeepWaste : max 3 faces supported') return Machinings, Result elseif Proc.nFct == 2 then