DataBeam :

- sistemata gestione smussi in ScarfJoint, SimpleScarf e StepJoint
- cominciata sistemazione messaggi (si toglie numero processo per TS3).
This commit is contained in:
Dario Sassi
2020-06-04 09:30:46 +00:00
parent 1baecd24e5
commit 8604483177
5 changed files with 235 additions and 52 deletions
+103 -12
View File
@@ -1,4 +1,4 @@
-- ProcessStepJoint.lua by Egaltech s.r.l. 2020/04/20
-- ProcessStepJoint.lua by Egaltech s.r.l. 2020/06/04
-- Gestione calcolo giunto a gradino per Travi
-- Tabella per definizione modulo
@@ -48,6 +48,92 @@ function ProcessStepJoint.Classify( Proc)
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') 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 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 : skipped not horizontal chamfer'
EgtOutLog( sWarn)
return true, sWarn
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)
@@ -57,7 +143,7 @@ local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
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'
local sErr = 'Error : part box not found'
EgtOutLog( sErr)
return false, sErr
end
@@ -88,7 +174,7 @@ local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- 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'
local sErr = 'Error : cutting not found in library'
EgtOutLog( sErr)
return false, sErr
end
@@ -107,7 +193,7 @@ local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
@@ -147,7 +233,7 @@ local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
@@ -220,7 +306,7 @@ local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
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'
local sErr = 'Error : part box not found'
EgtOutLog( sErr)
return false, sErr
end
@@ -264,7 +350,7 @@ local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- 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'
local sErr = 'Error : cutting not found in library'
EgtOutLog( sErr)
return false, sErr
end
@@ -282,7 +368,7 @@ local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
@@ -305,7 +391,7 @@ local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
@@ -371,15 +457,20 @@ 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
return MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
local bOk, sErr = MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
return bOk, sErr or sErrC
-- se altrimenti tre facce
elseif Proc.Fct == 3 then
return MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
local bOk, sErr = MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
return bOk, sErr or sErrC
-- altrimenti errore
else
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' face number not allowed'
local sErr = 'Error : face number not allowed'
EgtOutLog( sErr)
return false, sErr
end