786b1224a2
- correzioni varie.
482 lines
19 KiB
Lua
482 lines
19 KiB
Lua
-- ProcessStepJoint.lua by Egaltech s.r.l. 2021/01/23
|
|
-- Gestione calcolo giunto a gradino per Travi
|
|
|
|
-- Tabella per definizione modulo
|
|
local ProcessStepJoint = {}
|
|
|
|
-- Include
|
|
require( 'EgtBase')
|
|
local BL = require( 'BeamLib')
|
|
local DC = require( 'DiceCut')
|
|
local Cut = require( 'ProcessCut')
|
|
local Fbs = require( 'FacesBySaw')
|
|
|
|
EgtOutLog( ' ProcessStepJoint started', 1)
|
|
|
|
-- Dati
|
|
local BD = require( 'BeamData')
|
|
local ML = require( 'MachiningLib')
|
|
|
|
---------------------------------------------------------------------
|
|
-- Riconoscimento della feature
|
|
function ProcessStepJoint.Identify( Proc)
|
|
return ( ( Proc.Grp == 1 or Proc.Grp == 2) and Proc.Prc == 80)
|
|
end
|
|
|
|
---------------------------------------------------------------------
|
|
-- Classificazione della feature
|
|
function ProcessStepJoint.Classify( Proc)
|
|
-- numero delle facce
|
|
local nFacetCnt = EgtSurfTmFacetCount( Proc.Id)
|
|
-- 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 = false
|
|
if nFacetCnt == 2 then
|
|
local bAdj, _, _, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT)
|
|
bConvex = not bAdj or ( dAng > 0)
|
|
end
|
|
-- verifico le normali delle facce
|
|
for i = 1, nFacetCnt do
|
|
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i-1, GDB_ID.ROOT)
|
|
if not bConvex and vtN:getZ() < - 0.72 then
|
|
return true, true
|
|
end
|
|
end
|
|
return true, false
|
|
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')
|
|
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 dWidth = abs( EgtCurveThickness( AuxId))
|
|
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
|
-- eseguo lo smusso solo se direzione orizzontale (non propago la segnalazione a TS3)
|
|
if abs( vtExtr:getZ()) > 0.1 then
|
|
local sWarn = 'Warning : skipped not horizontal 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 : skipped chamfer (feature smaller than beam)'
|
|
EgtOutLog( sWarn)
|
|
return true, sWarn
|
|
end
|
|
local dExtra = 2
|
|
-- recupero la lavorazione
|
|
local sMilling = ML.FindMilling( 'Mark')
|
|
if not sMilling then
|
|
local sErr = 'Error : 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 al caso due facce
|
|
local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|
-- delta negativo affondamento lama per facce concave
|
|
local dExtraUp = -0.3
|
|
-- 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 : part box not found'
|
|
EgtOutLog( sErr)
|
|
return false, sErr
|
|
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)
|
|
-- 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 (due facce separate sono sicuramente convesse)
|
|
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
|
|
-- recupero la lavorazione
|
|
local sCutting = ML.FindCutting( EgtIf( bHead, 'HeadSide', 'TailSide'))
|
|
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
|
|
-- se convesso, lo tratto come due tagli singoli
|
|
if bConvex then
|
|
-- recupero gruppo per geometria addizionale
|
|
local nAddGrpId = BL.GetAddGroup( nPartId)
|
|
if not nAddGrpId then
|
|
local sErr = 'Error : missing AddGroup'
|
|
EgtOutLog( sErr)
|
|
return false, sErr
|
|
end
|
|
-- lavoro per prima la faccia più diretta in alto
|
|
local vOrd = { 1, 2}
|
|
if vtN[2]:getZ() > vtN[1]:getZ() then
|
|
vOrd = { 2, 1}
|
|
end
|
|
-- creo piano di taglio coincidente con la prima faccia e lo lavoro
|
|
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptC[vOrd[1]], vtN[vOrd[1]], b3Solid, GDB_RT.GLOB)
|
|
if AddId then
|
|
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
|
|
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
|
|
-- applico lavorazione
|
|
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
|
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
|
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
|
|
if not bOk then return bOk, sErr end
|
|
end
|
|
-- creo piano di taglio coincidente con la seconda faccia e lo lavoro
|
|
AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptC[vOrd[2]], vtN[vOrd[2]], b3Solid, GDB_RT.GLOB)
|
|
if AddId then
|
|
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
|
|
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
|
|
-- applico lavorazione
|
|
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
|
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
|
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
|
|
if not bOk then return bOk, sErr end
|
|
end
|
|
-- altrimenti concavo
|
|
else
|
|
-- calcolo direzione di lavoro
|
|
local vtRef = {}
|
|
local vtTg = ptP2 - ptP1 ;
|
|
vtRef[1] = vtN[1] ^ vtTg
|
|
if vtRef[1] * vtN[2] < 0 then vtRef[1] = - vtRef[1] end
|
|
vtRef[2] = vtN[2] ^ vtTg
|
|
if vtRef[2] * vtN[1] < 0 then vtRef[2] = - vtRef[2] 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
|
|
-- calcolo extra taglio
|
|
local dCutExtra = dExtraUp
|
|
if dAng < -90.5 and dAng > -179.5 then
|
|
dCutExtra = - dSawThick / tan( 180 + dAng) + dExtraUp
|
|
end
|
|
-- 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 : 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
|
|
-- assegno il modo di tagliare
|
|
local vtOrthO = EgtIf( ( i % 2) == 1, vtRef[nSmaInd], vtRef[nBigInd])
|
|
-- lavoro la faccia
|
|
for j = 1, #vCuts[i] do
|
|
local dLocCutExtra = EgtIf( j == #vCuts[i], dCutExtra - dExtraUp, dCutExtra)
|
|
local bOk, sErr = BL.MakeOneFaceBySaw( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthO, nil, dLocCutExtra, 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
|
|
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 al caso tre facce
|
|
local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|
-- delta negativo affondamento lama per facce concave
|
|
local dExtraUp = -0.3
|
|
-- 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 : 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
|
|
-- calcolo direzione di lavoro
|
|
local vtRef = {}
|
|
local vtTg = ptP2 - ptP1 ;
|
|
vtRef[1] = vtN[1] ^ vtTg
|
|
if vtRef[1] * vtN[2] < 0 then vtRef[1] = - vtRef[1] end
|
|
vtRef[2] = vtN[2] ^ vtTg
|
|
if vtRef[2] * vtN[1] < 0 then vtRef[2] = - vtRef[2] 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 : 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 : missing AddGroup'
|
|
EgtOutLog( sErr)
|
|
return false, sErr
|
|
end
|
|
-- creo piano di taglio coincidente con la faccia 2 e lo lavoro
|
|
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptC[3], vtN[3], b3Solid, GDB_RT.GLOB)
|
|
if AddId then
|
|
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
|
|
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
|
|
-- applico lavorazione
|
|
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
|
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
|
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
|
|
if not bOk then return bOk, sErr end
|
|
end
|
|
-- Taglio le facce 0 e 1 concave
|
|
-- calcolo extra taglio
|
|
local dCutExtra = dExtraUp
|
|
if dAng < -90.5 and dAng > -179.5 then
|
|
dCutExtra = - dSawThick / tan( 180 + dAng) + dExtraUp
|
|
end
|
|
-- 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
|
|
-- 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
|
|
-- assegno il modo di tagliare
|
|
local vtOrthO = EgtIf( ( i % 2) == 1, vtRef[nSmaInd], vtRef[nBigInd])
|
|
-- lavoro la faccia
|
|
for j = 1, #vCuts[i] do
|
|
local dLocCutExtra = EgtIf( j == #vCuts[i], dCutExtra - dExtraUp, dCutExtra)
|
|
local bOk, sErr = BL.MakeOneFaceBySaw( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthO, nil, dLocCutExtra, 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)
|
|
-- inserimento smussi
|
|
local bOkc, sErrC = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|
if not bOkc then return bOkc, sErrC end
|
|
-- se due facce
|
|
if Proc.Fct == 2 then
|
|
local bOk, sErr = MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|
return bOk, sErr or sErrC
|
|
-- se altrimenti tre facce
|
|
elseif Proc.Fct == 3 then
|
|
local bOk, sErr = MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|
return bOk, sErr or sErrC
|
|
-- altrimenti errore
|
|
else
|
|
local sErr = 'Error : face number not allowed'
|
|
EgtOutLog( sErr)
|
|
return false, sErr
|
|
end
|
|
end
|
|
|
|
---------------------------------------------------------------------
|
|
return ProcessStepJoint
|