DataBeam :
- migliorato ordinamento fori - riunite FindMilling, .... in una unica libreria - altre piccole migliorie.
This commit is contained in:
+46
-20
@@ -1,4 +1,4 @@
|
||||
-- BeamExec.lua by Egaltech s.r.l. 2019/01/07
|
||||
-- BeamExec.lua by Egaltech s.r.l. 2019/04/26
|
||||
-- Libreria esecuzione lavorazioni per Travi
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
@@ -13,15 +13,18 @@ _G.package.loaded.CutData = nil
|
||||
_G.package.loaded.MillingData = nil
|
||||
_G.package.loaded.PocketingData = nil
|
||||
_G.package.loaded.DrillData = nil
|
||||
_G.package.loaded.SawingData = nil
|
||||
local BD = require( 'BeamData')
|
||||
|
||||
-- Carico le librerie
|
||||
_G.package.loaded.MachiningLib = nil
|
||||
local BM = require( 'MachiningLib')
|
||||
_G.package.loaded.BeamLib = nil
|
||||
local BL = require( 'BeamLib')
|
||||
_G.package.loaded.DiceCut = nil
|
||||
local DC = require( 'DiceCut')
|
||||
_G.package.loaded.TwoFacesBySaw = nil
|
||||
local DC = require( 'TwoFacesBySaw')
|
||||
_G.package.loaded.FacesBySaw = nil
|
||||
local Fbs = require( 'FacesBySaw')
|
||||
_G.package.loaded.ProcessHeadCut = nil
|
||||
local Hcut= require( 'ProcessHeadCut')
|
||||
_G.package.loaded.ProcessSplit = nil
|
||||
@@ -280,11 +283,14 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH)
|
||||
Proc.Fct = EgtSurfTmFacetCount( ProcId) or 0
|
||||
Proc.Head = IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
||||
Proc.Tail = IsTailFeature( Proc, b3Raw)
|
||||
Proc.Diam = 0
|
||||
Proc.Fcs = 0
|
||||
Proc.Fce = 0
|
||||
table.insert( vProc, Proc)
|
||||
-- se foro
|
||||
if Drill.Identify( Proc) then
|
||||
-- assegno diametro
|
||||
Proc.Diam = EgtGetInfo( Proc.Id, 'P12', 'd') or 0
|
||||
-- assegno faccia di entrata e uscita (dati tabelle sempre per riferimento)
|
||||
Proc.Fcs = EgtGetInfo( Proc.Id, 'FCS', 'i') or 0
|
||||
Proc.Fce = EgtGetInfo( Proc.Id, 'FCE', 'i') or 0
|
||||
@@ -302,6 +308,7 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH)
|
||||
Proc2.Fct = Proc.Fct
|
||||
Proc2.Head = Proc.Head
|
||||
Proc2.Tail = Drill.IsTailFeature( Proc2, b3Raw)
|
||||
Proc2.Diam = Proc.Diam
|
||||
Proc2.Fcs = Proc.Fce
|
||||
Proc2.Fce = Proc.Fcs
|
||||
table.insert( vProc, Proc2)
|
||||
@@ -338,18 +345,22 @@ local function OrderFeatures( vProc, b3Raw)
|
||||
end
|
||||
-- se primo è foro e l'altro no, lo penalizzo
|
||||
if B1.Prc == 40 and B2.Prc ~= 40 then
|
||||
return B1.Box:getCenter():getX() - 300 > B2.Box:getCenter():getX()
|
||||
return B1.Box:getCenter():getX() > B2.Box:getMax():getX() + 100
|
||||
end
|
||||
-- se secondo è foro e l'altro no, lo penalizzo
|
||||
if B2.Prc == 40 and B1.Prc ~= 40 then
|
||||
return B1.Box:getCenter():getX() + 300 > B2.Box:getCenter():getX()
|
||||
return B1.Box:getMax():getX() + 100 > B2.Box:getCenter():getX()
|
||||
end
|
||||
-- se sono fori e hanno posizione praticamente uguale ordino secondo la faccia di inizio (Fcs)
|
||||
if B1.Prc == 40 and B2.Prc == 40 and abs( B1.Box:getCenter():getX() - B2.Box:getCenter():getX()) < 300 then
|
||||
if B1.Fcs == B2.Fcs then
|
||||
return B1.Box:getCenter():getX() > B2.Box:getCenter():getX()
|
||||
-- se sono fori e hanno posizione praticamente uguale ordino secondo diametro e faccia di inizio (Fcs)
|
||||
if B1.Prc == 40 and B2.Prc == 40 and abs( B1.Box:getCenter():getX() - B2.Box:getCenter():getX()) < 200 then
|
||||
if abs( B1.Diam - B2.Diam) < 1.0 then
|
||||
if B1.Fcs == B2.Fcs then
|
||||
return B1.Box:getCenter():getX() > B2.Box:getCenter():getX()
|
||||
else
|
||||
return B1.Fcs > B2.Fcs
|
||||
end
|
||||
else
|
||||
return B1.Fcs > B2.Fcs
|
||||
return ( B1.Diam > B2.Diam)
|
||||
end
|
||||
end
|
||||
-- se primo è taglio longitudinale completo, dopo tutte le altre feature non di coda
|
||||
@@ -376,6 +387,22 @@ local function OrderFeatures( vProc, b3Raw)
|
||||
end
|
||||
-- eseguo ordinamento
|
||||
table.sort( vProc, CompareFeatures)
|
||||
-- riunisco fori con lo stesso diametro e non troppo lontani
|
||||
for i = 1, #vProc do
|
||||
local ProcI = vProc[i]
|
||||
if ProcI.Prc == 40 then
|
||||
for j = i + 1, #vProc do
|
||||
local ProcJ = vProc[j]
|
||||
if ProcJ.Prc == 40 and ProcJ.Head == ProcI.Head and ProcJ.Tail == ProcI.Tail and
|
||||
abs( ProcJ.Diam - ProcI.Diam) < 1.0 and abs( ProcJ.Box:getCenter():getX() - ProcI.Box:getCenter():getX()) < 600.0 then
|
||||
if j > i + 1 then
|
||||
table.insert( vProc, i + 1, table.remove( vProc, j))
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
@@ -449,17 +476,16 @@ local function ClassifyFeatures( vProc, b3Raw)
|
||||
if bOk then
|
||||
-- non ammessa feature di testa o di coda da lavorare ribaltata
|
||||
if ( Proc.Head or Proc.Tail) and bDown then
|
||||
Proc.On = false
|
||||
Proc.Flg = 0
|
||||
Proc.Down = true
|
||||
bAllOk = false
|
||||
-- caso normale
|
||||
else
|
||||
Proc.On = true
|
||||
Proc.Down = bDown
|
||||
if bDown then bSomeDown = true end
|
||||
end
|
||||
else
|
||||
Proc.On = false
|
||||
Proc.Flg = 0
|
||||
bAllOk = false
|
||||
end
|
||||
end
|
||||
@@ -474,12 +500,12 @@ end
|
||||
local function PrintFeatures( vProc, b3Raw)
|
||||
EgtOutLog( ' RawBox=' .. tostring( b3Raw))
|
||||
for i = 1, #vProc do
|
||||
EgtOutLog( ' Proc=' .. string.format( '%3d', vProc[i].Id) .. ' Grp=' .. string.format( '%1d', vProc[i].Grp) .. ' Prc=' .. string.format( '%3d', vProc[i].Prc) ..
|
||||
' On=' .. EgtIf( vProc[i].On, 'T', 'F') .. ' Flg=' .. string.format( '%2d', vProc[i].Flg) .. ' Fcse=' .. string.format( '%1d,%1d', vProc[i].Fcs, vProc[i].Fce) ..
|
||||
' Down=' .. EgtIf( vProc[i].Down, 'T', 'F') .. ' Head=' .. EgtIf( vProc[i].Head, 'T', 'F') .. ' Tail=' .. EgtIf( vProc[i].Tail, 'T', 'F') ..
|
||||
' Fct=' .. string.format( '%2d', vProc[i].Fct) .. ' Box=' .. tostring( vProc[i].Box))
|
||||
local Proc = vProc[i]
|
||||
local sOut = string.format( ' Proc=%3d Grp=%1d Prc=%3d Flg=%2d Down=%s Head=%s Tail=%s Fcse=%1d,%1d Diam=%.2f Fct=%2d Box=%s',
|
||||
Proc.Id, Proc.Grp, Proc.Prc, Proc.Flg, EgtIf( Proc.Down, 'T', 'F'), EgtIf( Proc.Head, 'T', 'F'), EgtIf( Proc.Tail, 'T', 'F'),
|
||||
Proc.Fcs, Proc.Fce, Proc.Diam, Proc.Fct, tostring( Proc.Box))
|
||||
EgtOutLog( sOut)
|
||||
end
|
||||
return vProc
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
@@ -669,7 +695,7 @@ function BeamExec.ProcessFeatures()
|
||||
for i = 1, #vProc do
|
||||
-- creo la lavorazione
|
||||
local Proc = vProc[i]
|
||||
if Proc.On and Proc.Down then
|
||||
if Proc.Flg ~= 0 and Proc.Down then
|
||||
local bOk, sErr = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, b3Raw)
|
||||
if not bOk then
|
||||
bAddOk = false
|
||||
@@ -692,7 +718,7 @@ function BeamExec.ProcessFeatures()
|
||||
for i = 1, #vProc do
|
||||
-- creo la lavorazione
|
||||
local Proc = vProc[i]
|
||||
if Proc.On and not Proc.Down then
|
||||
if Proc.Flg ~= 0 and not Proc.Down then
|
||||
local bOk, sErr, bNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, b3Raw)
|
||||
if not bOk then
|
||||
bAddOk = false
|
||||
|
||||
@@ -1,33 +1,22 @@
|
||||
-- TwoFacesBySaw.lua by Egaltech s.r.l. 2019/03/28
|
||||
-- Gestione taglio con lama di feature con due facce
|
||||
-- FacesBySaw.lua by Egaltech s.r.l. 2019/04/26
|
||||
-- Gestione taglio con lama di feature con una, due o tre facce
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local TwoFacesBySaw = {}
|
||||
local FacesBySaw = {}
|
||||
|
||||
-- Include
|
||||
require( 'EgtBase')
|
||||
local BL = require( 'BeamLib')
|
||||
local DC = require( 'DiceCut')
|
||||
|
||||
EgtOutLog( ' TwoFacesBySaw started', 1)
|
||||
EgtOutLog( ' FacesBySaw started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Cuttings = require( 'CutData')
|
||||
|
||||
----------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
local function FindCutting( sType)
|
||||
for i = 1, #Cuttings do
|
||||
local Cutting = Cuttings[i]
|
||||
if Cutting.Type == sType then
|
||||
return i, Cutting.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function TwoFacesBySaw.Make( Proc, nPhase, nRawId, nPartId, sCutName)
|
||||
function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, sCutName)
|
||||
-- recupero l'ingombro del grezzo di appartenenza
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- ingombro del pezzo
|
||||
@@ -81,7 +70,7 @@ function TwoFacesBySaw.Make( Proc, nPhase, nRawId, nPartId, sCutName)
|
||||
local nBigInd = EgtIf( dSqDim1 >= dSqDim2, 1, 2)
|
||||
local nSmaInd = 3 - nBigInd
|
||||
-- recupero la lavorazione
|
||||
local _, sCutting = FindCutting( sCutName)
|
||||
local sCutting = ML.FindCutting( sCutName)
|
||||
if not sCutting then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library'
|
||||
EgtOutLog( sErr)
|
||||
@@ -144,4 +133,9 @@ function TwoFacesBySaw.Make( Proc, nPhase, nRawId, nPartId, sCutName)
|
||||
end
|
||||
end
|
||||
|
||||
return TwoFacesBySaw
|
||||
---------------------------------------------------------------------
|
||||
function FacesBySaw.MakeThree( Proc, nPhase, nRawId, nPartId, sCutName)
|
||||
return false
|
||||
end
|
||||
|
||||
return FacesBySaw
|
||||
@@ -0,0 +1,80 @@
|
||||
-- MachiningLib.lua by Egaltech s.r.l. 2019/04/26
|
||||
-- Libreria ricerca lavorazioni per Travi
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local MachiningLib = {}
|
||||
|
||||
-- Include
|
||||
require( 'EgtBase')
|
||||
|
||||
EgtOutLog( ' MachiningLib started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Cuttings = require( 'CutData')
|
||||
local Millings = require( 'MillingData')
|
||||
local Pocketings = require( 'PocketingData')
|
||||
local Sawings = require( 'SawingData')
|
||||
local Drillings = require( 'DrillData')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function MachiningLib.FindCutting( sType)
|
||||
for i = 1, #Cuttings do
|
||||
local Cutting = Cuttings[i]
|
||||
if Cutting.Type == sType then
|
||||
return Cutting.Name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function MachiningLib.FindMilling( sType)
|
||||
for i = 1, #Millings do
|
||||
local Milling = Millings[i]
|
||||
if Milling.Type == sType then
|
||||
return Milling.Name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function MachiningLib.FindPocketing( sType)
|
||||
for i = 1, #Pocketings do
|
||||
local Pocketing = Pocketings[i]
|
||||
if Pocketing.Type == sType then
|
||||
return Pocketing.Name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function MachiningLib.FindSawing( sType)
|
||||
for i = 1, #Sawings do
|
||||
local Sawing = Sawings[i]
|
||||
if Sawing.Type == sType then
|
||||
return Sawing.Name
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function MachiningLib.FindDrilling( dDiam)
|
||||
-- ricerca sulle forature, dal diametro maggiore al minore
|
||||
for i = #Drillings, 1, -1 do
|
||||
local Drilling = Drillings[i]
|
||||
if ( Drilling.Type == 'Drill' and Drilling.Diam < dDiam + 10 * GEO.EPS_SMALL and Drilling.Diam > dDiam - BD.DRILL_TOL - 10 * GEO.EPS_SMALL) then
|
||||
return Drilling.Name, Drilling.Type, Drilling.MaxMat
|
||||
end
|
||||
end
|
||||
-- ricerca sulle svuotature, dal diametro maggiore al minore
|
||||
for i = #Drillings, 1, -1 do
|
||||
local Drilling = Drillings[i]
|
||||
if ( Drilling.Type == 'Pocket' and dDiam > Drilling.Diam + 10 * GEO.EPS_SMALL) then
|
||||
return Drilling.Name, Drilling.Type, Drilling.MaxMat
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
return MachiningLib
|
||||
@@ -1,4 +1,4 @@
|
||||
-- ProcessMortise.lua by Egaltech s.r.l. 2019/03/25
|
||||
-- ProcessMortise.lua by Egaltech s.r.l. 2019/04/26
|
||||
-- Gestione calcolo tacche per Travi
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
@@ -7,14 +7,13 @@ local ProcessBirdsMouth = {}
|
||||
-- Include
|
||||
require( 'EgtBase')
|
||||
local BL = require( 'BeamLib')
|
||||
local Tfs = require( 'TwoFacesBySaw')
|
||||
local Fbs = require( 'FacesBySaw')
|
||||
|
||||
EgtOutLog( ' ProcessBirdsMouth started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Millings = require( 'MillingData')
|
||||
local Pocketings = require( 'PocketingData')
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
@@ -76,17 +75,6 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Lavorazione con fresa
|
||||
---------------------------------------------------------------------
|
||||
local function FindMilling( sType)
|
||||
for i = 1, #Millings do
|
||||
local Milling = Millings[i]
|
||||
if Milling.Type == sType then
|
||||
return i, Milling.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function Make2FacesByMill( Proc, nPhase, nRawId, nPartId)
|
||||
-- recupero l'ingombro del grezzo di appartenenza
|
||||
@@ -135,7 +123,7 @@ local function Make2FacesByMill( Proc, nPhase, nRawId, nPartId)
|
||||
end
|
||||
local nOthInd = 1 - nFacInd
|
||||
-- recupero la lavorazione
|
||||
local nMill, sMilling = FindMilling( 'BirdsMouth')
|
||||
local sMilling = ML.FindMilling( 'BirdsMouth')
|
||||
if not sMilling then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
@@ -174,17 +162,6 @@ local function Make2FacesByMill( Proc, nPhase, nRawId, nPartId)
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindPocketing( sType)
|
||||
for i = 1, #Pocketings do
|
||||
local Pocketing = Pocketings[i]
|
||||
if Pocketing.Type == sType then
|
||||
return i, Pocketing.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MakeMoreFacesByMill( Proc, nPhase, nRawId, nPartId)
|
||||
-- recupero l'ingombro del grezzo di appartenenza
|
||||
@@ -207,7 +184,7 @@ local function MakeMoreFacesByMill( Proc, nPhase, nRawId, nPartId)
|
||||
-- eventuali tagli preliminari
|
||||
-- per ora non previsti
|
||||
-- recupero la lavorazione
|
||||
local nMill, sPocketing = FindPocketing( 'Mortise')
|
||||
local sPocketing = ML.FindPocketing( 'Mortise')
|
||||
if not sPocketing then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' pocketing not found in library'
|
||||
EgtOutLog( sErr)
|
||||
@@ -294,7 +271,7 @@ function ProcessBirdsMouth.Make( Proc, nPhase, nRawId, nPartId)
|
||||
return MakeByMill( Proc, nPhase, nRawId, nPartId)
|
||||
-- con lama
|
||||
else
|
||||
return Tfs.Make( Proc, nPhase, nRawId, nPartId, 'HeadSide')
|
||||
return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, 'HeadSide')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -12,18 +12,7 @@ EgtOutLog( ' ProcessChamfer started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Millings = require( 'MillingData')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindMilling( sType)
|
||||
for i = 1, #Millings do
|
||||
local Milling = Millings[i]
|
||||
if Milling.Type == sType then
|
||||
return i, Milling.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
@@ -35,7 +24,7 @@ end
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessChamfer.Make( Proc, nPhase, nRawId, nPartId)
|
||||
-- recupero la lavorazione
|
||||
local nMill, sMilling = FindMilling( 'Chamfer')
|
||||
local sMilling = ML.FindMilling( 'Chamfer')
|
||||
if not sMilling then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
|
||||
+2
-13
@@ -13,18 +13,7 @@ EgtOutLog( ' ProcessCut started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Cuttings = require( 'CutData')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindCutting( sType)
|
||||
for i = 1, #Cuttings do
|
||||
local Cutting = Cuttings[i]
|
||||
if Cutting.Type == sType then
|
||||
return i, Cutting.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
@@ -62,7 +51,7 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
local _, sCutting = FindCutting( EgtIf( Proc.Head, 'HeadSide', 'TailSide'))
|
||||
local sCutting = ML.FindCutting( EgtIf( Proc.Head, 'HeadSide', 'TailSide'))
|
||||
if not sCutting then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library'
|
||||
EgtOutLog( sErr)
|
||||
|
||||
@@ -11,18 +11,7 @@ EgtOutLog( ' ProcessDecor started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Millings = require( 'MillingData')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindMilling( sType)
|
||||
for i = 1, #Millings do
|
||||
local Milling = Millings[i]
|
||||
if Milling.Type == sType then
|
||||
return i, Milling.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
@@ -57,7 +46,7 @@ function ProcessDecor.Make( Proc, nPhase, nRawId, nPartId)
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
local sToFind = EgtGetInfo( Proc.Id, 'P15')
|
||||
local nMill, sMilling = FindMilling( sToFind)
|
||||
local sMilling = ML.FindMilling( sToFind)
|
||||
if not sMilling then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
|
||||
@@ -13,7 +13,7 @@ EgtOutLog( ' ProcessDoubleCut started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Cuttings = require( 'CutData')
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
@@ -42,17 +42,6 @@ function ProcessDoubleCut.Classify( Proc)
|
||||
return true, false
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindCutting( sType)
|
||||
for i = 1, #Cuttings do
|
||||
local Cutting = Cuttings[i]
|
||||
if Cutting.Type == sType then
|
||||
return i, Cutting.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
@@ -87,7 +76,7 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local nBigInd = EgtIf( dSqDim1 >= dSqDim2, 1, 2)
|
||||
local nSmaInd = 3 - nBigInd
|
||||
-- recupero la lavorazione
|
||||
local _, sCutting = FindCutting( EgtIf( bHead, 'HeadSide', 'TailSide'))
|
||||
local sCutting = ML.FindCutting( EgtIf( bHead, 'HeadSide', 'TailSide'))
|
||||
if not sCutting then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library'
|
||||
EgtOutLog( sErr)
|
||||
|
||||
@@ -11,7 +11,7 @@ EgtOutLog( ' ProcessDrill started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Drillings = require( 'DrillData')
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
@@ -43,25 +43,6 @@ function ProcessDrill.IsTailFeature( Proc, b3Raw)
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindDrilling( dDiam)
|
||||
-- ricerca sulle forature, dal diametro maggiore al minore
|
||||
for i = #Drillings, 1, -1 do
|
||||
local Drilling = Drillings[i]
|
||||
if ( Drilling.Type == 'Drill' and Drilling.Diam < dDiam + 10 * GEO.EPS_SMALL and Drilling.Diam > dDiam - BD.DRILL_TOL - 10 * GEO.EPS_SMALL) then
|
||||
return i, Drilling.Name, Drilling.Type
|
||||
end
|
||||
end
|
||||
-- ricerca sulle svuotature, dal diametro maggiore al minore
|
||||
for i = #Drillings, 1, -1 do
|
||||
local Drilling = Drillings[i]
|
||||
if ( Drilling.Type == 'Pocket' and dDiam > Drilling.Diam + 10 * GEO.EPS_SMALL) then
|
||||
return i, Drilling.Name, Drilling.Type
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Verifica se da lavorare in due metà
|
||||
function ProcessDrill.Split( Proc)
|
||||
@@ -77,12 +58,12 @@ function ProcessDrill.Split( Proc)
|
||||
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
||||
local bOpen = ( EgtGetInfo( Proc.Id, 'FCE', 'i') ~= 0)
|
||||
-- recupero la lavorazione
|
||||
local nDri, sDrilling = FindDrilling( dDiam)
|
||||
local sDrilling, _, dMaxMat = ML.FindDrilling( dDiam)
|
||||
if not sDrilling then
|
||||
return bOpen
|
||||
end
|
||||
-- restituisco se va fatto in doppio
|
||||
return ( bOpen and dLen > Drillings[nDri].MaxMat + 10 * GEO.EPS_SMALL)
|
||||
return ( bOpen and dLen > dMaxMat + 10 * GEO.EPS_SMALL)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
@@ -137,7 +118,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
|
||||
if bToInvert then vtExtr = - vtExtr end
|
||||
if Proc.Flg == -2 then bToInvert = true end
|
||||
-- recupero la lavorazione
|
||||
local nDri, sDrilling, nType = FindDrilling( dDiam)
|
||||
local sDrilling, nType = ML.FindDrilling( dDiam)
|
||||
if not sDrilling then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' drilling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
|
||||
@@ -11,18 +11,7 @@ EgtOutLog( ' ProcessDtMortise started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Millings = require( 'MillingData')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindMilling( sType)
|
||||
for i = 1, #Millings do
|
||||
local Milling = Millings[i]
|
||||
if Milling.Type == sType then
|
||||
return i, Milling.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
@@ -68,7 +57,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId)
|
||||
return false, sErr
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
local nMill, sMilling = FindMilling( 'DtMortise')
|
||||
local sMilling = ML.FindMilling( 'DtMortise')
|
||||
if not sMilling then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
|
||||
@@ -13,18 +13,7 @@ EgtOutLog( ' ProcessTenon started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Millings = require( 'MillingData')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindMilling( sType)
|
||||
for i = 1, #Millings do
|
||||
local Milling = Millings[i]
|
||||
if Milling.Type == sType then
|
||||
return i, Milling.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
@@ -100,7 +89,7 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
local nMill, sMilling = FindMilling( 'DtTenon')
|
||||
local sMilling = ML.FindMilling( 'DtTenon')
|
||||
if not sMilling then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
|
||||
@@ -12,8 +12,7 @@ EgtOutLog( ' ProcessFreeContour started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Millings = require( 'MillingData')
|
||||
local Pocketings = require( 'PocketingData')
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
@@ -77,17 +76,6 @@ function ProcessFreeContour.Classify( Proc)
|
||||
return true, bDown
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindMilling( sType)
|
||||
for i = 1, #Millings do
|
||||
local Milling = Millings[i]
|
||||
if Milling.Type == sType then
|
||||
return i, Milling.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- recupero l'ingombro del grezzo di appartenenza
|
||||
@@ -105,7 +93,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
||||
local bToolInv = ( vtExtr:getZ() < -0.1)
|
||||
-- recupero la lavorazione
|
||||
local nMill, sMilling = FindMilling( 'FreeContour')
|
||||
local sMilling = ML.FindMilling( 'FreeContour')
|
||||
if not sMilling then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
@@ -214,17 +202,6 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindPocketing( sType)
|
||||
for i = 1, #Pocketings do
|
||||
local Pocketing = Pocketings[i]
|
||||
if Pocketing.Type == sType then
|
||||
return i, Pocketing.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- recupero e verifico l'entità curva
|
||||
@@ -240,7 +217,7 @@ local function MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
||||
--local bToolInv = ( vtExtr:getZ() < -0.1)
|
||||
-- recupero la lavorazione
|
||||
local nMill, sPocketing = FindPocketing( 'Mortise')
|
||||
local sPocketing = ML.FindPocketing( 'Mortise')
|
||||
if not sPocketing then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' pocketing not found in library'
|
||||
EgtOutLog( sErr)
|
||||
|
||||
@@ -12,18 +12,7 @@ EgtOutLog( ' ProcessSplit started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Cuttings = require( 'CutData')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindCutting( sType)
|
||||
for i = 1, #Cuttings do
|
||||
local Cutting = Cuttings[i]
|
||||
if Cutting.Type == sType then
|
||||
return i, Cutting.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
@@ -51,7 +40,7 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local nCuts = ceil( dOvmHead / BD.MAX_LEN_SCRAP)
|
||||
local dOffsL = dOvmHead / nCuts
|
||||
-- recupero la lavorazione
|
||||
local _, sCutting = FindCutting( 'HeadSide')
|
||||
local sCutting = ML.FindCutting( 'HeadSide')
|
||||
if not sCutting then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library'
|
||||
EgtOutLog( sErr)
|
||||
|
||||
+32
-65
@@ -1,4 +1,4 @@
|
||||
-- ProcessLapJoint.lua by Egaltech s.r.l. 2019/04/24
|
||||
-- ProcessLapJoint.lua by Egaltech s.r.l. 2019/04/26
|
||||
-- Gestione calcolo mezzo-legno per Travi
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
@@ -9,16 +9,13 @@ require( 'EgtBase')
|
||||
local BL = require( 'BeamLib')
|
||||
local Cut = require( 'ProcessCut')
|
||||
local DoubleCut = require( 'ProcessDoubleCut')
|
||||
local Tfs = require( 'TwoFacesBySaw')
|
||||
local Fbs = require( 'FacesBySaw')
|
||||
|
||||
EgtOutLog( ' ProcessLapJoint started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Cuttings = require( 'CutData')
|
||||
local Millings = require( 'MillingData')
|
||||
local Pocketings = require( 'PocketingData')
|
||||
local Sawings = require( 'SawingData')
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
@@ -104,17 +101,6 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Lavorazione con fresa
|
||||
---------------------------------------------------------------------
|
||||
local function FindMilling( sType)
|
||||
for i = 1, #Millings do
|
||||
local Milling = Millings[i]
|
||||
if Milling.Type == sType then
|
||||
return i, Milling.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MakeOneFaceByMill( Proc, nPhase, nRawId, nPartId)
|
||||
-- recupero l'ingombro del grezzo di appartenenza
|
||||
@@ -133,7 +119,7 @@ local function MakeOneFaceByMill( Proc, nPhase, nRawId, nPartId)
|
||||
-- scelta faccia da lavorare
|
||||
local nFacInd = 0
|
||||
-- recupero la lavorazione
|
||||
local nMill, sMilling = FindMilling( 'BirdsMouth')
|
||||
local sMilling = ML.FindMilling( 'BirdsMouth')
|
||||
if not sMilling then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
@@ -214,7 +200,7 @@ local function MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId)
|
||||
end
|
||||
local nOthInd = 1 - nFacInd
|
||||
-- recupero la lavorazione
|
||||
local nMill, sMilling = FindMilling( 'BirdsMouth')
|
||||
local sMilling = ML.FindMilling( 'BirdsMouth')
|
||||
if not sMilling then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
@@ -284,17 +270,6 @@ local function MakePreCuts( Proc, nPhase, nRawId, nPartId, b3Raw)
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindSawing( sType)
|
||||
for i = 1, #Sawings do
|
||||
local Sawing = Sawings[i]
|
||||
if Sawing.Type == sType then
|
||||
return i, Sawing.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MakeByChainSaw( Proc, nPhase, nRawId, nPartId, nFacInd, rfFac, dH, dV)
|
||||
-- Recupero le facce adiacenti alla principale
|
||||
@@ -344,7 +319,7 @@ local function MakeByChainSaw( Proc, nPhase, nRawId, nPartId, nFacInd, rfFac, dH
|
||||
local vtT = vtN ^ (ptP2 - ptP1)
|
||||
local d3RotAng = EgtIf( abs( vtT:getZ()) < GEO.EPS_SMALL, 0, 90)
|
||||
-- Recupero la lavorazione
|
||||
local nSaw, sSawing = FindSawing( 'Sawing')
|
||||
local sSawing = ML.FindSawing( 'Sawing')
|
||||
if not sSawing then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' chainsawing not found in library'
|
||||
EgtOutLog( sErr)
|
||||
@@ -398,25 +373,14 @@ local function MakeByChainSaw( Proc, nPhase, nRawId, nPartId, nFacInd, rfFac, dH
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindPocketing( sType)
|
||||
for i = 1, #Pocketings do
|
||||
local Pocketing = Pocketings[i]
|
||||
if Pocketing.Type == sType then
|
||||
return i, Pocketing.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MakeMoreFacesByMillOrChain( Proc, nPhase, nRawId, nPartId)
|
||||
local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId)
|
||||
-- recupero l'ingombro del grezzo di appartenenza
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- recupero il numero di facce della tacca
|
||||
assert( ( Proc.Fct > 2), 'Error : MakeMoreFacesByMillOrChain in LapJoint with ' .. tostring( Proc.Fct) .. ' faces')
|
||||
assert( ( Proc.Fct > 2), 'Error : MakeMoreFaces in LapJoint with ' .. tostring( Proc.Fct) .. ' faces')
|
||||
-- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa
|
||||
local nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc.Id)
|
||||
assert( nFacInd, 'Error : MakeMoreFacesByMillOrChain could not find reference face')
|
||||
assert( nFacInd, 'Error : MakeMoreFaces could not find reference face')
|
||||
-- dati della faccia
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
local rfFac, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
@@ -435,7 +399,7 @@ local function MakeMoreFacesByMillOrChain( Proc, nPhase, nRawId, nPartId)
|
||||
end
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
local nMill, sPocketing = FindPocketing( 'Mortise')
|
||||
local sPocketing = ML.FindPocketing( 'Mortise')
|
||||
if not sPocketing then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' pocketing not found in library'
|
||||
EgtOutLog( sErr)
|
||||
@@ -451,7 +415,7 @@ local function MakeMoreFacesByMillOrChain( Proc, nPhase, nRawId, nPartId)
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
end
|
||||
end
|
||||
-- se una dimensione della faccia è più piccola del diametro utensile, va usata la sega a catena
|
||||
-- se una dimensione della faccia è più piccola del diametro utensile, va usata la sega a catena o la lama
|
||||
if dH < dMillDiam or dV < dMillDiam then
|
||||
return MakeByChainSaw( Proc, nPhase, nRawId, nPartId, nFacInd, rfFac, dH, dV)
|
||||
end
|
||||
@@ -491,31 +455,34 @@ local function MakeMoreFacesByMillOrChain( Proc, nPhase, nRawId, nPartId)
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MakeByMillOrChain( Proc, nPhase, nRawId, nPartId)
|
||||
-- richiamo la routine di lavorazione opportuna a seconda del numero di facce
|
||||
if Proc.Fct == 1 then
|
||||
return MakeOneFaceByMill( Proc, nPhase, nRawId, nPartId)
|
||||
elseif Proc.Fct == 2 then
|
||||
return MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId)
|
||||
else
|
||||
return MakeMoreFacesByMillOrChain( Proc, nPhase, nRawId, nPartId)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
---------------------------------------------------------------------
|
||||
function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId)
|
||||
-- con fresa
|
||||
-- limiti di fresatura semplice
|
||||
local MAX_MILL_X = 80
|
||||
local MAX_MILL_VOL = ( 80 * 240 * 20) / 2
|
||||
if Proc.Fct > 2 or ( Proc.Box:getDimX() < MAX_MILL_X and Proc.Box:getDimX() * Proc.Box:getDimY() * Proc.Box:getDimZ() < MAX_MILL_VOL) then
|
||||
return MakeByMillOrChain( Proc, nPhase, nRawId, nPartId)
|
||||
-- con lama
|
||||
-- una faccia
|
||||
if Proc.Fct == 1 then
|
||||
-- se piccola, con fresa
|
||||
if Proc.Box:getDimX() < MAX_MILL_X or Proc.Box:getDimX() * Proc.Box:getDimY() * Proc.Box:getDimZ() < MAX_MILL_VOL then
|
||||
return MakeOneFaceByMill( Proc, nPhase, nRawId, nPartId)
|
||||
-- altrimenti, con lama
|
||||
else
|
||||
return Cut.Make( Proc, nPhase, nRawId, nPartId, 0)
|
||||
end
|
||||
-- due facce
|
||||
elseif Proc.Fct == 2 then
|
||||
-- se piccole, con fresa
|
||||
if Proc.Box:getDimX() < MAX_MILL_X or Proc.Box:getDimX() * Proc.Box:getDimY() * Proc.Box:getDimZ() < MAX_MILL_VOL then
|
||||
return MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId)
|
||||
-- altrimenti, con lama
|
||||
else
|
||||
return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, 'HeadSide')
|
||||
end
|
||||
-- tre o più facce
|
||||
else
|
||||
return Tfs.Make( Proc, nPhase, nRawId, nPartId, 'HeadSide')
|
||||
return MakeMoreFaces( Proc, nPhase, nRawId, nPartId)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ EgtOutLog( ' ProcessLongCut started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Millings = require( 'MillingData')
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
@@ -33,17 +33,6 @@ function ProcessLongCut.Classify( Proc)
|
||||
return true, false
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindMilling( sType)
|
||||
for i = 1, #Millings do
|
||||
local Milling = Millings[i]
|
||||
if Milling.Type == sType then
|
||||
return i, Milling.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId)
|
||||
@@ -72,7 +61,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId)
|
||||
return false, sErr
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
local nMill, sMilling = FindMilling( 'Long2Cut')
|
||||
local sMilling = ML.FindMilling( 'Long2Cut')
|
||||
if not sMilling then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
|
||||
+112
-235
@@ -11,7 +11,7 @@ EgtOutLog( ' ProcessLongDoubleCut started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Millings = require( 'MillingData')
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
@@ -23,25 +23,14 @@ end
|
||||
-- Classificazione della feature
|
||||
function ProcessLong2Cut.Classify( Proc)
|
||||
-- verifico le normali delle facce
|
||||
-- local nFacetCnt = EgtSurfTmFacetCount( Proc.Id)
|
||||
-- for i = 1, nFacetCnt do
|
||||
-- local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i-1, GDB_ID.ROOT)
|
||||
-- if vtN:getZ() < - 0.707 then
|
||||
-- return true, true
|
||||
-- end
|
||||
-- end
|
||||
return true, false
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindMilling( sType)
|
||||
for i = 1, #Millings do
|
||||
local Milling = Millings[i]
|
||||
if Milling.Type == sType then
|
||||
return i, Milling.Name
|
||||
end
|
||||
local nFacetCnt = EgtSurfTmFacetCount( Proc.Id)
|
||||
for i = 1, nFacetCnt do
|
||||
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i-1, GDB_ID.ROOT)
|
||||
if vtN:getZ() < - 0.707 then
|
||||
return true, true
|
||||
end
|
||||
end
|
||||
return 0
|
||||
return true, false
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
@@ -54,13 +43,12 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId)
|
||||
ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT)
|
||||
local dLen = EgtGetBBoxGlob( Proc.Id, GDB_BB.STANDARD):getDimX()
|
||||
-- verifico che il doppio taglio longitudinale non sia orientato verso il basso
|
||||
-- if vtN[1]:getZ() < - 0.707 or vtN[2]:getZ() < - 0.707 then
|
||||
-- local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Longitudinal Double Cut from bottom impossible'
|
||||
-- EgtOutLog( sErr)
|
||||
-- return false, sErr
|
||||
-- end
|
||||
|
||||
-- verifico se sopra o no
|
||||
if vtN[1]:getZ() < - 0.707 or vtN[2]:getZ() < - 0.707 then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Longitudinal Double Cut from bottom impossible'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- verifico se sopra o sui lati
|
||||
local bTop = ( vtN[1]:getZ() > 0 and vtN[2]:getZ() > 0)
|
||||
-- angolo diedro per stabilire se taglio convesso
|
||||
local _, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT)
|
||||
@@ -69,221 +57,110 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId)
|
||||
-- analisi del taglio
|
||||
local vOrd = {}
|
||||
local vFaceUse = {}
|
||||
local bDownCut = false
|
||||
if bTop then
|
||||
vOrd = EgtIf( ptC[1]:getY() < ptM:getY(), { 1, 2}, { 2, 1})
|
||||
vFaceUse = {[vOrd[1]] = MCH_MILL_FU.ORTHO_BACK, [vOrd[2]] = MCH_MILL_FU.ORTHO_FRONT}
|
||||
else
|
||||
-- verifico se sotto o sui lati
|
||||
if ( vtN[1]:getZ() < 0 and vtN[2]:getZ() < 0) then
|
||||
bDownCut = true
|
||||
vOrd = EgtIf( ptC[1]:getY() < ptM:getY(), { 1, 2}, { 2, 1})
|
||||
vFaceUse = {[vOrd[1]] = MCH_MILL_FU.PARAL_BACK, [vOrd[2]] = MCH_MILL_FU.PARAL_FRONT}
|
||||
else
|
||||
local bFront = ( vtN[1]:getY() < 0)
|
||||
if bFront then
|
||||
vOrd = EgtIf( ptC[1]:getZ() < ptM:getZ(), { 1, 2}, { 2, 1})
|
||||
vFaceUse = {[vOrd[1]] = MCH_MILL_FU.ORTHO_TOP, [vOrd[2]] = MCH_MILL_FU.ORTHO_DOWN}
|
||||
else
|
||||
vOrd = EgtIf( ptC[1]:getZ() < ptM:getZ(), { 2, 1}, { 1, 2})
|
||||
vFaceUse = {[vOrd[1]] = MCH_MILL_FU.ORTHO_DOWN, [vOrd[2]] = MCH_MILL_FU.ORTHO_TOP}
|
||||
end
|
||||
end
|
||||
local bFront = ( vtN[1]:getY() < 0)
|
||||
if bFront then
|
||||
vOrd = EgtIf( ptC[1]:getZ() < ptM:getZ(), { 1, 2}, { 2, 1})
|
||||
vFaceUse = {[vOrd[1]] = MCH_MILL_FU.ORTHO_TOP, [vOrd[2]] = MCH_MILL_FU.ORTHO_DOWN}
|
||||
else
|
||||
vOrd = EgtIf( ptC[1]:getZ() < ptM:getZ(), { 2, 1}, { 1, 2})
|
||||
vFaceUse = {[vOrd[1]] = MCH_MILL_FU.ORTHO_DOWN, [vOrd[2]] = MCH_MILL_FU.ORTHO_TOP}
|
||||
end
|
||||
end
|
||||
-- se non è sotto: taglio Long2Cut
|
||||
if not bDownCut then
|
||||
local vWidth = {}
|
||||
local vtDiff1 = ptC[vOrd[1]] - ptM
|
||||
vWidth[vOrd[1]] = 2 * sqrt( vtDiff1:getY() * vtDiff1:getY() + vtDiff1:getZ() * vtDiff1:getZ())
|
||||
local vtDiff2 = ptC[vOrd[2]] - ptM
|
||||
vWidth[vOrd[2]] = 2 * sqrt( vtDiff2:getY() * vtDiff2:getY() + vtDiff2:getZ() * vtDiff2:getZ())
|
||||
-- recupero la lavorazione
|
||||
local nMill, sMilling = FindMilling( 'Long2Cut')
|
||||
if not sMilling then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- recupero i dati dell'utensile
|
||||
local dToolDiam = 0
|
||||
local dMaxDepth = 0
|
||||
if EgtMdbSetCurrMachining( sMilling) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
end
|
||||
end
|
||||
-- determino il numero di parti in cui dividere la lavorazione
|
||||
local dEndLen = BD.LONGCUT_ENDLEN
|
||||
if dLen < 2 * dEndLen + BD.LONGCUT_MAXLEN then
|
||||
dEndLen = dLen / 3
|
||||
end
|
||||
local nC = ceil( ( dLen - 2 * dEndLen) / BD.LONGCUT_MAXLEN)
|
||||
local dC = 0
|
||||
if nC > 0 then dC = ( dLen - 2 * dEndLen) / nC end
|
||||
nC = nC + 2
|
||||
-- ciclo sulle parti
|
||||
local nM = 0
|
||||
for j = 1, nC do
|
||||
-- su entrambe le facce
|
||||
for i = 1, 2 do
|
||||
-- Limitazioni della lavorazione
|
||||
local nPos = EgtIf( i == 1, j, nC - j + 1)
|
||||
local dSal = EgtIf( nPos == 1, 0, - dEndLen - ( nPos - 2) * dC)
|
||||
local dEal = EgtIf( nPos == nC, 0, - dEndLen - ( nC - nPos - 1) * dC)
|
||||
-- Posizione braccio portatesta
|
||||
local nSCC = EgtIf( ( j == 1 or j == nC - 1), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
||||
-- ciclo sulle passate
|
||||
local nO = 1
|
||||
local dStep = 0
|
||||
local dAgg = EgtIf( bConvex, 2 * BD.CUT_EXTRA, BD.CUT_EXTRA)
|
||||
if vWidth[vOrd[i]] + dAgg > dToolDiam then
|
||||
nO = ceil(( vWidth[vOrd[i]] + dAgg) / dToolDiam)
|
||||
if nO > 1 then
|
||||
dStep = ( vWidth[vOrd[i]] + dAgg - dToolDiam) / ( nO - 1)
|
||||
end
|
||||
end
|
||||
for k = 1, nO do
|
||||
-- determino direzione di movimento
|
||||
local bToLeft = ( i == 1)
|
||||
-- inserisco le parti di lavorazione
|
||||
nM = nM + 1
|
||||
local sNameF = 'L2C_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM)
|
||||
local nMchFId = EgtAddMachining( sNameF, sMilling)
|
||||
if not nMchFId then
|
||||
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ Proc.Id, vOrd[i] - 1}})
|
||||
-- limito opportunamente la lavorazione
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal)
|
||||
-- imposto posizione braccio porta testa per non ingombrare agli estremi
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
-- imposto uso faccia
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse[vOrd[i]])
|
||||
-- imposto lato di lavoro e inversione
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, false)
|
||||
-- imposto offset radiale (nullo se concavo)
|
||||
if k < nO then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, ( nO - k) * dStep)
|
||||
else
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, EgtIf( bConvex, - BD.CUT_EXTRA, 0))
|
||||
end
|
||||
-- eseguo
|
||||
if not EgtApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- altrimenti (se è sotto): taglio Prof
|
||||
else
|
||||
local vWidth = {}
|
||||
local vtDiff1 = ptC[vOrd[1]] - ptM
|
||||
vWidth[vOrd[1]] = 2 * sqrt( vtDiff1:getY() * vtDiff1:getY() + vtDiff1:getZ() * vtDiff1:getZ())
|
||||
local vtDiff2 = ptC[vOrd[2]] - ptM
|
||||
vWidth[vOrd[2]] = 2 * sqrt( vtDiff2:getY() * vtDiff2:getY() + vtDiff2:getZ() * vtDiff2:getZ())
|
||||
-- recupero la lavorazione
|
||||
local nMill, sMilling = FindMilling( 'Prof')
|
||||
if not sMilling then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- recupero i dati dell'utensile
|
||||
local dToolDiam = 0
|
||||
local dMaxDepth = 0
|
||||
if EgtMdbSetCurrMachining( sMilling) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
-- dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
end
|
||||
end
|
||||
-- determino il numero di parti in cui dividere la lavorazione
|
||||
local dEndLen = BD.LONGCUT_ENDLEN
|
||||
if dLen < 2 * dEndLen + BD.LONGCUT_MAXLEN then
|
||||
dEndLen = dLen / 3
|
||||
end
|
||||
local nC = ceil( ( dLen - 2 * dEndLen) / BD.LONGCUT_MAXLEN)
|
||||
local dC = 0
|
||||
if nC > 0 then dC = ( dLen - 2 * dEndLen) / nC end
|
||||
nC = nC + 2
|
||||
-- ciclo sulle parti
|
||||
local nM = 0
|
||||
for j = 1, nC do
|
||||
-- su entrambe le facce
|
||||
for i = 1, 2 do
|
||||
-- Limitazioni della lavorazione
|
||||
local nPos = EgtIf( i == 1, j, nC - j + 1)
|
||||
local dSal = EgtIf( nPos == 1, 0, - dEndLen - ( nPos - 2) * dC)
|
||||
local dEal = EgtIf( nPos == nC, 0, - dEndLen - ( nC - nPos - 1) * dC)
|
||||
-- Posizione braccio portatesta
|
||||
local nSCC = EgtIf( ( j == 1 or j == nC - 1), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
||||
-- ciclo sulle passate
|
||||
local nO = 1
|
||||
local dStep = 0
|
||||
local dAgg = EgtIf( bConvex, 2 * BD.CUT_EXTRA, BD.CUT_EXTRA)
|
||||
if vWidth[vOrd[i]] + dAgg > dMaxDepth then
|
||||
nO = ceil(( vWidth[vOrd[i]] + dAgg) / dMaxDepth)
|
||||
if nO > 1 then
|
||||
dStep = ( vWidth[vOrd[i]] + dAgg - dMaxDepth) / ( nO - 1)
|
||||
end
|
||||
end
|
||||
for k = 1, nO do
|
||||
-- determino direzione di movimento
|
||||
local bToLeft = ( i == 1)
|
||||
-- inserisco le parti di lavorazione
|
||||
nM = nM + 1
|
||||
local sNameF = 'L2C_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM)
|
||||
local nMchFId = EgtAddMachining( sNameF, sMilling)
|
||||
if not nMchFId then
|
||||
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ Proc.Id, vOrd[i] - 1}})
|
||||
-- limito opportunamente la lavorazione
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal)
|
||||
-- imposto posizione braccio porta testa per non ingombrare agli estremi
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
-- imposto uso faccia
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse[vOrd[i]])
|
||||
-- imposto lato di lavoro e inversione
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
|
||||
local dDepth = min( dMaxDepth, vWidth[vOrd[i]] + BD.MILL_OVERLAP)
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||
-- EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH')
|
||||
EgtSetMachiningParam( MCH_MP.STEP, 0)
|
||||
|
||||
-- imposto offset radiale (nullo se concavo)
|
||||
if k < nO then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, ( nO - k) * dStep)
|
||||
else
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, EgtIf( bConvex, - BD.CUT_EXTRA, 0))
|
||||
end
|
||||
-- eseguo
|
||||
if not EgtApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
local vWidth = {}
|
||||
local vtDiff1 = ptC[vOrd[1]] - ptM
|
||||
vWidth[vOrd[1]] = 2 * sqrt( vtDiff1:getY() * vtDiff1:getY() + vtDiff1:getZ() * vtDiff1:getZ())
|
||||
local vtDiff2 = ptC[vOrd[2]] - ptM
|
||||
vWidth[vOrd[2]] = 2 * sqrt( vtDiff2:getY() * vtDiff2:getY() + vtDiff2:getZ() * vtDiff2:getZ())
|
||||
-- recupero la lavorazione
|
||||
local sMilling = ML.FindMilling( 'Long2Cut')
|
||||
if not sMilling then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- recupero i dati dell'utensile
|
||||
local dToolDiam = 0
|
||||
local dMaxDepth = 0
|
||||
if EgtMdbSetCurrMachining( sMilling) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
end
|
||||
end
|
||||
-- determino il numero di parti in cui dividere la lavorazione
|
||||
local dEndLen = BD.LONGCUT_ENDLEN
|
||||
if dLen < 2 * dEndLen + BD.LONGCUT_MAXLEN then
|
||||
dEndLen = dLen / 3
|
||||
end
|
||||
local nC = ceil( ( dLen - 2 * dEndLen) / BD.LONGCUT_MAXLEN)
|
||||
local dC = 0
|
||||
if nC > 0 then dC = ( dLen - 2 * dEndLen) / nC end
|
||||
nC = nC + 2
|
||||
-- ciclo sulle parti
|
||||
local nM = 0
|
||||
for j = 1, nC do
|
||||
-- su entrambe le facce
|
||||
for i = 1, 2 do
|
||||
-- Limitazioni della lavorazione
|
||||
local nPos = EgtIf( i == 1, j, nC - j + 1)
|
||||
local dSal = EgtIf( nPos == 1, 0, - dEndLen - ( nPos - 2) * dC)
|
||||
local dEal = EgtIf( nPos == nC, 0, - dEndLen - ( nC - nPos - 1) * dC)
|
||||
-- Posizione braccio portatesta
|
||||
local nSCC = EgtIf( ( j == 1 or j == nC - 1), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
||||
-- ciclo sulle passate
|
||||
local nO = 1
|
||||
local dStep = 0
|
||||
local dAgg = EgtIf( bConvex, 2 * BD.CUT_EXTRA, BD.CUT_EXTRA)
|
||||
if vWidth[vOrd[i]] + dAgg > dToolDiam then
|
||||
nO = ceil(( vWidth[vOrd[i]] + dAgg) / dToolDiam)
|
||||
if nO > 1 then
|
||||
dStep = ( vWidth[vOrd[i]] + dAgg - dToolDiam) / ( nO - 1)
|
||||
end
|
||||
end
|
||||
for k = 1, nO do
|
||||
-- determino direzione di movimento
|
||||
local bToLeft = ( i == 1)
|
||||
-- inserisco le parti di lavorazione
|
||||
nM = nM + 1
|
||||
local sNameF = 'L2C_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM)
|
||||
local nMchFId = EgtAddMachining( sNameF, sMilling)
|
||||
if not nMchFId then
|
||||
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ Proc.Id, vOrd[i] - 1}})
|
||||
-- limito opportunamente la lavorazione
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal)
|
||||
-- imposto posizione braccio porta testa per non ingombrare agli estremi
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
-- imposto uso faccia
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse[vOrd[i]])
|
||||
-- imposto lato di lavoro e inversione
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, false)
|
||||
-- imposto offset radiale (nullo se concavo)
|
||||
if k < nO then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, ( nO - k) * dStep)
|
||||
else
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, EgtIf( bConvex, - BD.CUT_EXTRA, 0))
|
||||
end
|
||||
-- eseguo
|
||||
if not EgtApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
+2
-13
@@ -11,18 +11,7 @@ EgtOutLog( ' ProcessMark started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Millings = require( 'MillingData')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindMilling( sType)
|
||||
for i = 1, #Millings do
|
||||
local Milling = Millings[i]
|
||||
if Milling.Type == sType then
|
||||
return i, Milling.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
@@ -65,7 +54,7 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId)
|
||||
return false, sErr
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
local nMill, sMilling = FindMilling( 'Mark')
|
||||
local sMilling = ML.FindMilling( 'Mark')
|
||||
if not sMilling then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
|
||||
+10
-16
@@ -11,18 +11,7 @@ EgtOutLog( ' ProcessMortise started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Pocketings = require( 'PocketingData')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindPocketing( sType)
|
||||
for i = 1, #Pocketings do
|
||||
local Pocketing = Pocketings[i]
|
||||
if Pocketing.Type == sType then
|
||||
return i, Pocketing.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
@@ -60,9 +49,14 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId)
|
||||
-- se curva aperta la allungo e chiudo
|
||||
if not EgtCurveIsClosed( AuxId) then
|
||||
local EXTRA_LEN = 30
|
||||
EgtExtendCurveStartByLen( AuxId, EXTRA_LEN)
|
||||
EgtExtendCurveEndByLen( AuxId, EXTRA_LEN)
|
||||
EgtCloseCurveCompo( AuxId)
|
||||
local dGap = dist( EgtSP( AuxId), EgtEP( AuxId))
|
||||
if dGap <= 2 * EXTRA_LEN then
|
||||
EgtAddCurveCompoArcTg( AuxId, EgtSP( AuxId))
|
||||
else
|
||||
EgtExtendCurveStartByLen( AuxId, EXTRA_LEN)
|
||||
EgtExtendCurveEndByLen( AuxId, EXTRA_LEN)
|
||||
EgtCloseCurveCompo( AuxId)
|
||||
end
|
||||
end
|
||||
-- recupero i dati della curva e del top
|
||||
local dDepth = abs( EgtCurveThickness( AuxId))
|
||||
@@ -76,7 +70,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId)
|
||||
return false, sErr
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
local nPocket, sPocketing = FindPocketing( 'Mortise')
|
||||
local sPocketing = ML.FindPocketing( 'Mortise')
|
||||
if not sPocketing then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' pocketing not found in library'
|
||||
EgtOutLog( sErr)
|
||||
|
||||
@@ -12,7 +12,7 @@ EgtOutLog( ' ProcessPocket started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Pocketings = require( 'PocketingData')
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
@@ -34,17 +34,6 @@ function ProcessPocket.Classify( Proc)
|
||||
return true, bDown
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindPocketing( sType)
|
||||
for i = 1, #Pocketings do
|
||||
local Pocketing = Pocketings[i]
|
||||
if Pocketing.Type == sType then
|
||||
return i, Pocketing.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessPocket.Make( Proc, nPhase, nRawId, nPartId)
|
||||
@@ -65,7 +54,7 @@ function ProcessPocket.Make( Proc, nPhase, nRawId, nPartId)
|
||||
return false, sErr
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
local nPocket, sPocketing = FindPocketing( 'Mortise')
|
||||
local sPocketing = ML.FindPocketing( 'Mortise')
|
||||
if not sPocketing then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' pocketing not found in library'
|
||||
EgtOutLog( sErr)
|
||||
|
||||
@@ -13,7 +13,7 @@ EgtOutLog( ' ProcessProfCamb started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Millings = require( 'MillingData')
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
@@ -21,17 +21,6 @@ function ProcessProfCamb.Identify( Proc)
|
||||
return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 103)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindMilling( sType)
|
||||
for i = 1, #Millings do
|
||||
local Milling = Millings[i]
|
||||
if Milling.Type == sType then
|
||||
return i, Milling.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function GetSawCutData( AuxId, vtNF)
|
||||
-- comincio con la normale a 45deg
|
||||
@@ -123,7 +112,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
local nMill, sMilling = FindMilling( 'Prof')
|
||||
local sMilling = ML.FindMilling( 'Prof')
|
||||
if not sMilling then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
|
||||
@@ -13,7 +13,7 @@ EgtOutLog( ' ProcessProfConcave started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Millings = require( 'MillingData')
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
@@ -21,17 +21,6 @@ function ProcessProfConcave.Identify( Proc)
|
||||
return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 101)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindMilling( sType)
|
||||
for i = 1, #Millings do
|
||||
local Milling = Millings[i]
|
||||
if Milling.Type == sType then
|
||||
return i, Milling.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function GetSawCutData( AuxId, vtN)
|
||||
-- comincio con la normale a 45deg
|
||||
@@ -107,7 +96,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
local nMill, sMilling = FindMilling( 'Prof')
|
||||
local sMilling = ML.FindMilling( 'Prof')
|
||||
if not sMilling then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
|
||||
@@ -13,7 +13,7 @@ EgtOutLog( ' ProcessProfConvex started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Millings = require( 'MillingData')
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
@@ -21,17 +21,6 @@ function ProcessProfConvex.Identify( Proc)
|
||||
return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 102)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindMilling( sType)
|
||||
for i = 1, #Millings do
|
||||
local Milling = Millings[i]
|
||||
if Milling.Type == sType then
|
||||
return i, Milling.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function GetSawCutData( AuxId, vtN)
|
||||
-- comincio con la normale a 45deg
|
||||
@@ -107,7 +96,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
local nMill, sMilling = FindMilling( 'Prof')
|
||||
local sMilling = ML.FindMilling( 'Prof')
|
||||
if not sMilling then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
|
||||
@@ -13,7 +13,7 @@ EgtOutLog( ' ProcessProfFront started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Millings = require( 'MillingData')
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
@@ -21,17 +21,6 @@ function ProcessProfFront.Identify( Proc)
|
||||
return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 100)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindMilling( sType)
|
||||
for i = 1, #Millings do
|
||||
local Milling = Millings[i]
|
||||
if Milling.Type == sType then
|
||||
return i, Milling.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function GetSawCutData( AuxId, vtN)
|
||||
local vtNP = Vector3d( vtN)
|
||||
@@ -96,7 +85,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
local nMill, sMilling = FindMilling( 'Prof')
|
||||
local sMilling = ML.FindMilling( 'Prof')
|
||||
if not sMilling then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
|
||||
@@ -13,7 +13,7 @@ EgtOutLog( ' ProcessProfHead started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Millings = require( 'MillingData')
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
@@ -21,17 +21,6 @@ function ProcessProfHead.Identify( Proc)
|
||||
return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 106)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindMilling( sType)
|
||||
for i = 1, #Millings do
|
||||
local Milling = Millings[i]
|
||||
if Milling.Type == sType then
|
||||
return i, Milling.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function GetSawCutData( AuxId, vtN)
|
||||
-- assegno la normale
|
||||
@@ -104,7 +93,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
local nMill, sMilling = FindMilling( 'Prof')
|
||||
local sMilling = ML.FindMilling( 'Prof')
|
||||
if not sMilling then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
|
||||
@@ -13,7 +13,7 @@ EgtOutLog( ' ProcessRidgeLap started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Cuttings = require( 'CutData')
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
@@ -39,17 +39,6 @@ function ProcessRidgeLap.Classify( Proc)
|
||||
return true, false
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindCutting( sType)
|
||||
for i = 1, #Cuttings do
|
||||
local Cutting = Cuttings[i]
|
||||
if Cutting.Type == sType then
|
||||
return i, Cutting.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
@@ -100,7 +89,7 @@ function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- determino se di testa o di coda
|
||||
local bHead = ( vtN[vFaceOrd[2]]:getX() > 0)
|
||||
-- recupero la lavorazione
|
||||
local _, sCutting = FindCutting( 'HeadSide')
|
||||
local sCutting = ML.FindCutting( 'HeadSide')
|
||||
if not sCutting then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library'
|
||||
EgtOutLog( sErr)
|
||||
|
||||
@@ -12,7 +12,7 @@ EgtOutLog( ' ProcessRoundArch started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Millings = require( 'MillingData')
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
@@ -76,17 +76,6 @@ function ProcessRoundArch.Classify( Proc)
|
||||
return true, bDown
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindMilling( sType)
|
||||
for i = 1, #Millings do
|
||||
local Milling = Millings[i]
|
||||
if Milling.Type == sType then
|
||||
return i, Milling.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessRoundArch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
@@ -105,7 +94,7 @@ function ProcessRoundArch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
||||
local bToolInv = ( vtExtr:getZ() < -0.1)
|
||||
-- recupero la lavorazione
|
||||
local nMill, sMilling = FindMilling( 'FreeContour')
|
||||
local sMilling = ML.FindMilling( 'FreeContour')
|
||||
if not sMilling then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
|
||||
@@ -13,7 +13,7 @@ EgtOutLog( ' ProcessSimpleScarf started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Cuttings = require( 'CutData')
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
@@ -35,17 +35,6 @@ function ProcessSimpleScarf.Classify( Proc)
|
||||
return true, false
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindCutting( sType)
|
||||
for i = 1, #Cuttings do
|
||||
local Cutting = Cuttings[i]
|
||||
if Cutting.Type == sType then
|
||||
return i, Cutting.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
@@ -99,7 +88,7 @@ function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local vtRef = Vector3d( 0, vtN[vFaceOrd[3]]:getY(), vtN[vFaceOrd[3]]:getZ())
|
||||
vtRef:normalize()
|
||||
-- recupero la lavorazione
|
||||
local _, sCutting = FindCutting( 'HeadSide')
|
||||
local sCutting = ML.FindCutting( 'HeadSide')
|
||||
if not sCutting then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library'
|
||||
EgtOutLog( sErr)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- ProcessSplit.lua by Egaltech s.r.l. 2019/04/08
|
||||
-- ProcessSplit.lua by Egaltech s.r.l. 2019/04/25
|
||||
-- Gestione calcolo tagli di separazione per Travi
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
@@ -12,18 +12,7 @@ EgtOutLog( ' ProcessSplit started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Cuttings = require( 'CutData')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindCutting( sType)
|
||||
for i = 1, #Cuttings do
|
||||
local Cutting = Cuttings[i]
|
||||
if Cutting.Type == sType then
|
||||
return i, Cutting.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
@@ -60,7 +49,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
|
||||
end
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
local _, sCutting = FindCutting( EgtIf( bSplit, 'SplitSide', 'TailSide'))
|
||||
local sCutting = ML.FindCutting( EgtIf( bSplit, 'SplitSide', 'TailSide'))
|
||||
if not sCutting then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library'
|
||||
EgtOutLog( sErr)
|
||||
@@ -80,7 +69,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
|
||||
if bDoubleCut then
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
local sNotes = 'Cut'
|
||||
local sNotes = EgtIf( bSplit, 'Presplit;', 'Precut;')
|
||||
local bOk, sErr = BL.MakeOneFaceBySaw( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_BACK, dCutExtra, BD.CUT_SIC, dCutOffset, sNotes, b3Raw)
|
||||
if not bOk then return false, true, sErr end
|
||||
end
|
||||
@@ -89,8 +78,10 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
local sNotes
|
||||
if not bSplit then
|
||||
sNotes = EgtIf( i == 1, 'Cut', 'Precut')
|
||||
if bSplit then
|
||||
sNotes = EgtIf( i == 1, 'Split;', 'Presplit;')
|
||||
else
|
||||
sNotes = EgtIf( i == 1, 'Cut;', 'Precut;')
|
||||
end
|
||||
local bOk, sErr = BL.MakeOneFaceBySaw( Proc.Id, 0, sCutting, dSawDiam, nOrthoOpposite, dCutExtra, BD.CUT_SIC, dCutOffset, sNotes, b3Raw)
|
||||
if not bOk then return false, true, sErr end
|
||||
|
||||
@@ -13,18 +13,7 @@ EgtOutLog( ' ProcessTenon started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Millings = require( 'MillingData')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindMilling( sType)
|
||||
for i = 1, #Millings do
|
||||
local Milling = Millings[i]
|
||||
if Milling.Type == sType then
|
||||
return i, Milling.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
@@ -113,7 +102,7 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
local nMill, sMilling = FindMilling( 'Tenon')
|
||||
local sMilling = ML.FindMilling( 'Tenon')
|
||||
if not sMilling then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
|
||||
+2
-13
@@ -11,18 +11,7 @@ EgtOutLog( ' ProcessText started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Millings = require( 'MillingData')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindMilling( sType)
|
||||
for i = 1, #Millings do
|
||||
local Milling = Millings[i]
|
||||
if Milling.Type == sType then
|
||||
return i, Milling.Name
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
@@ -62,7 +51,7 @@ function ProcessText.Make( Proc, nPhase, nRawId, nPartId)
|
||||
return false, sErr
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
local nMill, sMilling = FindMilling( 'Text')
|
||||
local sMilling = ML.FindMilling( 'Text')
|
||||
if not sMilling then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
|
||||
Reference in New Issue
Block a user