DataBeam :
- correzione a Taglio Doppio concavo con faccia verso il basso e altra verticale.
This commit is contained in:
+32
-19
@@ -1,6 +1,7 @@
|
||||
-- BeamLib.lua by Egaltech s.r.l. 2020/07/28
|
||||
-- BeamLib.lua by Egaltech s.r.l. 2020/08/18
|
||||
-- Libreria globale per Travi
|
||||
-- 2020/07/28 Corretto calcolo attacchi e uscite di lame per non uscire dalla faccia sotto.
|
||||
-- 2020/08/18 Aggiunto a GetNearestParalOpposite e GetNearestOrthoOpposite parametro opzionale vtNorm.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local BeamLib = {}
|
||||
@@ -240,20 +241,26 @@ function BeamLib.GetPointDirDepth( nPartId, ptP, vtDir)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function BeamLib.GetNearestParalOpposite( vtRef)
|
||||
function BeamLib.GetNearestParalOpposite( vtRef, vtNorm)
|
||||
-- se definita anche la normale alla faccia, elimino la parte di vtRef parallela a questa
|
||||
local vtMyRef = Vector3d( vtRef)
|
||||
if vtNorm then
|
||||
vtMyRef = vtMyRef - ( vtMyRef * vtNorm) * vtNorm
|
||||
vtMyRef:normalize()
|
||||
end
|
||||
-- devo confrontare la componente orizzontale con quella verticale
|
||||
local dHorSq = vtRef:getX() * vtRef:getX() + vtRef:getY() * vtRef:getY()
|
||||
local dVertSq =vtRef:getZ() * vtRef:getZ()
|
||||
local dHorSq = vtMyRef:getX() * vtMyRef:getX() + vtMyRef:getY() * vtMyRef:getY()
|
||||
local dVertSq =vtMyRef:getZ() * vtMyRef:getZ()
|
||||
-- se prevalente la componente orizzontale
|
||||
if dHorSq >= dVertSq then
|
||||
if abs( vtRef:getX()) > abs( vtRef:getY()) then
|
||||
if vtRef:getX() > 0 then
|
||||
if abs( vtMyRef:getX()) > abs( vtMyRef:getY()) then
|
||||
if vtMyRef:getX() > 0 then
|
||||
return MCH_MILL_FU.PARAL_LEFT
|
||||
else
|
||||
return MCH_MILL_FU.PARAL_RIGHT
|
||||
end
|
||||
else
|
||||
if vtRef:getY() > 0 then
|
||||
if vtMyRef:getY() > 0 then
|
||||
return MCH_MILL_FU.PARAL_FRONT
|
||||
else
|
||||
return MCH_MILL_FU.PARAL_BACK
|
||||
@@ -261,7 +268,7 @@ function BeamLib.GetNearestParalOpposite( vtRef)
|
||||
end
|
||||
-- altrimenti prevale la verticale
|
||||
else
|
||||
if vtRef:getZ() > 0 then
|
||||
if vtMyRef:getZ() > 0 then
|
||||
return MCH_MILL_FU.PARAL_DOWN
|
||||
else
|
||||
return MCH_MILL_FU.PARAL_TOP
|
||||
@@ -271,20 +278,26 @@ function BeamLib.GetNearestParalOpposite( vtRef)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function BeamLib.GetNearestOrthoOpposite( vtRef)
|
||||
function BeamLib.GetNearestOrthoOpposite( vtRef, vtNorm)
|
||||
-- se definita anche la normale alla faccia, elimino la parte di vtRef parallela a questa
|
||||
local vtMyRef = Vector3d( vtRef)
|
||||
if vtNorm then
|
||||
vtMyRef = vtMyRef - ( vtMyRef * vtNorm) * vtNorm
|
||||
vtMyRef:normalize()
|
||||
end
|
||||
-- devo confrontare la componente orizzontale con quella verticale
|
||||
local dHorSq = vtRef:getX() * vtRef:getX() + vtRef:getY() * vtRef:getY()
|
||||
local dVertSq =vtRef:getZ() * vtRef:getZ()
|
||||
local dHorSq = vtMyRef:getX() * vtMyRef:getX() + vtMyRef:getY() * vtMyRef:getY()
|
||||
local dVertSq = vtMyRef:getZ() * vtMyRef:getZ()
|
||||
-- se prevalente la componente orizzontale
|
||||
if dHorSq >= dVertSq then
|
||||
if abs( vtRef:getX()) >= abs( vtRef:getY()) then
|
||||
if vtRef:getX() > 0 then
|
||||
if abs( vtMyRef:getX()) >= abs( vtMyRef:getY()) then
|
||||
if vtMyRef:getX() > 0 then
|
||||
return MCH_MILL_FU.ORTHO_LEFT
|
||||
else
|
||||
return MCH_MILL_FU.ORTHO_RIGHT
|
||||
end
|
||||
else
|
||||
if vtRef:getY() > 0 then
|
||||
if vtMyRef:getY() > 0 then
|
||||
return MCH_MILL_FU.ORTHO_FRONT
|
||||
else
|
||||
return MCH_MILL_FU.ORTHO_BACK
|
||||
@@ -292,7 +305,7 @@ function BeamLib.GetNearestOrthoOpposite( vtRef)
|
||||
end
|
||||
-- altrimenti prevale la verticale
|
||||
else
|
||||
if vtRef:getZ() > 0 then
|
||||
if vtMyRef:getZ() > 0 then
|
||||
return MCH_MILL_FU.ORTHO_DOWN
|
||||
else
|
||||
return MCH_MILL_FU.ORTHO_TOP
|
||||
@@ -701,18 +714,18 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function BeamLib.MakeOneFaceBySaw( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, sNotes, b3Raw)
|
||||
-- risolvo paramentro ambiguo
|
||||
-- dati della faccia
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT)
|
||||
-- risolvo parametro ambiguo
|
||||
local nOrthoOpposite
|
||||
local vtOrthO
|
||||
if isVector3d( Par5) then
|
||||
nOrthoOpposite = BeamLib.GetNearestOrthoOpposite( Par5)
|
||||
nOrthoOpposite = BeamLib.GetNearestOrthoOpposite( Par5, vtN)
|
||||
vtOrthO = Vector3d( Par5)
|
||||
else
|
||||
nOrthoOpposite = Par5
|
||||
vtOrthO = BeamLib.GetVersRef( Par5)
|
||||
end
|
||||
-- dati della faccia
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT)
|
||||
-- linea o bilinea di lavorazione (qui uso nOrthoOpposite per ripetere esattamente il calcolo del Mach)
|
||||
local ptP1, ptPm, ptP2, vtV1, vtV2, dLen, dWidth = EgtSurfTmFacetOppositeSide( nSurfId, nFacet, BeamLib.GetVersRef( nOrthoOpposite), GDB_ID.ROOT)
|
||||
if not dLen or dLen < 1.1 or not dWidth or dWidth < 1.1 then
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- ProcessDoubleCut.lua by Egaltech s.r.l. 2020/06/10
|
||||
-- ProcessDoubleCut.lua by Egaltech s.r.l. 2020/08/18
|
||||
-- Gestione calcolo doppi tagli di lama per Travi
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
@@ -37,7 +37,7 @@ function ProcessDoubleCut.Classify( Proc)
|
||||
-- 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
|
||||
if not bConvex and ( vtN:getZ() < - 0.72 or ( vtN:getZ() < - 0.259 and Proc.Box:getDimX() > BD.MAX_DIM_DICE)) then
|
||||
return true, true
|
||||
end
|
||||
end
|
||||
@@ -188,15 +188,15 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
end
|
||||
end
|
||||
-- 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
|
||||
-- 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
|
||||
@@ -227,20 +227,12 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- altrimenti
|
||||
else
|
||||
-- verifico se necessari tagli supplementari
|
||||
local vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
|
||||
local vCuts = DC.GetDice( nAddGrpId, 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
|
||||
-- aggiorno nome e info
|
||||
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
|
||||
@@ -248,23 +240,11 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- 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
|
||||
local vtOrthOpp = EgtIf( ( i % 2) == 1, vtN[nBigInd], vtN[nSmaInd])
|
||||
if not bOnY then
|
||||
vtOrthOpp[2] = 0 ; vtOrthOpp:normalize()
|
||||
end
|
||||
local nOrthoOpposite = BL.GetNearestOrthoOpposite( vtOrthOpp)
|
||||
local vtOrthOpp = vtN[nBigInd]
|
||||
local vtNorm = vtN[nSmaInd]
|
||||
if ( i % 2) ~= 1 then vtOrthOpp, vtNorm = vtNorm, vtOrthOpp end
|
||||
if not bOnY then vtOrthOpp[2] = 0 end
|
||||
local nOrthoOpposite = BL.GetNearestOrthoOpposite( vtOrthOpp, vtNorm)
|
||||
-- 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)
|
||||
|
||||
Reference in New Issue
Block a user