DataBeam :
- corretta segnalazione sezione troppo piccola in BatchProcess - minimo sovramateriale di testa che produce taglio di lama portato da 1mm a 0.1mm - FacesBySaw.MakeTwo ora gestisce anche le prime due facce di una superficie con più facce - in foratura corretta Split per il caso in cui non esista punta per il foro - LapJoint riconoscibile di testa o coda se non più lunga del relativo massimo o del 60% della trave - StepJoint ora gestisce i casi 2 e 4 facce - StepJointNotch ora gestisce i casi 2 e 4 facce (larghe come la faccia della trave).
This commit is contained in:
+10
-9
@@ -1,4 +1,4 @@
|
||||
-- BatchProcess.lua by Egaltech s.r.l. 2019/10/09
|
||||
-- BatchProcess.lua by Egaltech s.r.l. 2019/10/22
|
||||
-- Gestione calcolo batch disposizione e lavorazioni per Travi
|
||||
-- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3.
|
||||
-- 2019/07/16 Aggiunta gestione modalità oltre 10 per impostazione macchina e uscita.
|
||||
@@ -255,14 +255,15 @@ if dRawW > BD.MAX_WIDTH + 10 * GEO.EPS_SMALL or dRawH > BD.MAX_HEIGHT + 10 * GEO
|
||||
end
|
||||
|
||||
-- Verifico sezione barra non troppo piccola
|
||||
if dRawW < BD.MIN_WIDTH - 10 * GEO.EPS_SMALL or dRawH < BD.MIN_HEIGHT - 10 * GEO.EPS_SMALL then
|
||||
local sOut = 'Sezione (' .. EgtNumToString( dRawW, 2) .. ' x ' .. EgtNumToString( dRawH, 2) .. ') ' ..
|
||||
'sotto i limiti della macchina (' .. EgtNumToString( BD.MIN_WIDTH, 2) .. ' x ' .. EgtNumToString( BD.MIN_HEIGHT, 2) .. ')'
|
||||
BEAM.ERR = 17
|
||||
BEAM.MSG = sOut
|
||||
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
|
||||
PostErrView( BEAM.ERR, BEAM.MSG)
|
||||
end
|
||||
if dRawW < BD.MIN_WIDTH - 10 * GEO.EPS_SMALL or dRawH < BD.MIN_HEIGHT - 10 * GEO.EPS_SMALL then
|
||||
local sOut = 'Sezione (' .. EgtNumToString( dRawW, 2) .. ' x ' .. EgtNumToString( dRawH, 2) .. ') ' ..
|
||||
'sotto i limiti della macchina (' .. EgtNumToString( BD.MIN_WIDTH, 2) .. ' x ' .. EgtNumToString( BD.MIN_HEIGHT, 2) .. ')'
|
||||
BEAM.ERR = 17
|
||||
BEAM.MSG = sOut
|
||||
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
|
||||
PostErrView( BEAM.ERR, BEAM.MSG)
|
||||
return
|
||||
end
|
||||
|
||||
-- Lunghezza della barra
|
||||
local dRawL = EgtGetInfo( EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL, 'BARLEN', 'd') or 12000
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- BeamExec.lua by Egaltech s.r.l. 2019/10/03
|
||||
-- BeamExec.lua by Egaltech s.r.l. 2019/10/22
|
||||
-- Libreria esecuzione lavorazioni per Travi
|
||||
-- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3.
|
||||
-- 2019/09/04 Corretto controllo feature di testa e coda con sovramateriale di testa elevato.
|
||||
@@ -154,7 +154,7 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam)
|
||||
return false, sOut
|
||||
end
|
||||
-- se sovramateriale di testa, aggiungo faccia per taglio iniziale al pezzo
|
||||
if DeltaS > 1. then
|
||||
if DeltaS > 0.09 then
|
||||
BL.AddPartStartFace( Pz, b3Solid)
|
||||
EgtSetInfo( nRaw, 'HOVM', DeltaS)
|
||||
end
|
||||
|
||||
@@ -28,7 +28,7 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutName)
|
||||
return false, sErr
|
||||
end
|
||||
-- verifico il numero di facce della tacca
|
||||
if Proc.Fct ~= 2 then
|
||||
if Proc.Fct < 2 then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' TwoFacesBySaw facet number not supported'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- ProcessDrill.lua by Egaltech s.r.l. 2019/08/29
|
||||
-- ProcessDrill.lua by Egaltech s.r.l. 2019/10/22
|
||||
-- Gestione calcolo forature per Travi
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
@@ -71,10 +71,11 @@ function ProcessDrill.Split( Proc, b3Raw)
|
||||
-- recupero la lavorazione
|
||||
local sDrilling, _, dMaxMat = ML.FindDrilling( dDiam)
|
||||
if not sDrilling then
|
||||
return bOpen
|
||||
dMaxMat = 0
|
||||
end
|
||||
-- restituisco se va fatto in doppio (solo fori orizzontali)
|
||||
return ( bOpen and dLen > dMaxMat + 10 * GEO.EPS_SMALL and ( abs( vtExtr:getY()) * b3Raw:getDimZ() > abs( vtExtr:getZ()) * b3Raw:getDimY() or Proc.Fce == 5 or Proc.Fce == 6))
|
||||
return ( bOpen and dLen > dMaxMat + 10 * GEO.EPS_SMALL and abs( vtExtr:getZ()) < abs( BD.DRILL_VZ_MIN) and
|
||||
( abs( vtExtr:getY()) * b3Raw:getDimZ() > abs( vtExtr:getZ()) * b3Raw:getDimY() or Proc.Fce == 5 or Proc.Fce == 6))
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
@@ -39,8 +39,8 @@ function ProcessLapJoint.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
||||
if Proc.Box:getMax():getX() < b3Raw:getMax():getX() - dCurrOvmH - BD.MAX_DIST_HTFEA then
|
||||
return false
|
||||
end
|
||||
-- la sua lunghezza non deve superare il massimo e 1/3 della lunghezza della trave
|
||||
if Proc.Box:getDimX() > min( BD.MAX_LEN_HTFEA, 0.33 *b3Raw:getDimX()) then
|
||||
-- la sua lunghezza non deve superare il massimo e 60% della lunghezza della trave
|
||||
if Proc.Box:getDimX() > min( BD.MAX_LEN_HTFEA, 0.6 *b3Raw:getDimX()) then
|
||||
return false
|
||||
end
|
||||
-- se una o due facce ora è sicuramente di testa
|
||||
@@ -75,8 +75,8 @@ function ProcessLapJoint.IsTailFeature( Proc, b3Raw)
|
||||
if Proc.Box:getMin():getX() > b3Raw:getMin():getX() + BD.MAX_DIST_HTFEA then
|
||||
return false
|
||||
end
|
||||
-- la sua lunghezza non deve superare il massimo e 1/3 della lunghezza della trave
|
||||
if Proc.Box:getDimX() > min( BD.MAX_LEN_HTFEA, 0.33 * b3Raw:getDimX()) then
|
||||
-- la sua lunghezza non deve superare il massimo e 60% della lunghezza della trave
|
||||
if Proc.Box:getDimX() > min( BD.MAX_LEN_HTFEA, 0.6 * b3Raw:getDimX()) then
|
||||
return false
|
||||
end
|
||||
-- se una o due facce ora è sicuramente di coda
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- ProcessStepJoint.lua by Egaltech s.r.l. 2019/09/25
|
||||
-- ProcessStepJoint.lua by Egaltech s.r.l. 2019/10/21
|
||||
-- Gestione calcolo giunto a gradino per Travi
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
@@ -28,12 +28,12 @@ end
|
||||
function ProcessStepJoint.Classify( Proc)
|
||||
-- numero delle facce
|
||||
local nFacetCnt = EgtSurfTmFacetCount( Proc.Id)
|
||||
-- gestisco solo 2 facce
|
||||
if nFacetCnt ~= 2 then
|
||||
-- gestisco solo 2 o 3 facce
|
||||
if nFacetCnt ~= 2 and nFacetCnt ~= 3 then
|
||||
return false, false
|
||||
end
|
||||
-- se due facce, verifico se convesso
|
||||
local bConvex = true
|
||||
local bConvex = false
|
||||
if nFacetCnt == 2 then
|
||||
local bAdj, _, _, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT)
|
||||
bConvex = not bAdj or ( dAng > 0)
|
||||
@@ -49,8 +49,8 @@ function ProcessStepJoint.Classify( Proc)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessStepJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- Applicazione della lavorazione al caso due facce
|
||||
local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- ingombro del grezzo
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- ingombro del pezzo
|
||||
@@ -209,5 +209,178 @@ function ProcessStepJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione al caso tre facce
|
||||
local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- ingombro del grezzo
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- ingombro del pezzo
|
||||
local Ls = EgtGetFirstNameInGroup( nPartId, 'Box')
|
||||
local b3Solid = EgtGetBBoxGlob( Ls 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
|
||||
-- riduco a forma canonica ( concavo tra 0 e 1, faccia 2 oltre convesso)
|
||||
local bAdj12, _, _, dAng12 = EgtSurfTmFacetsContact( Proc.Id, 1, 2, GDB_ID.ROOT)
|
||||
local bAdj20, _, _, dAng20 = EgtSurfTmFacetsContact( Proc.Id, 2, 0, GDB_ID.ROOT)
|
||||
if bAdj12 then
|
||||
if dAng12 < 0 then
|
||||
EgtSurfTmSwapFacets( Proc.Id, 0, 2)
|
||||
end
|
||||
elseif bAdj20 then
|
||||
if dAng20 < 0 then
|
||||
EgtSurfTmSwapFacets( Proc.Id, 1, 2)
|
||||
end
|
||||
end
|
||||
-- dati delle facce
|
||||
local ptC = {}
|
||||
local vtN = {}
|
||||
ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT)
|
||||
ptC[3], vtN[3] = EgtSurfTmFacetCenter( Proc.Id, 2, GDB_ID.ROOT)
|
||||
-- normale media per capire se taglio di testa o di coda
|
||||
local vtNm = ( vtN[1] + vtN[2]) ; vtNm:normalize()
|
||||
local bHead = ( vtNm:getX() > 0)
|
||||
-- angolo diedro per stabilire se taglio convesso
|
||||
local bAdj, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT)
|
||||
local bConvex = true
|
||||
local bOnY = true
|
||||
local ptPs = ( ptC[1] + ptC[2]) / 2
|
||||
if bAdj then
|
||||
local vtDir = ptP1 - ptP2 ; vtDir:normalize()
|
||||
bOnY = abs( vtDir:getZ()) > 0.5 and ( abs( vtDir:getZ()) + abs( vtDir:getX()) > abs( vtDir:getY()))
|
||||
ptPs = ( ptP1 + ptP2) / 2
|
||||
bConvex = ( dAng > 0)
|
||||
end
|
||||
-- determino quale faccia è più grande
|
||||
local _, dB1, dH1 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0)
|
||||
local _, dB2, dH2 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 1)
|
||||
local nBigInd = EgtIf( dB1 * dH1 >= dB2 * dH2, 1, 2)
|
||||
local nSmaInd = 3 - nBigInd
|
||||
-- recupero la lavorazione
|
||||
local sCutting = ML.FindCutting( EgtIf( bHead, 'HeadSide', 'TailSide'))
|
||||
if not sCutting then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' 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
|
||||
-- Taglio la faccia 2
|
||||
-- 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
|
||||
-- creo piano di taglio coincidente con la faccia 2 e lo lavoro
|
||||
local AddId = EgtSurfTmPlaneInBBox( EgtGetParent( Proc.Id), ptC[3], vtN[3], b3Solid, GDB_RT.GLOB)
|
||||
if AddId then
|
||||
EgtRelocate( AddId, nAddGrpId)
|
||||
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
|
||||
-- applico lavorazione
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg}
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, 0)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
-- Taglio le facce 0 e 1 concave
|
||||
-- verifico se necessari tagli supplementari
|
||||
local vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
|
||||
--DC.PrintOrderCut( vCuts)
|
||||
if #vCuts > 0 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
|
||||
-- sistemo posizione nel DB e nome
|
||||
for i = 1, #vCuts do
|
||||
for j = 1, #vCuts[i] do
|
||||
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
|
||||
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
|
||||
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
|
||||
end
|
||||
end
|
||||
-- eseguo
|
||||
for i = 1, #vCuts do
|
||||
-- determino il modo di tagliare
|
||||
local k, l = nBigInd, nSmaInd
|
||||
if ( i % 2) == 1 then
|
||||
k, l = l, k
|
||||
end
|
||||
local nOrthoOpposite
|
||||
if bOnY then
|
||||
local bFront = ( ptC[k]:getY() < ptPs:getY())
|
||||
nOrthoOpposite = EgtIf( bFront, MCH_MILL_FU.ORTHO_BACK, MCH_MILL_FU.ORTHO_FRONT)
|
||||
else
|
||||
local bOver = ( ptC[k]:getZ() > ptC[l]:getZ())
|
||||
nOrthoOpposite = EgtIf( bOver, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_TOP)
|
||||
end
|
||||
-- lavoro la faccia
|
||||
for j = 1, #vCuts[i] do
|
||||
local bOk, sErr = BL.MakeOneFaceBySaw( vCuts[i][j], 0, sCutting, dSawDiam, nOrthoOpposite, nil, 0, BD.CUT_SIC, 0, 0, nil, b3Raw)
|
||||
if not bOk then
|
||||
return bOk, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
-- altrimenti, tagli diretti delle facce
|
||||
else
|
||||
local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, EgtIf( bHead, 'HeadSide', 'TailSide'))
|
||||
if not bOk then
|
||||
return bOk, sErr
|
||||
end
|
||||
end
|
||||
-- Eventuale segnalazione ingombro di testa o coda
|
||||
if Proc.Head then
|
||||
local dOffs = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX()
|
||||
if vtNm:getZ() > 0.5 then
|
||||
dOffs = 0.5 * dOffs
|
||||
elseif abs( vtNm:getZ()) > 0.35 then
|
||||
dOffs = 0.75 * dOffs
|
||||
end
|
||||
BL.UpdateHCING( nRawId, dOffs)
|
||||
elseif Proc.Tail then
|
||||
local dOffs = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
|
||||
if vtNm:getZ() > 0.5 then
|
||||
dOffs = 0.5 * dOffs
|
||||
elseif abs( vtNm:getZ()) > 0.35 then
|
||||
dOffs = 0.75 * dOffs
|
||||
end
|
||||
BL.UpdateTCING( nRawId, dOffs)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessStepJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- se due facce
|
||||
if Proc.Fct == 2 then
|
||||
return MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- se altrimenti tre facce
|
||||
elseif Proc.Fct == 3 then
|
||||
return MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- altrimenti errore
|
||||
else
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' face number not allowed'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
return ProcessStepJoint
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- ProcessStepJointNotch.lua by Egaltech s.r.l. 2019/09/25
|
||||
-- ProcessStepJointNotch.lua by Egaltech s.r.l. 2019/10/22
|
||||
-- Gestione calcolo tacca a gradino per Travi
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
@@ -28,8 +28,8 @@ end
|
||||
function ProcessStepJointNotch.Classify( Proc)
|
||||
-- numero delle facce
|
||||
local nFacetCnt = EgtSurfTmFacetCount( Proc.Id)
|
||||
-- gestisco solo 2 facce
|
||||
if nFacetCnt ~= 2 then
|
||||
-- gestisco solo 2 o 4 facce
|
||||
if nFacetCnt ~= 2 and nFacetCnt ~= 4 then
|
||||
return false, false
|
||||
end
|
||||
-- verifico le normali delle facce
|
||||
@@ -44,8 +44,8 @@ function ProcessStepJointNotch.Classify( Proc)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessStepJointNotch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- Lavorazione di due facce
|
||||
local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- ingombro del grezzo
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- ingombro del pezzo
|
||||
@@ -127,7 +127,7 @@ function ProcessStepJointNotch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local bFront = ( ptC[k]:getY() < ptPs:getY())
|
||||
nOrthoOpposite = EgtIf( bFront, MCH_MILL_FU.ORTHO_BACK, MCH_MILL_FU.ORTHO_FRONT)
|
||||
else
|
||||
local bOver = ( ptC[k]:getZ() > ptC[l]:getZ())
|
||||
local bOver = true
|
||||
nOrthoOpposite = EgtIf( bOver, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_TOP)
|
||||
end
|
||||
-- lavoro la faccia
|
||||
@@ -148,5 +148,140 @@ function ProcessStepJointNotch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Lavorazione di due facce
|
||||
local function MakeFourFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- Prime due facce
|
||||
local bOk, sErr = MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
if not bOk then return bOk, sErr end
|
||||
-- Seconde due facce
|
||||
-- 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
|
||||
-- copio la superficie e scambio le facce
|
||||
local AddId = EgtCopyGlob( Proc.Id, nAddGrpId)
|
||||
if AddId then
|
||||
EgtSurfTmSwapFacets( AddId, 0, 2)
|
||||
EgtSurfTmSwapFacets( AddId, 1, 3)
|
||||
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
|
||||
-- applico lavorazione
|
||||
local NewProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg}
|
||||
local bOk, sErr = MakeTwoFaces( NewProc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- lavorazione smussi
|
||||
local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- verifico che lo smusso sia richiesto
|
||||
local dDepth = EgtGetInfo( Proc.Id, 'Q01', 'd') or 0
|
||||
if dDepth < 0.1 then return true end
|
||||
-- ingombro del grezzo
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- recupero e verifico l'entità curva associata
|
||||
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0
|
||||
if AuxId then AuxId = AuxId + Proc.Id end
|
||||
if not AuxId or ( EgtGetType( AuxId) & 256) == 0 then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing profile geometry'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- recupero i dati della curva e del profilo
|
||||
local dWidth = abs( EgtCurveThickness( AuxId))
|
||||
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
||||
-- eseguo lo smusso solo se direzione orizzontale
|
||||
if abs( vtExtr:getZ()) > 0.1 then
|
||||
local sWarn = 'Warning on process ' .. tostring( Proc.Id) .. ' skipped not horizontale chamfer'
|
||||
EgtOutLog( sWarn)
|
||||
return true
|
||||
end
|
||||
-- eseguo lo smusso solo se feature larga come la trave
|
||||
if dWidth < b3Raw:getDimY() - 1 then
|
||||
local sWarn = 'Warning on process ' .. tostring( Proc.Id) .. ' skipped chamfer (feature smaller than beam)'
|
||||
EgtOutLog( sWarn)
|
||||
return true
|
||||
end
|
||||
local dExtra = 2
|
||||
-- recupero la lavorazione
|
||||
local sMilling = ML.FindMilling( 'Mark')
|
||||
if not sMilling then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- Inserisco la lavorazione del lato standard
|
||||
local sName1 = 'SJN_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMch1Id = EgtAddMachining( sName1, sMilling)
|
||||
if not nMch1Id then
|
||||
local sErr = 'Error adding machining ' .. sName1 .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
-- assegno affondamento e offset radiale
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth + dExtra)
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
|
||||
-- assegno lato di lavoro
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
||||
-- eseguo
|
||||
if not EgtApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchId, false)
|
||||
return false, sErr
|
||||
end
|
||||
-- Inserisco la lavorazione del lato opposto
|
||||
local sName2 = 'SJN_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMch2Id = EgtAddMachining( sName2, sMilling)
|
||||
if not nMch2Id then
|
||||
local sErr = 'Error adding machining ' .. sName2 .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
-- inverto direzione utensile
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
-- assegno affondamento e offset radiale
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth + dExtra)
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
|
||||
-- assegno lato di lavoro
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||
-- eseguo
|
||||
if not EgtApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchId, false)
|
||||
return false, sErr
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessStepJointNotch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- se due facce
|
||||
if Proc.Fct == 2 then
|
||||
local bOk, sErr = MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
if not bOk then return bOk, sErr end
|
||||
-- se quattro facce
|
||||
elseif Proc.Fct == 4 then
|
||||
local bOk, sErr = MakeFourFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
if not bOk then return bOk, sErr end
|
||||
-- altrimenti errore
|
||||
else
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' face number not allowed'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- esecuzione eventuale smusso
|
||||
return MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
return ProcessStepJointNotch
|
||||
|
||||
Reference in New Issue
Block a user