Prima versione funzionante foratura. Per ora gestisce solo lavorazione con punta a forare
This commit is contained in:
@@ -223,6 +223,7 @@ local function GetStrategies_Egalware( Proc)
|
||||
---------------------------------------------------------------------
|
||||
-- Feature : Drilling (0-40)
|
||||
elseif ID.IsDrilling( Proc) then
|
||||
Strategies = { { sStrategyId = 'STR0011'}}
|
||||
---------------------------------------------------------------------
|
||||
-- Feature : Tenon (1-50)
|
||||
elseif ID.IsTenon( Proc) then
|
||||
@@ -548,6 +549,7 @@ local function GetStrategies_Essetre( Proc)
|
||||
---------------------------------------------------------------------
|
||||
-- Feature : Drilling (0-40)
|
||||
elseif ID.IsDrilling( Proc) then
|
||||
Strategies = { { sStrategyId = 'STR0011'}}
|
||||
---------------------------------------------------------------------
|
||||
-- Feature : Tenon (1-50)
|
||||
elseif ID.IsTenon( Proc) then
|
||||
|
||||
@@ -187,6 +187,8 @@ function BeamExec.GetToolsFromDB()
|
||||
end
|
||||
-- drillbit
|
||||
else
|
||||
Tool.dStep = EgtGetValInNotes( Tool.sUserNotes, 'STEP', 'd') or ( Tool.dMaxMaterial / 3) -- se non settato nell'utensile, considero un terzo del tagliente
|
||||
Tool.dSideStep = Tool.dDiameter -- si utilizza SOLO per i calcoli del MRR
|
||||
Tool.dPerformanceIndex = Tool.dDiameter / Tool.dLength
|
||||
Tool.nQuality = 4
|
||||
end
|
||||
|
||||
+13
-7
@@ -279,21 +279,27 @@ end
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- Recupero dati foro e adattamento se speciale
|
||||
function FeatureLib.GetDrillingData( Proc)
|
||||
local AuxId = EgtGetInfo( Proc.id, 'AUXID', 'i')
|
||||
local idAux = EgtGetInfo( Proc.id, 'AUXID', 'i')
|
||||
if idAux then idAux = idAux + Proc.id end
|
||||
|
||||
local FeatureExtraInfo = {}
|
||||
|
||||
-- verifico se foro da adattare
|
||||
if EgtExistsInfo( Proc.id, 'DiamUser') then
|
||||
if AuxId then AuxId = AuxId + Proc.id end
|
||||
if AuxId and EgtGetType( AuxId) == GDB_TY.CRV_ARC and BeamData.USER_HOLE_DIAM and BeamData.USER_HOLE_DIAM > 1 then
|
||||
EgtModifyArcRadius( AuxId, BeamData.USER_HOLE_DIAM / 2)
|
||||
if idAux and EgtGetType( idAux) == GDB_TY.CRV_ARC and BeamData.USER_HOLE_DIAM and BeamData.USER_HOLE_DIAM > 1 then
|
||||
EgtModifyArcRadius( idAux, BeamData.USER_HOLE_DIAM / 2)
|
||||
end
|
||||
end
|
||||
|
||||
FeatureExtraInfo.dDrillDiam = EgtGetInfo( Proc.id, 'P12', 'd') or 0
|
||||
FeatureExtraInfo.dDrillLen = abs( EgtCurveThickness( Proc.id + AuxId)) or 0
|
||||
FeatureExtraInfo.dDrillDiam = 2 * EgtArcRadius( idAux) or EgtGetInfo( Proc.id, 'P12', 'd') or 0
|
||||
FeatureExtraInfo.dDrillLen = abs( EgtCurveThickness( idAux)) or 0
|
||||
FeatureExtraInfo.ptDrillCenter = EgtCP( idAux, GDB_RT.GLOB)
|
||||
FeatureExtraInfo.vtDrillExtrusion = EgtCurveExtrusion( idAux, GDB_RT.GLOB)
|
||||
FeatureExtraInfo.nDrillFcs = EgtGetInfo( Proc.id, 'FCS', 'i') or 0
|
||||
FeatureExtraInfo.nDrillFce = EgtGetInfo( Proc.id, 'FCE', 'i') or 0
|
||||
FeatureExtraInfo.bIsDrillOpen = ( FeatureExtraInfo.nDrillFcs ~= 0 and FeatureExtraInfo.nDrillFce ~= 0)
|
||||
FeatureExtraInfo.bIsDrillHorizontal = abs( FeatureExtraInfo.vtDrillExtrusion:getZ()) < 10 * GEO.EPS_SMALL
|
||||
FeatureExtraInfo.idAddAuxGeom = idAux
|
||||
|
||||
return FeatureExtraInfo
|
||||
end
|
||||
@@ -512,7 +518,7 @@ function FeatureLib.GetFeatureQuality( sTypeTools)
|
||||
|
||||
-- indice in base a utensile
|
||||
for i=1, #TypeTools do
|
||||
if TypeTools[i] == 'Blade' then
|
||||
if TypeTools[i] == 'Blade' or TypeTools[i] == 'Drill' then
|
||||
nQuality = min( nQuality, 5)
|
||||
elseif TypeTools[i] == 'Mill' then
|
||||
nQuality = min( nQuality, 4)
|
||||
|
||||
+103
-1
@@ -415,7 +415,109 @@ end
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- funzione per cercare utensile tipo PUNTA A FORARE con certe caratteristiche
|
||||
-- TODO da fare
|
||||
function MachiningLib.FindDrill()
|
||||
function MachiningLib.FindDrill( Proc, ToolSearchParameters)
|
||||
local ToolInfo = {}
|
||||
local nBestToolIndex
|
||||
local dBestToolResidualDepth = 0
|
||||
|
||||
-- settio valori obbligatori
|
||||
if not ToolSearchParameters.dToolDiameter then
|
||||
ToolSearchParameters.dToolDiameter = Proc.FeatureInfo.dDrillDiam or 0
|
||||
end
|
||||
if not ToolSearchParameters.dMaxToolDiameter then
|
||||
ToolSearchParameters.dMaxToolDiameter = ToolSearchParameters.dToolDiameter + 100 * GEO.EPS_SMALL
|
||||
end
|
||||
if not ToolSearchParameters.dMinToolDiameter then
|
||||
ToolSearchParameters.dMinToolDiameter = ToolSearchParameters.dToolDiameter - 100 * GEO.EPS_SMALL
|
||||
end
|
||||
|
||||
for i = 1, #TOOLS do
|
||||
-- prima verifico che utensile sia compatibile
|
||||
local bIsToolCompatible = true
|
||||
-- se non è punta, non è compatibile
|
||||
if TOOLS[i].sFamily ~= 'DRILLBIT' then
|
||||
bIsToolCompatible = false
|
||||
-- se viene passato il nome, tutti gli altri sono incompatibili
|
||||
elseif ToolSearchParameters.sName and ToolSearchParameters.sName ~= TOOLS[i].sName then
|
||||
bIsToolCompatible = false
|
||||
-- controlli standard
|
||||
elseif TOOLS[i].dDiameter > ToolSearchParameters.dMaxToolDiameter then
|
||||
bIsToolCompatible = false
|
||||
elseif TOOLS[i].dDiameter < ToolSearchParameters.dMinToolDiameter then
|
||||
bIsToolCompatible = false
|
||||
elseif TOOLS[i].SetupInfo.HeadType.bTop and
|
||||
ToolSearchParameters.vtToolDirection:getZ() < TOOLS[i].SetupInfo.GetMinNz( ToolSearchParameters.vtToolDirection, TOOLS[i]) - GEO.EPS_ZERO then
|
||||
bIsToolCompatible = false
|
||||
elseif TOOLS[i].SetupInfo.HeadType.bBottom and
|
||||
ToolSearchParameters.vtToolDirection:getZ() > TOOLS[i].SetupInfo.GetMaxNz( ToolSearchParameters.vtToolDirection, TOOLS[i]) + GEO.EPS_ZERO then
|
||||
bIsToolCompatible = false
|
||||
end
|
||||
|
||||
-- scelgo il migliore
|
||||
if bIsToolCompatible then
|
||||
-- calcolo riduzione del massimo materiale utilizzabile
|
||||
local ToolEntryAngle = GetToolEntryAngle( Proc, ToolSearchParameters.vtToolDirection)
|
||||
-- se ToolHolder più grande dell'utensile, il primo oggetto in collisione è il ToolHolder. Altrimenti il motore.
|
||||
local dDimObjToCheck = EgtIf( TOOLS[i].ToolHolder.dDiameter > TOOLS[i].dDiameter, TOOLS[i].ToolHolder.dDiameter, TOOLS[i].SetupInfo.dCAxisEncumbrance)
|
||||
local dCurrentMaxMatReduction = BeamData.COLL_SIC or 5
|
||||
|
||||
-- TODO implementare le funzioni di Tool Collision Avoidance (vedi wiki e FacesBysaw -> CalcLeadInOutPerpGeom)
|
||||
-- TODO considerare anche il caso in cui lo stelo sia più grande del diametro utensile
|
||||
-- TODO nei confronti tra valori gestire tolleranze
|
||||
-- calcolo riduzione per non toccare con ToolHolder / Motore
|
||||
if ToolEntryAngle.dValue > 0 and ToolEntryAngle.dValue < 90 then
|
||||
dCurrentMaxMatReduction = dCurrentMaxMatReduction / ToolEntryAngle.dSin + ( ( dDimObjToCheck - TOOLS[i].dDiameter) / 2) / ToolEntryAngle.dTan
|
||||
end
|
||||
-- dCurrentResidualDepth = negativo -> mm extra disponibili, positivo -> limitare
|
||||
local dCurrentResidualDepth = ToolSearchParameters.dElevation + dCurrentMaxMatReduction - TOOLS[i].dMaxDepth
|
||||
|
||||
-- se non ancora trovato, oppure se completo e il migliore fino ad ora non è completo: corrente è il migliore
|
||||
if not nBestToolIndex or ( dBestToolResidualDepth > 0 and dCurrentResidualDepth <= 0) then
|
||||
nBestToolIndex = i
|
||||
dBestToolResidualDepth = dCurrentResidualDepth
|
||||
-- altrimenti scelgo il migliore
|
||||
else
|
||||
-- se entrambi completi
|
||||
if dBestToolResidualDepth <= 0 and dCurrentResidualDepth <= 0 then
|
||||
-- se il migliore era su aggregato e corrente montanto direttamente, prediligo utensile montato direttamente
|
||||
if not TOOLS[i].SetupInfo.bToolOnAggregate and TOOLS[nBestToolIndex].SetupInfo.bToolOnAggregate then
|
||||
nBestToolIndex = i
|
||||
dBestToolResidualDepth = dCurrentResidualDepth
|
||||
-- se hanno stesso montaggio
|
||||
elseif TOOLS[i].SetupInfo.bToolOnAggregate == TOOLS[nBestToolIndex].SetupInfo.bToolOnAggregate then
|
||||
-- se diametro diverso
|
||||
if abs( TOOLS[i].dDiameter - TOOLS[nBestToolIndex].dDiameter) > 10 * GEO.EPS_SMALL then
|
||||
-- si sceglie utensile dello stesso diametro del foro da lavorare
|
||||
if abs( TOOLS[i].dDiameter - ToolSearchParameters.dToolDiameter) < 10 * GEO.EPS_SMALL then
|
||||
nBestToolIndex = i
|
||||
dBestToolResidualDepth = dCurrentResidualDepth
|
||||
-- oppure utensile con performance maggiore
|
||||
elseif TOOLS[i].dPerformanceIndex > TOOLS[nBestToolIndex].dPerformanceIndex then
|
||||
nBestToolIndex = i
|
||||
BestToolResidualDepth = dCurrentResidualDepth
|
||||
end
|
||||
-- scelgo utensile con indice di bontà utensile calcolato come: lunghezza / massimo materiale / diametro
|
||||
elseif TOOLS[i].dPerformanceIndex > TOOLS[nBestToolIndex].dPerformanceIndex then
|
||||
nBestToolIndex = i
|
||||
dBestToolResidualDepth = dCurrentResidualDepth
|
||||
end
|
||||
end
|
||||
-- se entrambi incompleti
|
||||
elseif dBestToolResidualDepth > 0 and dCurrentResidualDepth > 0 then
|
||||
--scelgo quello che lavora di più
|
||||
if dCurrentResidualDepth < dBestToolResidualDepth then
|
||||
nBestToolIndex = i
|
||||
dBestToolResidualDepth = dCurrentResidualDepth
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ToolInfo.nToolIndex = nBestToolIndex
|
||||
ToolInfo.dResidualDepth = dBestToolResidualDepth
|
||||
|
||||
return ToolInfo
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user