Cambio punto di partenza del tenone
This commit is contained in:
@@ -564,6 +564,56 @@ function BeamLib.FindEdgeBestOrientedAsDirection( Edges, vtDirection)
|
||||
return BestEdge
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- nNearSide : 3=Z+, -3=Z-
|
||||
function BeamLib.PutStartNearestToEdge( nCrvId, b3Raw, dMaxDist, nNearSide)
|
||||
-- verifico che la curva sia chiusa
|
||||
if not EgtCurveIsClosed( nCrvId) then return false end
|
||||
-- recupero il versore normale al piano di lavoro o estrusione
|
||||
local vtN = EgtCurveExtrusion( nCrvId, GDB_ID.ROOT)
|
||||
-- coefficienti per riportare la distanza nel piano di lavoro
|
||||
local dCoeffY = 0
|
||||
if abs( vtN:getY()) < 0.999 then dCoeffY= 1 / ( sqrt( 1 - vtN:getY() * vtN:getY())) end
|
||||
local dCoeffZ = 0
|
||||
if abs( vtN:getZ()) < 0.999 then dCoeffZ = 1 / ( sqrt( 1 - vtN:getZ() * vtN:getZ())) end
|
||||
-- cerco l'estremo più vicino al box e lo imposto come inizio (se da sotto escludo Zmax e viceversa)
|
||||
local dUopt = 0
|
||||
local dDopt = GEO.INFINITO
|
||||
local dSopt = GEO.INFINITO
|
||||
local dUi, dUf = EgtCurveDomain( nCrvId)
|
||||
for dU = dUi, dUf, 0.5 do
|
||||
local ptP = EgtUP( nCrvId, dU, GDB_ID.ROOT)
|
||||
local vtDp = EgtUV( nCrvId, dU, -1, GDB_ID.ROOT)
|
||||
local vtDs = EgtUV( nCrvId, dU, 1, GDB_ID.ROOT)
|
||||
local bTg = ( vtDp and vtDs and vtDp * vtDs > 0.96)
|
||||
if ptP and bTg then
|
||||
local vtMin = ptP - b3Raw:getMin()
|
||||
local vtMax = ptP - b3Raw:getMax()
|
||||
local dD = abs( vtMin:getY()) * dCoeffY
|
||||
dD = min( abs( vtMax:getY()) * dCoeffY, dD)
|
||||
dD = min( abs( vtMin:getZ()) * dCoeffZ, dD)
|
||||
dD = min( abs( vtMax:getZ()) * dCoeffZ, dD)
|
||||
local dS
|
||||
if nNearSide == -3 then
|
||||
dS = abs( vtMin:getZ() * dCoeffZ)
|
||||
else --nNearSide == 3
|
||||
dS = abs( vtMax:getZ() * dCoeffZ)
|
||||
end
|
||||
if dD < dMaxDist and dS < dSopt + GEO.EPS_SMALL then
|
||||
dUopt = dU
|
||||
dDopt = dD
|
||||
dSopt = dS
|
||||
end
|
||||
end
|
||||
end
|
||||
if abs( dUopt - dUi) > GEO.EPS_ZERO and abs( dUopt - dUf) > GEO.EPS_ZERO then
|
||||
-- TODO. Non utilizzare la funzione EgtChangeClosedCurveStart perchè cambia proprietà della geometria.
|
||||
-- dopo aver trovato l'entità di partenza, calcolare l'offset da aggiungere alla lavorazione per poter cominciare da questa entità (senza modifica della geometria)
|
||||
EgtChangeClosedCurveStart( nCrvId, dUopt)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Merge sorting - algoritmo di sorting stabile, ossia che mantiene l'ordine relativo se gli elementi sono equivalenti
|
||||
-- TODO vedere come riordinare (tutto in tabella MergeSort??)
|
||||
|
||||
@@ -10,7 +10,6 @@ local MachiningLib = require( 'MachiningLib')
|
||||
local FeatureLib = require( 'FeatureLib')
|
||||
-- strategie di base
|
||||
local BladeToWaste = require( 'BLADETOWASTE')
|
||||
local FaceByBlade = require('FACEBYBLADE')
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local STR0006 = {}
|
||||
@@ -70,10 +69,10 @@ function GetTenonStrategy( Proc, Part)
|
||||
Machining.Milling.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
|
||||
if Machining.Milling.ToolInfo.nToolIndex then
|
||||
local bMachIsOk = true
|
||||
if ( Proc.FeatureInfo.vtTenonN[3] < 0 and TOOLS[Machining.Milling.ToolInfo.nToolIndex].SetupInfo.HeadType.bTop) or
|
||||
( Proc.FeatureInfo.vtTenonN[3] > 0 and TOOLS[Machining.Milling.ToolInfo.nToolIndex].SetupInfo.HeadType.bBottom) then
|
||||
if ( Proc.FeatureInfo.vtTenonN:getZ() < 0 and TOOLS[Machining.Milling.ToolInfo.nToolIndex].SetupInfo.HeadType.bTop) or
|
||||
( Proc.FeatureInfo.vtTenonN:getZ() > 0 and TOOLS[Machining.Milling.ToolInfo.nToolIndex].SetupInfo.HeadType.bBottom) then
|
||||
local dTotalLen = TOOLS[Machining.Milling.ToolInfo.nToolIndex].dLength + TOOLS[Machining.Milling.ToolInfo.nToolIndex].SetupInfo.dPivot
|
||||
local dHorizSpace = dTotalLen * sqrt( 1 - ( Proc.FeatureInfo.vtTenonN[3] * Proc.FeatureInfo.vtTenonN[3]))
|
||||
local dHorizSpace = dTotalLen * sqrt( 1 - ( Proc.FeatureInfo.vtTenonN:getZ() * Proc.FeatureInfo.vtTenonN:getZ()))
|
||||
if dHorizSpace - ( TOOLS[Machining.Milling.ToolInfo.nToolIndex].SetupInfo.dCAxisSideEncumbrance / 2) < Proc.b3Box:getDimX() then
|
||||
bMachIsOk = false
|
||||
end
|
||||
@@ -219,7 +218,6 @@ function STR0006.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
|
||||
-- taglio di lama
|
||||
else
|
||||
|
||||
for i = 1, #Strategy.Machining.Cutting do
|
||||
if Strategy.Machining.Cutting.bIsApplicable then
|
||||
if Proc.AffectedFaces.bLeft and Strategy.bCanMoveAfterSplit then
|
||||
@@ -249,6 +247,23 @@ function STR0006.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
Strategy.Machining.Milling.vtToolDirection = Proc.vtTNormal
|
||||
Strategy.Machining.Milling.sDepth = min( -Strategy.Machining.Milling.ToolInfo.dResidualDepth, 0)
|
||||
|
||||
local nNearSide -- +3 = Z+, -3 = Z-
|
||||
local bShortPart = ( Part.b3Part:getDimX() < BeamData.LEN_SHORT_PART)
|
||||
if TOOLS[Strategy.Machining.Milling.nToolIndex].SetupInfo.HeadType.bTop then
|
||||
if bShortPart and Proc.FeatureInfo.vtTenonN:getX() < 0 and Proc.FeatureInfo.vtTenonN:getZ() > 0 then
|
||||
nNearSide = -3
|
||||
else
|
||||
nNearSide = 3
|
||||
end
|
||||
else
|
||||
if bShortPart and Proc.FeatureInfo.vtTenonN:getX() < 0 and Proc.FeatureInfo.vtTenonN:getZ() < 0 then
|
||||
nNearSide = 3
|
||||
else
|
||||
nNearSide = -3
|
||||
end
|
||||
end
|
||||
|
||||
BeamLib.PutStartNearestToEdge( Proc.FeatureInfo.idAddAuxGeom, Part.b3Raw, Proc.FeatureInfo.dTenonMaxDist, nNearSide)
|
||||
-- LeadIn / LeadOut
|
||||
Strategy.Machining.Milling.LeadIn = {}
|
||||
Strategy.Machining.Milling.LeadOut = {}
|
||||
|
||||
Reference in New Issue
Block a user