DataBeam :
- migliorie e correzioni.
This commit is contained in:
+50
-14
@@ -1,4 +1,4 @@
|
||||
-- ProcessLapJoint.lua by Egaltech s.r.l. 2019/07/26
|
||||
-- ProcessLapJoint.lua by Egaltech s.r.l. 2019/07/30
|
||||
-- Gestione calcolo mezzo-legno per Travi
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
@@ -112,7 +112,8 @@ function ProcessLapJoint.Classify( Proc)
|
||||
ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT)
|
||||
-- verifico se è lavorabile solo dal basso
|
||||
local bSmall = ( (Proc.Head or Proc.Tail) and ( Proc.Box:getDimX() < BD.MAX_LEN_RIDGELAP_FROM_BOTTOM)) or Proc.Box:getDimY() < BD.MAX_LEN_RIDGELAP_FROM_BOTTOM
|
||||
local bSmall = ( ( Proc.Head or Proc.Tail) and Proc.Box:getDimX() < BD.MAX_LEN_RIDGELAP_FROM_BOTTOM) or
|
||||
( not ( Proc.Head or Proc.Tail) and Proc.Box:getDimY() < BD.MAX_LEN_RIDGELAP_FROM_BOTTOM)
|
||||
local bDown = ( vtN[1]:getZ() < BD.NZ_MINB and vtN[2]:getZ() < BD.NZ_MINB) or
|
||||
( vtN[1]:getZ() < BD.NZ_MINA and ( vtN[2]:getZ() < -0.1 or not bSmall)) or
|
||||
( vtN[2]:getZ() < BD.NZ_MINA and ( vtN[1]:getZ() < -0.1 or not bSmall))
|
||||
@@ -297,9 +298,8 @@ local function MakePreCuts( Proc, nPhase, nRawId, nPartId, b3Raw)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo sgrossatura e la lavoro
|
||||
local AddId = EgtSurfTmConvexHullInBBox( EgtGetParent( Proc.Id), Proc.Id, b3Raw, GDB_RT.GLOB)
|
||||
local AddId = EgtSurfTmConvexHullInBBox( nAddGrpId, Proc.Id, b3Raw, 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}
|
||||
@@ -532,31 +532,67 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId)
|
||||
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
|
||||
end
|
||||
-- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente
|
||||
local sWarn
|
||||
if dFacElev > dMaxDepth + 10 * GEO.EPS_SMALL then
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dMaxDepth - dFacElev)
|
||||
dFacElev = dMaxDepth
|
||||
local sWarn = 'Warning in process ' .. tostring( Proc.Id) .. ' : elevation bigger than max tool depth'
|
||||
sWarn = 'Warning in process ' .. tostring( Proc.Id) .. ' : elevation bigger than max tool depth'
|
||||
EgtOutLog( sWarn)
|
||||
end
|
||||
-- imposto elevazione
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dFacElev, 1) .. ';')
|
||||
-- dichiaro non si generano sfridi per VMill
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, 'VMRS=0;')
|
||||
-- imposto elevazione e dichiaro non si generano sfridi per VMill
|
||||
local sNotes = 'MaxElev=' .. EgtNumToString( dFacElev, 1) .. ';'
|
||||
sNotes = sNotes .. 'VMRS=0;'
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
|
||||
-- eseguo
|
||||
if not EgtApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sErr
|
||||
end
|
||||
return true
|
||||
return true, sWarn
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId)
|
||||
-- troppo lunga, per il momento la salto, andrà spezzata in parti
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' feature too long'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
-- 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
|
||||
-- recupero l'ingombro del grezzo di appartenenza
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- la divido in parti lungo X
|
||||
local vAddId = {}
|
||||
local nPart = ceil( Proc.Box:getDimX() / min( BD.LONGCUT_MAXLEN, 0.5 * b3Raw:getDimX()))
|
||||
local dPartLen = Proc.Box:getDimX() / nPart
|
||||
local Xmin = Proc.Box:getMin():getX()
|
||||
for i = 1, nPart do
|
||||
-- eseguo divisione
|
||||
local AddId = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
|
||||
EgtSetName( AddId, 'AddPart_' .. tostring( Proc.Id) .. '_' .. tostring( i))
|
||||
if i > 1 then
|
||||
local ptOn = Point3d( Xmin + ( i - 1) * dPartLen, 0, 0)
|
||||
EgtCutSurfTmPlane( AddId, ptOn, -X_AX(), true, GDB_RT.GLOB)
|
||||
end
|
||||
if i < nPart then
|
||||
local ptOn = Point3d( Xmin + i * dPartLen, 0, 0)
|
||||
EgtCutSurfTmPlane( AddId, ptOn, X_AX(), true, GDB_RT.GLOB)
|
||||
end
|
||||
table.insert( vAddId, AddId)
|
||||
end
|
||||
-- applico le lavorazioni sulle diverse parti
|
||||
for i = 1, #vAddId do
|
||||
local b3Box = EgtGetBBoxGlob( vAddId[i], GDB_BB.STANDARD)
|
||||
local nFct = EgtSurfTmFacetCount( vAddId[i])
|
||||
local AddProc = { Id = vAddId[i], Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Box, Fct = nFct, Flg = Proc.Flg}
|
||||
local bOk, sErr = MakeMoreFaces( AddProc, nPhase, nRawId, nPartId)
|
||||
if not bOk then
|
||||
return bOk, sErr
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user