Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b8d3cd461b | |||
| c506486585 | |||
| a73c0c85ac | |||
| fb3a5ec0be | |||
| e3e7537f8f | |||
| eec6b50985 | |||
| b5cb706ad5 | |||
| 053755e583 | |||
| c7045499f4 | |||
| 44478b91f0 | |||
| 1f4aa15af4 | |||
| a5d606b225 | |||
| c4697fbd6f | |||
| f58004dfeb | |||
| 7c485360de |
@@ -388,6 +388,15 @@ if bToProcess then
|
||||
else
|
||||
PARTS[i].b3PartOriginal = b3Solid
|
||||
end
|
||||
if BeamData.MAX_LENGTH and BeamData.MAX_LENGTH > 10 and b3Solid:getDimX() > BeamData.MAX_LENGTH then
|
||||
local sOut = 'Piece-Length (' .. EgtNumToString( b3Solid:getDimX(), 2) .. ') ' ..
|
||||
'out of machine limits (' .. EgtNumToString( BeamData.MAX_LENGTH, 2) .. ') '
|
||||
BEAM.ERR = 17
|
||||
BEAM.MSG = sOut
|
||||
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
|
||||
PostErrView( BEAM.ERR, BEAM.MSG)
|
||||
return
|
||||
end
|
||||
end
|
||||
-- Assegno lunghezza della barra
|
||||
dBarLen = PARTS[1].b3PartOriginal:getDimX() + 10
|
||||
@@ -447,6 +456,15 @@ if bToProcess then
|
||||
else
|
||||
PARTS[i].b3PartOriginal = b3Solid
|
||||
end
|
||||
if BeamData.MAX_LENGTH and BeamData.MAX_LENGTH > 10 and b3Solid:getDimX() > BeamData.MAX_LENGTH then
|
||||
local sOut = 'Piece-Length (' .. EgtNumToString( b3Solid:getDimX(), 2) .. ') ' ..
|
||||
'out of machine limits (' .. EgtNumToString( BeamData.MAX_LENGTH, 2) .. ') '
|
||||
BEAM.ERR = 17
|
||||
BEAM.MSG = sOut
|
||||
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
|
||||
PostErrView( BEAM.ERR, BEAM.MSG)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -153,6 +153,11 @@ function BeamExec.GetToolsFromDB()
|
||||
Tool.nDouble = EgtGetValInNotes( Tool.sUserNotes, 'DOUBLE', 'd')
|
||||
Tool.bIsProfiledTool = not EgtTdbIsCurrToolStandardDraw()
|
||||
|
||||
-- TODO per capire se ToolHolder è flottante bisogna leggere nota TYPE='Float' su ToolHolder. Serve funzione
|
||||
-- info per utensile su ToolHolder flottante
|
||||
Tool.dOverHang = EgtGetValInNotes( Tool.sUserNotes, 'TOOL_OVERHANG', 'd') or 0
|
||||
Tool.bToolOnFloatingTH = Tool.dOverHang > 0
|
||||
|
||||
-- lettura parametri non comuni ( famiglia DRILLBIT non ha parametri specifici)
|
||||
if sToolFamily ~= 'DRILLBIT' then
|
||||
Tool.dThickness = EgtTdbGetCurrToolParam( MCH_TP.THICK)
|
||||
|
||||
+11
-10
@@ -785,17 +785,18 @@ function BeamLib.BinaryToDecimal( dNumber)
|
||||
local sNumberToConvert = tostring( dNumber)
|
||||
local dResult = 0
|
||||
local k = 0
|
||||
|
||||
|
||||
for i = #sNumberToConvert, 1, -1 do
|
||||
k = k + 1
|
||||
local n = string.sub(sNumberToConvert, k, k)
|
||||
dResult = dResult + n*(2^(i-1))
|
||||
local n = string.sub( sNumberToConvert, k, k)
|
||||
dResult = dResult + n * ( 2^( i-1))
|
||||
end
|
||||
|
||||
|
||||
return dResult
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- TODO si può sostituire con funzione EgtNumToBitString
|
||||
function BeamLib.DecimalToBinary( dNumber)
|
||||
local sNumberToConvert = tostring( dNumber)
|
||||
local n = sNumberToConvert
|
||||
@@ -803,12 +804,12 @@ function BeamLib.DecimalToBinary( dNumber)
|
||||
local sResult = ""
|
||||
|
||||
for i = sNumberToConvert, 0, -1 do
|
||||
local q = math.modf(n)
|
||||
n = n/2
|
||||
local b = q%2
|
||||
table.insert(tmp, b)
|
||||
local q = math.modf( n)
|
||||
n = n / 2
|
||||
local b = q % 2
|
||||
table.insert( tmp, b)
|
||||
|
||||
if (q == 1) then
|
||||
if ( q == 1) then
|
||||
break
|
||||
end
|
||||
end
|
||||
@@ -816,7 +817,7 @@ function BeamLib.DecimalToBinary( dNumber)
|
||||
for i = #tmp, 1, -1 do
|
||||
sResult = sResult..tmp[i]
|
||||
end
|
||||
|
||||
|
||||
return tonumber( sResult)
|
||||
end
|
||||
|
||||
|
||||
@@ -347,7 +347,7 @@ local function TestEngagement( sBladeEngagement, Parameters, OptionalParameters)
|
||||
return false
|
||||
end
|
||||
-- lavorazione in collisione con il pezzo: non fattibile
|
||||
local bCollisionFound, bMoveAfterSplit = PreSimulationLib.CheckCollision( sBladeEngagement, CheckCollisionParameters, CheckCollisionOptionalParameters)
|
||||
local bCollisionFound, bMoveAfterSplit = PreSimulationLib.CheckCollision( CheckCollisionParameters, CheckCollisionOptionalParameters)
|
||||
if bCollisionFound then
|
||||
return false
|
||||
end
|
||||
@@ -373,7 +373,7 @@ local function TestEngagement( sBladeEngagement, Parameters, OptionalParameters)
|
||||
CheckCollisionOptionalParameters.PointsToCheck = {}
|
||||
table.insert( CheckCollisionOptionalParameters.PointsToCheck, PerpendicularLeadInOut.LeadIn.ptPoint)
|
||||
table.insert( CheckCollisionOptionalParameters.PointsToCheck, PerpendicularLeadInOut.LeadOut.ptPoint)
|
||||
local bCollisionFoundPerpendicular, bMoveAfterSplitPerpendicular = PreSimulationLib.CheckCollision( sBladeEngagement, CheckCollisionParameters, CheckCollisionOptionalParameters)
|
||||
local bCollisionFoundPerpendicular, bMoveAfterSplitPerpendicular = PreSimulationLib.CheckCollision( CheckCollisionParameters, CheckCollisionOptionalParameters)
|
||||
-- attacco perpendicolare possibile
|
||||
if not bCollisionFoundPerpendicular then
|
||||
LeadInOut.Perpendicular = PerpendicularLeadInOut
|
||||
@@ -403,7 +403,7 @@ local function TestEngagement( sBladeEngagement, Parameters, OptionalParameters)
|
||||
CheckCollisionOptionalParameters.PointsToCheck = {}
|
||||
table.insert( CheckCollisionOptionalParameters.PointsToCheck, TangentLeadInOut.LeadIn.ptPoint)
|
||||
table.insert( CheckCollisionOptionalParameters.PointsToCheck, TangentLeadInOut.LeadOut.ptPoint)
|
||||
local bCollisionFoundTangent, bMoveAfterSplitTangent = PreSimulationLib.CheckCollision( sBladeEngagement, CheckCollisionParameters, CheckCollisionOptionalParameters)
|
||||
local bCollisionFoundTangent, bMoveAfterSplitTangent = PreSimulationLib.CheckCollision( CheckCollisionParameters, CheckCollisionOptionalParameters)
|
||||
-- attacco tangenziale possibile
|
||||
if not bCollisionFoundTangent then
|
||||
LeadInOut.Tangent = TangentLeadInOut
|
||||
@@ -628,7 +628,7 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters)
|
||||
local bForceLongcutBlade = ToolSearchParameters.bForceLongcutBlade or false
|
||||
local EdgeToMachine = ToolSearchParameters.EdgeToMachine
|
||||
local Part = ToolSearchParameters.Part
|
||||
local bIsDicing = ToolSearchParameters.bIsDicing or false
|
||||
local idCheckCollisionTm = ToolSearchParameters.idCheckCollisionTm
|
||||
local sRestLengthSideForPreSimulation = ToolSearchParameters.sRestLengthSideForPreSimulation or 'Tail'
|
||||
local bCannotSplitRestLength = ToolSearchParameters.bCannotSplitRestLength or false
|
||||
local bDisableRealElevationCheck = ToolSearchParameters.bDisableRealElevationCheck or false
|
||||
@@ -663,7 +663,7 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters)
|
||||
dDepthToMachine = min( dElevation, TOOLS[i].dMaxDepth)
|
||||
}
|
||||
local BladeEngagementOptionalParameters = {
|
||||
bIsDicing = bIsDicing,
|
||||
idCheckCollisionTm = idCheckCollisionTm,
|
||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||
bCannotSplitRestLength = bCannotSplitRestLength,
|
||||
bDisableRealElevationCheck = bDisableRealElevationCheck
|
||||
|
||||
@@ -301,16 +301,14 @@ local function MoveMachineAxesToPosition( ptOnToolTipCenter, vtHead, vtAux)
|
||||
EgtSetAxisPos( AxesNames[6], dRotative3)
|
||||
end
|
||||
|
||||
return dTHome - dLinear1, AxesNames
|
||||
return dLinear1 - dTHome
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function CheckCollisionPoint( sAxis, ptOnToolTipCenter, vtHead, vtAux, Part, bCannotSplitRestLength, sRestLengthSideForPreSimulation, bCheckOnlyRestlength)
|
||||
local function CheckCollisionPoint( sAxis, ptOnToolTipCenter, vtHead, vtAux, Part, bCannotSplitRestLength, sRestLengthSideForPreSimulation, idCheckCollisionTm)
|
||||
|
||||
-- spostamento assi macchina in posizione
|
||||
local dDeltaXBeamOffset = MoveMachineAxesToPosition( ptOnToolTipCenter, vtHead, vtAux)
|
||||
-- spostamento trave in posizione macchina (è da riportare in posizione originale prima di return)
|
||||
EgtMove( Part.idRaw, Vector3d( dDeltaXBeamOffset, 0, 0), GDB_RT.GLOB)
|
||||
local dDeltaXHeadOffset = MoveMachineAxesToPosition( ptOnToolTipCenter, vtHead, vtAux)
|
||||
|
||||
-- si recuperano gli id delle geometrie dell'asse con cui controllare la collisione
|
||||
local idCollisionGroup = EgtGetFirstNameInGroup( EgtGetAxisId( sAxis), 'COLLISION')
|
||||
@@ -321,54 +319,55 @@ local function CheckCollisionPoint( sAxis, ptOnToolTipCenter, vtHead, vtAux, Par
|
||||
local CollisionSurfTmId = {}
|
||||
for i = 1, #CollisionGroupEntitiesId do
|
||||
if EgtGetType( CollisionGroupEntitiesId[i]) == GDB_TY.SRF_MESH then
|
||||
table.insert( CollisionSurfTmId, CollisionGroupEntitiesId[i])
|
||||
local idCollisionSurfTmCopy = EgtCopyGlob( CollisionGroupEntitiesId[i], Part.idTempGroup)
|
||||
EgtMove( idCollisionSurfTmCopy, Vector3d( dDeltaXHeadOffset, 0, 0), GDB_RT.GLOB)
|
||||
table.insert( CollisionSurfTmId, idCollisionSurfTmCopy)
|
||||
end
|
||||
end
|
||||
-- se presenti geometrie nel gruppo other si aggiungono anche quelle
|
||||
if CollisionGroupOtherEntitiesId and #CollisionGroupOtherEntitiesId > 0 then
|
||||
for i = 1, #CollisionGroupEntitiesId do
|
||||
if EgtGetType( CollisionGroupEntitiesId[i]) == GDB_TY.SRF_MESH then
|
||||
table.insert( CollisionSurfTmId, CollisionGroupEntitiesId[i])
|
||||
for i = 1, #CollisionGroupOtherEntitiesId do
|
||||
if EgtGetType( CollisionGroupOtherEntitiesId[i]) == GDB_TY.SRF_MESH then
|
||||
local idCollisionOtherSurfTmCopy = EgtCopyGlob( CollisionGroupOtherEntitiesId[i], Part.idTempGroup)
|
||||
EgtMove( idCollisionOtherSurfTmCopy, Vector3d( dDeltaXHeadOffset, 0, 0), GDB_RT.GLOB)
|
||||
table.insert( CollisionSurfTmId, idCollisionOtherSurfTmCopy)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- check collisione con pezzo
|
||||
local bCollisionFoundPiece = false
|
||||
if not bCheckOnlyRestlength then
|
||||
local idCheckCollisionTm = Part.idBoxTm
|
||||
if not idCheckCollisionTm then
|
||||
idCheckCollisionTm = Part.idBoxTm
|
||||
-- se testa o coda attaccate, si considerano nella superficie di collisione
|
||||
if bCannotSplitRestLength then
|
||||
local b3CheckCollision = BeamLib.GetPartBoxWithHeadTail( Part, sRestLengthSideForPreSimulation)
|
||||
idCheckCollisionTm = EgtSurfTmBBox( Part.idTempGroup, b3CheckCollision, false, GDB_RT.GLOB)
|
||||
end
|
||||
for i = 1, #CollisionSurfTmId do
|
||||
bCollisionFoundPiece = EgtCDeSolidSolid( idCheckCollisionTm, CollisionSurfTmId[i], BeamData.COLL_SIC)
|
||||
if not type( bCollisionFoundPiece) == "boolean" then
|
||||
error( 'Presimulation fail')
|
||||
end
|
||||
if EgtGetDebugLevel() >= 3 and bCollisionFoundPiece then
|
||||
EgtSetColor( CollisionSurfTmId[i], RED())
|
||||
end
|
||||
if bCollisionFoundPiece then
|
||||
break
|
||||
end
|
||||
end
|
||||
for i = 1, #CollisionSurfTmId do
|
||||
bCollisionFoundPiece = EgtCDeSolidSolid( idCheckCollisionTm, CollisionSurfTmId[i], BeamData.COLL_SIC)
|
||||
if not type( bCollisionFoundPiece) == "boolean" then
|
||||
error( 'Presimulation fail')
|
||||
end
|
||||
if EgtGetDebugLevel() >= 3 and bCollisionFoundPiece then
|
||||
EgtSetColor( CollisionSurfTmId[i], RED())
|
||||
end
|
||||
if bCollisionFoundPiece then
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
-- se trovata collisione con pezzo è inutile procedere con il grezzo
|
||||
if bCollisionFoundPiece then
|
||||
-- si riporta la trave in posizione originale
|
||||
EgtMove( Part.idRaw, Vector3d( -dDeltaXBeamOffset, 0, 0), GDB_RT.GLOB)
|
||||
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
-- check collisione con grezzo restante, se con il pezzo non c'è collisione e non è un taglio di testa o coda
|
||||
local bCollisionFoundRestLength = false
|
||||
if not ( bCollisionFoundPiece or bCannotSplitRestLength) then
|
||||
local idRestLengthSurfFr = GetRestlengthSurfTm( Part, sRestLengthSideForPreSimulation)
|
||||
EgtMove( idRestLengthSurfFr, Vector3d( dDeltaXBeamOffset, 0, 0), GDB_RT.GLOB)
|
||||
if idRestLengthSurfFr then
|
||||
for i = 1, #CollisionSurfTmId do
|
||||
bCollisionFoundRestLength = EgtCDeSolidSolid( idRestLengthSurfFr, CollisionSurfTmId[i], BeamData.COLL_SIC)
|
||||
@@ -385,9 +384,6 @@ local function CheckCollisionPoint( sAxis, ptOnToolTipCenter, vtHead, vtAux, Par
|
||||
end
|
||||
end
|
||||
|
||||
-- si riporta la trave in posizione originale
|
||||
EgtMove( Part.idRaw, Vector3d( -dDeltaXBeamOffset, 0, 0), GDB_RT.GLOB)
|
||||
|
||||
return false, bCollisionFoundRestLength
|
||||
end
|
||||
|
||||
@@ -405,7 +401,7 @@ local function CheckCollisionWithAxis( sAxis, MachiningParameters, OptionalParam
|
||||
|
||||
-- parametri opzionali
|
||||
OptionalParameters = OptionalParameters or {}
|
||||
local bCheckOnlyRestlength = OptionalParameters.bCheckOnlyRestlength or false
|
||||
local idCheckCollisionTm = OptionalParameters.idCheckCollisionTm
|
||||
local sRestLengthSideForPreSimulation = OptionalParameters.sRestLengthSideForPreSimulation or 'Tail'
|
||||
local bCannotSplitRestLength = OptionalParameters.bCannotSplitRestLength or false
|
||||
local vtAux = OptionalParameters.vtAux
|
||||
@@ -430,7 +426,7 @@ local function CheckCollisionWithAxis( sAxis, MachiningParameters, OptionalParam
|
||||
-- se non si trova collisione si ritorna se è necessario separare prima di effettuare la lavorazione (ossia non c'è collisione con il pezzo ma c'è con il grezzo restante)
|
||||
for i = 1, #PointsOnToolTipCenter do
|
||||
|
||||
local bCollisionFoundPiece, bCollisionFoundRestLength = CheckCollisionPoint( sAxis, PointsOnToolTipCenter[i], vtHead, vtAux, Part, bCannotSplitRestLength, sRestLengthSideForPreSimulation, bCheckOnlyRestlength)
|
||||
local bCollisionFoundPiece, bCollisionFoundRestLength = CheckCollisionPoint( sAxis, PointsOnToolTipCenter[i], vtHead, vtAux, Part, bCannotSplitRestLength, sRestLengthSideForPreSimulation, idCheckCollisionTm)
|
||||
|
||||
-- se trovata collisione con pezzo è inutile controllare gli altri punti
|
||||
if bCollisionFoundPiece then
|
||||
@@ -449,7 +445,7 @@ local function CheckCollisionWithAxis( sAxis, MachiningParameters, OptionalParam
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function PreSimulationLib.CheckCollision( sBladeEngagement, Parameters, OptionalParameters)
|
||||
function PreSimulationLib.CheckCollision( Parameters, OptionalParameters)
|
||||
|
||||
local bCollisionFound
|
||||
local bMoveAfterSplitL3, bMoveAfterSplitR3, bMoveAfterSplitR2, bMoveAfterSplitR1
|
||||
@@ -463,24 +459,19 @@ function PreSimulationLib.CheckCollision( sBladeEngagement, Parameters, Optional
|
||||
OptionalParameters = OptionalParameters or {}
|
||||
|
||||
local OptionalParametersCheckCollisionWithAxis = {}
|
||||
OptionalParametersCheckCollisionWithAxis.bCheckOnlyRestlength = false
|
||||
OptionalParametersCheckCollisionWithAxis.PointsToCheck = OptionalParameters.PointsToCheck or nil
|
||||
OptionalParametersCheckCollisionWithAxis.sRestLengthSideForPreSimulation = OptionalParameters.sRestLengthSideForPreSimulation or 'Tail'
|
||||
OptionalParametersCheckCollisionWithAxis.bCannotSplitRestLength = OptionalParameters.bCannotSplitRestLength or false
|
||||
OptionalParametersCheckCollisionWithAxis.sBlockedAxis = OptionalParameters.sBlockedAxis
|
||||
OptionalParametersCheckCollisionWithAxis.vtAux = OptionalParameters.vtAux
|
||||
OptionalParametersCheckCollisionWithAxis.idCheckCollisionTm = OptionalParameters.idCheckCollisionTm
|
||||
|
||||
local sBlockedAxis = OptionalParameters.sBlockedAxis
|
||||
local bIsDicing = OptionalParameters.bIsDicing or false
|
||||
local bDisableRealElevationCheck = OptionalParameters.bDisableRealElevationCheck or false
|
||||
local bCheckOnlyRestlengthForAxisABC = false
|
||||
|
||||
-- se cubetti in modalità standard (no DownUp) gli assi AB e C si controllano solo con grezzo (ci sarebbe collisione con il materiale già rimosso controllando AB e C con pezzo)
|
||||
if bIsDicing and ( sBladeEngagement == 'Standard') then
|
||||
bCheckOnlyRestlengthForAxisABC = true
|
||||
-- se l'elevazione reale (rispetto al pezzo + eventuale materiale in testa/coda) è maggiore del massimo materiale è sempre collisione
|
||||
-- TODO rifare con funzione
|
||||
elseif not bDisableRealElevationCheck then
|
||||
if not bDisableRealElevationCheck then
|
||||
local Edge = Parameters.Edge
|
||||
local vtNFace = Parameters.vtNFace
|
||||
local dDepthToMachine = Parameters.dDepthToMachine
|
||||
@@ -527,9 +518,6 @@ function PreSimulationLib.CheckCollision( sBladeEngagement, Parameters, Optional
|
||||
-- ultimo asse lineare prima dei rotativi (solitamente Z) si controlla sempre
|
||||
bCollisionFound, bMoveAfterSplitL3 = CheckCollisionWithAxis( sL3, Parameters, OptionalParametersCheckCollisionWithAxis)
|
||||
|
||||
-- assi rotativi: se richiesto si controlla la collisione solo col grezzo
|
||||
OptionalParametersCheckCollisionWithAxis.bCheckOnlyRestlength = bCheckOnlyRestlengthForAxisABC
|
||||
|
||||
if sR3 and not bCollisionFound then
|
||||
bCollisionFound, bMoveAfterSplitR3 = CheckCollisionWithAxis( sR3, Parameters, OptionalParametersCheckCollisionWithAxis)
|
||||
end
|
||||
|
||||
@@ -131,6 +131,14 @@ local function MyProcessInputData()
|
||||
else
|
||||
PARTS[i].b3PartOriginal = b3Solid
|
||||
end
|
||||
if BeamData.MAX_LENGTH and BeamData.MAX_LENGTH > 10 and b3Solid:getDimX() > BeamData.MAX_LENGTH then
|
||||
local sOut = 'Lunghezza (' .. EgtNumToString( b3Solid:getDimX(), 2) .. ') ' ..
|
||||
'oltre i limiti della macchina (' .. EgtNumToString( BeamData.MAX_LENGTH, 2) .. ') '
|
||||
EgtOutLog( sOut)
|
||||
EgtOutBox( sOut, 'Lavora Travi', 'WARNING')
|
||||
EgtDraw()
|
||||
return false
|
||||
end
|
||||
end
|
||||
dRawW = PARTS[1].b3PartOriginal:getDimY()
|
||||
dRawH = PARTS[1].b3PartOriginal:getDimZ()
|
||||
|
||||
@@ -87,6 +87,7 @@ local function GetTenonStrategy( Proc, Part)
|
||||
ToolSearchParameters.dElevation = EgtSurfTmFacetElevationInBBox( Strategy.idTenonCutPlane, 0, Part.b3Part, true, GDB_ID.ROOT)
|
||||
|
||||
ToolSearchParameters.vtToolDirection = Proc.FeatureInfo.vtTenonN
|
||||
ToolSearchParameters.sMillShape = 'STANDARD'
|
||||
ToolSearchParameters.AvailableToolList = MachiningLib.GetAvailableToolList( Proc, Strategy.Parameters.sPocketingList, 'Pocketing')
|
||||
Machining.Cutting.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@ local function GetSCC( Machining)
|
||||
|
||||
if TOOLS[Machining.nToolIndex].SetupInfo.bToolOnAggregate then
|
||||
nSCC = MCH_SCC.ADIR_NEAR
|
||||
elseif TOOLS[Machining.nToolIndex].SetupInfo.nBlockedSCC then
|
||||
nSCC = TOOLS[Machining.nToolIndex].SetupInfo.nBlockedSCC
|
||||
elseif Machining.vtToolDirection:getY() <= 0 then
|
||||
nSCC = MCH_SCC.ADIR_YM
|
||||
else
|
||||
@@ -96,7 +98,7 @@ function STR0014.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
Strategy.Machining.nSCC = GetSCC( Strategy.Machining)
|
||||
|
||||
Strategy.Machining.nType = MCH_MY.MILLING
|
||||
Strategy.Machining.sDepth = EgtClamp( Strategy.Parameters.dMachiningDepth, -1, 5)
|
||||
Strategy.Machining.sDepth = EgtClamp( Strategy.Parameters.dMachiningDepth, -1, TOOLS[Strategy.Machining.nToolIndex].dMaxMaterial)
|
||||
Strategy.Machining.nWorkside = MCH_MILL_WS.CENTER
|
||||
|
||||
-- LeadIn / LeadOut
|
||||
@@ -104,7 +106,19 @@ function STR0014.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
Strategy.Machining.LeadOut = {}
|
||||
Strategy.Machining.LeadIn.nType = MCH_MILL_LI.NONE
|
||||
Strategy.Machining.LeadOut.nType = MCH_MILL_LI.NONE
|
||||
|
||||
-- se è una penna, si limita la lavorazione per evitare di partire fuori dal grezzo
|
||||
if ToolSearchParameters.sMillShape == 'PEN' then
|
||||
Strategy.Machining.LeadIn.dStartAddLength = -20
|
||||
Strategy.Machining.LeadOut.dEndAddLength = -20
|
||||
end
|
||||
|
||||
-- TODO gestire meglio
|
||||
-- se utensile montato su aggregato flottante
|
||||
if TOOLS[Strategy.Machining.nToolIndex].bToolOnFloatingTH then
|
||||
Strategy.Machining.dMaxElev = Strategy.Parameters.dMachiningDepth
|
||||
Strategy.Machining.dLongitudinalOffset = -5
|
||||
end
|
||||
-- stessi parametri cambia solo al geometria
|
||||
for i = 1, #Proc.FeatureInfo.AdditionalGeometries do
|
||||
local AuxId = Proc.id + Proc.FeatureInfo.AdditionalGeometries[i]
|
||||
|
||||
@@ -260,7 +260,7 @@ local function GetBestBlade( Proc, Part, Face, OptionalParameters)
|
||||
local dShortPartLength = OptionalParameters.dShortPartLength or BeamData.LEN_SHORT_PART
|
||||
local EdgeToMachineTop = OptionalParameters.EdgeToMachineTop
|
||||
local EdgeToMachineBottom = OptionalParameters.EdgeToMachineBottom
|
||||
local bIsDicing = OptionalParameters.bIsDicing
|
||||
local idCheckCollisionTm = OptionalParameters.idCheckCollisionTm
|
||||
local sRestLengthSideForPreSimulation = OptionalParameters.sRestLengthSideForPreSimulation
|
||||
local bCannotSplitRestLength = OptionalParameters.bCannotSplitRestLength
|
||||
-- TODO qui sarebbe meglio avere dExtra come OptionalParameter???
|
||||
@@ -289,7 +289,7 @@ local function GetBestBlade( Proc, Part, Face, OptionalParameters)
|
||||
FaceToMachine = Face,
|
||||
EdgeToMachine = EdgeToMachineTop,
|
||||
Part = Part,
|
||||
bIsDicing = bIsDicing,
|
||||
idCheckCollisionTm = idCheckCollisionTm,
|
||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||
bCannotSplitRestLength = bCannotSplitRestLength
|
||||
})
|
||||
@@ -304,7 +304,7 @@ local function GetBestBlade( Proc, Part, Face, OptionalParameters)
|
||||
FaceToMachine = Face,
|
||||
EdgeToMachine = EdgeToMachineBottom,
|
||||
Part = Part,
|
||||
bIsDicing = bIsDicing,
|
||||
idCheckCollisionTm = idCheckCollisionTm,
|
||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||
bCannotSplitRestLength = bCannotSplitRestLength
|
||||
})
|
||||
@@ -371,7 +371,7 @@ local function GetSingleCutStrategy( Proc, Part, OptionalParameters)
|
||||
local bReduceBladePath = OptionalParameters.bReduceBladePath or false
|
||||
local bAllowFastCuts = OptionalParameters.bAllowFastCuts or false
|
||||
local FaceToMachine = Proc.Faces[OptionalParameters.nFaceToMachineIndex or 1]
|
||||
local bIsDicing = OptionalParameters.bIsDicing or false
|
||||
local idCheckCollisionTm = OptionalParameters.idCheckCollisionTm
|
||||
local sRestLengthSideForPreSimulation = OptionalParameters.sRestLengthSideForPreSimulation or 'Tail'
|
||||
local bCannotSplitRestLength = OptionalParameters.bCannotSplitRestLength or false
|
||||
-- lati da lavorare in base al tipo di lama
|
||||
@@ -390,7 +390,7 @@ local function GetSingleCutStrategy( Proc, Part, OptionalParameters)
|
||||
EdgeToMachineTop = EdgeToMachineList.Top,
|
||||
EdgeToMachineBottom = EdgeToMachineList.Bottom,
|
||||
nToolIndex = nToolIndex,
|
||||
bIsDicing = bIsDicing,
|
||||
idCheckCollisionTm = idCheckCollisionTm,
|
||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||
bCannotSplitRestLength = bCannotSplitRestLength
|
||||
}
|
||||
@@ -442,7 +442,7 @@ local function GetSingleCutStrategy( Proc, Part, OptionalParameters)
|
||||
FaceToMachine = FaceToMachine,
|
||||
EdgeToMachine = EdgeToMachineList.TopGuillotine,
|
||||
Part = Part,
|
||||
bIsDicing = bIsDicing,
|
||||
idCheckCollisionTm = idCheckCollisionTm,
|
||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||
bCannotSplitRestLength = bCannotSplitRestLength
|
||||
})
|
||||
@@ -475,7 +475,7 @@ local function GetDualSideCutStrategy( Proc, Part, OptionalParameters)
|
||||
OptionalParameters = OptionalParameters or {}
|
||||
local nToolIndex = OptionalParameters.nToolIndex
|
||||
local FaceToMachine = Proc.Faces[OptionalParameters.nFaceToMachineIndex or 1]
|
||||
local bIsDicing = OptionalParameters.bIsDicing or false
|
||||
local idCheckCollisionTm = OptionalParameters.idCheckCollisionTm
|
||||
local sRestLengthSideForPreSimulation = OptionalParameters.sRestLengthSideForPreSimulation or 'Tail'
|
||||
local bCannotSplitRestLength = OptionalParameters.bCannotSplitRestLength or false
|
||||
|
||||
@@ -499,7 +499,7 @@ local function GetDualSideCutStrategy( Proc, Part, OptionalParameters)
|
||||
FaceToMachine = FaceToMachine,
|
||||
EdgeToMachine = EdgeToMachine,
|
||||
Part = Part,
|
||||
bIsDicing = bIsDicing,
|
||||
idCheckCollisionTm = idCheckCollisionTm,
|
||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||
bCannotSplitRestLength = bCannotSplitRestLength
|
||||
})
|
||||
@@ -512,7 +512,7 @@ local function GetDualSideCutStrategy( Proc, Part, OptionalParameters)
|
||||
FaceToMachine = FaceToMachine,
|
||||
EdgeToMachine = BeamLib.FindEdgeBestOrientedAsDirection( FaceToMachine.Edges, -EdgeToMachine.vtN),
|
||||
Part = Part,
|
||||
bIsDicing = bIsDicing,
|
||||
idCheckCollisionTm = idCheckCollisionTm,
|
||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||
bCannotSplitRestLength = bCannotSplitRestLength
|
||||
})
|
||||
@@ -534,7 +534,7 @@ local function GetDualSideCutStrategy( Proc, Part, OptionalParameters)
|
||||
FaceToMachine = FaceToMachine,
|
||||
EdgeToMachine = BeamLib.FindEdgeBestOrientedAsDirection( FaceToMachine.Edges, -EdgeToMachine.vtN),
|
||||
Part = Part,
|
||||
bIsDicing = bIsDicing,
|
||||
idCheckCollisionTm = idCheckCollisionTm,
|
||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||
bCannotSplitRestLength = bCannotSplitRestLength
|
||||
})
|
||||
@@ -553,7 +553,7 @@ local function GetDualSideCutStrategy( Proc, Part, OptionalParameters)
|
||||
FaceToMachine = FaceToMachine,
|
||||
EdgeToMachine = EdgeToMachine,
|
||||
Part = Part,
|
||||
bIsDicing = bIsDicing,
|
||||
idCheckCollisionTm = idCheckCollisionTm,
|
||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||
bCannotSplitRestLength = bCannotSplitRestLength
|
||||
})
|
||||
@@ -589,7 +589,7 @@ local function GetDualSideCutStrategy( Proc, Part, OptionalParameters)
|
||||
FaceToMachine = FaceToMachine,
|
||||
EdgeToMachine = EdgeToMachine,
|
||||
Part = Part,
|
||||
bIsDicing = bIsDicing,
|
||||
idCheckCollisionTm = idCheckCollisionTm,
|
||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||
bCannotSplitRestLength = bCannotSplitRestLength
|
||||
})
|
||||
@@ -607,7 +607,7 @@ local function GetDualSideCutStrategy( Proc, Part, OptionalParameters)
|
||||
dDepthToMachine = dDepthToMachine
|
||||
}
|
||||
local BladeEngagementOptionalParameters = {
|
||||
bIsDicing = bIsDicing,
|
||||
idCheckCollisionTm = idCheckCollisionTm,
|
||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||
bCannotSplitRestLength = bCannotSplitRestLength
|
||||
}
|
||||
@@ -782,6 +782,52 @@ local function CutWholeWaste( Proc, Part, OptionalParameters)
|
||||
end
|
||||
|
||||
|
||||
local function UpdateDiceRaw( idRaw, idParallelTm, idPerpendicularTm, Part, MainFace, OtherFace)
|
||||
|
||||
-- frame solidale alla feature
|
||||
local vtZ = MainFace.vtN
|
||||
local vtX = OtherFace and OtherFace.vtN or nil
|
||||
local frMainFace = Frame3d( MainFace.ptCenter, vtZ, vtX)
|
||||
|
||||
-- box del cubetto in riferimento feature
|
||||
local b3Surf = EgtGetBBoxRef( idParallelTm, GDB_BB.STANDARD, frMainFace)
|
||||
if idPerpendicularTm then
|
||||
local b3SurfPerpendicular = EgtGetBBoxRef( idPerpendicularTm, GDB_BB.STANDARD, frMainFace)
|
||||
b3Surf:Add( b3SurfPerpendicular)
|
||||
else
|
||||
-- se non arriva la superficie perpendicolare è un solo taglio parallelo: si estende il box in Z in modo da uscire dal pezzo
|
||||
local ptDeltaZ = b3Surf:getMax() + vtZ * ( MainFace.dElevation + 5)
|
||||
b3Surf:Add( ptDeltaZ)
|
||||
end
|
||||
|
||||
-- estensione box per non avere problemi nella sottrazione booleana
|
||||
if OtherFace and idPerpendicularTm then
|
||||
local vtY = vtZ ^ vtX
|
||||
local ptDeltaX = b3Surf:getMax() + vtX * 1
|
||||
local ptDeltaZ = b3Surf:getMax() + vtZ * 1
|
||||
local ptDeltaYplus = b3Surf:getMax() + vtY * 1
|
||||
local ptDeltaYminus = b3Surf:getMin() - vtY * 1
|
||||
b3Surf:Add( ptDeltaX)
|
||||
b3Surf:Add( ptDeltaZ)
|
||||
b3Surf:Add( ptDeltaYplus)
|
||||
b3Surf:Add( ptDeltaYminus)
|
||||
else
|
||||
b3Surf:expand( 1)
|
||||
end
|
||||
|
||||
-- si porta il box in riferimento globale
|
||||
b3Surf:toGlob( frMainFace)
|
||||
|
||||
-- conversione box cubetto in superficie
|
||||
local idSurfTmToSubtract = EgtSurfTmBBox( Part.idTempGroup, b3Surf, false, GDB_RT.GLOB)
|
||||
|
||||
-- sottrazione del cubetto dal grezzo
|
||||
EgtSurfTmSubtract( idRaw, idSurfTmToSubtract)
|
||||
|
||||
return idRaw
|
||||
end
|
||||
|
||||
|
||||
local function CalculateDiceMachinings( vCuts, Parameters)
|
||||
local Machinings = {}
|
||||
local bMoveAfterSplit = false
|
||||
@@ -789,6 +835,7 @@ local function CalculateDiceMachinings( vCuts, Parameters)
|
||||
local Proc = Parameters.Proc
|
||||
local Part = Parameters.Part
|
||||
local MainFace = Parameters.MainFace
|
||||
local OtherFace = next( Parameters.OtherFace) and Parameters.OtherFace or nil
|
||||
local Tool = Parameters.Tool
|
||||
local sChosenBladeType = Parameters.sChosenBladeType
|
||||
local dExtendAfterTail = Parameters.dExtendAfterTail
|
||||
@@ -797,21 +844,15 @@ local function CalculateDiceMachinings( vCuts, Parameters)
|
||||
local bCannotSplitRestLength = Parameters.bCannotSplitRestLength
|
||||
local bReduceDiceDepth = Parameters.bReduceDiceDepth
|
||||
|
||||
-- trimesh con RestLength
|
||||
local b3CheckCollision = BeamLib.GetPartBoxWithHeadTail( Part, sRestLengthSideForPreSimulation)
|
||||
local idCheckCollisionTm = EgtSurfTmBBox( Part.idTempGroup, b3CheckCollision, false, GDB_RT.GLOB)
|
||||
|
||||
-- eventuale inversione tagli ortogonali e aggiunta informazioni alla geometria
|
||||
local bAreOrthogonalCutsInverted = false
|
||||
for i = 1, #vCuts do
|
||||
for j = 1, #vCuts[i] do
|
||||
SetDiceFaceInfo( Proc, vCuts[i][j])
|
||||
-- TODO vedere se questa parte serve ancora; in teoria no perchè il taglio è girato automaticamente nella FaceByBlade
|
||||
-- if ( i % 2) == 1 then
|
||||
-- local vtO = EgtSurfTmFacetNormVersor( vCuts[i][j], 0, GDB_ID.ROOT)
|
||||
-- if MachiningLib.IsFaceZOutOfRange( vtO, Tool) then
|
||||
-- EgtInvertSurf( vCuts[i][j])
|
||||
-- local vtCurrentFaceNormal = EgtSurfTmFacetNormVersor( vCuts[i][j], 0, GDB_ID.ROOT)
|
||||
-- EgtMove( vCuts[i][j], -vtCurrentFaceNormal * Tool.dThickness, GDB_RT.GLOB)
|
||||
-- bAreOrthogonalCutsInverted = true
|
||||
-- end
|
||||
-- end
|
||||
end
|
||||
end
|
||||
-- calcolo lavorazioni
|
||||
@@ -852,19 +893,17 @@ local function CalculateDiceMachinings( vCuts, Parameters)
|
||||
end
|
||||
-- calcolo lavorazione della singola faccia
|
||||
-- per tagli paralleli e faccia aperta si prova a tagliare come se fosse una faccia singola, accorpando i tagli
|
||||
-- TODO bIsDicing è da mettere a true?
|
||||
local bCanMergeParallelCuts = ( ( i % 2) == 0) and ( Proc.nFct == 1)
|
||||
local bIsDicingOk = true
|
||||
if bCanMergeParallelCuts then
|
||||
local nAddGrpId = BeamLib.GetAddGroup( Part.id)
|
||||
local nSurfToCut = EgtSurfTmBySewing( nAddGrpId, vCuts[i], false)
|
||||
local ProcTrimesh = FeatureLib.GetProcFromTrimesh( nSurfToCut, Part)
|
||||
local idSurfToCut = EgtSurfTmBySewing( nAddGrpId, vCuts[i], false)
|
||||
local ProcTrimesh = FeatureLib.GetProcFromTrimesh( idSurfToCut, Part)
|
||||
|
||||
local OptionalParametersCutWholeWaste = {
|
||||
nToolIndex = Tool.nIndex,
|
||||
dExtendAfterTail = dExtendAfterTail,
|
||||
bReduceBladePath = bReduceBladePath,
|
||||
bIsDicing = false,
|
||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||
bCannotSplitRestLength = bCannotSplitRestLength
|
||||
}
|
||||
@@ -877,8 +916,12 @@ local function CalculateDiceMachinings( vCuts, Parameters)
|
||||
bMoveAfterSplit = true
|
||||
end
|
||||
end
|
||||
-- aggiornamento grezzo dinamico
|
||||
if i % 2 == 0 then
|
||||
UpdateDiceRaw( idCheckCollisionTm, idSurfToCut, vCuts[i-1][#vCuts[i-1]], Part, MainFace, OtherFace)
|
||||
end
|
||||
else
|
||||
EgtErase( nSurfToCut)
|
||||
EgtErase( idSurfToCut)
|
||||
bIsDicingOk = false
|
||||
end
|
||||
end
|
||||
@@ -919,9 +962,10 @@ local function CalculateDiceMachinings( vCuts, Parameters)
|
||||
dRadialStepSpan = 0,
|
||||
dExtendAfterTail = dExtendAfterTail,
|
||||
bIsDicing = true,
|
||||
idCheckCollisionTm = idCheckCollisionTm,
|
||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||
bCannotSplitRestLength = bCannotSplitRestLength,
|
||||
bDisableRealElevationCheck = ( i % 2) > 0 -- se taglio perpendicolare non si deve mai considerare il materiale precedente
|
||||
bDisableRealElevationCheck = true
|
||||
}
|
||||
Cutting = FaceByBlade.Make( ProcTrimesh, Part, FaceToMachine, EdgeToMachine, OptionalParametersFaceByBlade)
|
||||
Cutting.ptCenter = Point3d( ProcTrimesh.Faces[1].ptCenter:getX(), 0, 0)
|
||||
@@ -936,6 +980,10 @@ local function CalculateDiceMachinings( vCuts, Parameters)
|
||||
if Cutting.sStage == 'AfterTail' then
|
||||
bMoveAfterSplit = true
|
||||
end
|
||||
-- aggiornamento grezzo dinamico
|
||||
if i % 2 == 0 then
|
||||
UpdateDiceRaw( idCheckCollisionTm, vCuts[i][j], vCuts[i-1][j], Part, MainFace, OtherFace)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1013,6 +1061,7 @@ local function CutWithDicing( Proc, Part, OptionalParameters)
|
||||
Proc = Proc,
|
||||
Part = Part,
|
||||
MainFace = Face1,
|
||||
OtherFace = Face2,
|
||||
Tool = TOOLS[nToolIndex],
|
||||
sChosenBladeType = sChosenBladeType,
|
||||
dExtendAfterTail = dExtendAfterTail,
|
||||
|
||||
@@ -209,6 +209,7 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
||||
local dRadialStepSpan = OptionalParameters.dRadialStepSpan
|
||||
local sUserNotes = OptionalParameters.sUserNotes or ''
|
||||
local bIsDicing = OptionalParameters.bIsDicing or false
|
||||
local idCheckCollisionTm = OptionalParameters.idCheckCollisionTm
|
||||
local sRestLengthSideForPreSimulation = OptionalParameters.sRestLengthSideForPreSimulation or 'Tail'
|
||||
local bCannotSplitRestLength = OptionalParameters.bCannotSplitRestLength or false
|
||||
local bDisableRealElevationCheck = OptionalParameters.bDisableRealElevationCheck or false
|
||||
@@ -232,8 +233,12 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
||||
Tool = TOOLS[Cutting.nToolIndex],
|
||||
dDepthToMachine = dDepthToMachine
|
||||
}
|
||||
if OppositeToolDirectionMode == 'Enabled' then
|
||||
BladeEngagementParameters.Edge = EdgeToMachineOpposite
|
||||
end
|
||||
local BladeEngagementOptionalParameters = {
|
||||
bIsDicing = bIsDicing,
|
||||
idCheckCollisionTm = idCheckCollisionTm,
|
||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||
bCannotSplitRestLength = bCannotSplitRestLength,
|
||||
bDisableRealElevationCheck = bDisableRealElevationCheck
|
||||
@@ -357,6 +362,7 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
||||
}
|
||||
local BladeEngagementOptionalParameters = {
|
||||
bIsDicing = bIsDicing,
|
||||
idCheckCollisionTm = idCheckCollisionTm,
|
||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||
bCannotSplitRestLength = bCannotSplitRestLength,
|
||||
bDisableRealElevationCheck = bDisableRealElevationCheck
|
||||
@@ -475,6 +481,7 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
||||
}
|
||||
local BladeEngagementOptionalParameters = {
|
||||
bIsDicing = bIsDicing,
|
||||
idCheckCollisionTm = idCheckCollisionTm,
|
||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||
bCannotSplitRestLength = bCannotSplitRestLength,
|
||||
bDisableRealElevationCheck = bDisableRealElevationCheck
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
==== Beam Update Log ====
|
||||
|
||||
Versione 2.6-- (--/--/2024)
|
||||
- Primo commit creazione nuovo automatismo BEAM con strategie
|
||||
Versione 3.1e1 (29/05/2026)
|
||||
- Primo commit nuovo automatismo a strategie
|
||||
+2
-2
@@ -2,5 +2,5 @@
|
||||
-- Gestione della versione di Beam
|
||||
|
||||
NAME = 'Beam'
|
||||
VERSION = '2.8a1'
|
||||
MIN_EXE = '2.7j2'
|
||||
VERSION = '3.1e1'
|
||||
MIN_EXE = '3.1e1'
|
||||
|
||||
Reference in New Issue
Block a user