- in PreCollisionLib refactoring
This commit is contained in:
@@ -11,6 +11,58 @@ local BeamData = require( 'BeamDataNew')
|
||||
|
||||
EgtOutLog( ' PreSimulationLib started', 1)
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function GetMachineAxes()
|
||||
|
||||
local LinearAxes = {}
|
||||
local RotativeAxes = {}
|
||||
|
||||
-- si recuperano tutti gli assi, lineari e rotativi
|
||||
local AxesNames = EgtGetAllCurrAxesNames()
|
||||
for i = 1, #AxesNames do
|
||||
-- EgtGetAxisType restituisce vero se asse lineare, false se asse rotativo
|
||||
if EgtGetAxisType( AxesNames[i]) then
|
||||
LinearAxes[#LinearAxes + 1] = {}
|
||||
LinearAxes[#LinearAxes].sName = AxesNames[i]
|
||||
else
|
||||
RotativeAxes[#RotativeAxes + 1] = {}
|
||||
RotativeAxes[#RotativeAxes].sName = AxesNames[i]
|
||||
end
|
||||
end
|
||||
|
||||
return LinearAxes, RotativeAxes
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function LogOutstroke( ptOnToolTipCenter, vtHead, OptionalParameters)
|
||||
|
||||
-- parametri opzionali
|
||||
OptionalParameters = OptionalParameters or {}
|
||||
local LinearAxes = OptionalParameters.LinearAxes
|
||||
local RotativeAxes = OptionalParameters.RotativeAxes
|
||||
|
||||
-- gruppo per geometrie temporanee
|
||||
local idTempGroup = BeamLib.GetTempGroup()
|
||||
|
||||
-- si disegnano punto e vettore
|
||||
local idPoint = EgtPoint( idTempGroup, ptOnToolTipCenter, GDB_RT.GLOB)
|
||||
local idVector = EgtVector( idTempGroup, vtHead, ptOnToolTipCenter, GDB_RT.GLOB)
|
||||
EgtSetColor( idPoint, RED())
|
||||
EgtSetColor( idVector, RED())
|
||||
|
||||
-- si loggano valori di punto e vettore
|
||||
EgtOutLog( ' Presimulation : OutStroke, Tip Point = ' .. tostring( ptOnToolTipCenter) .. ', id = ' .. idPoint .. ', vtHead = ' .. tostring( vtHead) .. ', id = ' .. idVector)
|
||||
|
||||
-- se disponibili, si loggano anche i valori calcolati degli assi
|
||||
if LinearAxes then
|
||||
EgtOutLog( ' ' .. LinearAxes[1].sName .. ' = ' .. tostring( LinearAxes[1].dValue) .. ', ' .. LinearAxes[2].sName .. ' = ' .. tostring( LinearAxes[2].dValue) .. ', ' .. LinearAxes[3].sName .. ' = ' .. tostring( LinearAxes[3].dValue))
|
||||
end
|
||||
if RotativeAxes then
|
||||
EgtOutLog( ' ' .. RotativeAxes[1].sName .. ' = ' .. tostring( RotativeAxes[1].dValue) .. ', ' .. RotativeAxes[2].sName .. ' = ' .. tostring( RotativeAxes[2].dValue))
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- costruzione trimesh del grezzo restante (con leggera sovrapposizione)
|
||||
@@ -50,7 +102,7 @@ end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- restituisce i punti notevoli della lavorazioni in cui fare il controllo
|
||||
local function GetPointsToCheck( Edge, dDepthToMachine)
|
||||
local function GetCollisionPointsToCheck( Edge, dDepthToMachine)
|
||||
|
||||
local PointsToCheck = {}
|
||||
|
||||
@@ -92,24 +144,12 @@ local function CheckOutOfStrokePoint( ptOnFace, vtHead, vtNFace, vtNEdge, nSCC,
|
||||
-- settaggio SCC per discriminare soluzioni multiple
|
||||
EgtSetCalcSolCh( nSCC)
|
||||
|
||||
-- si recuperano tutti gli assi, lineari e rotativi
|
||||
local AxesNames = EgtGetAllCurrAxesNames()
|
||||
local LinearAxes = {}
|
||||
local RotativeAxes = {}
|
||||
for i = 1, #AxesNames do
|
||||
-- EgtGetAxisType restituisce vero se asse lineare, false se asse rotativo
|
||||
if EgtGetAxisType( AxesNames[i]) then
|
||||
LinearAxes[#LinearAxes + 1] = {}
|
||||
LinearAxes[#LinearAxes].sName = AxesNames[i]
|
||||
else
|
||||
RotativeAxes[#RotativeAxes + 1] = {}
|
||||
RotativeAxes[#RotativeAxes].sName = AxesNames[i]
|
||||
end
|
||||
end
|
||||
-- assi macchina da calcolare
|
||||
local LinearAxes, RotativeAxes = GetMachineAxes()
|
||||
|
||||
-- se più di 3 assi lineari e 2 assi rotativi, macchina non supportata
|
||||
if #LinearAxes > 3 or #RotativeAxes > 2 then
|
||||
|
||||
|
||||
error(' CheckOutOfStrokePoint : too many axes')
|
||||
end
|
||||
|
||||
@@ -125,12 +165,9 @@ local function CheckOutOfStrokePoint( ptOnFace, vtHead, vtNFace, vtNEdge, nSCC,
|
||||
-- se nessuna soluzione dagli assi rotativi, è in extracorsa
|
||||
if nSolutionsAngles == 0 then
|
||||
|
||||
local idTempGroup = BeamLib.GetTempGroup()
|
||||
local idVector = EgtVector( idTempGroup, vtHead, ptOnToolTipCenter, GDB_RT.GLOB)
|
||||
EgtSetColor( idVector, RED())
|
||||
EgtOutLog( ' Presimulation : OutStroke Rotative axis, vtHead = ' .. tostring( vtHead) .. ', id = ' .. idVector)
|
||||
EgtOutLog( ' ' .. RotativeAxes[1].sName .. ' = ' .. tostring( RotativeAxes[1].dValue) .. ', ' .. RotativeAxes[2].sName .. ' = ' .. tostring( RotativeAxes[2].dValue))
|
||||
|
||||
if EgtGetDebugLevel() >= 3 then
|
||||
LogOutstroke( ptOnToolTipCenter, vtHead)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -149,7 +186,7 @@ local function CheckOutOfStrokePoint( ptOnFace, vtHead, vtNFace, vtNEdge, nSCC,
|
||||
-- siccome non si sa a priori il numero di assi lineari e rotativi, si aggiungono tutti a Args in ordine
|
||||
-- Args viene poi esplosa in modo da passare a EgtVerifyOutstroke i valori separati
|
||||
local Args = {}
|
||||
|
||||
|
||||
for i = 1, #LinearAxes do
|
||||
Args[#Args+1] = LinearAxes[i].dValue
|
||||
end
|
||||
@@ -161,16 +198,10 @@ local function CheckOutOfStrokePoint( ptOnFace, vtHead, vtNFace, vtNEdge, nSCC,
|
||||
local bAllAxesInStroke = EgtVerifyOutstroke( table.unpack( Args))
|
||||
|
||||
if not bAllAxesInStroke then
|
||||
|
||||
local idTempGroup = BeamLib.GetTempGroup()
|
||||
local idPoint = EgtPoint( idTempGroup, ptOnToolTipCenter, GDB_RT.GLOB)
|
||||
local idVector = EgtVector( idTempGroup, vtHead, ptOnToolTipCenter, GDB_RT.GLOB)
|
||||
EgtSetColor( idPoint, RED())
|
||||
EgtSetColor( idVector, RED())
|
||||
EgtOutLog( ' Presimulation : OutStroke Axes, Tip Point = ' .. tostring( ptOnToolTipCenter) .. ', id = ' .. idPoint .. ', vtHead = ' .. tostring( vtHead) .. ', id = ' .. idVector)
|
||||
EgtOutLog( ' ' .. LinearAxes[1].sName .. ' = ' .. LinearAxes[1].dValue .. ', ' .. LinearAxes[2].sName .. ' = ' .. LinearAxes[2].dValue .. ', ' .. LinearAxes[3].sName .. ' = ' .. LinearAxes[3].dValue)
|
||||
EgtOutLog( ' ' .. RotativeAxes[1].sName .. ' = ' .. tostring( RotativeAxes[1].dValue) .. ', ' .. RotativeAxes[2].sName .. ' = ' .. tostring( RotativeAxes[2].dValue))
|
||||
|
||||
|
||||
if EgtGetDebugLevel() >= 3 then
|
||||
LogOutstroke( ptOnToolTipCenter, vtHead, { LinearAxes = LinearAxes, RotativeAxes = RotativeAxes})
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -180,6 +211,7 @@ local function CheckOutOfStrokePoint( ptOnFace, vtHead, vtNFace, vtNEdge, nSCC,
|
||||
-- EgtSetAxisPos( 'C', dC1)
|
||||
-- EgtSetAxisPos( 'A', dA1)
|
||||
|
||||
-- se si arriva qui, il punto non è in finecorsa
|
||||
return false
|
||||
end
|
||||
|
||||
@@ -304,7 +336,7 @@ local function CheckCollisionWithAxis( sAxis, MachiningParameters, OptionalParam
|
||||
-- end
|
||||
|
||||
-- punti notevoli della lavorazione in cui fare il check
|
||||
local PointsToCheck = OptionalParameters.PointsToCheck or GetPointsToCheck( Edge, dDepthToMachine)
|
||||
local PointsToCheck = OptionalParameters.PointsToCheck or GetCollisionPointsToCheck( Edge, dDepthToMachine)
|
||||
|
||||
-- punti in centro lama su naso mandrino o aggregato. In base a direzione e punto
|
||||
local bIsDownUp = AreOppositeVectorApprox( vtNFace, vtHead)
|
||||
|
||||
Reference in New Issue
Block a user