- in BatchProcessNew e BeamExec, dove si salva il Box del Part si salva anche idBoxTm, id della trimesh del box
- in BeamLib rimosse funzioni GetPlaneOrientation e IsEdgeOnBox, non usate - in MachiningLib rivista completamente GetBladeEngagement e aggiunta Check2DBladeCollision
This commit is contained in:
+4
-2
@@ -235,7 +235,8 @@ elseif BEAM.FLAG == 9 then
|
||||
|
||||
local Part = {}
|
||||
Part.id = EgtGetParent( EgtGetParent( BEAM.FEATUREID))
|
||||
Part.b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( Part.id, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
Part.idBoxTm = EgtGetFirstInGroup( EgtGetFirstNameInGroup( Part.id, 'Box') or GDB_ID.NULL)
|
||||
Part.b3Part = EgtGetBBoxGlob( Part.idBoxTm, GDB_BB.STANDARD)
|
||||
|
||||
local Proc = FeatureLib.GetProcFromTrimesh( BEAM.FEATUREID, Part)
|
||||
Proc.nGrp = EgtGetInfo( Proc.id, 'GRP', 'i')
|
||||
@@ -573,7 +574,8 @@ if bToProcess then
|
||||
PARTS[i].dRawWidth = PARTS[i].b3Raw:getDimY()
|
||||
PARTS[i].dRawHeight = PARTS[i].b3Raw:getDimZ()
|
||||
-- dimensione pezzo finito
|
||||
PARTS[i].b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[i].id, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
PARTS[i].idBoxTm = EgtGetFirstInGroup( EgtGetFirstNameInGroup( PARTS[i].id, 'Box') or GDB_ID.NULL)
|
||||
PARTS[i].b3Part = EgtGetBBoxGlob( PARTS[i].idBoxTm, GDB_BB.STANDARD)
|
||||
PARTS[i].dLength = PARTS[i].b3Part:getDimX()
|
||||
PARTS[i].dWidth = PARTS[i].b3Part:getDimY()
|
||||
PARTS[i].dHeight = PARTS[i].b3Part:getDimZ()
|
||||
|
||||
@@ -477,7 +477,8 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS, b
|
||||
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].b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[i].id, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
PARTS[i].idBoxTm = EgtGetFirstInGroup( EgtGetFirstNameInGroup( PARTS[i].id, 'Box') or GDB_ID.NULL)
|
||||
PARTS[i].b3Part = EgtGetBBoxGlob( PARTS[i].idBoxTm, GDB_BB.STANDARD)
|
||||
PARTS[i].nIndexInParts = i
|
||||
PARTS[i].SplittingPoints = BeamLib.GetPartSplittingPoints( PARTS[i])
|
||||
PARTS[i].NotClampableLength = { STD = { dHead = 0, dTail = 0}, SIDE = { dHead = 0, dTail = 0}, DOWN = { dHead = 0, dTail = 0}}
|
||||
@@ -1145,7 +1146,7 @@ local function CalculateMachinings( vProc, Part, nInitialRotation)
|
||||
end
|
||||
-- aggiorno info pezzo
|
||||
Part.b3Raw = EgtGetRawPartBBox( Part.idRaw)
|
||||
Part.b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( Part.id, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
Part.b3Part = EgtGetBBoxGlob( Part.idBoxTm, GDB_BB.STANDARD)
|
||||
-- si applicano le strategie
|
||||
if Proc.ChosenStrategy then
|
||||
-- carico file script strategia (non serve verificare presenza del file perchè già fatto durante scelta strategia)
|
||||
@@ -1171,7 +1172,7 @@ local function CalculateMachinings( vProc, Part, nInitialRotation)
|
||||
BeamLib.RotateRawPart( Part, 1 - nCurrRotation)
|
||||
-- aggiorno info pezzo
|
||||
Part.b3Raw = EgtGetRawPartBBox( Part.idRaw)
|
||||
Part.b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( Part.id, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
Part.b3Part = EgtGetBBoxGlob( Part.idBoxTm, GDB_BB.STANDARD)
|
||||
end
|
||||
return MACHININGS, bAreAllApplyOk
|
||||
end
|
||||
@@ -1227,14 +1228,14 @@ function BeamExec.GetProcessings( PARTS, bCalcBestPieceUnloadPosition)
|
||||
BeamLib.RotateRawPart( PARTS[nPart], 1)
|
||||
-- aggiorno info pezzo
|
||||
PARTS[nPart].b3Raw = EgtGetRawPartBBox( PARTS[nPart].idRaw)
|
||||
PARTS[nPart].b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[nPart].id, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
PARTS[nPart].b3Part = EgtGetBBoxGlob( PARTS[nPart].idBoxTm, GDB_BB.STANDARD)
|
||||
end
|
||||
if bCalcBestPieceUnloadPosition then
|
||||
-- inversione pezzo testa-coda
|
||||
BeamLib.InvertRawPart( PARTS[nPart], 2)
|
||||
-- aggiorno info pezzo
|
||||
PARTS[nPart].b3Raw = EgtGetRawPartBBox( PARTS[nPart].idRaw)
|
||||
PARTS[nPart].b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[nPart].id, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
PARTS[nPart].b3Part = EgtGetBBoxGlob( PARTS[nPart].idBoxTm, GDB_BB.STANDARD)
|
||||
end
|
||||
end
|
||||
local Part = {}
|
||||
@@ -1543,14 +1544,14 @@ function BeamExec.GetCombinationMatrix( PARTS, bCalcBestPieceUnloadPosition)
|
||||
BeamLib.RotateRawPart( PARTS[nPart], 1)
|
||||
-- aggiorno info pezzo
|
||||
PARTS[nPart].b3Raw = EgtGetRawPartBBox( PARTS[nPart].idRaw)
|
||||
PARTS[nPart].b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[nPart].id, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
PARTS[nPart].b3Part = EgtGetBBoxGlob( PARTS[nPart].idBoxTm, GDB_BB.STANDARD)
|
||||
end
|
||||
if bCalcBestPieceUnloadPosition then
|
||||
-- inversione del pezzo testa-coda
|
||||
BeamLib.InvertRawPart( PARTS[nPart], 2)
|
||||
-- aggiorno info pezzo
|
||||
PARTS[nPart].b3Raw = EgtGetRawPartBBox( PARTS[nPart].idRaw)
|
||||
PARTS[nPart].b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[nPart].id, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
PARTS[nPart].b3Part = EgtGetBBoxGlob( PARTS[nPart].idBoxTm, GDB_BB.STANDARD)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -785,77 +785,6 @@ function BeamLib.FindEdgeBestOrientedAsDirection( Edges, vtDirection)
|
||||
return BestEdge
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.GetPlaneOrientation( vtN)
|
||||
local x = vtN:getX()
|
||||
local y = vtN:getY()
|
||||
local z = vtN:getZ()
|
||||
|
||||
-- modulo della proiezione in ogni piano
|
||||
local Orientation = {
|
||||
{ sPlane = "XY", dMagnitude = EgtClamp( sqrt( x^2 + y^2), 0, 1)},
|
||||
{ sPlane = "XZ", dMagnitude = EgtClamp( sqrt( x^2 + z^2), 0, 1)},
|
||||
{ sPlane = "YZ", dMagnitude = EgtClamp( sqrt( y^2 + z^2), 0, 1)}
|
||||
}
|
||||
|
||||
-- modulo totale in 3d
|
||||
local dTotalMagnitude = EgtClamp( sqrt( x^2 + y^2 + z^2), 0, 1)
|
||||
|
||||
-- incidenza del modulo in ogni piano
|
||||
for i = 1, #Orientation do
|
||||
-- se il modulo è nullo, si restituisce 0 in tutti i piani
|
||||
if dTotalMagnitude == 0 then
|
||||
Orientation[i].dRelativeMagnitude = 0
|
||||
-- altrimenti, si calcola l'incidenza relativa
|
||||
else
|
||||
Orientation[i].dRelativeMagnitude = Orientation[i].dMagnitude / dTotalMagnitude
|
||||
end
|
||||
end
|
||||
|
||||
-- si ordina per incidenza in ogni piano
|
||||
table.sort( Orientation, function (a, b) return a.dRelativeMagnitude > b.dRelativeMagnitude end)
|
||||
|
||||
return Orientation
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.IsEdgeOnBox( Face, Edge, b3Box)
|
||||
-- TODO sostituire con informazioni direttamente da box e rimuuovere il parametro Face
|
||||
local ptEdge1, _, ptEdge2 = EgtSurfTmFacetOppositeSide( Face.idTrimesh, Face.id, -Edge.vtN, GDB_ID.ROOT)
|
||||
|
||||
-- il lato è sul box se i suoi estremi sono entrambi sullo stesso lato del box
|
||||
if ptEdge1:getZ() > b3Box:getMax():getZ() - 500 * GEO.EPS_SMALL
|
||||
and ptEdge2:getZ() > b3Box:getMax():getZ() - 500 * GEO.EPS_SMALL then
|
||||
|
||||
return true
|
||||
end
|
||||
if ptEdge1:getZ() > b3Box:getMin():getZ() - 500 * GEO.EPS_SMALL
|
||||
and ptEdge2:getZ() > b3Box:getMin():getZ() - 500 * GEO.EPS_SMALL then
|
||||
|
||||
return true
|
||||
end
|
||||
if ptEdge1:getY() > b3Box:getMax():getY() - 500 * GEO.EPS_SMALL
|
||||
and ptEdge2:getY() > b3Box:getMax():getY() - 500 * GEO.EPS_SMALL then
|
||||
|
||||
return true
|
||||
end
|
||||
if ptEdge1:getY() > b3Box:getMin():getY() - 500 * GEO.EPS_SMALL
|
||||
and ptEdge2:getY() > b3Box:getMin():getY() - 500 * GEO.EPS_SMALL then
|
||||
|
||||
return true
|
||||
end
|
||||
if ptEdge1:getX() > b3Box:getMax():getX() - 500 * GEO.EPS_SMALL
|
||||
and ptEdge2:getX() > b3Box:getMax():getX() - 500 * GEO.EPS_SMALL then
|
||||
|
||||
return true
|
||||
end
|
||||
if ptEdge1:getX() > b3Box:getMin():getX() - 500 * GEO.EPS_SMALL
|
||||
and ptEdge2:getX() > b3Box:getMin():getX() - 500 * GEO.EPS_SMALL then
|
||||
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- nNearSide : 3=Z+, -3=Z-
|
||||
function BeamLib.PutStartNearestToEdge( nCrvId, b3Raw, dMaxDist, nNearSide)
|
||||
|
||||
@@ -181,7 +181,7 @@ function FaceData.GetFacesInfo( Proc, Part, FacesToGet)
|
||||
Faces[i].ptCenter, Faces[i].vtN = EgtSurfTmFacetCenter( Proc.id, i - 1, GDB_ID.ROOT)
|
||||
if Proc.nFct < 6 or FaceIsToGet( i) then
|
||||
-- frame OCS faccia
|
||||
Faces[i].vtFrameHV = Frame3d( Faces[i].ptCenter, Faces[i].vtN)
|
||||
Faces[i].frFrameHV = Frame3d( Faces[i].ptCenter, Faces[i].vtN)
|
||||
-- elevazione calcolata rispetto al box della parte
|
||||
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
|
||||
|
||||
+38
-102
@@ -284,104 +284,47 @@ local function IsFaceZOutOfRange ( vtNFace, Tool)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function IsBladeOrientationOkForDownUp( Face, Edge, b3Part)
|
||||
local function Check2DBladeCollision( Edge, vtHead, Part, Tool, dDepthToMachine)
|
||||
local idTempGroup = BeamLib.GetTempGroup()
|
||||
|
||||
-- se l'utensile lavora perpendicolarmente, l'orientamento è sempre valido per DownUp
|
||||
if AreSameVectorApprox( Face.vtN, Edge.vtN) then
|
||||
|
||||
return true
|
||||
end
|
||||
-- nel piano perpendicolare alla direzione di taglio, se c'è intersezione tra motore e trave c'è collisione
|
||||
|
||||
-- componente Z negativa di vtTool, ossia testa sotto alla trave e rischio collisione carro Z: non lavorabile in Downup
|
||||
-- TODO con lama da sopra il test è per Z > 0!!!
|
||||
if Edge.vtN:getZ() < - 10 * GEO.EPS_SMALL then
|
||||
|
||||
return false
|
||||
end
|
||||
-- riferimento perpendicolare al taglio, X nel verso della normale al lato e Y verso il motore
|
||||
local ptMid = Point3d( ( Edge.ptStart + Edge.ptEnd) / 2)
|
||||
local vtEdge = Edge.ptEnd - Edge.ptStart
|
||||
vtEdge:normalize()
|
||||
local frBlade = Frame3d( ptMid, vtEdge, Edge.vtN)
|
||||
|
||||
-- orientamento 3d della faccia: non lavorabile in DownUp
|
||||
-- TODO implementare gestione DownUp in 3d
|
||||
local FaceOrientation = BeamLib.GetPlaneOrientation( Face.vtN)
|
||||
if FaceOrientation[1].dRelativeMagnitude < 1 - 10 * GEO.EPS_SMALL then
|
||||
|
||||
return false
|
||||
-- silhouette del pezzo nel riferimento
|
||||
local idFirstCurve, nCurveCount = EgtGetSurfTmSilhouette( Part.idBoxTm, vtEdge, 10 * GEO.EPS_SMALL, idTempGroup)
|
||||
-- se più curve c'è qualcosa che non va: errore
|
||||
if nCurveCount > 1 then
|
||||
error( 'Check2DBladeCollision : error in part box')
|
||||
end
|
||||
|
||||
-- orientamento 2d: si determinano il piano della faccia e la direzione perpendicolare
|
||||
local sPlane = FaceOrientation[1].sPlane
|
||||
local vtPerpendicularToPlane
|
||||
if sPlane == 'XY' then
|
||||
vtPerpendicularToPlane = Z_AX()
|
||||
elseif sPlane == 'XZ' then
|
||||
vtPerpendicularToPlane = Y_AX()
|
||||
elseif sPlane == 'YZ' then
|
||||
vtPerpendicularToPlane = X_AX()
|
||||
end
|
||||
-- flat region del pezzo nel riferimento
|
||||
local idPartSurfFr = EgtSurfFlatRegion( idTempGroup, idFirstCurve)
|
||||
|
||||
-- se l'utensile è in direzione perpendicolare al piano, l'orientamento è sempre valido per DownUp
|
||||
if AreSameOrOppositeVectorApprox( Edge.vtN, vtPerpendicularToPlane) then
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
-- se tutte le condizioni precedenti sono soddisfatte, il DownUp si può fare se lungo l'asse in cui Face.vtN e Edge.vtN sono discordi il punto iniziale del lato è sul box
|
||||
-- in pratica, ciò significa che il braccio non entrerà in collisione con la trave
|
||||
-- TODO in realtà così si escludono dei casi di faccia non troncante in cui aumenterebbe l'elevation ma si potrebbe comunque lavorare
|
||||
local _, ptOnBox = EgtSurfTmFacetOppositeSide( Face.idTrimesh, Face.id, -Edge.vtN, GDB_ID.ROOT)
|
||||
-- Helper function: verifica se i vettori sono discordi lungo l'asse indicato e, se sì, se il punto iniziale della lavorazione è sul box oppure no, nella direzione dell'utensile
|
||||
local function IsDiscordantAndOnBox( sAxis)
|
||||
-- si compongono i metodi getX, getY, getZ in base all'asse in arrivo (Face.vtN[getX] equivale a Face.vtN:getX())
|
||||
local dFaceComponent = Face.vtN["get" .. sAxis](Face.vtN)
|
||||
local dEdgeComponent = Edge.vtN["get" .. sAxis](Edge.vtN)
|
||||
local dPtonboxComponent = ptOnBox["get" .. sAxis](ptOnBox)
|
||||
local dMaxb3PartComponent = b3Part:getMax()["get" .. sAxis](b3Part:getMax())
|
||||
local dMinb3PartComponent = b3Part:getMin()["get" .. sAxis](b3Part:getMin())
|
||||
|
||||
if dFaceComponent * dEdgeComponent < 10 * GEO.EPS_SMALL then
|
||||
if dEdgeComponent > GEO.EPS_SMALL then
|
||||
return dPtonboxComponent > dMaxb3PartComponent - 500 * GEO.EPS_SMALL
|
||||
else
|
||||
return dPtonboxComponent < dMinb3PartComponent + 500 * GEO.EPS_SMALL
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
-- in base all'orientamento, si verifica se il DownUp è fattibile
|
||||
if sPlane == 'XY' then
|
||||
if IsDiscordantAndOnBox( "X") then
|
||||
return true
|
||||
elseif IsDiscordantAndOnBox( "Y") then
|
||||
return true
|
||||
end
|
||||
elseif sPlane == 'XZ' then
|
||||
if IsDiscordantAndOnBox( "X") then
|
||||
return true
|
||||
elseif IsDiscordantAndOnBox( "Z") then
|
||||
return true
|
||||
end
|
||||
elseif sPlane == 'YZ' then
|
||||
if IsDiscordantAndOnBox( "Y") then
|
||||
return true
|
||||
elseif IsDiscordantAndOnBox( "Z") then
|
||||
return true
|
||||
end
|
||||
end
|
||||
-- flat region del motore nel riferimento
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- ritorna se la faccia e il lato sono lavorabili e, se sì, il modo di lavorare (standard/DownUp) e l'elevazione corretta (in DownUp può cambiare)
|
||||
function MachiningLib.GetBladeEngagement( Face, Edge, b3Part, Tool, dDepthToMachine, bAvoidCollisionCheckForStandardCut)
|
||||
-- ritorna se la faccia e il lato sono lavorabili e, se sì, il modo di lavorare (standard/DownUp)
|
||||
-- TODO si dovrà decidere come tagliare anche in base a lavorazione di coda (spostare dopo separazione?) o pezzo corto (il motore non deve ingombrare con il pinzaggio)
|
||||
-- valutare se restituire, se disponibili, entrambe le soluzioni e demandare la decisione alla FaceByBlade
|
||||
function MachiningLib.GetBladeEngagement( Face, Edge, Part, Tool, dDepthToMachine, bAvoidCollisionCheckForStandardCut)
|
||||
local sBladeEngagement = 'Standard'
|
||||
local dDownUpElevation = Edge.dElevation
|
||||
|
||||
-- la normale della faccia permette di lavorare in modo standard, ma potrebbero esserci altre condizioni che fanno fallire il taglio
|
||||
if not IsFaceZOutOfRange( Face.vtN, Tool) then
|
||||
|
||||
-- TODO verifica collisione carro Z, collisione traversa PF, collisione 'C' Fast... La riduzione percorso cambia questo test?
|
||||
if bAvoidCollisionCheckForStandardCut or not Check2DBladeCollision( Edge, Face.vtN, Part, Tool, dDepthToMachine) then
|
||||
|
||||
return true, sBladeEngagement
|
||||
return true, sBladeEngagement
|
||||
end
|
||||
end
|
||||
|
||||
-- faccia non lavorabile in modo standard: si verifica se il DownUp è fattibile
|
||||
@@ -391,26 +334,22 @@ function MachiningLib.GetBladeEngagement( Face, Edge, b3Part, Tool, dDepthToMach
|
||||
return false
|
||||
end
|
||||
|
||||
-- faccia non parallelogramma: non lavorabile in DownUp
|
||||
if not FaceData.IsFaceParallelogram( Face) then
|
||||
|
||||
-- rischio collisione carro Z: non lavorabile in Downup
|
||||
local bIsToolBelowWorkpiece = Edge.vtN:getZ() < - 10 * GEO.EPS_SMALL
|
||||
local bIsToolAboveWorkpiece = Edge.vtN:getZ() > 10 * GEO.EPS_SMALL
|
||||
|
||||
if Tool.SetupInfo.HeadType.bTop and bIsToolBelowWorkpiece
|
||||
or ( Tool.SetupInfo.HeadType.bBottom and bIsToolAboveWorkpiece) then
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
-- se il lato di approccio non è sul box e non è espressamente consentito (es: cubetti), non lavorabile in DownUp
|
||||
local EdgeOpposite = BeamLib.FindEdgeBestOrientedAsDirection( Face.Edges, -Edge.vtN)
|
||||
if not bAvoidCollisionCheckForStandardCut and not BeamLib.IsEdgeOnBox( Face, EdgeOpposite, b3Part) then
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
-- orientamento faccia / utensile compatibili con DownUp: lavorabile, si calcola l'elevazione reale per DownUp e si ritorna
|
||||
if IsBladeOrientationOkForDownUp( Face, Edge, b3Part) then
|
||||
-- orientamento faccia / utensile compatibili con DownUp: lavorabile
|
||||
if not Check2DBladeCollision( Edge, -Face.vtN, Part, Tool, dDepthToMachine) then
|
||||
|
||||
sBladeEngagement = 'DownUp'
|
||||
dDownUpElevation = FaceData.GetEdgeElevationInBBox( Face, Edge, b3Part)
|
||||
|
||||
return true, sBladeEngagement, dDownUpElevation
|
||||
return true, sBladeEngagement
|
||||
end
|
||||
|
||||
return false
|
||||
@@ -558,7 +497,7 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters)
|
||||
local dElevation = ToolSearchParameters.dElevation or 0
|
||||
local bForceLongcutBlade = ToolSearchParameters.bForceLongcutBlade or false
|
||||
local EdgeToMachine = ToolSearchParameters.EdgeToMachine
|
||||
local b3Part = ToolSearchParameters.b3Part
|
||||
local Part = ToolSearchParameters.Part
|
||||
local bAvoidCollisionCheckForStandardCut = ToolSearchParameters.bAvoidCollisionCheckForStandardCut or false
|
||||
|
||||
local nBestToolIndex
|
||||
@@ -578,13 +517,10 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters)
|
||||
|
||||
-- se dati sufficienti, si determina se con questo utensile il taglio è fattibile e il modo di lavorare della lama
|
||||
if bIsToolCompatible then
|
||||
if FaceToMachine and EdgeToMachine and dElevation and b3Part then
|
||||
local bIsBladeOk, sBladeEngagement, dDownUpElevation = MachiningLib.GetBladeEngagement( FaceToMachine, EdgeToMachine, b3Part, TOOLS[i], dElevation, bAvoidCollisionCheckForStandardCut)
|
||||
-- orientamento non raggiungibile o elevazione eccessiva per DownUp: non compatibile
|
||||
if not bIsBladeOk
|
||||
or ( sBladeEngagement == 'DownUp'
|
||||
and ( dDownUpElevation - ( EdgeToMachine.dElevation - dElevation)) > TOOLS[i].dMaxMaterial - 10 * GEO.EPS_SMALL) then
|
||||
|
||||
if FaceToMachine and EdgeToMachine and Part and dElevation then
|
||||
local bIsBladeOk = MachiningLib.GetBladeEngagement( FaceToMachine, EdgeToMachine, Part, TOOLS[i], dElevation, bAvoidCollisionCheckForStandardCut)
|
||||
-- orientamento non raggiungibile
|
||||
if not bIsBladeOk then
|
||||
bIsToolCompatible = false
|
||||
end
|
||||
|
||||
|
||||
@@ -280,7 +280,7 @@ local function GetBestBlade( Proc, Part, Face, OptionalParameters)
|
||||
dElevation = dElevationTop,
|
||||
FaceToMachine = Face,
|
||||
EdgeToMachine = EdgeToMachineTop,
|
||||
b3Part = Part.b3Part
|
||||
Part = Part
|
||||
})
|
||||
if ToolInfo.dResidualDepth < 10 * GEO.EPS_SMALL then
|
||||
nToolIndexTop = ToolInfo.nToolIndex
|
||||
@@ -292,7 +292,7 @@ local function GetBestBlade( Proc, Part, Face, OptionalParameters)
|
||||
dElevation = dElevationBottom,
|
||||
FaceToMachine = Face,
|
||||
EdgeToMachine = EdgeToMachineBottom,
|
||||
b3Part = Part.b3Part
|
||||
Part = Part
|
||||
})
|
||||
if ToolInfo.dResidualDepth < 10 * GEO.EPS_SMALL then
|
||||
nToolIndexBottom = ToolInfo.nToolIndex
|
||||
@@ -390,7 +390,7 @@ local function GetSingleCutStrategy( Proc, Part, OptionalParameters)
|
||||
bAllowBottomHead = false,
|
||||
FaceToMachine = FaceToMachine,
|
||||
EdgeToMachine = EdgeToMachineList.Top,
|
||||
b3Part = Part.b3Part
|
||||
Part = Part
|
||||
})
|
||||
nToolIndexGuillotine = ToolInfo.nToolIndex
|
||||
|
||||
@@ -435,7 +435,7 @@ local function GetDualSideCutStrategy( Proc, Part, OptionalParameters)
|
||||
dElevation = dDepthToMachineTop,
|
||||
FaceToMachine = FaceToMachine,
|
||||
EdgeToMachine = EdgeToMachine,
|
||||
b3Part = Part.b3Part
|
||||
Part = Part
|
||||
})
|
||||
-- ricerca lama testa sotto
|
||||
local ToolInfoBottomBlade = MachiningLib.FindBlade( Proc, {
|
||||
@@ -444,7 +444,7 @@ local function GetDualSideCutStrategy( Proc, Part, OptionalParameters)
|
||||
dElevation = dDepthToMachineBottom,
|
||||
FaceToMachine = FaceToMachine,
|
||||
EdgeToMachine = EdgeToMachine,
|
||||
b3Part = Part.b3Part
|
||||
Part = Part
|
||||
})
|
||||
|
||||
local bIsTopLimited = ToolInfoTopBlade.dResidualDepth > 10 * GEO.EPS_SMALL
|
||||
@@ -462,7 +462,7 @@ local function GetDualSideCutStrategy( Proc, Part, OptionalParameters)
|
||||
dElevation = dDepthToMachineBottom,
|
||||
FaceToMachine = FaceToMachine,
|
||||
EdgeToMachine = EdgeToMachine,
|
||||
b3Part = Part.b3Part
|
||||
Part = Part
|
||||
})
|
||||
bIsBottomLimited = ToolInfoBottomBlade.dResidualDepth > 10 * GEO.EPS_SMALL
|
||||
|
||||
@@ -478,7 +478,7 @@ local function GetDualSideCutStrategy( Proc, Part, OptionalParameters)
|
||||
dElevation = dDepthToMachineTop,
|
||||
FaceToMachine = FaceToMachine,
|
||||
EdgeToMachine = EdgeToMachine,
|
||||
b3Part = Part.b3Part
|
||||
Part = Part
|
||||
})
|
||||
bIsTopLimited = ToolInfoTopBlade.dResidualDepth > 10 * GEO.EPS_SMALL
|
||||
end
|
||||
@@ -511,7 +511,7 @@ local function GetDualSideCutStrategy( Proc, Part, OptionalParameters)
|
||||
dElevation = dDepthToMachine,
|
||||
FaceToMachine = FaceToMachine,
|
||||
EdgeToMachine = EdgeToMachine,
|
||||
b3Part = Part.b3Part
|
||||
Part = Part
|
||||
})
|
||||
|
||||
-- se lama ci arriva si assegnano utensili e profondità da ritornare
|
||||
@@ -822,7 +822,8 @@ local function CutWithDicing( Proc, Part, OptionalParameters)
|
||||
dDepthToMachine = dDepthToMachine,
|
||||
nToolIndex = nToolIndex,
|
||||
dRadialStepSpan = 0,
|
||||
dExtendAfterTail = dExtendAfterTail
|
||||
dExtendAfterTail = dExtendAfterTail,
|
||||
bAvoidCollisionCheckForStandardCut = true
|
||||
}
|
||||
Cutting = FaceByBlade.Make( ProcTrimesh, Part, FaceToMachine, EdgeToMachine, OptionalParametersFaceByBlade)
|
||||
Cutting.ptCenter = Point3d( ProcTrimesh.Faces[1].ptCenter:getX(), 0, 0)
|
||||
|
||||
@@ -276,15 +276,12 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
||||
-- ricerca utensile
|
||||
if nToolIndex then
|
||||
Cutting.nToolIndex = nToolIndex
|
||||
local dDownUpElevation = dDepthToMachine
|
||||
|
||||
-- si determina se il taglio è fattibile e il modo di lavorare della lama
|
||||
Cutting.bIsApplicable, Cutting.sBladeEngagement, dDownUpElevation = MachiningLib.GetBladeEngagement( FaceToMachine, EdgeToMachine, Part.b3Raw, TOOLS[nToolIndex], dDepthToMachine, bAvoidCollisionCheckForStandardCut)
|
||||
Cutting.bIsApplicable, Cutting.sBladeEngagement = MachiningLib.GetBladeEngagement( FaceToMachine, EdgeToMachine, Part, TOOLS[nToolIndex], dDepthToMachine, bAvoidCollisionCheckForStandardCut)
|
||||
|
||||
-- orientamento non raggiungibile o elevazione eccessiva per DownUp: non applicabile
|
||||
if not Cutting.bIsApplicable
|
||||
or ( Cutting.sBladeEngagement == 'DownUp'
|
||||
and ( dDownUpElevation - ( EdgeToMachine.dElevation - dDepthToMachine)) > TOOLS[nToolIndex].dMaxMaterial - 10 * GEO.EPS_SMALL) then
|
||||
if not Cutting.bIsApplicable then
|
||||
|
||||
Cutting.sMessage = 'Orientation not reachable'
|
||||
EgtOutLog( Cutting.sMessage)
|
||||
@@ -300,7 +297,7 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
||||
ToolSearchParameters.bForceLongcutBlade = bForceLongcutBlade
|
||||
ToolSearchParameters.FaceToMachine = FaceToMachine
|
||||
ToolSearchParameters.EdgeToMachine = EdgeToMachine
|
||||
ToolSearchParameters.b3Part = Part.b3Part
|
||||
ToolSearchParameters.Part = Part
|
||||
|
||||
local ToolInfo = MachiningLib.FindBlade( Proc, ToolSearchParameters)
|
||||
Cutting.nToolIndex = ToolInfo.nToolIndex
|
||||
@@ -360,19 +357,15 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
||||
|
||||
-- si attiva OppositeToolDirection solo se il taglio è fattibile anche in direzione opposta
|
||||
local EdgeToMachineOpposite = BeamLib.FindEdgeBestOrientedAsDirection( FaceToMachine.Edges, -Cutting.vtToolDirection)
|
||||
local bIsApplicableOpposite, sBladeEngagementOpposite, dDownUpElevationOpposite = MachiningLib.GetBladeEngagement( FaceToMachine, EdgeToMachineOpposite, Part.b3Raw, TOOLS[nToolIndex], dDepthToMachine, bAvoidCollisionCheckForStandardCut)
|
||||
local bIsApplicableOpposite, sBladeEngagementOpposite = MachiningLib.GetBladeEngagement( FaceToMachine, EdgeToMachineOpposite, Part, TOOLS[nToolIndex], dDepthToMachine, bAvoidCollisionCheckForStandardCut)
|
||||
|
||||
if bIsApplicableOpposite and ( sBladeEngagementOpposite == Cutting.sBladeEngagement) then
|
||||
|
||||
if sBladeEngagementOpposite ~= 'DownUp'
|
||||
or ( ( dDownUpElevationOpposite - ( EdgeToMachine.dElevation - dDepthToMachine)) > TOOLS[nToolIndex].dMaxMaterial - 10 * GEO.EPS_SMALL) then
|
||||
|
||||
OppositeToolDirectionMode = 'Enabled'
|
||||
Cutting.sBladeEngagement = sBladeEngagementOpposite
|
||||
Cutting.vtToolDirection = -EdgeToMachine.vtN
|
||||
Cutting.ptEdge1, _, Cutting.ptEdge2 = EgtSurfTmFacetOppositeSide( Proc.id, FaceToMachine.id, -Cutting.vtToolDirection, GDB_ID.ROOT)
|
||||
Cutting.bInvert = not Cutting.bInvert
|
||||
end
|
||||
|
||||
-- se non possibile taglio opposto, si setta per tagliare verso l'alto
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user