DataWall :

- modifiche per nesting cliente belga
- in FreeContour aggiunta gestione marcatura (codice 10).
This commit is contained in:
DarioS
2021-11-04 13:53:36 +01:00
parent 995d8d839f
commit fea5d18c06
11 changed files with 1215 additions and 275 deletions
+116 -1
View File
@@ -1,4 +1,4 @@
-- ProcessFreeContour.lua by Egaltech s.r.l. 2021/11/02
-- ProcessFreeContour.lua by Egaltech s.r.l. 2021/11/04
-- Gestione calcolo profilo libero per Pareti
-- Tabella per definizione modulo
@@ -58,6 +58,56 @@ function WPF.Classify( Proc, b3Raw)
end
end
----------------------------------------------------------------------
-- Classificazione del flip della feature per nesting
-- return nFlip0, nFlip1
function WPF.FlipClassify( Proc, b3Raw)
local nFlip0 = 0
local nFlip1 = 0
-- verifico se di tipo pocket
local bPocket = ( EgtGetInfo( Proc.Id, 'PCKT', 'i') == 1)
-- recupero la curva associata se esiste
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if not AuxId then return false end
AuxId = AuxId + Proc.Id
local vtN = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
local dVtNZ = vtN:getZ()
-- se tasca
if bPocket then
-- verifico se è lavorabile da sopra
nFlip0 = EgtIf( dVtNZ < -0.5, 0, 100)
-- verifico se e' lavorabile da fliped: cambio segno al versore
nFlip1 = EgtIf( -dVtNZ < -0.5, 100, 0)
-- se altrimenti profilo orizzontale
elseif abs( dVtNZ) < WD.NZ_MINA then
return 0, 0
-- se altrimenti profilo verticale che non interessa tutta la sezione
elseif Proc.Box:getMax():getZ() < b3Raw:getMax():getZ() - 2 then
return 0 , 0
-- altrimenti è profilo verticale che interessa tutta la sezione
else
local dVtNZMedia = 0
for i = 1, Proc.Fct do
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT)
dVtNZMedia = dVtNZMedia + vtN:getZ()
end
dVtNZMedia = dVtNZMedia / Proc.Fct
if abs( dVtNZMedia) <= GEO.EPS_SMALL then
nFlip0 = 100
nFlip1 = 100
elseif dVtNZMedia >= 0 + GEO.EPS_SMALL then
nFlip0 = 75
nFlip1 = 25
else
nFlip0 = 25
nFlip1 = 75
end
end
return nFlip0, nFlip1
end
---------------------------------------------------------------------
local function TestElleShape3( nIdGeom, nNumFacet)
-- valida solo nel caso di tre facce
@@ -1852,6 +1902,68 @@ local function MakeByMill( Proc, nRawId, b3Raw)
return true
end
---------------------------------------------------------------------
local function MakeByMark( 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 e verifico l'entità curva
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0
if AuxId then AuxId = AuxId + Proc.Id end
if not AuxId or ( EgtGetType( AuxId) & GDB_FY.GEO_CURVE) == 0 then
local sErr = 'Error : missing profile geometry'
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati della curva e del profilo
local dDepth = abs( EgtCurveThickness( AuxId))
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
local b3Aux = EgtGetBBoxGlob( AuxId, GDB_BB.STANDARD)
local bToolInv = ( vtExtr:getZ() < -0.1)
local nTool_ID = EgtGetInfo( Proc.Id, 'CNT_DATA', 'i')
-- recupero la lavorazione
local sMilling = WM.FindMilling( 'Text', nil, nil, nTool_ID)
if not sMilling then
local sErr = 'Error : milling not found in library'
if nTool_ID then sErr = sErr .. ' (Tool_ID=' .. tostring( nTool_ID) .. ')' end
EgtOutLog( sErr)
return false, sErr
end
-- inserisco la lavorazione
local sName = 'FreeMark_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
EgtSetInfo( nMchId, 'Part', Proc.PartId)
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- se estrusione da sotto, inverto direzione fresa
if bToolInv then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
end
-- posizione braccio porta testa
local nSCC = MCH_SCC.ADIR_ZP
if AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then
nSCC = EgtIf( Proc.Box:getDimX() >= Proc.Box:getDimY(), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_XP)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
end
return true
end
---------------------------------------------------------------------
local function MakeByNail( Proc, nRawId, b3Raw)
-- ingombro del pezzo
@@ -2119,6 +2231,9 @@ function WPF.Make( Proc, nRawId, b3Raw)
-- se fresatura
if nCntType == 2 then
return MakeByMill( Proc, nRawId, b3Raw)
-- se marcatura
elseif nCntType == 10 then
return MakeByMark( Proc, nRawId, b3Raw)
-- se chiodatura
elseif nCntType == 20 then
return MakeByNail( Proc, nRawId, b3Raw)