DataBeam :

- migliorato ordinamento fori
- riunite FindMilling, .... in una unica libreria
- altre piccole migliorie.
This commit is contained in:
Dario Sassi
2019-04-26 15:06:31 +00:00
parent fc441ff8b2
commit 998624035b
30 changed files with 354 additions and 710 deletions
+32 -65
View File
@@ -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