DataWall :

- prima versione con gestione evoluta dei tagli di lama.
This commit is contained in:
Dario Sassi
2020-06-27 08:20:06 +00:00
parent 1cb5906403
commit f800eab2ab
2 changed files with 129 additions and 4 deletions
+100 -4
View File
@@ -6,7 +6,7 @@ local ProcessFreeContour = {}
-- Include
require( 'EgtBase')
--local BL = require( 'BeamLib')
local WL = require( 'WallLib')
EgtOutLog( ' ProcessFreeContour started', 1)
@@ -47,6 +47,101 @@ function ProcessFreeContour.Classify( Proc, b3Raw)
end
end
---------------------------------------------------------------------
local function MakeByCut( Proc, nRawId, b3Raw)
-- ingombro del pezzo
local Ls = EgtGetFirstNameInGroup( Proc.PartId, 'Box')
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then
local sErr = 'Error : part box not found'
EgtOutLog( sErr)
return false, sErr
end
-- recupero la lavorazione
local sCutting = ML.FindCutting( 'Standard')
if not sCutting then
local sErr = 'Error : cutting not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati dell'utensile
local dSawDiam = 400
local dMaxDepth = 0
if EgtMdbSetCurrMachining( sCutting) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- recupero i dati di tutte le facce
local vFace = {}
for i = 1, Proc.Fct do
-- recupero centro e normale della faccia
local ptCen, vtN = EgtSurfTmFacetCenter( Proc.Id, i - 1, GDB_ID.ROOT)
-- recupero le dimensioni della faccia
local _, dLen, dWidth = WL.GetFaceHvRefDim( Proc.Id, i - 1)
-- recupero l'angolo con la faccia successiva
local bAdj, _, _, dAng = EgtSurfTmFacetsContact( Proc.Id, EgtIf( i == 1, Proc.Fct - 1, i - 2), i -1, GDB_ID.ROOT)
-- salvo i dati
vFace[i] = { Cen = ptCen, Norm = vtN, Len = dLen, Width = dWidth, AngPrev = EgtIf( bAdj, dAng, 0)}
end
-- ciclo sulle facce del contorno in esame
for i = 1, Proc.Fct do
-- verifico l'affondamento
local dDepth = WD.CUT_EXTRA
if vFace[i].Width + WD.CUT_EXTRA > dMaxDepth then
dDepth = dMaxDepth - vFace[i].Width
end
-- lunghezza baffo
local dElev = vFace[i].Width + dDepth
local dWhisk = dElev * sqrt( dSawDiam / dElev - 1)
-- determino la lunghezza del taglio passante e il tipo di attacco e uscita
local dLen = vFace[i].Len
local nLeadIn = MCH_SAW_LI.CENT
local nLeadOut = MCH_SAW_LO.CENT
if vFace[i].AngPrev < -0.1 then
dLen = dLen - dWhisk
nLeadIn = MCH_SAW_LI.STRICT
end
if vFace[EgtIf( i < Proc.Fct, i + 1, 1)].AngPrev < -0.1 then
dLen = dLen - dWhisk
nLeadOut = MCH_SAW_LO.STRICT
end
-- se lunghezza significativa, inserisco la lavorazione
if dLen > 1 then
local sName = 'Cut_' .. ( EgtGetName( Proc.PartId) or tostring( Proc.PartId)) .. '_' .. tostring( i)
local nMchId = EgtAddMachining( sName, sCutting)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sCutting
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( { { Proc.Id, i - 1}})
-- percorso da non invertire
EgtSetMachiningParam( MCH_MP.INVERT, false)
-- assegno affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- assegno il lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- assegno il tipo di attacco
EgtSetMachiningParam( MCH_MP.LEADINTYPE, nLeadIn)
-- assegno il tipo di uscita
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, nLeadOut)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_XP)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
end
end
end
return true
end
---------------------------------------------------------------------
local function MakeByMill( Proc, nRawId, b3Raw)
-- ingombro del pezzo
@@ -87,10 +182,8 @@ local function MakeByMill( Proc, nRawId, b3Raw)
end
-- eventuale spezzatura sul tratto più lungo se curva chiusa
--BL.PutStartOnLonger( AuxId)
-- verifiche per affondamento ( possibili lavorazioni in doppio)
local bCross = false
-- verifiche per affondamento
if b3Aux:getDimZ() > b3Raw:getDimZ() - 1.0 then
bCross = true
dDepth = min( dDepth, b3Raw:getDimZ()) + WD.CUT_EXTRA
end
if dDepth > dMaxDepth then
@@ -206,6 +299,9 @@ function ProcessFreeContour.Make( Proc, nRawId, b3Raw)
-- se svuotatura
if bPocket then
return MakeByPocket( Proc, nRawId, b3Raw)
-- se lati diritti, taglio con lama e pulizia angoli con fresa
elseif true then
return MakeByCut( Proc, nRawId, b3Raw)
-- altrimenti contornatura
else
return MakeByMill( Proc, nRawId, b3Raw)