DataWall :

- completamento gestione riprese con fresa su contorni lama nel caso siano perpendicolari.
This commit is contained in:
Dario Sassi
2020-06-30 11:09:56 +00:00
parent ee13b3aca8
commit 13ac5f7c96
+66 -8
View File
@@ -1,4 +1,4 @@
-- ProcessFreeContour.lua by Egaltech s.r.l. 2020/06/24
-- ProcessFreeContour.lua by Egaltech s.r.l. 2020/06/30
-- Gestione calcolo profilo libero per Pareti
-- Tabella per definizione modulo
@@ -13,6 +13,8 @@ EgtOutLog( ' ProcessFreeContour started', 1)
-- Dati
local WD = require( 'WallData')
local WM = require( 'WMachiningLib')
local WHISK_SAFE = 5
local MIN_LEN_CUT = 1
---------------------------------------------------------------------
-- Riconoscimento della feature
@@ -55,7 +57,7 @@ local function GetOtherRegions( nPartId)
local nRegId = EgtGetFirstInGroup( EgtGetFirstNameInGroup( nOtherId, 'Outline') or GDB_ID.NULL)
while nRegId do
local vtN = EgtSurfFrNormVersor( nRegId, GDB_ID.ROOT)
if vtN and AreSameVectorApprox( vtN, Z_AX()) then
if EgtExistsInfo( nRegId, 'REGION') and vtN and AreSameVectorApprox( vtN, Z_AX()) then
local b3Reg = EgtGetBBoxGlob( nRegId, GDB_BB.STANDARD)
if b3Reg then
table.insert( vOthers, { PartId = nOtherId, RegId = nRegId, Box = b3Reg})
@@ -84,6 +86,45 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw)
i = i + 1
end
while i <= #vFace do
-- se inizio faccia senza taglio e non è successiva di senza taglio, inserisco una fresatura
local j
if abs( vFace[i].AngPrev) > 0.1 then
j = EgtIf( i == 1, #vFace, i - 1)
end
if ( vFace[i].Type & 1) ~= 0 and ( not j or ( vFace[j].Type == 0 or vFace[j].Type == 1)) then
-- inserisco la lavorazione
local sName = 'Free_' .. ( EgtGetName( Proc.PartId) or tostring( Proc.PartId))
local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- calcolo l'affondamento
local dDepth = min( vFace[i].Width + WD.CUT_EXTRA, dMaxDepth)
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, i - 1}})
local dSal = 0
local dEal = vFace[i].Whisk - vFace[i].Len
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal)
-- percorso da non invertire
EgtSetMachiningParam( MCH_MP.INVERT, false)
-- assegno utilizzo faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN)
-- assegno affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- 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
-- se tutta la faccia o la sua fine senza taglio, inserisco una fresatura
if ( vFace[i].Type & 2) ~= 0 or vFace[i].Type == 4 then
-- inserisco la lavorazione
@@ -159,12 +200,19 @@ local function AddCuts( sCutting, vFace, Proc, nRawId, b3Raw)
EgtSetMachiningParam( MCH_MP.DEPTH, vFace[i].Depth)
-- assegno il lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- assegno il tipo di attacco
-- assegno i dati di attacco (sicurezza solo se angolo interno)
local nLeadIn = EgtIf( ( vFace[i].Type & 1) == 0, MCH_SAW_LI.CENT, MCH_SAW_LI.STRICT)
EgtSetMachiningParam( MCH_MP.LEADINTYPE, nLeadIn)
-- assegno il tipo di uscita
if vFace[i].AngPrev < -0.1 then
EgtSetMachiningParam( MCH_MP.STARTADDLEN, -WHISK_SAFE)
end
-- assegno i dati di uscita (sicurezza solo se angolo interno)
local nLeadOut = EgtIf( ( vFace[i].Type & 2) == 0, MCH_SAW_LO.CENT, MCH_SAW_LO.STRICT)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, nLeadOut)
local j = EgtIf( i < #vFace, i + 1, 1)
if vFace[j].AngPrev < -0.1 then
EgtSetMachiningParam( MCH_MP.ENDADDLEN, -WHISK_SAFE)
end
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_XP)
-- eseguo
@@ -235,7 +283,7 @@ local function MakeByCut( Proc, nRawId, b3Raw)
end
-- lunghezza baffo
local dElev = vFace[i].Width + dDepth
local dWhisk = dElev * sqrt( dSawDiam / dElev - 1)
local dWhisk = dElev * sqrt( dSawDiam / dElev - 1) + WHISK_SAFE
-- determino la lunghezza del taglio passante e il tipo di attacco e uscita
local dLen = vFace[i].Len
local nType = 0
@@ -248,7 +296,7 @@ local function MakeByCut( Proc, nRawId, b3Raw)
nType = nType + 2
end
-- se lunghezza non significativa, non va inserito il taglio
if dLen < 1 then
if dLen < MIN_LEN_CUT then
nType = 4
end
vFace[i].Depth = dDepth
@@ -274,7 +322,12 @@ local function MakeByCut( Proc, nRawId, b3Raw)
if OverlapsXY( b3Wh, vOthers[j].Box) then
local nClass = EgtSurfFrChunkSimpleClassify( WhId, 0, vOthers[j].RegId, 0)
if nClass ~= GDB_RC.OUT then
vFace[i].Type = vFace[i].Type + 1
local dLen = vFace[i].Len - vFace[i].Whisk + EgtIf( ( vFace[i].Type & 2) ~= 0, -vFace[i].Whisk, 0)
if dLen >= MIN_LEN_CUT then
vFace[i].Type = vFace[i].Type + 1
else
vFace[i].Type = 4
end
break
end
end
@@ -294,7 +347,12 @@ local function MakeByCut( Proc, nRawId, b3Raw)
if OverlapsXY( b3Wh, vOthers[j].Box) then
local nClass = EgtSurfFrChunkSimpleClassify( WhId, 0, vOthers[j].RegId, 0)
if nClass ~= GDB_RC.OUT then
vFace[i].Type = vFace[i].Type + 2
local dLen = vFace[i].Len - vFace[i].Whisk + EgtIf( ( vFace[i].Type & 1) ~= 0, -vFace[i].Whisk, 0)
if dLen >= MIN_LEN_CUT then
vFace[i].Type = vFace[i].Type + 2
else
vFace[i].Type = 4
end
break
end
end