DataBeam :
- aggiunta gestione tagli in FrontMortise e FrontDtMortise - completata gestione tagli lunghi per non rovinare i pezzi successivi - aggiunte a tutte le chiamate di Cut.Make e DoubleCut.Make il passaggio del sovramateriale di testa.
This commit is contained in:
+65
-10
@@ -1,4 +1,4 @@
|
||||
-- ProcessMortise.lua by Egaltech s.r.l. 2020/05/27
|
||||
-- ProcessMortise.lua by Egaltech s.r.l. 2020/10/09
|
||||
-- Gestione calcolo mortase per Travi
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
@@ -7,6 +7,7 @@ local ProcessMortise = {}
|
||||
-- Include
|
||||
require( 'EgtBase')
|
||||
local BL = require( 'BeamLib')
|
||||
local Cut = require( 'ProcessCut')
|
||||
|
||||
EgtOutLog( ' ProcessMortise started', 1)
|
||||
|
||||
@@ -22,6 +23,12 @@ function ProcessMortise.Identify( Proc)
|
||||
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 53))
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della sola feature frontale
|
||||
function ProcessMortise.FrontIdentify( Proc)
|
||||
return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 51)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Classificazione della feature: decide se la feature è in una posizione che per lavorala
|
||||
-- deve essere ribaltata o no
|
||||
@@ -53,9 +60,26 @@ function ProcessMortise.Classify( Proc)
|
||||
return true, bDown
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Piano di taglio della feature
|
||||
function ProcessMortise.GetCutPlane( Proc)
|
||||
if ProcessMortise.FrontIdentify( Proc) then
|
||||
return EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT)
|
||||
else
|
||||
return nil, nil
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId)
|
||||
function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- ingombro del pezzo
|
||||
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
if not b3Solid then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' part box not found'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- recupero e verifico l'entità curva
|
||||
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
|
||||
local bForceOneSide
|
||||
@@ -98,15 +122,21 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- verifico se frontale
|
||||
local bFront = ( Proc.Prc == 51)
|
||||
-- recupero i dati della faccia di fondo
|
||||
local frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0, GDB_ID.ROOT)
|
||||
local ptC = frMor:getOrigin()
|
||||
local vtN = frMor:getVersZ()
|
||||
-- Confronto le direzioni Z dei 2 versori : se diverse la faccia 0 non è il fondo => mortasa passante
|
||||
local bOpenBtm = ( abs( vtExtr:getZ() - vtN:getZ()) > GEO.EPS_SMALL)
|
||||
local ptC = ORIG()
|
||||
local vtN = V_NULL()
|
||||
if frMor then
|
||||
ptC = frMor:getOrigin()
|
||||
vtN = frMor:getVersZ()
|
||||
end
|
||||
-- Confronto le direzioni dei 2 versori : se diverse la faccia 0 non è il fondo => mortasa passante
|
||||
local bOpenBtm = not AreSameVectorApprox( vtExtr, vtN)
|
||||
if bOpenBtm then
|
||||
-- creo superficie chiusa
|
||||
local nFlat = EgtSurfTmByFlatContour( EgtGetParent( AuxId), AuxId, 0.02)
|
||||
local nFlat = EgtSurfTmByFlatContour( EgtGetParent( AuxId), AuxId, 0.05)
|
||||
if nFlat then
|
||||
frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( nFlat, 0, GDB_ID.ROOT)
|
||||
ptC = frMor:getOrigin()
|
||||
@@ -132,6 +162,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId)
|
||||
end
|
||||
-- scrivo info nel log
|
||||
EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3)
|
||||
-- Se mortasa chiusa
|
||||
if not bOpenBtm then
|
||||
-- verifico che la mortasa non sia orientata verso il basso (limite -5 deg)
|
||||
if vtN:getZ() < - 0.1 then
|
||||
@@ -139,7 +170,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId)
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- se mortasa passante
|
||||
-- altrimenti passante
|
||||
else
|
||||
-- determino se la mortasa da lavorare sul lato opposto sia di angolo inferiore a quello consentito
|
||||
if abs(vtN:getZ()) > 0.1 then
|
||||
@@ -151,12 +182,36 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId)
|
||||
end
|
||||
end
|
||||
|
||||
-- se mortasa di fronte, eseguo il taglio della faccia
|
||||
if bFront then
|
||||
-- verifico esista la faccia di taglio
|
||||
local ptCutC, vtCutN = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT)
|
||||
if ptCutC and vtCutN and AreSameVectorApprox( vtExtr, vtCutN) then
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptCutC, vtCutN, b3Solid, GDB_RT.GLOB)
|
||||
local b3Cut = EgtGetBBoxGlob( AddId or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Cut, Fct = 1, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
local bFromBottom = ( b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getZ() > 0.25)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH, bFromBottom)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
end
|
||||
|
||||
-- determino altezza della mortasa
|
||||
local b3Mor = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frMor)
|
||||
local dMorH = b3Mor:getDimZ()
|
||||
-- elevazione del punto centro
|
||||
local _, dCenElev = BL.GetPointDirDepth( nPartId, ptC, vtN)
|
||||
dMorH = max( dMorH, dCenElev or 0)
|
||||
if not bFront then
|
||||
local _, dCenElev = BL.GetPointDirDepth( nPartId, ptC, vtN)
|
||||
dMorH = max( dMorH, dCenElev or 0)
|
||||
end
|
||||
-- determino larghezza della mortasa
|
||||
if dL < dW then dL, dW = dW, dL end
|
||||
-- recupero la lavorazione
|
||||
|
||||
Reference in New Issue
Block a user