diff --git a/LuaLibs/BasicCustomerStrategies.lua b/LuaLibs/BasicCustomerStrategies.lua index 01729bd..de03953 100644 --- a/LuaLibs/BasicCustomerStrategies.lua +++ b/LuaLibs/BasicCustomerStrategies.lua @@ -17,8 +17,7 @@ local ID = require( 'Identity') -- *** EGALWARE *** ---------------------------------------------------------------------------------- local function GetStrategies_Egalware( Proc) - local Strategy_Egalware = {} - local Strategies_Egalware = {} + local Strategies = {} -- TODO tabella da compleatare man mano che si inseriscono le varie strategie @@ -26,15 +25,14 @@ local function GetStrategies_Egalware( Proc) -- Feature : Cut if ID.IsHeadCut( Proc) then -- TODO TOGLIERE IL true PER FORZARE IF!!! PROVVISORIO PER PROVARE STRATEGIE if Proc.Topology.sName == 'FEATURE' then - Strategy_Egalware = { - sStrategyId = 'STR0001', - Parameters = { + Strategies = { + { sStrategyId = 'STR0001', + Parameters = { { sName = 'Step', sValue = '15', sType = 'd'}, { sName = 'AntiSplint', sValue = 'false', sType = 'b'} + } } } - table.insert( Strategies_Egalware, Strategy_Egalware) - Strategy_Egalware = {} end --------------------------------------------------------------------- -- Feature : Cut @@ -58,13 +56,18 @@ local function GetStrategies_Egalware( Proc) -- Feature : Slot elseif ID.IsSlot( Proc) then if Proc.Topology.sName == 'Pocket-5-Blind' then - Strategy_Egalware = { sStrategyId = 'STR0002'} - table.insert( Strategies_Egalware, Strategy_Egalware) - Strategy_Egalware = {} + Strategies = { { sStrategyId = 'STR0002'}} + elseif Proc.Topology.sName == 'Groove-4-Blind' then + Strategies = { { sStrategyId = 'STR0002'}} end --------------------------------------------------------------------- -- Feature : Front Slot elseif ID.IsFrontSlot( Proc) then + if Proc.Topology.sName == 'Pocket-5-Blind' then + Strategies = { { sStrategyId = 'STR0002'}} + elseif Proc.Topology.sName == 'Groove-4-Blind' then + Strategies = { { sStrategyId = 'STR0002'}} + end --------------------------------------------------------------------- -- Feature : Birds Mouth elseif ID.IsBirdsMouth( Proc) then @@ -74,18 +77,38 @@ local function GetStrategies_Egalware( Proc) --------------------------------------------------------------------- -- Feature : Ridge Lap elseif ID.IsRidgeLap( Proc) then + if Proc.Topology.sName == 'Pocket-5-Blind' then + Strategies = { { sStrategyId = 'STR0002'}} + elseif Proc.Topology.sName == 'Groove-4-Blind' then + Strategies = { { sStrategyId = 'STR0002'}} + end --------------------------------------------------------------------- -- Feature : Lap Joint elseif ID.IsLapJoint( Proc) then + if Proc.Topology.sName == 'Pocket-5-Blind' then + Strategies = { { sStrategyId = 'STR0002'}} + elseif Proc.Topology.sName == 'Groove-4-Blind' then + Strategies = { { sStrategyId = 'STR0002'}} + end --------------------------------------------------------------------- -- Feature : Notch/Rabbet elseif ID.IsNotchRabbet( Proc) then + if Proc.Topology.sName == 'Pocket-5-Blind' then + Strategies = { { sStrategyId = 'STR0002'}} + elseif Proc.Topology.sName == 'Groove-4-Blind' then + Strategies = { { sStrategyId = 'STR0002'}} + end --------------------------------------------------------------------- -- Feature : Block Haus elseif ID.IsBlockHaus( Proc) then --------------------------------------------------------------------- -- Feature : Notch elseif ID.IsNotch( Proc) then + if Proc.Topology.sName == 'Pocket-5-Blind' then + Strategies = { { sStrategyId = 'STR0002'}} + elseif Proc.Topology.sName == 'Groove-4-Blind' then + Strategies = { { sStrategyId = 'STR0002'}} + end --------------------------------------------------------------------- -- Feature : French Ridge Lap elseif ID.IsFrenchRidgeLap( Proc) then @@ -102,9 +125,9 @@ local function GetStrategies_Egalware( Proc) -- Feature : Pocket elseif ID.IsPocket( Proc) then if Proc.Topology.sName == 'Pocket-5-Blind' then - Strategy_Egalware = { sStrategyId = 'STR0002'} - table.insert( Strategies_Egalware, Strategy_Egalware) - Strategy_Egalware = {} + Strategies = { { sStrategyId = 'STR0002'}} + elseif Proc.Topology.sName == 'Groove-4-Blind' then + Strategies = { { sStrategyId = 'STR0002'}} end --------------------------------------------------------------------- -- Feature : Drilling @@ -199,21 +222,30 @@ local function GetStrategies_Egalware( Proc) --------------------------------------------------------------------- end - return Strategies_Egalware + return Strategies end ---------------------------------------------------------------------------------- -- *** ESSETRE *** ---------------------------------------------------------------------------------- local function GetStrategies_Essetre( Proc) - local Strategy_Essetre = {} - local Strategies_Essetre = {} + local Strategies = {} -- TODO tabella da compleatare man mano che si inseriscono le varie strategie --------------------------------------------------------------------- -- Feature : Cut - if ID.IsHeadCut( Proc) then + if ID.IsHeadCut( Proc) then -- TODO TOGLIERE IL true PER FORZARE IF!!! PROVVISORIO PER PROVARE STRATEGIE + if Proc.Topology.sName == 'FEATURE' then + Strategies = { + { sStrategyId = 'STR0001', + Parameters = { + { sName = 'Step', sValue = '15', sType = 'd'}, + { sName = 'AntiSplint', sValue = 'false', sType = 'b'} + } + } + } + end --------------------------------------------------------------------- -- Feature : Cut elseif ID.IsSplitCut( Proc) then @@ -236,13 +268,18 @@ local function GetStrategies_Essetre( Proc) -- Feature : Slot elseif ID.IsSlot( Proc) then if Proc.Topology.sName == 'Pocket-5-Blind' then - Strategy_Essetre = { sStrategyId = 'STR0002'} - table.insert( Strategies_Essetre, Strategy_Essetre) - Strategy_Essetre = {} + Strategies = { { sStrategyId = 'STR0002'}} + elseif Proc.Topology.sName == 'Groove-4-Blind' then + Strategies = { { sStrategyId = 'STR0002'}} end --------------------------------------------------------------------- -- Feature : Front Slot elseif ID.IsFrontSlot( Proc) then + if Proc.Topology.sName == 'Pocket-5-Blind' then + Strategies = { { sStrategyId = 'STR0002'}} + elseif Proc.Topology.sName == 'Groove-4-Blind' then + Strategies = { { sStrategyId = 'STR0002'}} + end --------------------------------------------------------------------- -- Feature : Birds Mouth elseif ID.IsBirdsMouth( Proc) then @@ -252,18 +289,38 @@ local function GetStrategies_Essetre( Proc) --------------------------------------------------------------------- -- Feature : Ridge Lap elseif ID.IsRidgeLap( Proc) then + if Proc.Topology.sName == 'Pocket-5-Blind' then + Strategies = { { sStrategyId = 'STR0002'}} + elseif Proc.Topology.sName == 'Groove-4-Blind' then + Strategies = { { sStrategyId = 'STR0002'}} + end --------------------------------------------------------------------- -- Feature : Lap Joint elseif ID.IsLapJoint( Proc) then + if Proc.Topology.sName == 'Pocket-5-Blind' then + Strategies = { { sStrategyId = 'STR0002'}} + elseif Proc.Topology.sName == 'Groove-4-Blind' then + Strategies = { { sStrategyId = 'STR0002'}} + end --------------------------------------------------------------------- -- Feature : Notch/Rabbet elseif ID.IsNotchRabbet( Proc) then + if Proc.Topology.sName == 'Pocket-5-Blind' then + Strategies = { { sStrategyId = 'STR0002'}} + elseif Proc.Topology.sName == 'Groove-4-Blind' then + Strategies = { { sStrategyId = 'STR0002'}} + end --------------------------------------------------------------------- -- Feature : Block Haus elseif ID.IsBlockHaus( Proc) then --------------------------------------------------------------------- -- Feature : Notch elseif ID.IsNotch( Proc) then + if Proc.Topology.sName == 'Pocket-5-Blind' then + Strategies = { { sStrategyId = 'STR0002'}} + elseif Proc.Topology.sName == 'Groove-4-Blind' then + Strategies = { { sStrategyId = 'STR0002'}} + end --------------------------------------------------------------------- -- Feature : French Ridge Lap elseif ID.IsFrenchRidgeLap( Proc) then @@ -280,9 +337,9 @@ local function GetStrategies_Essetre( Proc) -- Feature : Pocket elseif ID.IsPocket( Proc) then if Proc.Topology.sName == 'Pocket-5-Blind' then - Strategy_Essetre = { sStrategyId = 'STR0002'} - table.insert( Strategies_Essetre, Strategy_Essetre) - Strategy_Essetre = {} + Strategies = { { sStrategyId = 'STR0002'}} + elseif Proc.Topology.sName == 'Groove-4-Blind' then + Strategies = { { sStrategyId = 'STR0002'}} end --------------------------------------------------------------------- -- Feature : Drilling @@ -377,10 +434,9 @@ local function GetStrategies_Essetre( Proc) --------------------------------------------------------------------- end - return Strategies_Essetre + return Strategies end - ---------------------------------------------------------------------------------- -- *** Esecuzione *** ---------------------------------------------------------------------------------- diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index 99e96ff..c52a2f8 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -73,6 +73,7 @@ function MachiningLib.FindMill( Proc, sMillType, sMillShape, dMaxToolDiameter, d bCompatibleTool = false elseif sMillShape == 'PEN' and not TOOLS[nCurrIndex].bIsPen then bCompatibleTool = false + -- TODO controllare montaggio e verificare se direzione utensile raggiungibile. Serve funzione in BeamData end -- scelgo il migliore @@ -121,13 +122,20 @@ end ------------------------------------------------------------------------------------------------------------- -- funzione per cercare utensile tipo LAMA con certe caratteristiche +-- TODO da fare function MachiningLib.FindBlade() end ------------------------------------------------------------------------------------------------------------- -- funzione per cercare utensile tipo PUNTA A FORARE con certe caratteristiche +-- TODO da fare function MachiningLib.FindDrill() end +------------------------------------------------------------------------------------------------------------- +-- funzione per cercare utensile tipo PUNTA A FORARE con certe caratteristiche +-- TODO da fare +function MachiningLib.FindChainSaw() +end ------------------------------------------------------------------------------------------------------------- return MachiningLib diff --git a/Strategies/STR0002/STR0002.lua b/Strategies/STR0002/STR0002.lua index fd0c8f0..d130fdb 100644 --- a/Strategies/STR0002/STR0002.lua +++ b/Strategies/STR0002/STR0002.lua @@ -10,6 +10,7 @@ -- IsNotch -- IsPocket -- Topology: 'Pocket-5-Blind' +-- 'Groove-4-Blind' -- carico librerie local BeamLib = require( 'BeamLib') @@ -23,7 +24,7 @@ local Strategy = {} ------------------------------------------------------------------------------------------------------------- local function IsTopologyOk( Proc) - if Proc.Topology.sName == 'Pocket-5-Blind' then + if Proc.Topology.sName == 'Pocket-5-Blind' or Proc.Topology.sName == 'Groove-4-Blind' then return true else return false @@ -57,9 +58,6 @@ function STR0002.Make( AddMachining, Proc, Part, CustomParameters) -- cerco utensile ToolInfo = MachLib.FindMill( Proc, sMillType, sMillShape, dMaxToolDiameter, dElevation, Proc.MainFaces.BottomFace.vtN) - - - if ToolInfo.idTool and TOOLS[ToolInfo.idTool].sName then if ToolInfo.dMaxMatReduction < 0 then Strategy.RatingResult.sStatus = 'Not-Completed' @@ -75,7 +73,90 @@ function STR0002.Make( AddMachining, Proc, Part, CustomParameters) -- TODO gestione spezzatura da completare -- le lunghezza richiede spezzatura if ( Proc.b3Box:getDimX() > BeamData.LONGCUT_MAXLEN) or ( Proc.b3Box:getDimX() > 0.7 * Part.b3Solid:getDimX() and Proc.b3Box:getDimX() > BeamData.LONGCUT_ENDLEN) then - + -- recupero gruppo per geometria aggiuntiva + local nAddGrpId = BeamLib.GetAddGroup( Part.idPart) + local vAddId = {} + local bStartLeft, bStartRight + + -- se feature inizia al di sotto del limite sinistro + if Proc.b3Box:getMin():getX() < Part.b3Solid:getMin():getX() + BeamData.LONGCUT_ENDLEN then + bStartLeft = true + end + -- se feature inizia al di sotto del limite destro + if Proc.b3Box:getMax():getX() > Part.b3Solid:getMax():getX() - BeamData.LONGCUT_ENDLEN then + bStartRight = true + end + + -- salvo valori + local dNewMinX = Proc.b3Box:getMin():getX() + local dNewMaxX = Proc.b3Box:getMax():getX() + local dNewRest = Proc.b3Box:getDimX() + -- creo primo spezzone sulla sinistra + if bStartLeft then + local AddId = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL + dNewMinX = max( ( Proc.b3Box:getMin():getX() + TOOLS[ToolInfo.idTool].dDiameter * 2), Part.b3Solid:getMin():getX() + BeamData.LONGCUT_ENDLEN) + local ptOn = Point3d( dNewMinX, 0, 0) + dNewRest = abs( dNewMaxX - dNewMinX) + -- taglio della superficie lato sinistro + EgtCutSurfTmPlane( AddId, ptOn, X_AX(), true, GDB_RT.GLOB) + -- eseguo inserimento + table.insert( vAddId, AddId) + end + -- creo spezzone sulla destra + if bStartRight then + local AddId = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL + dNewMaxX = min( ( Proc.b3Box:getMax():getX() - TOOLS[ToolInfo.idTool].dDiameter * 2), Part.b3Solid:getMax():getX() - BeamData.LONGCUT_ENDLEN) + local ptOn = Point3d( dNewMaxX, 0, 0) + dNewRest = abs( dNewMaxX - dNewMinX) + -- taglio della superficie lato destro + EgtCutSurfTmPlane( AddId, ptOn, -X_AX(), true, GDB_RT.GLOB) + -- eseguo inserimento + table.insert( vAddId, EgtIf( BeamData.RIGHT_LOAD, 2, 1),AddId) + end + -- lavoro il restante + local nSplitParts = max( ceil( dNewRest / BeamData.LONGCUT_MAXLEN + 10 * GEO.EPS_SMALL), 2) + local dSplitPartsLen = dNewRest / nSplitParts + for i = 1, nSplitParts do + local AddId = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL + local ptOn + -- eseguo trim sinistro + if i ~= 1 or bStartLeft then + ptOn = Point3d( dNewMinX, 0, 0) + -- taglio della superficie lato sinistro + EgtCutSurfTmPlane( AddId, ptOn, -X_AX(), true, GDB_RT.GLOB) + end + -- eseguo trim destro + dNewMaxX = dNewMinX + dSplitPartsLen + if i ~= nSplitParts or bStartRight then + ptOn = Point3d( dNewMaxX, 0, 0) + -- taglio della superficie lato destro + EgtCutSurfTmPlane( AddId, ptOn, X_AX(), true, GDB_RT.GLOB) + end + -- il nuovo minimo รจ il punto massimo del precedente + dNewMinX = dNewMaxX + -- eseguo inserimento in modo da ordinare da X- a X+ + table.insert( vAddId, EgtIf( BeamData.RIGHT_LOAD, 1+i, EgtIf( bStartLeft, 1, 2)), AddId) + end + -- si applicano le lavorazioni + for i = 1, #vAddId do + EgtCreateMachining( 'Svuotatura', MCH_OY.POCKETING, TOOLS[ToolInfo.idTool].sName) + EgtSetMachiningParam( MCH_MP.STEP, TOOLS[ToolInfo.idTool].dStep) + EgtSetMachiningParam( MCH_MP.DEPTH, min( 0, ToolInfo.dMaxMatReduction)) + EgtSetMachiningParam( MCH_MP.SIDESTEP, TOOLS[ToolInfo.idTool].dSideStep) + EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALOUT) + EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_POCK_LI.ZIGZAG) + EgtSetMachiningParam( MCH_MP.LITANG, TOOLS[ToolInfo.idTool].dDiameter/2) + EgtSetMachiningParam( MCH_MP.LIELEV, TOOLS[ToolInfo.idTool].dDiameter/2) + for j=1, Proc.nFct do + local vtNSplitFace + _, vtNSplitFace = EgtSurfTmFacetCenter( vAddId[i], j - 1, GDB_ID.ROOT) + if vtNSplitFace and AreSameVectorExact( vtNSplitFace, Proc.MainFaces.BottomFace.vtN) then + EgtSetMachiningGeometry( {{ vAddId[i], j - 1}}) + EgtApplyMachining( true, true) + break + end + end + end else EgtCreateMachining( 'Svuotatura', MCH_OY.POCKETING, TOOLS[ToolInfo.idTool].sName) EgtSetMachiningParam( MCH_MP.STEP, TOOLS[ToolInfo.idTool].dStep) diff --git a/Strategies/Strategies.ini b/Strategies/Strategies.ini index 72f9b37..5e49b14 100644 --- a/Strategies/Strategies.ini +++ b/Strategies/Strategies.ini @@ -16,23 +16,29 @@ STR0002 = Topologia tipo LapJoint. Svuotatura con fresa ; Feature : Saw Cut 13,0,Feature, ; Feature : Slot -16.0,Pocket-5-Blind,STR0002 +16,0,Pocket-5-Blind,STR0002 +16,0,Groove-4-Blind,STR0002 ; Feature : Front Slot 17,0,Pocket-5-Blind,STR0002 +17,0,Groove-4-Blind,STR0002 ; Feature : Birds Mouth 20,0,Feature, ; Feature : Hip or Valley Rafter Notch 25,0,Feature, ; Feature : Ridge Lap 30,1,Pocket-5-Blind,STR0002 +30,1,Groove-4-Blind,STR0002 ; Feature : Lap Joint 30,0,Pocket-5-Blind,STR0002 +30,0,Groove-4-Blind,STR0002 ; Feature : Notch/Rabbet 32,0,Pocket-5-Blind,STR0002 +32,0,Groove-4-Blind,STR0002 ; Feature : Block Haus 33,0,Feature, ; Feature : Notch 34,0,Pocket-5-Blind,STR0002 +34,0,Groove-4-Blind,STR0002 ; Feature : French Ridge Lap 35,1,Feature, ; Feature : Chamfer @@ -43,6 +49,7 @@ STR0002 = Topologia tipo LapJoint. Svuotatura con fresa 38,0,Feature, ; Feature : Pocket 39,0,Pocket-5-Blind,STR0002 +39,0,Groove-4-Blind,STR0002 ; Feature : Drilling 40,0,Feature, ; Feature : Tenon