e1440b9400
- modifiche per gestire correttamente più utensili sullo stesso profilo (strutture lua sono sempre per riferimento).
81 lines
3.2 KiB
Lua
81 lines
3.2 KiB
Lua
-- Drilling.lua by Egalware s.r.l. 2024/06/13
|
|
-- Libreria esecuzione lavorazioni per Serramenti -> Lavorazione di foratura
|
|
|
|
-- Tabella per definizione modulo
|
|
local Drilling = {}
|
|
|
|
-- Include
|
|
require( 'EgtBase')
|
|
|
|
-- Carico i dati globali
|
|
local WinData = require( 'WinData')
|
|
local MachiningLib = require( 'MachiningLib')
|
|
|
|
EgtOutLog( ' Drilling started', 1)
|
|
EgtMdbSave()
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
-- funzione che decide se eseguire le forature dopo le profilature. Solo forature di testa inclinate. Altrimenti sempre prima.
|
|
local function IsDrillToMachineAfterProfile( Proc)
|
|
local bExecAfterProfile = false
|
|
if ( Proc.AffectedFaces.Left or Proc.AffectedFaces.Right) and abs( Proc.vtDir:getX()) > 0.15 then
|
|
bExecAfterProfile = true
|
|
end
|
|
return bExecAfterProfile
|
|
end
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
function Drilling.Make( Proc, Part)
|
|
|
|
local Machining = { LeadIn = {}, LeadOut = {}, Steps = {}}
|
|
local AuxiliaryData = {}
|
|
local ToolSearchParameters = {}
|
|
|
|
-- cerco utensile punta a forare
|
|
ToolSearchParameters.dDiameter = Proc.dDiameter
|
|
ToolSearchParameters.dLength = Proc.dLength
|
|
local ToolInfo = MachiningLib.FindDrill( Proc, ToolSearchParameters)
|
|
|
|
-- se trovato utensile
|
|
if ToolInfo.nToolIndex then
|
|
Machining.nType = MCH_OY.DRILLING
|
|
Machining.nToolIndex = ToolInfo.nToolIndex
|
|
Machining.sDepth = 'th'
|
|
Machining.Steps.dStep = TOOLS[ToolInfo.nToolIndex].dStep
|
|
Machining.Geometry = Proc.id
|
|
AuxiliaryData.bExecAfterProfile = IsDrillToMachineAfterProfile( Proc)
|
|
AuxiliaryData.bIsDrilling = true
|
|
AuxiliaryData.nIndexMachining = 1
|
|
AuxiliaryData.nPhase = MachiningLib.GetPhaseMach( Proc)
|
|
Machining.dStartSafetyLength = MachiningLib.GetDrillAdditionalSafeDistanceToRaw( Proc, Part, Machining)
|
|
MachiningLib.AddNewMachining( Proc, Machining, AuxiliaryData)
|
|
else
|
|
-- provo a cercare una fresa che faccia una svuotatura
|
|
ToolSearchParameters.dMaxToolDiameter = Proc.dDiameter
|
|
ToolInfo = MachiningLib.FindDrill( Proc, ToolSearchParameters)
|
|
-- se trovato utensile
|
|
if ToolInfo.nToolIndex then
|
|
Machining.nType = MCH_OY.POCKETING
|
|
Machining.nSubType = MCH_POCK_SUB.SPIRALOUT
|
|
Machining.LeadIn.nType = MCH_POCK_LI.ZIGZAG
|
|
Machining.Steps.dStep = TOOLS[ToolInfo.nToolIndex].dStep
|
|
Machining.Steps.dSideStep = TOOLS[ToolInfo.nToolIndex].dSideStep
|
|
Machining.nToolIndex = ToolInfo.nToolIndex
|
|
Machining.LeadIn.dTangentDistance = TOOLS[ToolInfo.nToolIndex].dDiameter/2
|
|
Machining.LeadIn.dElevation = TOOLS[ToolInfo.nToolIndex].dDiameter/2
|
|
Machining.sDepth = 0
|
|
Machining.Geometry = Proc.id
|
|
AuxiliaryData.bIsPocketingDrill = true
|
|
AuxiliaryData.nIndexMachining = 1
|
|
AuxiliaryData.nPhase = MachiningLib.GetPhaseMach( Proc)
|
|
MachiningLib.AddNewMachining( Proc, Machining, AuxiliaryData)
|
|
else
|
|
return false
|
|
end
|
|
end
|
|
|
|
return true
|
|
end
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
return Drilling |