Merge branch 'STR0005_BladeToWaste' into develop

This commit is contained in:
luca.mazzoleni
2025-02-27 14:29:54 +01:00
10 changed files with 164 additions and 66 deletions
+9 -9
View File
@@ -91,16 +91,11 @@ function BeamLib.AddPartEndFace( PartId, b3Solid)
end
-------------------------------------------------------------------------------------------------------------
function BeamLib.GetPartSplittingPoints( Part, OptionalParameters)
function BeamLib.GetPartSplittingPoints( Part)
local PartSplittingPoints = {}
local dPartLength = Part.b3Part:getDimX()
-- parametri opzionali
if not OptionalParameters then
OptionalParameters = {}
end
local dMaxSegmentLength = OptionalParameters.dMaxSegmentLength or BeamData.LONGCUT_MAXLEN
local dMaxSegmentLengthOnEdges = OptionalParameters.dMaxSegmentLengthOnEdges or BeamData.LONGCUT_ENDLEN
local dMaxSegmentLength = BeamData.LONGCUT_MAXLEN
local dMaxSegmentLengthOnEdges = BeamData.LONGCUT_ENDLEN
if dPartLength < dMaxSegmentLength + 10 * GEO.EPS_SMALL then
return {}
@@ -447,7 +442,12 @@ function BeamLib.LoadCustomParametersInStrategy( CustomParameters)
if CustomParameters[i].sType == 'b' then
Parameters[CustomParameters[i].sName] = CustomParameters[i].sValue == 'true'
elseif CustomParameters[i].sType == 'd' then
Parameters[CustomParameters[i].sName] = tonumber( CustomParameters[i].sValue)
if #CustomParameters[i].sValue > 0 then
Parameters[CustomParameters[i].sName] = tonumber( CustomParameters[i].sValue)
-- stringa vuota equivale a non passare alcun valore (deciderà la strategia)
else
Parameters[CustomParameters[i].sName] = nil
end
else --CustomParameters[i].sType == 's' or CustomParameters[i].sType == 'combo'
Parameters[CustomParameters[i].sName] = CustomParameters[i].sValue
end
+11 -4
View File
@@ -216,9 +216,9 @@ function MachiningLib.FindMill( Proc, ToolSearchParameters)
-- controlli standard
elseif TOOLS[i].dDiameter > ToolSearchParameters.dMaxToolDiameter then
bIsToolCompatible = false
elseif TOOLS[i].SetupInfo.HeadType.bTop and ToolSearchParameters.vtToolDirection:getZ() < TOOLS[i].SetupInfo.dMaxNegativeAngle then
elseif TOOLS[i].SetupInfo.dMinNz and ToolSearchParameters.vtToolDirection:getZ() < TOOLS[i].SetupInfo.dMinNz - GEO.EPS_ZERO then
bIsToolCompatible = false
elseif TOOLS[i].SetupInfo.HeadType.bBottom and ToolSearchParameters.vtToolDirection:getZ() > TOOLS[i].SetupInfo.dMaxPositiveAngle then
elseif TOOLS[i].SetupInfo.dMaxNz and ToolSearchParameters.vtToolDirection:getZ() > TOOLS[i].SetupInfo.dMaxNz + GEO.EPS_ZERO then
bIsToolCompatible = false
elseif ToolSearchParameters.sMillShape == 'STANDARD' and ( TOOLS[i].dSideAngle ~= 0 or TOOLS[i].bIsPen) then
bIsToolCompatible = false
@@ -297,12 +297,11 @@ end
-- funzione per cercare utensile tipo LAMA con certe caratteristiche
-- TODO da completare
-- TODO il FindBlade dovrà restituire di utilizzare sempre la lama sopra se l'angolo lo permette, ma avendo un'altezza massima (da macchina) oltre cui il DownUp non sarà fattibile (evita collisioni tra asse e pezzo)
-- TODO bisogna leggere vtToolDirection in arrivo e confrontarlo con il SetupInfo
function MachiningLib.FindBlade( Proc, ToolSearchParameters)
local ToolInfo = {}
-- parametri obbligatori
if type( ToolSearchParameters.vtToolDirection) ~= 'table' then
if type( ToolSearchParameters.vtN) ~= 'table' then
error( 'FindBlade : missing tool direction')
end
if type( ToolSearchParameters.bAllowTopHead) ~= 'boolean' then
@@ -334,6 +333,14 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters)
end
end
-- check angolo limite lama
if TOOLS[i].SetupInfo.dMinNz and ToolSearchParameters.vtN:getZ() < TOOLS[i].SetupInfo.dMinNz - GEO.EPS_ZERO then
bIsToolCompatible = false
end
if TOOLS[i].SetupInfo.dMaxNz and ToolSearchParameters.vtN:getZ() > TOOLS[i].SetupInfo.dMaxNz + GEO.EPS_ZERO then
bIsToolCompatible = false
end
if bIsToolCompatible then
-- TODO gestire accorciamento massimo materiale per inclinazione
local dCurrentResidualDepth = ToolSearchParameters.dElevation - TOOLS[i].dMaxDepth
+1 -1
View File
@@ -67,7 +67,7 @@ local function GetSplitStrategy( Proc, Part)
Machining.sTypeMachining = 'None'
local Splitting = {}
local ToolSearchParameters = {}
ToolSearchParameters.vtToolDirection = Proc.Faces[1].vtN
ToolSearchParameters.vtN = Proc.Faces[1].vtN
-- ===== RICERCA UTENSILE =====
@@ -4,15 +4,15 @@ local STR0003Data = {
sStrategyId = 'STR0003',
Parameters = {
{ sName = 'bFinishWithChainSaw', sNameNge = 'ALLOW_FINISH_CHAINSAW', sValue = 'true', sDescriptionShort = 'Finish with chainsaw if needed', sDescriptionLong = 'Finish with chainsaw if needed', sType = 'b', sMessageId = '', sMinUserLevel = '1'},
{ sName = 'dExtendAfterTail', sNameNge = 'EXTEND_AFTER_TAIL', sValue = 'false', sDescriptionShort = '', sDescriptionLong = '', sType = 'd', sMessageId = '', sMinUserLevel = '1'},
{ sName = 'dExtendAfterTail', sNameNge = 'EXTEND_AFTER_TAIL', sValue = '', sDescriptionShort = '', sDescriptionLong = '', sType = 'd', sMessageId = '', sMinUserLevel = '1'},
{ sName = 'bForceLongcutBlade', sNameNge = 'USE_LONGCUT_BLADE', sValue = 'false', sDescriptionShort = 'Force ripping blade', sDescriptionLong = 'Force the use of ripping blade, designed for cuts parallel to the grain', sType = 'b', sMessageId = '', sMinUserLevel = '1'},
{ sName = 'bNotCompleteWithBladeRadius', sNameNge = 'NOT_COMPLETE_WITH_BLADE_RADIUS', sValue = 'true', sDescriptionShort = '', sDescriptionLong = '', sType = 'b', sMessageId = '', sMinUserLevel = '1'},
{ sName = 'bUseZigZagMortising', sNameNge = 'USE_ZIGZAG_CHAINSAW', sValue = 'false', sDescriptionShort = '', sDescriptionLong = '', sType = 'b', sMessageId = '', sMinUserLevel = '1'},
{ sName = 'bSortBySegment', sNameNge = 'SORT_BY_SEGMENT', sValue = 'true', sDescriptionShort = '', sDescriptionLong = '', sType = 'b', sMessageId = '', sMinUserLevel = '1'},
{ sName = 'sCanDamageNextPiece', sNameNge = 'DAMAGE_NEXT_PIECE', sValue = 'NEVER', sType = 'combo', sMinUserLevel = '1',
Choices = { sValue = 'NEVER', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''},
Choices = { { sValue = 'NEVER', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''},
{ sValue = 'ONLY_IF_RAWPART', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''},
{ sValue = 'ALWAYS', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''}}
{ sValue = 'ALWAYS', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''}}}
}
}
@@ -4,11 +4,11 @@ local STR0004Data = {
sStrategyId = 'STR0004',
Parameters = {
{ sName = 'bUseZigZagMortising', sNameNge = 'USE_ZIGZAG_CHAINSAW', sValue = 'false', sDescriptionShort = '', sDescriptionLong = '', sType = 'b', sMessageId = '', sMinUserLevel = '1'},
{ sName = 'dExtendAfterTail', sNameNge = 'EXTEND_AFTER_TAIL', sValue = 'false', sDescriptionShort = '', sDescriptionLong = '', sType = 'd', sMessageId = '', sMinUserLevel = '1'},
{ sName = 'dExtendAfterTail', sNameNge = 'EXTEND_AFTER_TAIL', sValue = '', sDescriptionShort = '', sDescriptionLong = '', sType = 'd', sMessageId = '', sMinUserLevel = '1'},
{ sName = 'sCanDamageNextPiece', sNameNge = 'DAMAGE_NEXT_PIECE', sValue = 'NEVER', sType = 'combo', sMinUserLevel = '1',
Choices = { sValue = 'NEVER', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''},
Choices = { { sValue = 'NEVER', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''},
{ sValue = 'ONLY_IF_RAWPART', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''},
{ sValue = 'ALWAYS', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''}}
{ sValue = 'ALWAYS', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''}}}
}
}
+34 -16
View File
@@ -180,27 +180,45 @@ function STR0005.Make( bAddMachining, Proc, Part, CustomParameters)
table.sort( Blade.Result.Sorted, SortMachiningsBySegment)
-- calcolo parametri per la stima della velocità di asportazione
MRRParameters1 = {
dStep = TOOLS[Cutting1.nToolIndex].dThickness,
dSideStep = min( TOOLS[Cutting1.nToolIndex].dSideStep, dDepthToMachine),
dFeed = TOOLS[Cutting1.nToolIndex].Feeds.dFeed}
MRRParameters2 = {
dStep = TOOLS[Cutting2.nToolIndex].dThickness,
dSideStep = min( TOOLS[Cutting2.nToolIndex].dSideStep, dDepthToMachine),
dFeed = TOOLS[Cutting2.nToolIndex].Feeds.dFeed}
local dMRRBlade1 = MachiningLib.GetToolMRR( MRRParameters1)
local dMRRBlade2 = MachiningLib.GetToolMRR( MRRParameters2)
dMRRBlade = ( dMRRBlade1 + dMRRBlade2) / 2
if Cutting1.bIsApplicable and Cutting2.bIsApplicable then
MRRParameters1 = {
dStep = TOOLS[Cutting1.nToolIndex].dThickness,
dSideStep = min( TOOLS[Cutting1.nToolIndex].dSideStep, dDepthToMachine),
dFeed = TOOLS[Cutting1.nToolIndex].Feeds.dFeed}
MRRParameters2 = {
dStep = TOOLS[Cutting2.nToolIndex].dThickness,
dSideStep = min( TOOLS[Cutting2.nToolIndex].dSideStep, dDepthToMachine),
dFeed = TOOLS[Cutting2.nToolIndex].Feeds.dFeed}
local dMRRBlade1 = MachiningLib.GetToolMRR( MRRParameters1)
local dMRRBlade2 = MachiningLib.GetToolMRR( MRRParameters2)
dMRRBlade = ( dMRRBlade1 + dMRRBlade2) / 2
dCompletionPercentage = Cutting2.dCompletionPercentage
dCompletionPercentage = Cutting2.dCompletionPercentage
else
dMRRBlade = 0
dCompletionPercentage = 0
end
end
-- lavorazione a cubetti / taglio singolo
if #Blade.Result == 0 and not bLeaveWasteAttached then
local bDropWholeWaste = Strategy.Parameters.sCuttingStrategy == 'DROP_WHOLE_WASTE'
local OptionalParameters = { bDropWholeWaste = bDropWholeWaste, dMaxWasteVolume = Strategy.Parameters.dMaxWasteVolume, dMaxWasteLength = Strategy.Parameters.dMaxWasteLength}
local bDropWholeWaste = ( Strategy.Parameters.sCuttingStrategy == 'DROP_WHOLE_WASTE')
local dMinZTopBlade
local dMaxNyTopBlade
if Strategy.Parameters.dMinZAngleTopBlade then
dMinZTopBlade = sin( Strategy.Parameters.dMinZAngleTopBlade)
end
if Strategy.Parameters.dMaxYAngleTopBlade then
dMaxNyTopBlade = sin( Strategy.Parameters.dMaxYAngleTopBlade)
end
local OptionalParameters = { bDropWholeWaste = bDropWholeWaste,
dMaxWasteVolume = Strategy.Parameters.dMaxWasteVolume,
dMaxWasteLength = Strategy.Parameters.dMaxWasteLength,
dMinNzTopBlade = dMinZTopBlade,
dMaxNyTopBlade = dMaxNyTopBlade
}
Blade.Result.Sorted, dCompletionPercentage = BladeToWaste.Make( Proc, Part, OptionalParameters)
end
@@ -6,18 +6,20 @@ local STR0005Data = {
sStrategyId = 'STR0005',
Parameters = {
{ sName = 'bForceLongcutBlade', sNameNge = 'USE_LONGCUT_BLADE', sValue = 'false', sDescriptionShort = 'Force ripping blade', sDescriptionLong = 'Force the use of ripping blade, designed for cuts parallel to the grain', sType = 'b', sMessageId = '', sMinUserLevel = '1'},
{ sName = 'dExtendAfterTail', sNameNge = 'EXTEND_AFTER_TAIL', sValue = 'false', sDescriptionShort = '', sDescriptionLong = '', sType = 'd', sMessageId = '', sMinUserLevel = '1'},
{ sName = 'dExtendAfterTail', sNameNge = 'EXTEND_AFTER_TAIL', sValue = '', sDescriptionShort = '', sDescriptionLong = '', sType = 'd', sMessageId = '', sMinUserLevel = '1'},
{ sName = 'sCanDamageNextPiece', sNameNge = 'DAMAGE_NEXT_PIECE', sValue = 'NEVER', sType = 'combo', sMinUserLevel = '1',
Choices = { sValue = 'NEVER', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''},
Choices = { { sValue = 'NEVER', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''},
{ sValue = 'ONLY_IF_RAWPART', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''},
{ sValue = 'ALWAYS', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''}},
{ sValue = 'ALWAYS', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''}}},
{ sName = 'sCuttingStrategy', sNameNge = 'CUTTING_STRATEGY', sValue = 'AUTO', sType = 'combo', sMinUserLevel = '1',
Choices = { sValue = 'AUTO', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''},
Choices = { { sValue = 'AUTO', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''},
{ sValue = 'DROP_WHOLE_WASTE', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''},
{ sValue = 'LEAVE_WASTE_ATTACHED', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''}},
{ sValue = 'LEAVE_WASTE_ATTACHED', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''}}},
{ sName = 'dMaxWasteLength', sNameNge = 'MAX_WASTE_LENGTH', sValue = '300', sDescriptionShort = '', sDescriptionLong = '', sType = 'd', sMessageId = '', sMinUserLevel = '1'},
{ sName = 'dMaxWasteVolume', sNameNge = 'MAX_WASTE_VOLUME', sValue = '6000000', sDescriptionShort = '', sDescriptionLong = '', sType = 'd', sMessageId = '', sMinUserLevel = '1'},
{ sName = 'dStripWidth', sNameNge = 'STRIP_WIDTH', sValue = '5', sDescriptionShort = '', sDescriptionLong = '', sType = 'd', sMessageId = '', sMinUserLevel = '1'}
{ sName = 'dStripWidth', sNameNge = 'STRIP_WIDTH', sValue = '5', sDescriptionShort = '', sDescriptionLong = '', sType = 'd', sMessageId = '', sMinUserLevel = '1'},
{ sName = 'dMinZAngleTopBlade', sNameNge = 'MIN_Z_ANGLE_TOP_BLADE', sValue = '', sDescriptionShort = '', sDescriptionLong = '', sType = 'd', sMessageId = '', sMinUserLevel = '1'},
{ sName = 'dMaxYAngleTopBlade', sNameNge = 'MAX_Y_ANGLE_TOP_BLADE', sValue = '1', sDescriptionShort = '', sDescriptionLong = '', sType = 'd', sMessageId = '', sMinUserLevel = '1'}
}
}
+77 -13
View File
@@ -20,6 +20,70 @@ EgtOutLog( ' BLADETOWASTE started', 1)
-------------------------------------------------------------------------------------------------------------
local function GetBestBladeForDicing( Proc, Part, Face, OptionalParameters)
local nChosenToolIndex
-- parametri opzionali
local dMinNzTopBladeIfEqual = OptionalParameters.dMinNzTopBlade or sin(-5)
local dMaxNyTopBlade = OptionalParameters.dMaxNyTopBlade or sin(1)
local dShortPartLength = OptionalParameters.dShortPartLength or BeamData.LEN_SHORT_PART
-- ricerca lama testa sopra
local ToolSearchParameters = {}
ToolSearchParameters.vtN = Face.vtN
ToolSearchParameters.bAllowTopHead = true
ToolSearchParameters.bAllowBottomHead = false
ToolSearchParameters.bForceLongcutBlade = false
ToolInfo = MachiningLib.FindBlade( Proc, ToolSearchParameters)
local nToolIndexTop = ToolInfo.nToolIndex
-- ricerca lama testa sotto
ToolSearchParameters = {}
ToolSearchParameters.vtN = Face.vtN
ToolSearchParameters.bAllowTopHead = false
ToolSearchParameters.bAllowBottomHead = true
ToolSearchParameters.bForceLongcutBlade = false
ToolInfo = MachiningLib.FindBlade( Proc, ToolSearchParameters)
local nToolIndexBottom = ToolInfo.nToolIndex
-- lama sopra e sotto
if nToolIndexTop and nToolIndexBottom then
-- angolo minimo che determina la preferenza tra lama sopra e sotto
local dMinNzTopBlade
-- entrambe le lame senza aggregato o entrambe con aggregato
if TOOLS[nToolIndexTop].SetupInfo.bIsCSymmetrical == TOOLS[nToolIndexBottom].SetupInfo.bIsCSymmetrical then
dMinNzTopBlade = dMinNzTopBladeIfEqual
-- lama sopra con aggregato - preferenza testa sopra
elseif not TOOLS[nToolIndexTop].SetupInfo.bIsCSymmetrical then
dMinNzTopBlade = OptionalParameters.dMinNzTopBlade or TOOLS[nToolIndexTop].SetupInfo.dMinNz / 2
-- lama sotto con aggregato - preferenza testa sotto
elseif not TOOLS[nToolIndexBottom].SetupInfo.bIsCSymmetrical then
dMinNzTopBlade = OptionalParameters.dMinNzTopBlade or TOOLS[nToolIndexBottom].SetupInfo.dMaxNz / 2
else
error( 'GetBestBladeForDicing : unknown blade type')
end
-- se la Z della faccia è sotto all'angolo minimo e inclinata in Y oppure il pezzo è corto, si preferisce la lama sotto
if Face.vtN:getZ() < dMinNzTopBlade - GEO.EPS_SMALL
and ( abs( Face.vtN:getY()) > dMaxNyTopBlade or Part.b3Raw:getDimX() < dShortPartLength - 10 * GEO.EPS_SMALL) then
nChosenToolIndex = nToolIndexBottom
else
nChosenToolIndex = nToolIndexTop
end
-- solo lama sopra
elseif nToolIndexTop then
nChosenToolIndex = nToolIndexTop
-- solo lama sotto
elseif nToolIndexBottom then
nChosenToolIndex = nToolIndexBottom
end
-- se non trovata alcuna lama ritorna nil
return nChosenToolIndex
end
function BLADETOWASTE.Make( Proc, Part, OptionalParameters)
local Result = {}
local dCompletionPercentage = 0
@@ -34,6 +98,9 @@ function BLADETOWASTE.Make( Proc, Part, OptionalParameters)
end
-- parametri opzionali e default
if not OptionalParameters then
OptionalParameters = {}
end
local nToolIndex = OptionalParameters.nToolIndex
local bDropWholeWaste = OptionalParameters.bDropWholeWaste or false
local dMaxWasteVolume = OptionalParameters.dMaxWasteVolume or 0
@@ -61,7 +128,7 @@ function BLADETOWASTE.Make( Proc, Part, OptionalParameters)
end
dDepthToMachine = EdgeToMachine.dElevation + BeamData.CUT_EXTRA
ToolSearchParameters.dElevation = dDepthToMachine
ToolSearchParameters.vtToolDirection = EdgeToMachine.vtN
ToolSearchParameters.vtN = Proc.Faces[1].vtN
ToolSearchParameters.bAllowTopHead = true
-- TODO bisognerà implementare anche la lama da sotto
ToolSearchParameters.bAllowBottomHead = false
@@ -70,6 +137,7 @@ function BLADETOWASTE.Make( Proc, Part, OptionalParameters)
nToolIndex = ToolInfo.nToolIndex
end
-- TODO qui gestire il caso in cui si può tagliare da due lati (inizialmente solo se vtN:Y è ~= 0?)
if ToolInfo.dResidualDepth < 10 * GEO.EPS_SMALL then
local OptionalParametersFaceByBlade = { dDepthToMachine = dDepthToMachine, nToolIndex = nToolIndex}
Cutting = FaceByBlade.Make( Proc, Part, Proc.Faces[1], EdgeToMachine, OptionalParametersFaceByBlade)
@@ -89,19 +157,15 @@ function BLADETOWASTE.Make( Proc, Part, OptionalParameters)
if Proc.nFct == 2 then
Face2 = Proc.Faces[2]
end
-- direzione migliore di lavoro, per la ricerca utensile
local _, dCutH, dCutV = BeamLib.GetFaceHvRefDim( Proc.Id, 0, Part.b3Raw)
-- ricerca utensile
local ToolSearchParameters = {}
ToolSearchParameters.vtToolDirection = EdgeToMachine.vtN
ToolSearchParameters.bAllowTopHead = true
-- TODO bisognerà implementare anche la lama da sotto
ToolSearchParameters.bAllowBottomHead = false
ToolSearchParameters.bForceLongcutBlade = false
ToolInfo = MachiningLib.FindBlade( Proc, ToolSearchParameters)
nToolIndex = ToolInfo.nToolIndex
local vCuts = DiceCut.GetDice( Part, Face1, Face2, OptionalParameters)
-- scelta lama da sopra o da sotto
if not nToolIndex then
nToolIndex = GetBestBladeForDicing( Proc, Part, Face1, OptionalParameters)
end
local OptionalParametersDiceCut = {}
local vCuts = DiceCut.GetDice( Part, Face1, Face2, OptionalParametersDiceCut)
+17 -10
View File
@@ -127,7 +127,15 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
Cutting.ptEdge1, _, Cutting.ptEdge2 = EgtSurfTmFacetOppositeSide( Proc.id, FaceToMachine.id, -Cutting.vtToolDirection, GDB_ID.ROOT)
local b3BoxEdge = BBox3d( Cutting.ptEdge1, Cutting.ptEdge2)
Cutting.dLengthOnX = b3BoxEdge:getDimX()
--
-- TODO gestire lama da sotto e lama downUp
-- TODO qui il check andrebbe migliorato e sostituito con una funzione più generale (così è ottimizzato solo per tasche non inclinate)
if bAllowToolInvert and FaceToMachine.vtN:getZ() < - 10 * GEO.EPS_SMALL then
Cutting.bToolInvert = true
Cutting.bInvert = not Cutting.bInvert
else
Cutting.bToolInvert = false
end
-- ricerca utensile
if nToolIndex then
@@ -135,7 +143,11 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
else
local ToolSearchParameters = {}
ToolSearchParameters.dElevation = dDepthToMachine
ToolSearchParameters.vtToolDirection = Cutting.vtToolDirection
if Cutting.bToolInvert then
ToolSearchParameters.vtN = -FaceToMachine.vtN
else
ToolSearchParameters.vtN = FaceToMachine.vtN
end
ToolSearchParameters.bAllowTopHead = true
-- TODO bisognerà implementare anche la lama da sotto
ToolSearchParameters.bAllowBottomHead = false
@@ -144,7 +156,7 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
Cutting.nToolIndex = ToolInfo.nToolIndex
end
Cutting.nType = MCH_OY.MILLING
if not TOOLS[Cutting.nToolIndex].sName then
if not TOOLS[Cutting.nToolIndex] or not TOOLS[Cutting.nToolIndex].sName then
Cutting.sMessage = 'Blade not found'
Cutting.bIsApplicable = false
EgtOutLog( Cutting.sMessage)
@@ -175,7 +187,7 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
-- inizio e fine aperti o chiusi
Cutting.bIsStartClosed = not EdgeToMachine.bIsStartOpen
Cutting.bIsEndClosed = not EdgeToMachine.bIsEndOpen
-- lato di lavoro e inversioni
-- lato di lavoro e inversione
if TOOLS[Cutting.nToolIndex].bIsCCW then
Cutting.nWorkside = MCH_MILL_WS.RIGHT
Cutting.bInvert = true
@@ -186,13 +198,8 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
if bOppositeToolDirection then
Cutting.bInvert = not Cutting.bInvert
end
-- TODO gestire lama da sotto e lama downUp
-- TODO qui il check della vtN dovrebbe essere sulla dMaxNegativeAngle in SetupInfo dell'utensile?
if bAllowToolInvert and FaceToMachine.vtN:getZ() < - 10 * GEO.EPS_SMALL then
Cutting.bToolInvert = true
if Cutting.bToolInvert then
Cutting.bInvert = not Cutting.bInvert
else
Cutting.bToolInvert = false
end
-- profondità da lavorare e offset radiale
if TOOLS[Cutting.nToolIndex].dMaxDepth > dDepthToMachine - 10 * GEO.EPS_SMALL then
+1 -1
View File
@@ -28,7 +28,7 @@ function SPLITCUT.GetStrategy( Proc, Part, OptionalParameters)
local Splitting = {}
-- imposto parametri di ricerca utensile in base a topologia
local ToolSearchParameters = {}
ToolSearchParameters.vtToolDirection = Proc.Faces[1].vtN
ToolSearchParameters.vtN = Proc.Faces[1].vtN
-- ===== RICERCA UTENSILE =====
-- cerco lama sopra