DataBeam :

- nuovo metodo per calcolo percorso di riferimento per antischeggia per mortase a coda di rondine
- migliorie varie a LapJoint.
This commit is contained in:
Dario Sassi
2020-04-14 07:38:58 +00:00
parent 02c399eaa0
commit f1b0324106
4 changed files with 68 additions and 87 deletions
+40 -51
View File
@@ -1,4 +1,4 @@
-- ProcessDtMortise.lua by Egaltech s.r.l. 2020/03/31
-- ProcessDtMortise.lua by Egaltech s.r.l. 2020/04/11
-- Gestione calcolo mortase a coda di rondice per Travi
-- Tabella per definizione modulo
@@ -49,59 +49,48 @@ function ProcessDtMortise.Classify( Proc)
end
---------------------------------------------------------------------
local function ExtractTopPath( nProcId, vtOrtho, nAddGrpId, rfFac0, dZedTop)
-- estraggo percorso di contorno
local nAuxTop, nNumTop = EgtExtractSurfTmLoops( nProcId, nAddGrpId)
if nNumTop ~= 1 then
-- elimino i percorsi creati
for i = 1, nNumTop do
EgtErase( nAuxTop + i - 1)
local function CalcTopPath( nProcId, AuxId, nAddGrpId, dAltMort, dSideAng, b3Solid)
-- copio la curva di base
local NewAuxId = EgtCopyGlob( AuxId, nAddGrpId)
if not NewAuxId then return end
-- ne allungo gli estremi
EgtExtendCurveStartByLen( NewAuxId, 100)
EgtExtendCurveEndByLen( NewAuxId, 100)
-- eseguo traslazione e offset per portarla sul top
local vtMove = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) * ( dAltMort - 10 * GEO.EPS_SMALL)
EgtMove( NewAuxId, vtMove, GDB_RT.GLOB)
local dOffset = dAltMort * tan( dSideAng)
if not EgtOffsetCurve( NewAuxId, dOffset) then return end
-- la limito entro la trave
local refBox = Frame3d( b3Solid:getMin())
local vtBoxDiag = b3Solid:getMax() - b3Solid:getMin()
local nCount
NewAuxId, nCount = EgtTrimFlatCurveWithBox( NewAuxId, refBox, vtBoxDiag, true, true, GDB_RT.GLOB)
-- se divisa in più parti, le unisco congiungendole con segmenti
if nCount > 1 then
if EgtGetType( NewAuxId) ~= GDB_TY.CRV_COMPO then
NewAuxId = EgtCurveCompo( nAddGrpId, NewAuxId)
end
return nil, 0
else
-- fondo tra loro le curve compatibili
EgtMergeCurvesInCurveCompo( nAuxTop)
-- esplodo il percorso in modo da avere entità separate per poterle controllare
local nStartId, nCount = EgtExplodeCurveCompo( nAuxTop)
if nStartId then
-- tabella con identificativi delle curve
tEnt = EgtTableFill( nStartId, nCount)
-- elimino le curve che non stanno al bordo superiore
for i = nCount, 1, -1 do
local ptP1 = EgtSP( tEnt[i], GDB_RT.GLOB)
local ptP2 = EgtEP( tEnt[i], GDB_RT.GLOB)
ptP1:toLoc( rfFac0)
ptP2:toLoc( rfFac0)
-- se ha variazioni in Z o non è alla giusta Z, cancello l'entità
if ( abs( ptP1:getZ() - ptP2:getZ()) > 10 * GEO.EPS_SMALL) or
( abs( ptP1:getZ() - dZedTop) > 10 * GEO.EPS_SMALL) then
EgtErase( tEnt[i])
table.remove( tEnt, i)
end
end
-- ricreo il percorso
local ptStart = EgtSP( tEnt[1])
local nFirstId, nCnt = EgtCurveCompoByReorder( nAddGrpId, tEnt, ptStart, true)
if not nFirstId then return nil, 0 end
-- deve rimanere un solo percorso
if nCnt > 1 then
for nId = nFirstId, nFirstId + nCnt - 1 do
EgtErase( nFirstId)
end
return nil, 0
end
-- modifico estrusione percorso
EgtModifyCurveExtrusion( nFirstId, vtOrtho, GDB_RT.GLOB)
return nFirstId, 1
for i = 2, nCount do
local CrvId = NewAuxId + i - 1
local ptStart = EgtSP( CrvId, GDB_ID.ROOT)
EgtAddCurveCompoLine( NewAuxId, ptStart, GDB_RT.GLOB)
EgtAddCurveCompoCurve( NewAuxId, CrvId)
end
end
return nil, 0
return NewAuxId
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId)
-- 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')
if AuxId then AuxId = AuxId + Proc.Id end
@@ -129,13 +118,13 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId)
-- recupero il diametro dell'utensile e l'angolo di spoglia
local dToolDiam = 100
local dMaxMat = 30
local dSideAngle = 0
local dSideAng = 0
if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
dSideAngle = EgtTdbGetCurrToolParam( MCH_TP.SIDEANG) or dSideAngle
dSideAng = EgtTdbGetCurrToolParam( MCH_TP.SIDEANG) or dSideAng
end
end
-- se parametro interno abilitato e il percorso non è chiuso, aggiungo percorso e lavorazione antischeggia
@@ -153,12 +142,12 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId)
EgtOutLog( sErr)
return false, sErr
end
-- estraggo il percorso top mortise
local nAuxId1 = ExtractTopPath( Proc.Id, vtExtr, nAddGrpId, rfFac0, dAltMort)
-- calcolo il percorso top mortise
local nAuxId1 = CalcTopPath( Proc.Id, AuxId, nAddGrpId, dAltMort, dSideAng, b3Solid)
-- se esiste il percorso
if nAuxId1 then
-- creo percorso sulla parte alta della mortasa
local dToolRadDelta = dAltMort * tan( dSideAngle)
local dToolRadDelta = dAltMort * tan( dSideAng)
local dTopDiam = dToolDiam + 2 * dToolRadDelta
-- recupero punto iniziale e finale del percorso
local ptStart = EgtSP( nAuxId1, GDB_RT.GLOB)