Merge remote-tracking branch 'origin/develop' into STR0003_BladePlusChainsaw

This commit is contained in:
luca.mazzoleni
2024-05-17 18:47:42 +02:00
2 changed files with 46 additions and 37 deletions
+22 -15
View File
@@ -66,25 +66,25 @@ function MachiningLib.GetMachiningSteps( dMachiningDepth, dStep)
return MachiningSteps
end
-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
-- funzione per cercare utensile tipo FRESA con certe caratteristiche
function MachiningLib.FindMill( Proc, sMillType, sMillShape, dMaxToolDiameter, dElevation, vtToolDir)
function MachiningLib.FindMill( Proc, ToolSearchParameters)
local ToolInfo = {}
for nCurrIndex=1, #TOOLS do
-- prima verifico che utensile sia compatibile
local bCompatibleTool = true
if TOOLS[nCurrIndex].sType ~= sMillType then
if TOOLS[nCurrIndex].sType ~= ToolSearchParameters.sType then
bCompatibleTool = false
elseif TOOLS[nCurrIndex].dDiameter > dMaxToolDiameter then
elseif TOOLS[nCurrIndex].dDiameter > ToolSearchParameters.dMaxToolDiameter then
bCompatibleTool = false
elseif sMillShape == 'STANDARD' and ( TOOLS[nCurrIndex].dSideAngle ~= 0 or TOOLS[nCurrIndex].bIsPen) then
elseif ToolSearchParameters.sMillShape == 'STANDARD' and ( TOOLS[nCurrIndex].dSideAngle ~= 0 or TOOLS[nCurrIndex].bIsPen) then
bCompatibleTool = false
elseif sMillShape == 'DOVETAIL' and not TOOLS[nCurrIndex].bIsDoveTail then
elseif ToolSearchParameters.sMillShape == 'DOVETAIL' and not TOOLS[nCurrIndex].bIsDoveTail then
bCompatibleTool = false
elseif sMillShape == 'TSHAPEMILL' and not TOOLS[nCurrIndex].bIsTMill then
elseif ToolSearchParameters.sMillShape == 'TSHAPEMILL' and not TOOLS[nCurrIndex].bIsTMill then
bCompatibleTool = false
elseif sMillShape == 'PEN' and not TOOLS[nCurrIndex].bIsPen then
elseif ToolSearchParameters.sMillShape == 'PEN' and not TOOLS[nCurrIndex].bIsPen then
bCompatibleTool = false
-- TODO controllare montaggio e verificare se direzione utensile raggiungibile. Serve funzione in BeamData
end
@@ -92,7 +92,7 @@ function MachiningLib.FindMill( Proc, sMillType, sMillShape, dMaxToolDiameter, d
-- scelgo il migliore
if bCompatibleTool then
-- calcolo riduzione del massimo materiale utilizzabile
local dToolEntryAngle = GetToolEntryAngle( Proc, vtToolDir)
local dToolEntryAngle = GetToolEntryAngle( Proc, ToolSearchParameters.vtToolDir)
-- se ToolHolder più grande dell'utensile, il primo oggetto in collisione è il ToolHolder. Altrimenti il motore.
local dDimObjToCheck = EgtIf( TOOLS[nCurrIndex].ToolHolder.dDiameter > TOOLS[nCurrIndex].dDiameter, TOOLS[nCurrIndex].ToolHolder.dDiameter, BeamData.C_SIMM_ENC)
local dCurrMaxMatReduction = BeamData.COLL_SIC or 5
@@ -102,26 +102,26 @@ function MachiningLib.FindMill( Proc, sMillType, sMillShape, dMaxToolDiameter, d
dCurrMaxMatReduction = dCurrMaxMatReduction / cos( 90 - dToolEntryAngle) + ( ( dDimObjToCheck - TOOLS[nCurrIndex].dDiameter) / 2) / tan( dToolEntryAngle)
end
-- dCurrMachReduction = negativo -> limitare, positivo -> mm extra disponibili
local dCurrMachReduction = TOOLS[nCurrIndex].dMaxDepth - dElevation - dCurrMaxMatReduction
local dCurrMachReduction = TOOLS[nCurrIndex].dMaxDepth - ToolSearchParameters.dElevation - dCurrMaxMatReduction
-- se non ancora trovato, oppure se completo e il migliore fino ad ora non è completo: corrente è il migliore
if not ToolInfo.idTool or ( ToolInfo.dMaxMatReduction <= 0 and dCurrMachReduction > 0) then
ToolInfo.idTool = nCurrIndex
if not ToolInfo.nToolIndex or ( ToolInfo.dMaxMatReduction <= 0 and dCurrMachReduction > 0) then
ToolInfo.nToolIndex = nCurrIndex
ToolInfo.dMaxMatReduction = dCurrMachReduction
-- altrimenti scelgo il migliore
else
-- se entrambi completi
if ToolInfo.dMaxMatReduction > 0 and dCurrMachReduction > 0 then
-- scelgo utensile con rapporto lunghezza / diametro minore
if ( TOOLS[nCurrIndex].dLength / pow( TOOLS[nCurrIndex].dDiameter, 1.5)) < ( TOOLS[ToolInfo.idTool].dLength / pow( TOOLS[ToolInfo.idTool].dDiameter, 1.5)) then
ToolInfo.idTool = nCurrIndex
if ( TOOLS[nCurrIndex].dLength / pow( TOOLS[nCurrIndex].dDiameter, 1.5)) < ( TOOLS[ToolInfo.nToolIndex].dLength / pow( TOOLS[ToolInfo.nToolIndex].dDiameter, 1.5)) then
ToolInfo.nToolIndex = nCurrIndex
ToolInfo.dMaxMatReduction = dCurrMachReduction
end
-- se entrambi incompleti
elseif ToolInfo.dMaxMatReduction < 0 and dCurrMachReduction < 0 then
--scelgo quello che lavora di più
if dCurrMachReduction > ToolInfo.dMaxMatReduction then
ToolInfo.idTool = nCurrIndex
ToolInfo.nToolIndex = nCurrIndex
ToolInfo.dMaxMatReduction = dCurrMachReduction
end
end
@@ -189,5 +189,12 @@ end
-- TODO da fare
function MachiningLib.FindChainSaw()
end
-------------------------------------------------------------------------------------------------------------
-- funzione per aggiungere una nuova lavorazione
-- TODO da fare
function MachiningLib.AddNewMachining( Machining)
end
-------------------------------------------------------------------------------------------------------------
return MachiningLib