- in MachiningLib aggiunta la scrittura dello spezzone nella lavorazione

- in STR0004 aggiunto ordinamento lavorazioni
- piccole aggiunte varie
This commit is contained in:
luca.mazzoleni
2024-11-21 17:53:24 +01:00
parent 21b73e0031
commit a2b49fdf3e
4 changed files with 46 additions and 12 deletions
+23 -9
View File
@@ -78,19 +78,18 @@ end
-------------------------------------------------------------------------------------------------------------
function MachiningLib.GetSplitMachinings( Machinings, vSplittingPoints, Part )
for i = #Machinings, 1, -1 do
local nParts = #vSplittingPoints + 1
local dEdgeMaxX = Machinings[i].ptEdge1:getX()
local dEdgeMinX = Machinings[i].ptEdge2:getX()
if Machinings[i].ptEdge1:getX() < Machinings[i].ptEdge2:getX() - 10 * GEO.EPS_SMALL then
dEdgeMaxX = Machinings[i].ptEdge2:getX()
dEdgeMinX = Machinings[i].ptEdge1:getX()
end
if FeatureLib.MachiningNeedsSplitting( Machinings[i].dLengthOnX, Part) then
local dOriginalStartAddLength = Machinings[i].LeadIn.dStartAddLength
local dOriginalEndAddLength = Machinings[i].LeadOut.dEndAddLength
local nCurrentMachiningIndex = i
local nParts = #vSplittingPoints + 1
for j = 1, nParts do
local dEdgeMaxX = Machinings[i].ptEdge1:getX()
local dEdgeMinX = Machinings[i].ptEdge2:getX()
if Machinings[i].ptEdge1:getX() < Machinings[i].ptEdge2:getX() - 10 * GEO.EPS_SMALL then
dEdgeMaxX = Machinings[i].ptEdge2:getX()
dEdgeMinX = Machinings[i].ptEdge1:getX()
end
-- il punto di spezzatura deve essere all'interno del lato che si sta lavorando
if ( j == nParts) or ( vSplittingPoints[j]:getX() > dEdgeMinX + 10 * GEO.EPS_SMALL and vSplittingPoints[j]:getX() < dEdgeMaxX - 10 * GEO.EPS_SMALL) then
if j > 1 then
@@ -108,13 +107,28 @@ function MachiningLib.GetSplitMachinings( Machinings, vSplittingPoints, Part )
dStartAddLength = - ( dEdgeMaxX - vSplittingPoints[j - 1]:getX()) + BeamData.MILL_OVERLAP
dEndAddLength = - ( vSplittingPoints[j]:getX() - dEdgeMinX) + BeamData.MILL_OVERLAP
end
if Machinings[nCurrentMachiningIndex].bInvert then
if Machinings[nCurrentMachiningIndex].vtEdgeDirection:getX() > 10 * GEO.EPS_SMALL and not Machinings[nCurrentMachiningIndex].bInvert then
dStartAddLength, dEndAddLength = dEndAddLength, dStartAddLength
end
Machinings[nCurrentMachiningIndex].LeadIn.dStartAddLength = dStartAddLength
Machinings[nCurrentMachiningIndex].LeadOut.dEndAddLength = dEndAddLength
end
Machinings[nCurrentMachiningIndex].nPart = j
end
-- anche le lavorazioni non splittate necessitano del segmento assegnato
else
for j = 1, nParts do
local dNextSplitX = dEdgeMaxX
local dPreviousSplitX = dEdgeMinX
if j ~= 1 then
dPreviousSplitX = vSplittingPoints[j - 1]:getX()
elseif j ~= nParts then
dNextSplitX = vSplittingPoints[j]:getX()
end
if dEdgeMinX > dNextSplitX - 10 * GEO.EPS_SMALL and dEdgeMaxX < dPreviousSplitX + 10 * GEO.EPS_SMALL then
Machinings[i].nPart = j
end
end
end
end
+1
View File
@@ -106,6 +106,7 @@ function SLOTBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
Cutting.dLengthOnX = abs( EdgeToMachine.dLength * EdgeToMachine.vtToolDirection:getY())
Cutting.dEdgeLength = EdgeToMachine.dLength
Cutting.ptEdge1, _, Cutting.ptEdge2 = EgtSurfTmFacetOppositeSide( Proc.id, FaceToMachine.id, -EdgeToMachine.vtToolDirection, GDB_ID.ROOT)
Cutting.vtEdgeDirection = EdgeToMachine.vtToolDirection ^ FaceToMachine.vtN
local dPocketHeight = 0
if Proc.Topology.sFamily == 'Tunnel' then
+1
View File
@@ -72,6 +72,7 @@ function SLOTBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
Mortising.dLengthOnX = abs( dLengthToMachine * EdgeToMachine.vtToolDirection:getY())
Mortising.dEdgeLength = EdgeToMachine.dLength
Mortising.ptEdge1, _, Mortising.ptEdge2 = EgtSurfTmFacetOppositeSide( Proc.id, FaceToMachine.id, -EdgeToMachine.vtToolDirection, GDB_ID.ROOT)
Mortising.vtEdgeDirection = EdgeToMachine.vtToolDirection ^ FaceToMachine.vtN
-- altezza tasca, in base alla topologia
local dPocketHeight = 0
+21 -3
View File
@@ -57,6 +57,21 @@ local function GetCompletionPercentage( Proc, Result)
end
local function CompareMachinings( MachiningA, MachiningB)
if MachiningA.nPart > MachiningB.nPart then
return false
elseif MachiningB.nPart > MachiningA.nPart then
return true
else
if MachiningA.sEdgeType == 'Side' and MachiningB.sEdgeType ~= 'Side' then
return true
elseif MachiningB.sEdgeType == 'Side' and MachiningA.sEdgeType ~= 'Side' then
return false
end
end
end
local function AddResult( Machining, Result)
table.insert( Result, {})
if not Result.Bottom then
@@ -195,7 +210,7 @@ function STR0004.Make( bAddMachining, Proc, Part, CustomParameters)
end
end
-- lavorazioni raggruppate in unica lista, che verrà poi riordinata
-- lavorazioni raggruppate in unica lista
Chainsaw.Result.Sorted = {}
for i = 1, #Chainsaw.Result.Side do
if Chainsaw.Result.Side[i].bIsApplicable then
@@ -212,13 +227,16 @@ function STR0004.Make( bAddMachining, Proc, Part, CustomParameters)
table.insert( Chainsaw.Result.Sorted, Chainsaw.Result.Opposite[i])
end
end
-- calcolo eventuali spezzoni
-- aggiunta eventuali lavorazioni splittate
local vFeatureSplittingPoints = FeatureLib.GetFeatureSplittingPoints( Proc, Part)
-- aggiunta eventuali lavorazioni splittate e ordinamento
if #vFeatureSplittingPoints > 0 then
Chainsaw.Result.Sorted = MachiningLib.GetSplitMachinings( Chainsaw.Result.Sorted, vFeatureSplittingPoints, Part)
end
-- ordinamento
table.sort( Chainsaw.Result.Sorted, CompareMachinings)
-- aggiunta lavorazioni
local nIsApplicableCount = 0
local dFinalCompletionPercentage = 100