10 Commits

Author SHA1 Message Date
luca.mazzoleni b882f23d3e - commenti 2024-12-24 08:44:46 +01:00
luca.mazzoleni 8c39c6a94f - in MachiningLib -> GetSplitMachinings correzione al calcolo FeatureSegment nel caso di lavorazione non spezzata 2024-12-23 18:25:30 +01:00
luca.mazzoleni e126e3f389 - in BeamLib introdotto algoritmo di sorting STABILE (merge sorting)
- piccole correzioni in SLOTBYBLADE e SLOTBYCHAINSAW
2024-12-23 16:11:25 +01:00
luca.mazzoleni 3bce7b5fd6 implementato sorting lavorazioni ma non corretto, serve un algoritmo di STABLE SORTING 2024-12-23 09:08:03 +01:00
luca.mazzoleni 99e0bd27d9 - funzioni di Sorting spostate in MachiningLib
- Sorting di base funzionante
2024-12-19 18:33:39 +01:00
luca.mazzoleni 456d8e903a - in BeamExec completata la funzione PrepareMachiningsForSorting
- in FaceData la lunghezza rispetto a X è ora in valore assoluto
- in MachiningLib -> GetSplitMachinings aggiunta la scrittura del centro della lavorazione
- in STR0003, STR0004, SlotByChainSaw e SlotByBLade nSegment diventa nFeatureSegment per distinguerla da nPartSegment
2024-12-19 15:04:17 +01:00
luca.mazzoleni 14f81da3df - in Process e BeamExec reinserito calcolo parte dopo spostamento pezzo 2024-12-18 12:23:04 +01:00
luca.mazzoleni eb4a5e521f - in BeamExec si evita di ricalcolare senza motivo il box del pezzo
- tutti i riferimenti a PARTS[i].b3Box o Part.b3Solid diventano Part.b3Part
- in BeamExec aggiunte funzioni PrepareMachiningsForSorting e SortMachiningsBySegment, da completare
- in BeamLib aggiunta funzione GetSplittingPoints
- nelle lavorazioni introdotta la variabile sStage che rappresenta la fase di lavoro a cui la lavorazione stessa appartiene (Head, Tail, AfterTail oppure vuota che significa sezione centrale, quella divisa in segments)
- piccole correzioni ad alcuni nomi di variabile
2024-12-18 11:59:08 +01:00
luca.mazzoleni 233a928dcd - in DiceCut modificati i commenti 2024-12-16 13:18:10 +01:00
luca.mazzoleni db88c7bb8d Merge branch 'feature/NewStrategyLib' into develop 2024-12-16 11:19:59 +01:00
16 changed files with 490 additions and 115 deletions
+56 -14
View File
@@ -146,11 +146,13 @@ function BeamExec.GetToolsFromDB()
Tool.dStep = EgtGetValInNotes( Tool.sUserNotes, 'STEP', 'd') or ( Tool.dMaxMaterial / 3) -- se non settato nell'utensile, considero metà del tagliente
Tool.dSideStep = EgtGetValInNotes( Tool.sUserNotes, 'SIDESTEP', 'd') or floor( Tool.dDiameter / 3) -- se non settato nell'utensile, considero metà del diametro
Tool.bIsPen = abs( Tool.dSpeed) < 5
Tool.dPerformanceIndex = ( Tool.dDiameter * Tool.dMaxMaterial) / Tool.dLength
-- recupero parametri propri delle lame
elseif sToolFamily == 'SAWBLADE' then
Tool.bIsUsedForLongCut = EgtGetValInNotes( Tool.sUserNotes, 'LONGCUT') == 1 or false -- false come valore di default
Tool.dStep = EgtGetValInNotes( Tool.sUserNotes, 'STEP', 'd') or Tool.dThickness -- se non settato nell'utensile, considero lo spessore lama
Tool.dSideStep = EgtGetValInNotes( Tool.sUserNotes, 'SIDESTEP', 'd') or Tool.dMaxMaterial -- se non settato nell'utensile, considero un quarto del diametro
Tool.dPerformanceIndex = 1 / ( Tool.dDiameter * Tool.dLength)
-- recupero parametri propri delle motoseghe
elseif sToolFamily == 'MORTISE' then
Tool.dDistance = EgtTdbGetCurrToolParam( MCH_TP.DIST) or 90 -- 90mm dimensione standard aggregato catena
@@ -160,7 +162,11 @@ function BeamExec.GetToolsFromDB()
Tool.dSideStep = EgtGetValInNotes( Tool.sUserNotes, 'SIDESTEP', 'd') or ( Tool.dThickness - 1) -- se non settato nell'utensile, considero spessore catena meno 1mm di sicurezza
Tool.dCornerRadius = EgtTdbGetCurrToolParam( MCH_TP.CORNRAD)
Tool.dWidth = Tool.dDiameter
Tool.dPerformanceIndex = 1 / Tool.dLength
end
-- drillbit
else
Tool.dPerformanceIndex = Tool.dDiameter / Tool.dLength
end
-- se tutti i dati necessari sono disponibili, inserisco utensile nella lista globale degli utensili disponibili
@@ -375,13 +381,13 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS)
local dDeltaE = BeamData.OVM_MID
for i = 1, #PARTS do
-- dati del pezzo
local b3Part = EgtGetBBoxGlob( PARTS[i].id or GDB_ID.NULL, GDB_BB.EXACT)
if b3Part:isEmpty() or PARTS[i].b3Box:isEmpty() then break end
EgtOutLog( 'PartSez=' .. EgtNumToString( b3Part:getDimY(), 1) .. 'x' .. EgtNumToString( b3Part:getDimZ(), 1), 3)
local b3BoxExact = EgtGetBBoxGlob( PARTS[i].id or GDB_ID.NULL, GDB_BB.EXACT)
if b3BoxExact:isEmpty() or PARTS[i].b3PartOriginal:isEmpty() then break end
EgtOutLog( 'PartSez=' .. EgtNumToString( b3BoxExact:getDimY(), 1) .. 'x' .. EgtNumToString( b3BoxExact:getDimZ(), 1), 3)
-- se sezione compatibile e lunghezza disponibile sufficiente
local dPartLen = PARTS[i].b3Box:getDimX()
local dPartWidth = PARTS[i].b3Box:getDimY()
local dPartHeight = PARTS[i].b3Box:getDimZ()
local dPartLen = PARTS[i].b3PartOriginal:getDimX()
local dPartWidth = PARTS[i].b3PartOriginal:getDimY()
local dPartHeight = PARTS[i].b3PartOriginal:getDimZ()
local dNextLen = dLen - EgtIf( i == 1, dDeltaS, 0) - dPartLen - dDeltaE
if (( abs( dPartWidth - dRawW) < 100 * GEO.EPS_SMALL and abs( dPartHeight - dRawH) < 100 * GEO.EPS_SMALL) or
( abs( dPartHeight - dRawW) < 100 * GEO.EPS_SMALL and abs( dPartWidth - dRawH) < 100 * GEO.EPS_SMALL)) and
@@ -411,7 +417,7 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS)
return false, sOut
end
-- aggiungo faccia per taglio iniziale al pezzo
BeamLib.AddPartStartFace( PARTS[i].id, PARTS[i].b3Box)
BeamLib.AddPartStartFace( PARTS[i].id, PARTS[i].b3PartOriginal)
-- se sovramateriale di testa, lo notifico
if dDeltaS > 0.09 then
EgtSetInfo( PARTS[i].idRaw, 'HOVM', dDeltaS)
@@ -423,16 +429,16 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS)
EgtSetInfo( PARTS[i].idRaw, 'TOVM', dDeltaE)
end
-- aggiungo faccia per taglio finale al pezzo
BeamLib.AddPartEndFace( PARTS[i].id, PARTS[i].b3Box)
BeamLib.AddPartEndFace( PARTS[i].id, PARTS[i].b3PartOriginal)
-- inserisco il pezzo nel grezzo
EgtDeselectPartObjs( PARTS[i].id)
local ptPos = b3Part:getMin() - PARTS[i].b3Box:getMin() + Vector3d( dDelta, ( dRawW - dPartWidth) / 2, ( dRawH - dPartHeight) / 2)
local ptPos = b3BoxExact:getMin() - PARTS[i].b3PartOriginal:getMin() + Vector3d( dDelta, ( dRawW - dPartWidth) / 2, ( dRawH - dPartHeight) / 2)
EgtAddPartToRawPart( PARTS[i].id, ptPos, PARTS[i].idRaw)
if abs( dPartWidth - dRawW) > 100 * GEO.EPS_SMALL then
-- rotazione attorno a centro geometria complessiva del pezzo
EgtRotatePartInRawPart( PARTS[i].id, X_AX(), 90)
-- correggo per eccentricità solido rispetto a geometria complessiva del pezzo
local vtEccOri = PARTS[i].b3Box:getCenter() - b3Part:getCenter()
local vtEccOri = PARTS[i].b3PartOriginal:getCenter() - b3BoxExact:getCenter()
local vtEccRot = Vector3d( vtEccOri)
vtEccRot:rotate( X_AX(), 90)
EgtMovePartInRawPart( PARTS[i].id, ( vtEccOri - vtEccRot))
@@ -450,9 +456,10 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS)
PARTS[i].dWidth = PARTS[i].b3Raw:getDimY()
PARTS[i].dHeight = PARTS[i].b3Raw:getDimZ()
PARTS[i].bSquareSection = abs( PARTS[i].dWidth - PARTS[i].dHeight) < 100 * GEO.EPS_SMALL
PARTS[i].b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[i].id, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
PARTS[i].b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[i].id, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
PARTS[i].nIndexInParts = i
PARTS[i].CombinationList = GetAvailableCombinations( PARTS[i])
PARTS[i].SplittingPoints = BeamLib.GetPartSplittingPoints( PARTS[i])
else
local sOut = 'Error: part L(' .. EgtNumToString( dPartLen, 1) .. ') too big for raw part L(' .. EgtNumToString( dLen - 0.1, 1) .. ')'
return false, sOut
@@ -981,6 +988,7 @@ local function CalculateMachinings( vProc, Part)
bAreAllApplyOk, _ = StrategyScript.Make( true, Proc, Part, Proc.ChosenStrategy.Parameters)
end
end
return MACHININGS
end
@@ -1326,11 +1334,45 @@ function BeamExec.ProcessMachinings( PROCESSINGS, PARTS)
-- esegue le strategie migliori che ha precedentemente scelto e salva le lavorazioni nella lista globale
MACHININGS = CalculateMachinings( vProc, PARTS[nPart])
MACHININGS = MachiningLib.PrepareMachiningsForSorting( PARTS[nPart])
-- TODO riordinare lavorazioni ottimizzando cambio utensile/spezzone ecc..., mantenendo dipendenze definite prima
-- ordino le lavorazioni
-- MACHININGS = OrderMachining( MACHININGS, PARTS[nPart])
--TODO - rimuovere o mettere in Log, serve solo per test
-- TEST
local MachiningPropertiesBeforeSorting = {}
for i =1, #MACHININGS do
MachiningPropertiesBeforeSorting[i] = {}
MachiningPropertiesBeforeSorting[i] = {
ptCenter = MACHININGS[i].Machining.ptCenter,
nStage = MACHININGS[i].Machining.nStage,
nPartSegment = MACHININGS[i].Machining.nPartSegment,
sToolFamily = TOOLS[ MACHININGS[i].Machining.nToolIndex].sFamily,
dToolPerformanceIndex = TOOLS[ MACHININGS[i].Machining.nToolIndex].dPerformanceIndex,
sToolName = TOOLS[ MACHININGS[i].Machining.nToolIndex].sName,
vtToolDirection = MACHININGS[i].Machining.vtToolDirection
}
end
-- fine TEST
-- TODO completare ordinamento. Mancano le dipendenze.
MACHININGS = BeamLib.StableSort( MACHININGS, MachiningLib.CompareMachinings)
--TODO - rimuovere o mettere in Log, serve solo per test
-- TEST
local MachiningPropertiesAfterSorting = {}
for i =1, #MACHININGS do
MachiningPropertiesAfterSorting[i] = {}
MachiningPropertiesAfterSorting[i] = {
ptCenter = MACHININGS[i].Machining.ptCenter,
nStage = MACHININGS[i].Machining.nStage,
nPartSegment = MACHININGS[i].Machining.nPartSegment,
sToolFamily = TOOLS[ MACHININGS[i].Machining.nToolIndex].sFamily,
dToolPerformanceIndex = TOOLS[ MACHININGS[i].Machining.nToolIndex].dPerformanceIndex,
sToolName = TOOLS[ MACHININGS[i].Machining.nToolIndex].sName,
vtToolDirection = MACHININGS[i].Machining.vtToolDirection
}
end
-- fine TEST
-- aggiungo la fase, se non è la prima
if nOrd == 1 then
EgtSetCurrPhase( 1)
+99 -6
View File
@@ -90,6 +90,48 @@ function BeamLib.AddPartEndFace( PartId, b3Solid)
return true
end
-------------------------------------------------------------------------------------------------------------
function BeamLib.GetPartSplittingPoints( Part, OptionalParameters)
local PartSplittingPoints = {}
local dPartLength = Part.b3Part:getDimX()
-- parametri opzionali
if not OptionalParameters then
OptionalParameters = {}
end
local dMaxSegmentLength = OptionalParameters.dMaxSegmentLength or BeamData.LONGCUT_MAXLEN
local dMaxSegmentLengthOnEdges = OptionalParameters.dMaxSegmentLengthOnEdges or BeamData.LONGCUT_ENDLEN
if dPartLength < dMaxSegmentLength + 10 * GEO.EPS_SMALL then
return {}
elseif dPartLength >= dMaxSegmentLength + 10 * GEO.EPS_SMALL
and dPartLength < 3 * dMaxSegmentLengthOnEdges + 10 * GEO.EPS_SMALL then
local dXPartCentralPoint = ( Part.b3Part:getMax():getX() - Part.b3Part:getMin():getX()) / 2
table.insert( PartSplittingPoints, Point3d( dXPartCentralPoint, 0, 0))
else
-- punto estremo destro
local dSplitXRight = Part.b3Part:getMax():getX() - dMaxSegmentLengthOnEdges
table.insert( PartSplittingPoints, Point3d( dSplitXRight, 0, 0))
-- punti centrali
local dPartCentralLength = dPartLength - 2 * dMaxSegmentLengthOnEdges
local nSplitParts = max( ceil( dPartCentralLength / dMaxSegmentLength + 10 * GEO.EPS_SMALL), 1)
local dSplitPartsLen = dPartCentralLength / nSplitParts
for i = 1, ( nSplitParts - 1) do
local ptOn
local dCurrentPointX = dSplitXRight - i * dSplitPartsLen
ptOn = Point3d( dCurrentPointX, 0, 0)
table.insert( PartSplittingPoints, ptOn)
end
-- punto estremo sinistro
local dSplitXLeft = Part.b3Part:getMin():getX() + dMaxSegmentLengthOnEdges
table.insert( PartSplittingPoints, Point3d( dSplitXLeft, 0, 0))
end
return PartSplittingPoints
end
-------------------------------------------------------------------------------------------------------------
function BeamLib.AddPhaseWithRawParts( nRawId, OriXR, PosXR, dDeltaSucc)
EgtAddPhase()
@@ -193,22 +235,22 @@ end
function BeamLib.GetAffectedFaces( Proc, Part)
local vtFacesAffected = { bTop = false, bBottom = false, bFront = false, bBack = false, bLeft = false, bRight = false}
if Proc.b3Box and not Proc.b3Box:isEmpty() then
if Proc.b3Box:getMax():getZ() > Part.b3Solid:getMax():getZ() - 500 * GEO.EPS_SMALL then
if Proc.b3Box:getMax():getZ() > Part.b3Part:getMax():getZ() - 500 * GEO.EPS_SMALL then
vtFacesAffected.bTop = true
end
if Proc.b3Box:getMin():getZ() < Part.b3Solid:getMin():getZ() + 500 * GEO.EPS_SMALL then
if Proc.b3Box:getMin():getZ() < Part.b3Part:getMin():getZ() + 500 * GEO.EPS_SMALL then
vtFacesAffected.bBottom = true
end
if Proc.b3Box:getMin():getY() < Part.b3Solid:getMin():getY() + 500 * GEO.EPS_SMALL then
if Proc.b3Box:getMin():getY() < Part.b3Part:getMin():getY() + 500 * GEO.EPS_SMALL then
vtFacesAffected.bFront = true
end
if Proc.b3Box:getMax():getY() > Part.b3Solid:getMax():getY() - 500 * GEO.EPS_SMALL then
if Proc.b3Box:getMax():getY() > Part.b3Part:getMax():getY() - 500 * GEO.EPS_SMALL then
vtFacesAffected.bBack = true
end
if Proc.b3Box:getMin():getX() < Part.b3Solid:getMin():getX() + 500 * GEO.EPS_SMALL then
if Proc.b3Box:getMin():getX() < Part.b3Part:getMin():getX() + 500 * GEO.EPS_SMALL then
vtFacesAffected.bLeft = true
end
if Proc.b3Box:getMax():getX() > Part.b3Solid:getMax():getX() - 500 * GEO.EPS_SMALL then
if Proc.b3Box:getMax():getX() > Part.b3Part:getMax():getX() - 500 * GEO.EPS_SMALL then
vtFacesAffected.bRight = true
end
end
@@ -533,5 +575,56 @@ function BeamLib.TableCopyDeep( OriginalTable)
return CopiedTable
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??)
-- TODO libreria Sorting??
do
-- unisce due liste ordinate
local function MergeHalves(Left, Right, Compare)
local result = {}
local i, j = 1, 1
while i <= #Left and j <= #Right do
if Compare( Left[i], Right[j]) then
table.insert( result, Left[i])
i = i + 1
else
table.insert( result, Right[j])
j = j + 1
end
end
-- Append degli elementi rimanenti a sinistra o destra
while i <= #Left do
table.insert( result, Left[i])
i = i + 1
end
while j <= #Right do
table.insert( result, Right[j])
j = j + 1
end
return result
end
-- Merge sort
local function MergeSort( List, Compare)
if #List <= 1 then
return List
end
local mid = floor( #List / 2)
local Left = MergeSort( { table.unpack( List, 1, mid)}, Compare)
local Right = MergeSort( { table.unpack( List, mid + 1)}, Compare)
return MergeHalves( Left, Right, Compare)
end
-- chiamata accessibile dall'esterno
function BeamLib.StableSort( List, Compare)
return MergeSort( List, Compare)
end
end
-------------------------------------------------------------------------------------------------------------
return BeamLib
+4 -4
View File
@@ -386,9 +386,9 @@ end
---------------------------------------------------------------------------------------------------------------
-- DiceCut.GetDice :
-- Part : pezzo
-- MainFace : lista. Contiene tutti i dati della faccia principale. Obblogatori i campi '.ptCenter' e '.vtNormal'
-- SubordinateFace : lista. Contiene tutti i dati della faccia secondaria. Se non esiste, la lista è vuota. Se esiste, obblogatori i campi '.ptCenter' e '.vtNormal'
-- Part : pezzo
-- Face1 : table. Contiene tutti i dati della faccia principale. Obbligatori i campi '.ptCenter' e '.vtNormal'
-- Face2 : table. Contiene tutti i dati della faccia secondaria. Se non esiste, la table è vuota ({}). Se esiste, obbligatori i campi '.ptCenter' e '.vtNormal'
-- OptionaParameters : eventuali parametri opzionali
---------------------------------------------------------------------------------------------------------------
function DiceCut.GetDice( Part, Face1, Face2, OptionalParameters)
@@ -403,7 +403,7 @@ function DiceCut.GetDice( Part, Face1, Face2, OptionalParameters)
-- recupero gruppo per geometria addizionale
local nAddGrpId = BeamLib.GetAddGroup( Part.id)
-- se il box non è passato tra i parametri opzionali, faccio i calcoli sul SOLID del Part
local b3BoxToDicing = OptionalParameters.b3BoxToDicing or Part.b3Solid
local b3BoxToDicing = OptionalParameters.b3BoxToDicing or Part.b3Part
-- copio dati passati su variabili locali
local ptCMainFace, vtNMainFace, ptCSubordinateFace, vtNSubordinateFace, bGetOrtoPlanes
if Face1.ptCenter and Face1.vtNormal then
+5 -5
View File
@@ -120,7 +120,7 @@ function FaceData.GetFacesInfo( Proc, Part)
-- frame OCS faccia
Faces[i].vtFrameHV = Frame3d( Faces[i].ptCenter, Faces[i].vtN)
-- elevazione calcolata rispetto al box della parte
Faces[i].dElevation = EgtSurfTmFacetElevationInBBox( Proc.id, i - 1, Part.b3Solid, true, GDB_ID.ROOT)
Faces[i].dElevation = EgtSurfTmFacetElevationInBBox( Proc.id, i - 1, Part.b3Part, true, GDB_ID.ROOT)
-- TODO qui sarebbe meglio l'area vera e non quella del rettangolo minimo
local _, dLongEdgeDimension, dShortEdgeDimension = EgtSurfTmFacetMinAreaRectangle( Proc.id, i - 1, GDB_ID.ROOT)
Faces[i].dArea = dShortEdgeDimension * dLongEdgeDimension
@@ -180,7 +180,7 @@ local function GetTunnelFaces( Proc, Part)
end
-- faccia centrale
local nMiddleTmId = EgtSurfTmPlaneInBBox( nAddGrpId, ptTunnelCenter, vtTunnelDirection, Part.b3Solid, GDB_ID.ROOT)
local nMiddleTmId = EgtSurfTmPlaneInBBox( nAddGrpId, ptTunnelCenter, vtTunnelDirection, Part.b3Part, GDB_ID.ROOT)
-- TODO se non si riesce a costruire la faccia bisogna dare errore o semplicemente non ritornarla??
for i = 1, Proc.nFct do
EgtCutSurfTmPlane( nMiddleTmId, Proc.Faces[i].ptCenter, -Proc.Faces[i].vtN, false, GDB_ID.ROOT)
@@ -265,7 +265,7 @@ local function GetBottomFaces( Proc)
CurrentEdge.idAdjacentFace = BottomFaces[1].Edges[i].Adj
CurrentEdge.vtToolDirection = Vector3d( BottomFaces[1].Edges[i].Norm)
CurrentEdge.dLength = BottomFaces[1].Edges[i].Len
CurrentEdge.dLengthOnX = CurrentEdge.dLength * CurrentEdge.vtToolDirection:getY()
CurrentEdge.dLengthOnX = abs( CurrentEdge.dLength * CurrentEdge.vtToolDirection:getY())
CurrentEdge.dElevation = BottomFaces[1].Edges[i].Elev
CurrentEdge.bIsOpen = BottomFaces[1].Edges[i].Open
CurrentEdge.bIsStartOpen = BottomFaces[1].Edges[nPreviousEdgeIndex].Open
@@ -351,7 +351,7 @@ local function GetLongFaces( Proc, MainFaces)
CurrentEdge.idAdjacentFace = LongFaces[i].Edges[j].Adj
CurrentEdge.vtToolDirection = Vector3d( LongFaces[i].Edges[j].Norm)
CurrentEdge.dLength = LongFaces[i].Edges[j].Len
CurrentEdge.dLengthOnX = CurrentEdge.dLength * CurrentEdge.vtToolDirection:getY()
CurrentEdge.dLengthOnX = abs( CurrentEdge.dLength * CurrentEdge.vtToolDirection:getY())
CurrentEdge.dElevation = LongFaces[i].Edges[j].Elev
CurrentEdge.bIsOpen = LongFaces[i].Edges[j].Open
CurrentEdge.bIsStartOpen = LongFaces[i].Edges[nPreviousEdgeIndex].Open
@@ -438,7 +438,7 @@ local function GetSideFaces( Proc, MainFaces)
CurrentEdge.idAdjacentFace = SideFaces[i].Edges[j].Adj
CurrentEdge.vtToolDirection = Vector3d( SideFaces[i].Edges[j].Norm)
CurrentEdge.dLength = SideFaces[i].Edges[j].Len
CurrentEdge.dLengthOnX = CurrentEdge.dLength * CurrentEdge.vtToolDirection:getY()
CurrentEdge.dLengthOnX = abs( CurrentEdge.dLength * CurrentEdge.vtToolDirection:getY())
CurrentEdge.dElevation = SideFaces[i].Edges[j].Elev
CurrentEdge.bIsOpen = SideFaces[i].Edges[j].Open
CurrentEdge.bIsStartOpen = SideFaces[i].Edges[nPreviousEdgeIndex].Open
+18 -20
View File
@@ -98,14 +98,12 @@ end
---------------------------------------------------------------------
-- restituisce true se almeno una delle dimensioni della feature è maggiore o uguale ad una delle dimensioni principali del pezzo (tolleranza 1 mm)
local function IsAnyDimensionLongAsPart( Proc)
local function IsAnyDimensionLongAsPart( Proc, Part)
local bResult = false
local nBoxSolidId = EgtGetFirstNameInGroup( Proc.idPart or GDB_ID.NULL, 'Box')
local b3Solid = EgtGetBBoxGlob( nBoxSolidId, GDB_BB.STANDARD)
if Proc.b3Box:getDimX() > b3Solid:getDimX() - 1000 * GEO.EPS_SMALL or
Proc.b3Box:getDimY() > b3Solid:getDimY() - 1000 * GEO.EPS_SMALL or
Proc.b3Box:getDimZ() > b3Solid:getDimZ() - 1000 * GEO.EPS_SMALL then
if Proc.b3Box:getDimX() > Part.b3Part:getDimX() - 1000 * GEO.EPS_SMALL or
Proc.b3Box:getDimY() > Part.b3Part:getDimY() - 1000 * GEO.EPS_SMALL or
Proc.b3Box:getDimZ() > Part.b3Part:getDimZ() - 1000 * GEO.EPS_SMALL then
bResult = true
end
@@ -141,7 +139,7 @@ function FeatureLib.ClassifyTopology( Proc, Part)
local bIsFeatureCuttingEntireSection = IsFeatureCuttingEntireSection( Proc.b3Box, Part)
local bIsFeatureCuttingEntireLength = IsFeatureCuttingEntireLength( Proc.b3Box, Part)
local bIsAnyDimensionLongAsPart = IsAnyDimensionLongAsPart( Proc)
local bIsAnyDimensionLongAsPart = IsAnyDimensionLongAsPart( Proc, Part)
local vAdj = Proc.AdjacencyMatrix
local bAllAnglesConcave, bAllRightAngles = AreAllAnglesConcaveOrRight( vAdj)
local vTriangularFaces = FaceData.GetTriangularFaces( Proc)
@@ -305,13 +303,13 @@ function FeatureLib.MachiningNeedsSplitting( dMachiningLengthOnX, Part, Optional
local dMaxSegmentLength = OptionalParameters.dMaxSegmentLength or BeamData.LONGCUT_MAXLEN
bMachiningNeedsSplitting = ( dMachiningLengthOnX > dMaxSegmentLength + 10 * GEO.EPS_SMALL)
or ( dMachiningLengthOnX > 0.7 * Part.b3Solid:getDimX() + 10 * GEO.EPS_SMALL)
or ( dMachiningLengthOnX > 0.7 * Part.b3Part:getDimX() + 10 * GEO.EPS_SMALL)
return bMachiningNeedsSplitting
end
-------------------------------------------------------------------------------------------------------------
function FeatureLib.GetFeatureSplittingPoints( Proc, Part, OptionalParameters)
local vFeatureSplittingPoints = {}
local FeatureSplittingPoints = {}
local bFeatureStartsOnEdgeLeft = false
local bFeatureStartsOnEdgeRight = false
local dSplitXLeft = Proc.b3Box:getMin():getX()
@@ -333,10 +331,10 @@ function FeatureLib.GetFeatureSplittingPoints( Proc, Part, OptionalParameters)
end
-- verifica se necessari spezzoni differenti sugli estremi
if Proc.b3Box:getMin():getX() < Part.b3Solid:getMin():getX() + dMaxSegmentLengthOnEdges - 10 * GEO.EPS_SMALL then
if Proc.b3Box:getMin():getX() < Part.b3Part:getMin():getX() + dMaxSegmentLengthOnEdges - 10 * GEO.EPS_SMALL then
bFeatureStartsOnEdgeLeft = true
end
if Proc.b3Box:getMax():getX() > Part.b3Solid:getMax():getX() - dMaxSegmentLengthOnEdges + 10 * GEO.EPS_SMALL then
if Proc.b3Box:getMax():getX() > Part.b3Part:getMax():getX() - dMaxSegmentLengthOnEdges + 10 * GEO.EPS_SMALL then
bFeatureStartsOnEdgeRight = true
end
@@ -345,13 +343,13 @@ function FeatureLib.GetFeatureSplittingPoints( Proc, Part, OptionalParameters)
if bFeatureStartsOnEdgeLeft then
-- decido punto spezzatura verso la coda
if Proc.b3Box:getDimX() > dMaxSegmentLengthOnEdges * 2 then
dSplitXLeft = max( Part.b3Solid:getMin():getX() + dMaxSegmentLengthOnEdges, Proc.b3Box:getMin():getX() + dMinSegmentLength)
dSplitXLeft = max( Part.b3Part:getMin():getX() + dMaxSegmentLengthOnEdges, Proc.b3Box:getMin():getX() + dMinSegmentLength)
else
-- se pezzo abbastanza piccolo, spezzo in mezzo al 'pezzo + grezzo restante'
if Part.dRestLength + Part.b3Solid:getDimX() < BeamData.dMinRaw * 1.5 then
dSplitXLeft = Part.b3Solid:getMax():getX() - ( ( Part.dRestLength + Part.b3Solid:getDimX()) / 2)
if Part.dRestLength + Part.b3Part:getDimX() < BeamData.dMinRaw * 1.5 then
dSplitXLeft = Part.b3Part:getMax():getX() - ( ( Part.dRestLength + Part.b3Part:getDimX()) / 2)
else
dSplitXLeft = max( Proc.b3Box:getMin():getX() + ( BeamData.dMinRaw)/2 + 150, Part.b3Solid:getMax():getX() - dMaxSegmentLengthOnEdges)
dSplitXLeft = max( Proc.b3Box:getMin():getX() + ( BeamData.dMinRaw)/2 + 150, Part.b3Part:getMax():getX() - dMaxSegmentLengthOnEdges)
end
end
dFeatureCentralLength = abs( dSplitXRight - dSplitXLeft)
@@ -361,7 +359,7 @@ function FeatureLib.GetFeatureSplittingPoints( Proc, Part, OptionalParameters)
-- calcolo punto estremo destro
local ptSplitXRight
if bFeatureStartsOnEdgeRight then
dSplitXRight = min( ( Proc.b3Box:getMax():getX() - dMinSegmentLength), Part.b3Solid:getMax():getX() - dMaxSegmentLengthOnEdges)
dSplitXRight = min( ( Proc.b3Box:getMax():getX() - dMinSegmentLength), Part.b3Part:getMax():getX() - dMaxSegmentLengthOnEdges)
if dSplitXRight - dSplitXLeft < 500 * GEO.EPS_SMALL then
dSplitXRight = dSplitXLeft - dToolOverlapBetweenSegments
dFeatureCentralLength = 0
@@ -373,7 +371,7 @@ function FeatureLib.GetFeatureSplittingPoints( Proc, Part, OptionalParameters)
-- aggiungo eventuale punto estremo destro
if bFeatureStartsOnEdgeRight then
table.insert( vFeatureSplittingPoints, ptSplitXRight)
table.insert( FeatureSplittingPoints, ptSplitXRight)
end
-- aggiungo punti centrali della feature
@@ -384,16 +382,16 @@ function FeatureLib.GetFeatureSplittingPoints( Proc, Part, OptionalParameters)
local ptOn
local dCurrentPointX = dSplitXRight - i * dSplitPartsLen
ptOn = Point3d( dCurrentPointX, 0, 0)
table.insert( vFeatureSplittingPoints, ptOn)
table.insert( FeatureSplittingPoints, ptOn)
end
end
-- aggiungo eventuale punto estemo sinistro
if bFeatureStartsOnEdgeLeft then
table.insert( vFeatureSplittingPoints, ptSplitXLeft)
table.insert( FeatureSplittingPoints, ptSplitXLeft)
end
return vFeatureSplittingPoints
return FeatureSplittingPoints
end
-------------------------------------------------------------------------------------------------------------
+239 -19
View File
@@ -105,9 +105,9 @@ function MachiningLib.GetMachiningSteps( dMachiningDepth, dStep)
end
-------------------------------------------------------------------------------------------------------------
function MachiningLib.GetSplitMachinings( Machinings, vSplittingPoints, Part )
function MachiningLib.GetSplitMachinings( Machinings, SplittingPoints, Part )
for i = #Machinings, 1, -1 do
local nParts = #vSplittingPoints + 1
local nParts = #SplittingPoints + 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
@@ -122,10 +122,10 @@ function MachiningLib.GetSplitMachinings( Machinings, vSplittingPoints, Part )
for j = 1, nParts do
-- check ultimo segmento della lavorazione (NON della feature)
local bIsLastSegment = ( nParts == 1)
or ( ( ( j ~= 1) and vSplittingPoints[j - 1]:getX() > dEdgeMinX + 10 * GEO.EPS_SMALL)
and ( j == nParts or vSplittingPoints[j]:getX() < dEdgeMinX + 10 * GEO.EPS_SMALL))
or ( ( ( j ~= 1) and SplittingPoints[j - 1]:getX() > dEdgeMinX + 10 * GEO.EPS_SMALL)
and ( j == nParts or SplittingPoints[j]:getX() < dEdgeMinX + 10 * GEO.EPS_SMALL))
-- se non è l'ultimo segmento della lavorazione, il punto di spezzatura deve essere all'interno del lato che si sta lavorando
if ( j ~= nParts and ( vSplittingPoints[j]:getX() > dEdgeMinX + 10 * GEO.EPS_SMALL and vSplittingPoints[j]:getX() < dEdgeMaxX - 10 * GEO.EPS_SMALL))
if ( j ~= nParts and ( SplittingPoints[j]:getX() > dEdgeMinX + 10 * GEO.EPS_SMALL and SplittingPoints[j]:getX() < dEdgeMaxX - 10 * GEO.EPS_SMALL))
or bIsLastSegment then
if j > 1 then
nCurrentMachiningIndex = nCurrentMachiningIndex + 1
@@ -137,12 +137,15 @@ function MachiningLib.GetSplitMachinings( Machinings, vSplittingPoints, Part )
dStartAddLength, dEndAddLength = dEndAddLength, dStartAddLength
end
if j == 1 then
dEndAddLength = - ( vSplittingPoints[j]:getX() - dEdgeMinX) + BeamData.MILL_OVERLAP
dEndAddLength = - ( SplittingPoints[j]:getX() - dEdgeMinX) + BeamData.MILL_OVERLAP
Machinings[nCurrentMachiningIndex].ptCenter = Point3d( SplittingPoints[j]:getX() + ( dEdgeMaxX - SplittingPoints[j]:getX()) / 2, 0, 0)
elseif j == nParts then
dStartAddLength = - ( dEdgeMaxX - vSplittingPoints[j - 1]:getX()) + BeamData.MILL_OVERLAP
dStartAddLength = - ( dEdgeMaxX - SplittingPoints[j - 1]:getX()) + BeamData.MILL_OVERLAP
Machinings[nCurrentMachiningIndex].ptCenter = Point3d( dEdgeMinX + ( SplittingPoints[j - 1]:getX() - dEdgeMinX) / 2, 0, 0)
else
dStartAddLength = - ( dEdgeMaxX - vSplittingPoints[j - 1]:getX()) + BeamData.MILL_OVERLAP
dEndAddLength = - ( vSplittingPoints[j]:getX() - dEdgeMinX) + BeamData.MILL_OVERLAP
dStartAddLength = - ( dEdgeMaxX - SplittingPoints[j - 1]:getX()) + BeamData.MILL_OVERLAP
dEndAddLength = - ( SplittingPoints[j]:getX() - dEdgeMinX) + BeamData.MILL_OVERLAP
Machinings[nCurrentMachiningIndex].ptCenter = Point3d( SplittingPoints[j]:getX() + ( SplittingPoints[j - 1]:getX() - SplittingPoints[j]:getX()) / 2, 0, 0)
end
if MachiningLib.StartsLeftSide( Machinings[nCurrentMachiningIndex]) then
dStartAddLength, dEndAddLength = dEndAddLength, dStartAddLength
@@ -152,9 +155,9 @@ function MachiningLib.GetSplitMachinings( Machinings, vSplittingPoints, Part )
Machinings[nCurrentMachiningIndex].LeadOut.dEndAddLength = dEndAddLength
end
if not bIsLastSegment then
Machinings[nCurrentMachiningIndex].bMoveAfterSplitcut = false
Machinings[nCurrentMachiningIndex].sStage = ''
end
Machinings[nCurrentMachiningIndex].nSegment = j
Machinings[nCurrentMachiningIndex].nFeatureSegment = j
end
-- anche le lavorazioni non splittate necessitano del segmento assegnato
else
@@ -167,12 +170,14 @@ function MachiningLib.GetSplitMachinings( Machinings, vSplittingPoints, Part )
local dNextSplitX = dEdgeMinX
local dPreviousSplitX = dEdgeMaxX
if j ~= 1 then
dPreviousSplitX = vSplittingPoints[j - 1]:getX()
elseif j ~= nParts then
dNextSplitX = vSplittingPoints[j]:getX()
dPreviousSplitX = SplittingPoints[j - 1]:getX()
end
if ( dEdgeMinX - dLeftAddLength) > dNextSplitX - 10 * GEO.EPS_SMALL and ( dEdgeMaxX + dRightAddLength) < dPreviousSplitX + 10 * GEO.EPS_SMALL then
Machinings[i].nSegment = j
if j ~= nParts then
dNextSplitX = SplittingPoints[j]:getX()
end
if ( dEdgeMinX - dLeftAddLength) > dNextSplitX - 10 * GEO.EPS_SMALL and ( dEdgeMinX - dLeftAddLength) < dPreviousSplitX + 10 * GEO.EPS_SMALL then
Machinings[i].nFeatureSegment = j
Machinings[i].ptCenter = Point3d( dNextSplitX + ( dPreviousSplitX - dNextSplitX) / 2, 0, 0)
end
end
end
@@ -254,7 +259,7 @@ function MachiningLib.FindMill( Proc, ToolSearchParameters)
-- se hanno stesso montaggio
elseif TOOLS[i].SetupInfo.bToolOnAggregate == TOOLS[nBestToolIndex].SetupInfo.bToolOnAggregate then
-- scelgo utensile con indice di bontà utensile calcolato come: lunghezza / massimo materiale / diametro
if ( TOOLS[i].dLength / TOOLS[i].dMaxMaterial) / TOOLS[i].dDiameter < ( TOOLS[nBestToolIndex].dLength / TOOLS[nBestToolIndex].dMaxMaterial) / TOOLS[nBestToolIndex].dDiameter then
if TOOLS[i].dPerformanceIndex > TOOLS[nBestToolIndex].dPerformanceIndex then
nBestToolIndex = i
dBestToolResidualDepth = dCurrentResidualDepth
end
@@ -391,7 +396,7 @@ function MachiningLib.FindChainSaw( Proc, ToolSearchParameters)
-- se entrambi completi
if dBestToolResidualDepth <= 0 and dCurrentResidualDepth <= 0 then
-- scelgo utensile con rapporto lunghezza / diametro minore
if ( TOOLS[i].dLength / pow( TOOLS[i].dDiameter, 1.5)) < ( TOOLS[nBestToolIndex].dLength / pow( TOOLS[nBestToolIndex].dDiameter, 1.5)) then
if TOOLS[i].dPerformanceIndex > TOOLS[nBestToolIndex].dPerformanceIndex then
nBestToolIndex = i
dBestToolResidualDepth = dCurrentResidualDepth
end
@@ -642,7 +647,7 @@ function MachiningLib.AddOperations( vProc, Part, sRotation)
-- TODO è giusto inserire queste info alla fine della lavorazione? oppure conviene creare un record in MACHININGS apposito per la disposizione?
-- se era taglio di separazione, aggiungo nuova fase
if MACHININGS[i].AuxiliaryData.bAddNewPhase then
if MACHININGS[i].AuxiliaryData.bIsSplitOrCut then
bSplitExecuted = true
BeamLib.AddPhaseWithRawParts( MACHININGS[i].Proc.idRaw, BeamData.ptOriXR, BeamData.dPosXR, BeamData.RAW_OFFSET)
-- se grezzo successivo senza pezzi e finale, va tolto
@@ -711,5 +716,220 @@ function MachiningLib.GetToolMRR( Parameters)
return dMRR / pow( 10, 6)
end
-------------------------------------------------------------------------------------------------------------
function MachiningLib.PrepareMachiningsForSorting( Part)
local nFeatureInternalIndex = 1
for i = 1, #MACHININGS do
local MachiningCurrent = MACHININGS[i].Machining
local ProcCurrent = MACHININGS[i].Proc
if not MachiningCurrent.ptCenter then
MachiningCurrent.ptCenter = Point3d( ProcCurrent.b3Box:getCenter():getX(), 0, 0)
end
-- conversione campo sStage in nStage, numerico e ordinabile
if not MachiningCurrent.sStage or MachiningCurrent.sStage == '' then
MachiningCurrent.sStage = 'Middle'
end
if MachiningCurrent.sStage == 'Head' then
MachiningCurrent.nStage = 1
elseif MachiningCurrent.sStage == 'Tail' then
MachiningCurrent.nStage = 3
elseif MachiningCurrent.sStage == 'AfterTail' then
MachiningCurrent.nStage = 4
else
MachiningCurrent.nStage = 2
end
if i > 1 then
local MachiningPrevious = MACHININGS[i - 1].Machining
local ProcPrevious = MACHININGS[i - 1].Proc
if ProcCurrent.id == ProcPrevious.id then
-- nStage devono essere sempre uguali o crescenti nella stessa feature
if MachiningCurrent.nStage < MachiningPrevious.nStage then
MachiningCurrent.nStage = MachiningPrevious.nStage
end
-- assegnazione indice interno alla feature
nFeatureInternalIndex = nFeatureInternalIndex + 1
else
nFeatureInternalIndex = 1
end
end
MachiningCurrent.nFeatureInternalIndex = nFeatureInternalIndex
-- se fase di lavoro standard, assegnazione dello spezzone
if MachiningCurrent.nStage == 2 then
local nParts = #Part.SplittingPoints + 1
local dPartMinX = Part.b3Part:getMin():getX()
local dPartMaxX = Part.b3Part:getMax():getX()
for j = 1, nParts do
local dNextSplitX = dPartMinX
local dPreviousSplitX = dPartMaxX
if j ~= 1 then
dPreviousSplitX = Part.SplittingPoints[j - 1]:getX()
elseif j ~= nParts then
dNextSplitX = Part.SplittingPoints[j]:getX()
end
if MachiningCurrent.ptCenter:getX() > dNextSplitX - 10 * GEO.EPS_SMALL and MachiningCurrent.ptCenter:getX() < dPreviousSplitX + 10 * GEO.EPS_SMALL then
MachiningCurrent.nPartSegment = j
end
end
else
MachiningCurrent.nPartSegment = -1
end
end
return MACHININGS
end
-- TODO convertire in tabella in cui si chiamano direttamente i nomi delle funzioni, in modo da poter cambiare l'ordine facilmente
-- TODO libreria Sorting??
-------------------------------------------------------------------------------------------------------------
local SortingComparisonRules = {
-- ordine interno alla feature
function( MachiningA, MachiningB)
if MachiningA.Proc.id == MachiningB.Proc.id then
if MachiningA.Machining.nFeatureInternalIndex < MachiningB.Machining.nFeatureInternalIndex then
return 1
elseif MachiningA.Machining.nFeatureInternalIndex > MachiningB.Machining.nFeatureInternalIndex then
return -1
end
end
return 0
end,
-- dipendenze solo spostamento stage 2->4
-- TODO da fare
-- stage
function( MachiningA, MachiningB)
if MachiningA.Machining.nStage < MachiningB.Machining.nStage then
return 1
elseif MachiningA.Machining.nStage > MachiningB.Machining.nStage then
return -1
else
return 0
end
end,
-- dipendenze
-- TODO da fare
-- segment
function ( MachiningA, MachiningB)
if MachiningA.Machining.nPartSegment < MachiningB.Machining.nPartSegment then
return 1
elseif MachiningA.Machining.nPartSegment > MachiningB.Machining.nPartSegment then
return -1
else
return 0
end
end,
-- testa
-- TODO da fare
-- famiglia utensile
function ( MachiningA, MachiningB)
-- TODO tirare fuori da qua??
local ToolFamilyOrder = {
SAWBLADE = 1,
DRILLBIT = 2,
MILL = 3,
MORTISE = 4
}
local nToolFamilyOrderA = ToolFamilyOrder[ TOOLS[ MachiningA.Machining.nToolIndex].sFamily]
local nToolFamilyOrderB = ToolFamilyOrder[ TOOLS[ MachiningB.Machining.nToolIndex].sFamily]
if nToolFamilyOrderA < nToolFamilyOrderB then
return 1
elseif nToolFamilyOrderA > nToolFamilyOrderB then
return -1
else
return 0
end
end,
-- performance utensile
function( MachiningA, MachiningB)
local dToolPerformanceIndexA = TOOLS[MachiningA.Machining.nToolIndex].dPerformanceIndex
local dToolPerformanceIndexB = TOOLS[MachiningB.Machining.nToolIndex].dPerformanceIndex
if dToolPerformanceIndexA > dToolPerformanceIndexB then
return 1
elseif dToolPerformanceIndexA < dToolPerformanceIndexB then
return -1
else
return 0
end
end,
-- probabilmente arrivati qui significa che gli utensili A e B sono gli stessi
-- se così non fosse e tutte le caratteristiche sopra sono uguali, ordine alfabetico
function( MachiningA, MachiningB)
local sToolNameA = TOOLS[MachiningA.Machining.nToolIndex].sName
local sToolNameB = TOOLS[MachiningB.Machining.nToolIndex].sName
if sToolNameA < sToolNameB then
return 1
elseif sToolNameA > sToolNameB then
return -1
else
return 0
end
end,
-- lato di lavoro
-- TODO questo, insieme all'ordinamento X, andrà sostituito dallo shortest path pesato sulla quantità di rotazione della testa
function( MachiningA, MachiningB)
if MachiningA.Machining.vtToolDirection:getY() < 10 * GEO.EPS_SMALL and MachiningB.Machining.vtToolDirection:getY() >= 10 * GEO.EPS_SMALL then
return 1
elseif MachiningA.Machining.vtToolDirection:getY() >= 10 * GEO.EPS_SMALL and MachiningB.Machining.vtToolDirection:getY() < 10 * GEO.EPS_SMALL then
return -1
else
return 0
end
end,
-- ordinamento X
-- TODO questo andrà sostituito dallo shortest path pesato sulla quantità di rotazione della testa
function( MachiningA, MachiningB)
local bIsMachiningOnFront = MachiningA.Machining.vtToolDirection:getY() < 10 * GEO.EPS_SMALL
local nResult = 0
-- se lavorazione davanti ordine testa->coda
if bIsMachiningOnFront then
if MachiningA.Machining.ptCenter:getX() > MachiningB.Machining.ptCenter:getX() + 10 * GEO.EPS_SMALL then
nResult = 1
elseif MachiningA.Machining.ptCenter:getX() < MachiningB.Machining.ptCenter:getX() - 10 * GEO.EPS_SMALL then
nResult = -1
end
-- se lavorazione dietro ordine coda->testa
else
if MachiningA.Machining.ptCenter:getX() < MachiningB.Machining.ptCenter:getX() - 10 * GEO.EPS_SMALL then
nResult = 1
elseif MachiningA.Machining.ptCenter:getX() > MachiningB.Machining.ptCenter:getX() + 10 * GEO.EPS_SMALL then
nResult = -1
end
end
return nResult
end
}
-------------------------------------------------------------------------------------------------------------
function MachiningLib.CompareMachinings( MachiningA, MachiningB)
-- itera le SortingComparisonRules una per volta. Se non vi è alcuna scelta va avanti (result = 0), altrimenti ritorna true/false in base al risultato
for i = 1, #SortingComparisonRules do
local CompareFunction = SortingComparisonRules[i]
local result = CompareFunction( MachiningA, MachiningB)
if result ~= 0 then
return result > 0
end
end
return false
end
-------------------------------------------------------------------------------------------------------------
return MachiningLib
+4 -4
View File
@@ -239,7 +239,7 @@ function StrategyLib.SplitStrategy.Execute( Proc, Part, Strategy)
OptionalParameters.dLongitudinalOffset = Strategy.dOffset or 0
OptionalParameters.sUserNotes = EgtIf( Strategy.bSplit, 'Split;', 'Cut;')
Machining.AuxiliaryData.bAddNewPhase = true
Machining.AuxiliaryData.bIsSplitOrCut = true
local EdgeToMachine = StrategyLib.SplitStrategy.GetEdgeToMachine( Proc, -Y_AX())
-- approccio e retrazione
@@ -279,7 +279,7 @@ function StrategyLib.SplitStrategy.Execute( Proc, Part, Strategy)
OptionalParameters.dRadialOffset = ( Part.dWidth - BeamData.CUT_EXTRA) / 2
OptionalParameters.sUserNotes = EgtIf( Strategy.bSplit, 'Split;', 'Cut;')
Machining.AuxiliaryData.bAddNewPhase = true
Machining.AuxiliaryData.bIsSplitOrCut = true
EdgeToMachine = StrategyLib.SplitStrategy.GetEdgeToMachine( Proc, Y_AX())
-- approccio e retrazione
@@ -299,7 +299,7 @@ function StrategyLib.SplitStrategy.Execute( Proc, Part, Strategy)
OptionalParameters.dRadialOffset = -BeamData.CUT_EXTRA
OptionalParameters.sUserNotes = EgtIf( Strategy.bSplit, 'Split;', 'Cut;')
Machining.AuxiliaryData.bAddNewPhase = true
Machining.AuxiliaryData.bIsSplitOrCut = true
local EdgeToMachine = StrategyLib.SplitStrategy.GetEdgeToMachine( Proc, Z_AX())
-- approccio e retrazione
@@ -340,7 +340,7 @@ function StrategyLib.SplitStrategy.Execute( Proc, Part, Strategy)
OptionalParameters.dRadialOffset = Part.dHeight - Strategy.SplitStrategy[2].ToolInfo.dMaxMatBladeFromDown + dExtraMaxMat
OptionalParameters.sUserNotes = EgtIf( Strategy.bSplit, 'Split;', 'Cut;')
Machining.AuxiliaryData.bAddNewPhase = true
Machining.AuxiliaryData.bIsSplitOrCut = true
EdgeToMachine = StrategyLib.SplitStrategy.GetEdgeToMachine( Proc, -Z_AX())
-- approccio e retrazione
+9 -9
View File
@@ -131,15 +131,15 @@ local function MyProcessInputData()
EgtOutBox( 'Box non definito per la trave ' .. PARTS[i].sName, 'Lavora Travi', 'ERROR')
return false
else
PARTS[i].b3Box = b3Solid
PARTS[i].b3PartOriginal = b3Solid
end
end
dRawW = PARTS[1].b3Box:getDimY()
dRawH = PARTS[1].b3Box:getDimZ()
dRawW = PARTS[1].b3PartOriginal:getDimY()
dRawH = PARTS[1].b3PartOriginal:getDimZ()
local vBeamErr = {}
for i = 2, #PARTS do
local dDimW = PARTS[i].b3Box:getDimY()
local dDimH = PARTS[i].b3Box:getDimZ()
local dDimW = PARTS[i].b3PartOriginal:getDimY()
local dDimH = PARTS[i].b3PartOriginal:getDimZ()
if ( abs( dDimW - dRawW) > 10 * GEO.EPS_SMALL or abs( dDimH - dRawH) > 10 * GEO.EPS_SMALL) and
( abs( dDimH - dRawW) > 10 * GEO.EPS_SMALL or abs( dDimW - dRawH) > 10 * GEO.EPS_SMALL) then
table.insert( vBeamErr, i)
@@ -186,9 +186,9 @@ local function MyProcessBeams()
-- Lunghezza totale delle travi
local dTotLen = 0
for i = 1, #PARTS - 1 do
dTotLen = dTotLen + PARTS[i].b3Box:getDimX()
dTotLen = dTotLen + PARTS[i].b3PartOriginal:getDimX()
end
dTotLen = dTotLen + max( PARTS[#PARTS].b3Box:getDimX(), BeamData.dMinRaw)
dTotLen = dTotLen + max( PARTS[#PARTS].b3PartOriginal:getDimX(), BeamData.dMinRaw)
local dAddLen = BeamData.OVM_HEAD + ( #PARTS - 1) * BeamData.OVM_MID
EgtOutLog( 'Ltot : '..EgtNumToString( dTotLen, 1) .. ' Lagg : '..EgtNumToString( dAddLen, 1)..' MinUnloadRaw : '.. EgtNumToString( BeamData.dMinRaw + BeamData.OVM_MID, 1), 1)
@@ -277,10 +277,10 @@ local function MyProcessBeams()
local bOrd = ( vsVal[5] == 'true')
if bOrd then
table.sort( PARTS, function( B1, B2)
if abs( B1.b3Box:getDimX() - B2.b3Box:getDimX()) < 1 then
if abs( B1.b3PartOriginal:getDimX() - B2.b3PartOriginal:getDimX()) < 1 then
return B1.nInd < B2.nInd
else
return B1.b3Box:getDimX() < B2.b3Box:getDimX()
return B1.b3PartOriginal:getDimX() < B2.b3PartOriginal:getDimX()
end
end)
end
+1
View File
@@ -77,6 +77,7 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
Cutting.nToolIndex = OptionalParameters.nToolIndex
Cutting.Geometry = {{ Proc.id, FaceToMachine}}
Cutting.id = Proc.id
Cutting.vtToolDirection = vtMachiningDirection
-- ===== calcolo LeadIn/out =====
+10 -5
View File
@@ -93,7 +93,7 @@ function SLOTBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
Cutting.dResidualDepth = abs( EdgeToMachine.dElevation)
Cutting.dBladeMarkLength = 0
Cutting.sEdgeType = EdgeToMachine.sType
Cutting. nSegment = 1
Cutting.nFeatureSegment = 1
-- parametri opzionali
if not OptionalParameters then
@@ -107,7 +107,12 @@ 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
Cutting.vtToolDirection = EdgeToMachine.vtToolDirection
if EdgeToMachine.bIsOpen then
Cutting.vtEdgeDirection = -EdgeToMachine.vtToolDirection ^ FaceToMachine.vtN
else
Cutting.vtEdgeDirection = EdgeToMachine.vtToolDirection ^ FaceToMachine.vtN
end
local dPocketHeight = 0
if Proc.Topology.sFamily == 'Tunnel' then
@@ -248,7 +253,7 @@ function SLOTBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
-- se lavorazione aperta sulla coda, eventuali aggiustamenti
-- TODO valutare se fare funzione a parte
if Proc.AffectedFaces.bLeft then
if Proc.AffectedFaces.bLeft and ( EdgeToMachine.sType == 'Bottom' or ( EdgeToMachine.vtToolDirection:getX() < 10 * GEO.EPS_SMALL)) then
local bStartLeft = MachiningLib.StartsLeftSide( Cutting)
local dAddLengthLeftSide = Cutting.LeadOut.dEndAddLength
local dAddLengthToReduce = sqrt( Cutting.dDepthToMachine * TOOLS[Cutting.nToolIndex].dDiameter - Cutting.dDepthToMachine * Cutting.dDepthToMachine)
@@ -257,13 +262,13 @@ function SLOTBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
end
if not AreSameOrOppositeVectorApprox( EdgeToMachine.vtToolDirection, Y_AX()) then
if MachiningLib.CanMoveAfterSplitcut( Cutting.dLengthOnX, Part) then
Cutting.bMoveAfterSplitcut = true
Cutting.sStage = 'AfterTail'
else
Cutting.bIsApplicable = false
end
elseif dAddLengthLeftSide + dAddLengthToReduce > dExtendAfterTail then
if MachiningLib.CanMoveAfterSplitcut( Cutting.dLengthOnX, Part) then
Cutting.bMoveAfterSplitcut = true
Cutting.sStage = 'AfterTail'
else
if bStartLeft then
Cutting.LeadIn.dStartAddLength = - dAddLengthToReduce + dExtendAfterTail
+11 -6
View File
@@ -56,7 +56,7 @@ function SLOTBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
Mortising.sMessage = ''
Mortising.idProc = Proc.id
Mortising.sEdgeType = EdgeToMachine.sType
Mortising.nSegment = 1
Mortising.nFeatureSegment = 1
-- parametri opzionali
if not OptionalParameters then
@@ -74,7 +74,12 @@ 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
Mortising.vtToolDirection = EdgeToMachine.vtToolDirection
if EdgeToMachine.bIsOpen then
Mortising.vtEdgeDirection = -EdgeToMachine.vtToolDirection ^ FaceToMachine.vtN
else
Mortising.vtEdgeDirection = EdgeToMachine.vtToolDirection ^ FaceToMachine.vtN
end
-- altezza tasca, in base alla topologia
local dPocketHeight = 0
@@ -185,7 +190,7 @@ function SLOTBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
-- offset radiale
Mortising.dRadialOffset = 0
-- distanza di sicurezza
Mortising.dStartSafetyLength = max( EdgeToMachine.dElevation, 10)
Mortising.dStartSafetyLength = max( EdgeToMachine.dElevation, ( TOOLS[Mortising.nToolIndex].SetupInfo.dZSafeDelta or 60) + EgtMdbGetGeneralParam( MCH_GP.SAFEZ))
-- overlap
Mortising.dOverlap = 0
-- step
@@ -224,7 +229,7 @@ function SLOTBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
-- se lavorazione aperta sulla coda, eventuali aggiustamenti
-- TODO valutare se fare funzione a parte
if Proc.AffectedFaces.bLeft then
if Proc.AffectedFaces.bLeft and ( EdgeToMachine.sType == 'Bottom' or ( EdgeToMachine.vtToolDirection:getX() < 10 * GEO.EPS_SMALL)) then
local bStartLeft = MachiningLib.StartsLeftSide( Mortising)
local dAddLengthLeftSide = Mortising.LeadOut.dEndAddLength
if bStartLeft then
@@ -232,13 +237,13 @@ function SLOTBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
end
if not AreSameOrOppositeVectorApprox( EdgeToMachine.vtToolDirection, Y_AX()) then
if MachiningLib.CanMoveAfterSplitcut( Mortising.dLengthOnX, Part) then
Mortising.bMoveAfterSplitcut = true
Mortising.sStage = 'AfterTail'
else
Mortising.bIsApplicable = false
end
elseif dAddLengthLeftSide + TOOLS[Mortising.nToolIndex].dDiameter / 2 > dExtendAfterTail then
if MachiningLib.CanMoveAfterSplitcut( Mortising.dLengthOnX, Part) then
Mortising.bMoveAfterSplitcut = true
Mortising.sStage = 'AfterTail'
else
if bStartLeft then
Mortising.LeadIn.dStartAddLength = - TOOLS[Mortising.nToolIndex].dDiameter / 2 + dExtendAfterTail
+6
View File
@@ -279,6 +279,7 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
-- approccio e retrazione
OptionalParameters.LeadIn, OptionalParameters.LeadOut = CalculateLeadInOut( Splitting, EdgeToMachine)
Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1].id, EdgeToMachine, OptionalParameters)
Splitting.sStage = 'Head'
MachiningLib.AddNewMachining( Proc, Splitting, AuxiliaryData)
----------------------------------------------------------------------------------
elseif Strategy.sSplitStrategy.sTypeMachining == 'BladeSideDouble' then
@@ -295,6 +296,7 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
-- approccio e retrazione
OptionalParameters.LeadIn, OptionalParameters.LeadOut = CalculateLeadInOut( Splitting, EdgeToMachine)
Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1].id, EdgeToMachine, OptionalParameters)
Splitting.sStage = 'Head'
MachiningLib.AddNewMachining( Proc, Splitting, AuxiliaryData)
-- Taglio lato dietro
@@ -312,6 +314,7 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
-- approccio e retrazione
OptionalParameters.LeadIn, OptionalParameters.LeadOut = CalculateLeadInOut( Splitting, EdgeToMachine)
Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1].id, EdgeToMachine, OptionalParameters)
Splitting.sStage = 'Head'
MachiningLib.AddNewMachining( Proc, Splitting, AuxiliaryData)
----------------------------------------------------------------------------------
elseif Strategy.sSplitStrategy.sTypeMachining == 'BladeHorizontalSingle' then
@@ -327,6 +330,7 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
-- approccio e retrazione
OptionalParameters.LeadIn, OptionalParameters.LeadOut = CalculateLeadInOut( Splitting, EdgeToMachine)
Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1].id, EdgeToMachine, OptionalParameters)
Splitting.sStage = 'Head'
MachiningLib.AddNewMachining( Proc, Splitting, AuxiliaryData)
----------------------------------------------------------------------------------
elseif Strategy.sSplitStrategy.sTypeMachining == 'BladeHorizontalDouble' then
@@ -344,6 +348,7 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
-- approccio e retrazione
OptionalParameters.LeadIn, OptionalParameters.LeadOut = CalculateLeadInOut( Splitting, EdgeToMachine)
Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1].id, EdgeToMachine, OptionalParameters)
Splitting.sStage = 'Head'
MachiningLib.AddNewMachining( Proc, Splitting, AuxiliaryData)
-- Taglio lato dietro
@@ -361,6 +366,7 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
-- approccio e retrazione
OptionalParameters.LeadIn, OptionalParameters.LeadOut = CalculateLeadInOut( Splitting, EdgeToMachine)
Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1].id, EdgeToMachine, OptionalParameters)
Splitting.sStage = 'Head'
MachiningLib.AddNewMachining( Proc, Splitting, AuxiliaryData)
----------------------------------------------------------------------------------
elseif Strategy.sSplitStrategy.sTypeMachining == 'ChainSawHorizontal' then
+11 -8
View File
@@ -360,29 +360,29 @@ local function GetSplitSurfaces( Proc, Part)
end
-- recupero punti di spezzatura - da destra a sinistra
local vFeatureSplittingPoints = FeatureLib.GetFeatureSplittingPoints( Proc, Part)
local FeatureSplittingPoints = FeatureLib.GetFeatureSplittingPoints( Proc, Part)
if #vFeatureSplittingPoints == 0 then
if #FeatureSplittingPoints == 0 then
local nAddId = EgtCopyGlob( Proc.id, nAddGrpId) or GDB_ID.NULL
local nAddIdTunnel = EgtCopyGlob( nOriginalTmIdTunnel, nAddGrpId) or GDB_ID.NULL
table.insert( vAddId, nAddId)
table.insert( vAddIdTunnel, nAddIdTunnel)
else
for i = 1, #vFeatureSplittingPoints do
for i = 1, #FeatureSplittingPoints do
local nAddId = EgtCopyGlob( Proc.id, nAddGrpId) or GDB_ID.NULL
local nAddIdTunnel = EgtCopyGlob( nOriginalTmIdTunnel, nAddGrpId) or GDB_ID.NULL
if i == 1 then
-- prima superficie, va tagliata solo a sinistra
local ptSplit = vFeatureSplittingPoints[i] + Vector3d( -BeamData.MILL_OVERLAP / 2, 0, 0)
local ptSplit = FeatureSplittingPoints[i] + Vector3d( -BeamData.MILL_OVERLAP / 2, 0, 0)
EgtCutSurfTmPlane( nAddId, ptSplit, -X_AX(), true, GDB_RT.GLOB)
EgtCutSurfTmPlane( nAddIdTunnel, ptSplit, -X_AX(), true, GDB_RT.GLOB)
else
-- taglio della superficie corrente - lato sinistro
local ptSplit = vFeatureSplittingPoints[i] + Vector3d( -BeamData.MILL_OVERLAP / 2, 0, 0)
local ptSplit = FeatureSplittingPoints[i] + Vector3d( -BeamData.MILL_OVERLAP / 2, 0, 0)
EgtCutSurfTmPlane( nAddId, ptSplit, -X_AX(), true, GDB_RT.GLOB)
EgtCutSurfTmPlane( nAddIdTunnel, ptSplit, -X_AX(), true, GDB_RT.GLOB)
-- taglio della superficie corrente - lato destro
ptSplit = vFeatureSplittingPoints[i - 1] + Vector3d( BeamData.MILL_OVERLAP / 2, 0, 0)
ptSplit = FeatureSplittingPoints[i - 1] + Vector3d( BeamData.MILL_OVERLAP / 2, 0, 0)
EgtCutSurfTmPlane( nAddId, ptSplit, X_AX(), true, GDB_RT.GLOB)
EgtCutSurfTmPlane( nAddIdTunnel, ptSplit, X_AX(), true, GDB_RT.GLOB)
end
@@ -392,7 +392,7 @@ local function GetSplitSurfaces( Proc, Part)
-- taglio ultima superficie, va tagliata solo a destra
local nAddId = EgtCopyGlob( Proc.id, nAddGrpId) or GDB_ID.NULL
local nAddIdTunnel = EgtCopyGlob( nOriginalTmIdTunnel, nAddGrpId) or GDB_ID.NULL
local ptSplit = vFeatureSplittingPoints[#vFeatureSplittingPoints] + Vector3d( BeamData.MILL_OVERLAP / 2, 0, 0)
local ptSplit = FeatureSplittingPoints[#FeatureSplittingPoints] + Vector3d( BeamData.MILL_OVERLAP / 2, 0, 0)
EgtCutSurfTmPlane( nAddId, ptSplit, X_AX(), true, GDB_RT.GLOB)
EgtCutSurfTmPlane( nAddIdTunnel, ptSplit, X_AX(), true, GDB_RT.GLOB)
table.insert( vAddId, nAddId)
@@ -438,6 +438,7 @@ function STR0002.Make( bAddMachining, Proc, Part, CustomParameters)
vAddId, vAddIdTunnel = GetSplitSurfaces( Proc, Part)
-- si applicano le lavorazioni
-- TODO manca la gestione delle lavorazioni dopo separazione
for i = 1, #vAddId do
for j = 1, #Strategy.Machining do
if Strategy.Machining[j].bIsApplicable then
@@ -460,13 +461,15 @@ function STR0002.Make( bAddMachining, Proc, Part, CustomParameters)
-- se ho una sola trimesh, sto lavorando la Proc direttamente e non ho spezzato. Applico direttamente alla geometria calcolata prima
if #vAddId == 1 then
Pocketing.Geometry = {{ Strategy.Machining[j].idProc, Strategy.Machining[j].idFaceToMachine}}
Pocketing.vtToolDirection = Proc.Faces[ Strategy.Machining[j].idFaceToMachine + 1].vtN
bAreAllMachiningsAdded = MachiningLib.AddNewMachining( Proc, Pocketing)
else
-- TODO settare parametro per indicare qual è lo spezzone che deve essere fatto dopo il taglio di separazione
for k = 1, Proc.nFct do
local vtNSplitFace
local nIdTm = EgtIf( Strategy.Machining[j].bMachAppliedToTunnelFace, vAddIdTunnel[i], vAddId[i])
vtNSplitFace = EgtSurfTmFacetNormVersor( nIdTm, k - 1, GDB_ID.ROOT)
Pocketing.ptCenter, vtNSplitFace = EgtSurfTmFacetCenter( nIdTm, k - 1, GDB_ID.ROOT)
Pocketing.vtToolDirection = vtNSplitFace
if vtNSplitFace and AreSameVectorApprox( vtNSplitFace * EgtIf( Pocketing.bToolInvert, -1, 1), Strategy.Machining[j].vtFaceNormal) then
Pocketing.Geometry = {{ nIdTm, k - 1}}
bAreAllMachiningsAdded = bAreAllMachiningsAdded and MachiningLib.AddNewMachining( Proc, Pocketing)
+9 -9
View File
@@ -62,9 +62,9 @@ end
-- TODO si può unificare con eguale funzione in STR0004
local function SortMachiningsBySegment( MachiningA, MachiningB)
if MachiningA.nSegment > MachiningB.nSegment then
if MachiningA.nFeatureSegment > MachiningB.nFeatureSegment then
return false
elseif MachiningB.nSegment > MachiningA.nSegment then
elseif MachiningB.nFeatureSegment > MachiningA.nFeatureSegment then
return true
else
if TOOLS[ MachiningA.nToolIndex].sFamily == 'SAWBLADE' and TOOLS[ MachiningB.nToolIndex].sFamily == 'MORTISE' then
@@ -88,9 +88,9 @@ local function SortMachiningsByTool( MachiningA, MachiningB)
elseif TOOLS[ MachiningA.nToolIndex].sFamily == 'MORTISE' and TOOLS[ MachiningB.nToolIndex].sFamily == 'SAWBLADE' then
return false
else
if MachiningA.nSegment > MachiningB.nSegment then
if MachiningA.nFeatureSegment > MachiningB.nFeatureSegment then
return false
elseif MachiningB.nSegment > MachiningA.nSegment then
elseif MachiningB.nFeatureSegment > MachiningA.nFeatureSegment then
return true
else
if MachiningA.sEdgeType == 'Side' and MachiningB.sEdgeType ~= 'Side' then
@@ -303,9 +303,9 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
-- lama - lavorazioni raggruppate in unica lista
Blade.Result.Sorted = MergeResults( Blade.Result)
-- lama - aggiunta eventuali lavorazioni splittate
local vFeatureSplittingPoints = FeatureLib.GetFeatureSplittingPoints( Proc, Part)
if #vFeatureSplittingPoints > 0 then
Blade.Result.Sorted = MachiningLib.GetSplitMachinings( Blade.Result.Sorted, vFeatureSplittingPoints, Part)
local FeatureSplittingPoints = FeatureLib.GetFeatureSplittingPoints( Proc, Part)
if #FeatureSplittingPoints > 0 then
Blade.Result.Sorted = MachiningLib.GetSplitMachinings( Blade.Result.Sorted, FeatureSplittingPoints, Part)
end
-- lama - nessuna lavorazione successiva - aggiunta lavorazioni e calcolo risultati
if not Strategy.Parameters.bFinishWithChainSaw then
@@ -500,8 +500,8 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
-- sega a catena - lavorazioni raggruppate in unica lista
Chainsaw.Result.Sorted = MergeResults( Chainsaw.Result)
-- sega a catena - aggiunta eventuali lavorazioni splittate
if #vFeatureSplittingPoints > 0 then
Chainsaw.Result.Sorted = MachiningLib.GetSplitMachinings( Chainsaw.Result.Sorted, vFeatureSplittingPoints, Part)
if #FeatureSplittingPoints > 0 then
Chainsaw.Result.Sorted = MachiningLib.GetSplitMachinings( Chainsaw.Result.Sorted, FeatureSplittingPoints, Part)
end
-- tutte le lavorazioni di tutti gli utensili in unica lista
+7 -6
View File
@@ -57,10 +57,11 @@ local function GetCompletionPercentage( Proc, Result)
end
-- TODO si può unificare con Sorting generale
local function SortMachiningsBySegment( MachiningA, MachiningB)
if MachiningA.nSegment > MachiningB.nSegment then
if MachiningA.nFeatureSegment > MachiningB.nFeatureSegment then
return false
elseif MachiningB.nSegment > MachiningA.nSegment then
elseif MachiningB.nFeatureSegment > MachiningA.nFeatureSegment then
return true
else
if MachiningA.sEdgeType == 'Side' and MachiningB.sEdgeType ~= 'Side' then
@@ -156,7 +157,7 @@ function STR0004.Make( bAddMachining, Proc, Part, CustomParameters)
-- calcolo lavorazioni
local Mortising = {}
OptionalParameters = { dExtendAfterTail = dExtendAfterTail}
local OptionalParameters = { dExtendAfterTail = dExtendAfterTail}
if Proc.Topology.sName == 'Groove-4-Blind' or Proc.Topology.sName == 'Pocket-5-Blind' then
-- si lavora tutto il fondo
local OptionalParameters = { dExtendAfterTail = dExtendAfterTail}
@@ -234,9 +235,9 @@ function STR0004.Make( bAddMachining, Proc, Part, CustomParameters)
end
-- aggiunta eventuali lavorazioni splittate
local vFeatureSplittingPoints = FeatureLib.GetFeatureSplittingPoints( Proc, Part)
if #vFeatureSplittingPoints > 0 then
Chainsaw.Result.Sorted = MachiningLib.GetSplitMachinings( Chainsaw.Result.Sorted, vFeatureSplittingPoints, Part)
local FeatureSplittingPoints = FeatureLib.GetFeatureSplittingPoints( Proc, Part)
if #FeatureSplittingPoints > 0 then
Chainsaw.Result.Sorted = MachiningLib.GetSplitMachinings( Chainsaw.Result.Sorted, FeatureSplittingPoints, Part)
end
-- ordinamento
+1
View File
@@ -89,6 +89,7 @@ function TAILCUT.Make( bAddMachining, Proc, Part, CustomParameters)
-- aggiungo lavorazioni trovate alla lista generale
for i = 1, #MachiningsToAdd do
MachiningsToAdd[i].Splitting.sStage = 'Tail'
MachiningLib.AddNewMachining( Proc, MachiningsToAdd[i].Splitting, MachiningsToAdd[i].AuxiliaryData)
end