Compare commits

...

10 Commits

Author SHA1 Message Date
luca.mazzoleni a1ca23acc9 Merge branch 'develop' into Feature/ToolIdForL030Through 2023-09-12 18:08:43 +02:00
luca.mazzoleni 5f47ce88da Feature/ToolIdForL030Through: correzione a lato di lavoro e invert 2023-06-29 16:55:17 +02:00
luca.mazzoleni 8370ef5b3a Merge branch 'develop' into Feature/ToolIdForL030Through 2023-06-29 14:49:59 +02:00
luca.mazzoleni 19edc158c7 Merge branch 'develop' into Feature/ToolIdForL030Through 2023-03-28 15:05:38 +02:00
luca.mazzoleni 041706a04d Merge branch 'develop' into Feature/ToolIdForL030Through 2023-03-24 09:16:19 +01:00
luca.mazzoleni 77cec328a6 Merge branch 'develop' into Feature/ToolIdForL030Through 2023-03-16 11:02:35 +01:00
luca.mazzoleni afef9c54fe altra piccola correzione 2023-03-14 18:55:48 +01:00
luca.mazzoleni 83048f2f52 piccola correzione 2023-03-13 18:37:55 +01:00
luca.mazzoleni 8dce03138e Feature/ToolIdForL030Through:
- per LapJoint -> MakeByPockets implementato Tool_ID per forzare scelta utensile in caso di lavorazione laterale
- per FindPocketing implementata la ricerca lavorazione da UUID dell'utensile
2023-03-13 17:49:03 +01:00
luca.mazzoleni ee1c67b006 Merge remote-tracking branch 'origin/master' into feature/ToolIdForL030Through 2023-03-13 17:15:57 +01:00
2 changed files with 75 additions and 33 deletions
+8 -5
View File
@@ -6,6 +6,7 @@
-- 2022/11/25 Per FindMilling implementata la possibilità di escludere la testa H3 dalla ricerca utensile.
-- 2022/12/28 Per FindMilling e FindDrilling possibilità di escludere la testa H2 dalla ricerca utensile.
-- 2023/01/31 Per FindPocketing implementata la possibilità di escludere le teste H2 o H3 dalla ricerca utensile.
-- 2023/03/13 Per FindPocketing implementata la scelta lavorazione da UUID dell'utensile.
-- 2023/07/28 Aggiunta gestione del tipo di foratura "Drill_AT".
-- Tabella per definizione modulo
@@ -163,13 +164,15 @@ function VerifyMill( dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bH2)
end
---------------------------------------------------------------------
function VerifyPocket( dMaxDiam, dDepth, dMaxTotLen, bH2)
function VerifyPocket( dMaxDiam, dDepth, dMaxTotLen, sTuuidMstr, bH2)
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
if ( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and
( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and
( not dMaxTotLen or dTTotLen < dMaxTotLen + GEO.EPS_SMALL) then
( not dMaxTotLen or dTTotLen < dMaxTotLen + GEO.EPS_SMALL) and
( not sTuuidMstr or sTuuidMstr == sTuuid) then
return true, { TDiam = dTDiam, TMaxDepth = dTMaxDepth, H2 = bH2}
end
end
@@ -187,7 +190,7 @@ function VerifyTool( MachiningType, sType, Params, bH2)
elseif MachiningType == MCH_MY.MILLING then
return VerifyMill( Params.Depth, Params.TuuidMstr, Params.MaxDiam, Params.MaxTotLen, bH2)
elseif MachiningType == MCH_MY.POCKETING then
return VerifyPocket( Params.MaxDiam, Params.Depth, Params.MaxTotLen, bH2)
return VerifyPocket( Params.MaxDiam, Params.Depth, Params.MaxTotLen, Params.TuuidMstr, bH2)
elseif MachiningType == MCH_MY.MORTISING then
return true, { H2 = bH2}
else
@@ -404,8 +407,8 @@ function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotL
end
---------------------------------------------------------------------
function MachiningLib.FindPocketing( sType, dMaxDiam, dDepth, dMaxTotLen, bTopHead, bDownHead, bExcludeH2, bExcludeH3)
return FindMachining( MCH_MY.POCKETING, sType, { MaxDiam = dMaxDiam, Depth = dDepth, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead, bExcludeH2, bExcludeH3)
function MachiningLib.FindPocketing( sType, dMaxDiam, dDepth, dMaxTotLen, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sTuuidMstr)
return FindMachining( MCH_MY.POCKETING, sType, { MaxDiam = dMaxDiam, Depth = dDepth, MaxTotLen = dMaxTotLen, TuuidMstr = sTuuidMstr}, bTopHead, bDownHead, bExcludeH2, bExcludeH3)
end
---------------------------------------------------------------------
+67 -28
View File
@@ -64,6 +64,7 @@
-- 2023/02/06 Alla MakeDrillOnCorner aggiunto controllo distanza di sicurezza minima.
-- 2023/02/16 Piccola correzione alla scelta utensile di svuotatura.
-- 2023/02/21 Piccola correzione alla MakeByPocket.
-- 2023/03/13 In MakeByPocket aggiunto Q11=Tool_ID per forzare la scelta utensile in casi con Q03=2/3.
-- 2023/03/31 Correzione al calcolo della distanza di collisione nel caso in cui il gambo sia più piccolo dell'utensile.
-- 2023/06/06 Limiti su svuotature tasche a L 4 facce come per L 3 facce. In svuotatura aggiunto recupero UserNotes da libreria per MaxOptSize.
-- 2023/16/12 Corretto il recupero dati utensile che, in alcune funzioni, puntava all'utensile errato.
@@ -145,6 +146,7 @@ local function AssignQIdent( Proc)
Q_SIDE_ROUGH_TOOL = ''
Q_ANTISPLINT_TYPE = ''
Q_MAX_ELEVATION = 'Q10'
Q_TOOL_ID = ''
if ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 16 then
Q_FORCE_BLADE = 'Q01' -- i
@@ -168,10 +170,12 @@ local function AssignQIdent( Proc)
Q_BLADE_ON_ALONG_FACE = 'Q04' -- i
Q_ANTISPLINT_TYPE = 'Q06' -- i
Q_DEPTH_CHAMFER = 'Q07' -- d
Q_TOOL_ID = 'Q11' -- i
elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 32 then
Q_SIDE_ROUGH_TOOL = 'Q01' -- i
Q_CONTOUR_SMALL_TOOL = 'Q02' -- i
Q_ANTISPLINT_TYPE = 'Q06' -- i
Q_TOOL_ID = 'Q11' -- i
elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 33 then
Q_ANTISPLINT_TYPE = 'Q06' -- i
elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 34 then
@@ -327,12 +331,15 @@ local function VerifyChainSaw( Proc, dMinDim, dMaxDim)
end
---------------------------------------------------------------------
local function VerifyPocket( Proc, dDiam, dDepth, dMaxTotLen, sMchFindMaster, bPocketUp, bPocketDown)
local function VerifyPocket( Proc, dDiam, dDepth, dMaxTotLen, sMchFindMaster, bPocketUp, bPocketDown, sChosenToolUuid)
-- tipo di svuotatura
local sMchFind = EgtIf( sMchFindMaster and #sMchFindMaster > 0, sMchFindMaster, 'Pocket')
-- ricerca della svuotatura
local sPocketing
if dDepth then
-- se viene specificato un utensile non guardo altro
if sChosenToolUuid then
sPocketing = ML.FindPocketing( sMchFind, dDiam, 0, dMaxTotLen, bPocketUp, bPocketDown, nil, nil, sChosenToolUuid)
elseif dDepth then
sPocketing = ML.FindPocketing( sMchFind, dDiam, dDepth, dMaxTotLen, bPocketUp, bPocketDown) or
ML.FindPocketing( sMchFind, dDiam, 0.8 * dDepth, dMaxTotLen, bPocketUp, bPocketDown) or
ML.FindPocketing( sMchFind, dDiam, 0.7 * dDepth, dMaxTotLen, bPocketUp, bPocketDown) or
@@ -3465,7 +3472,7 @@ local function GetUShapeWidth( Proc, nFacInd)
end
---------------------------------------------------------------------
local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMchFindMaster, bIs3Faces, b3Solid, bOrthoFacesMaster, bMillDown, bSetOpenBorders, bIsU, bIsL)
local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMchFindMaster, bIs3Faces, b3Solid, bOrthoFacesMaster, bMillDown, bSetOpenBorders, bIsU, bIsL, dOvmHead)
local nFirstMachId
local bOrthoFaces
@@ -3473,8 +3480,32 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
local sMchFind = 'Pocket'
local dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt
local bBadMach = false
dOvmHead = dOvmHead or 10
-- minima altezza della tasca sotto alla quale fa una contornatura invece di una svuotatura
local dMinFaceElevForPocket = 20
-- se l'utente forza un utensile e la lavorazione è forzata dal lato modifico la minima altezza della tasca
local sChosenToolUuid
if ( ( EgtGetInfo( Proc.Id, Q_TOOL_ID, 'i') or 0) > 0 and ( EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') or 0) > 1) then
local nChosenToolUuid = EgtGetInfo( Proc.Id, Q_TOOL_ID, 'i')
local sToolName = EgtTdbGetFirstTool( MCH_TF.MILL)
while sToolName ~= '' do
EgtTdbSetCurrTool( sToolName)
local nToolId = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'Tool_ID', 'i')
local bIsToolActive = EgtTdbGetCurrToolParam( MCH_TP.ACTIVE)
if ( ( nChosenToolUuid == nToolId) and bIsToolActive) then break end
sToolName = EgtTdbGetNextTool( MCH_TF.MILL)
end
if sToolName == '' then
sChosenToolUuid = ''
else
local dChosenToolDiameter = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
dMinFaceElevForPocket = dChosenToolDiameter / 2 + 10 * GEO.EPS_SMALL
sChosenToolUuid = EgtTdbGetCurrToolParam( MCH_TP.UUID)
end
end
if sMchFindMaster and #sMchFindMaster > 0 then
sMchFind = sMchFindMaster
end
@@ -3493,7 +3524,9 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
else
bOrthoFaces = bOrthoFacesMaster
end
local bMakeContour = false
local bMakePocket, sPocketing, dMaxDepth, dDiamTool
local sMilling
-- se è un tunnel verifico se è possibile usare la svuotatura
if bOrthoFaces then
-- ottengo le dimensioni del tunnel
@@ -3520,10 +3553,10 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
-- ricalcolo se è lavorabile da sotto
bMillDown = ( BD.DOWN_HEAD == true)
-- verifico se può essere fatto con svuotatura
local bMakePocket, sPocketing, dMaxDepth, dDiamTool = VerifyPocket( Proc, dDimMin, dDepth / 2, nil, sMchFind)
bMakePocket, sPocketing, dMaxDepth, dDiamTool = VerifyPocket( Proc, dDimMin, dDepth / 2, nil, sMchFind, nil, nil, sChosenToolUuid)
local bMakePocketDn, sPocketingDn, dMaxDepthDn, dDiamToolDn
if bMillDown then
bMakePocketDn, sPocketingDn, dMaxDepthDn, dDiamToolDn = VerifyPocket( Proc, dDimMin, dDepth / 2, nil, sMchFind, nil, true)
bMakePocketDn, sPocketingDn, dMaxDepthDn, dDiamToolDn = VerifyPocket( Proc, dDimMin, dDepth / 2, nil, sMchFind, nil, true, sChosenToolUuid)
-- se è negativo inverto il versore e la faccia
if vtOrtho:getZ() < 0 then
vtOrtho = -vtOrtho
@@ -3532,11 +3565,9 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
end
local nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc.Id, nPartId)
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
local bMakeContour = false
local sMilling
-- recupero la lavorazione di contornatura
sMilling = ML.FindMilling( 'Prof', nil, sChosenToolUuid)
if dFacElev < dMinFaceElevForPocket and ( bIsU or bIsL) and ( Proc.Fct == 2 or Proc.Fct == 3) and abs( vtN:getZ()) > 0.996 then
-- recupero la lavorazione di contornatura
sMilling = ML.FindMilling( 'Prof', nil, nil, nil, nil, not bMillDown, bMillDown)
if not sMilling then
local sMyWarn = 'Warning : Prof not found in library'
EgtOutLog( sMyWarn)
@@ -3547,8 +3578,8 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
if sMilling and EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dDiamTool = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dToolMaxDepth
dDiamTool = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dDiamTool
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
bMakeContour = true
end
end
@@ -3703,18 +3734,20 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LI.LINEAR)
EgtSetMachiningParam( MCH_MP.LITANG, 0)
EgtSetMachiningParam( MCH_MP.LOTANG, 0)
EgtSetMachiningParam( MCH_MP.LIPERP, 30)
EgtSetMachiningParam( MCH_MP.LOPERP, 30)
EgtSetMachiningParam( MCH_MP.LIPERP, dMinFaceElevForPocket + 10)
EgtSetMachiningParam( MCH_MP.LOPERP, dMinFaceElevForPocket + 10)
elseif bIsL then
EgtSetMachiningParam( MCH_MP.STARTADDLEN, 30)
EgtSetMachiningParam( MCH_MP.STARTADDLEN, 0)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dAddWorkWidth)
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.TANGENT)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LI.LINEAR)
EgtSetMachiningParam( MCH_MP.LITANG, 30)
EgtSetMachiningParam( MCH_MP.LITANG, dOvmHead + ( dDiamTool / 2) + 10)
EgtSetMachiningParam( MCH_MP.LOTANG, 0)
EgtSetMachiningParam( MCH_MP.LIPERP, 0)
EgtSetMachiningParam( MCH_MP.LOPERP, 30)
EgtSetMachiningParam( MCH_MP.LOPERP, dMinFaceElevForPocket + 10)
end
EgtSetMachiningParam( MCH_MP.TOOLINVERT, false)
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
end
-- imposto elevazione e dichiaro non si generano sfridi per VMill
local sNotes = ''
@@ -3836,25 +3869,26 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
EgtSetMachiningParam( MCH_MP.LIELEV, 0)
EgtSetMachiningParam( MCH_MP.LOELEV, 0)
if bIsU then
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dAddWorkWidth)
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dAddWorkWidth)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dAddWorkWidth)
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.LINEAR)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LI.LINEAR)
EgtSetMachiningParam( MCH_MP.LITANG, 0)
EgtSetMachiningParam( MCH_MP.LOTANG, 0)
EgtSetMachiningParam( MCH_MP.LIPERP, 30)
EgtSetMachiningParam( MCH_MP.LOPERP, 30)
EgtSetMachiningParam( MCH_MP.LIPERP, dMinFaceElevForPocket + 10)
EgtSetMachiningParam( MCH_MP.LOPERP, dMinFaceElevForPocket + 10)
elseif bIsL then
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dAddWorkWidth)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, 30)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, 0)
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.LINEAR)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LI.TANGENT)
EgtSetMachiningParam( MCH_MP.LITANG, 0)
EgtSetMachiningParam( MCH_MP.LOTANG, 30)
EgtSetMachiningParam( MCH_MP.LIPERP, 30)
EgtSetMachiningParam( MCH_MP.LOTANG, dOvmHead + ( dDiamTool / 2) + 10)
EgtSetMachiningParam( MCH_MP.LIPERP, dMinFaceElevForPocket + 10)
EgtSetMachiningParam( MCH_MP.LOPERP, 0)
end
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
end
-- imposto elevazione e dichiaro non si generano sfridi per VMill
sNotes = ''
@@ -3875,7 +3909,7 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
end
end
-- se non completo e U, cerco di lavorare anche la faccia di fondo (con il massimo affondamento possibile)
if not bComplete and bIs3Faces then
if not bComplete and bIs3Faces and not bMakeContour then
-- recupero la faccia da lavorare
local nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc.Id, nPartId)
local vtN
@@ -3949,8 +3983,13 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
end
end
end
return 0, sWarn, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, dDiamTool, bDoubleSide, nPathInt, nSurfInt, bOneShot, bMillDown, nFirstMachId, bOrthoFaces
if ( sChosenToolUuid == '') or ( sChosenToolUuid and ( ( bMakeContour and not sMilling) or not sPocketing)) then
local sErr = 'Error : no machining found with chosen Tool_ID'
EgtOutLog( sErr)
return -1, sErr
else
return 0, sWarn, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, dDiamTool, bDoubleSide, nPathInt, nSurfInt, bOneShot, bMillDown, nFirstMachId, bOrthoFaces
end
end
---------------------------------------------------------------------
@@ -5099,7 +5138,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
-- lavoro con svuotature (singola o doppia contrapposta)
local sMyMchFind = 'Pocket'
nOk, sErr, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, _, _, _, _, _, _, _,
bOrthoFaces = MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMyMchFind, true, b3Solid, nil, bMillDown)
bOrthoFaces = MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMyMchFind, true, b3Solid, nil, bMillDown, bSetOpenBorders, bIsU, bIsL, dOvmHead)
-- se lavorazione non idonee ( asse della feature troppo inclinato e impossibile lavorare completamente da due parti)
if nOk == -2 then
if not sMchFind then
@@ -5277,7 +5316,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
bSetOpenBorders = true
end
nOk, sErr, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, dDiamTool, bDoubleSide, nPathInt, nSurfInt, bOneShot, bMillDown, nFirstMachId,
bOrthoFaces = MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMyMchFind, bIs3Faces, b3Solid, bOrthoFacesMaster, bMillDown, bSetOpenBorders, bIsU, bIsL)
bOrthoFaces = MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMyMchFind, bIs3Faces, b3Solid, bOrthoFacesMaster, bMillDown, bSetOpenBorders, bIsU, bIsL, dOvmHead)
if nOk == -3 then
bTryWithBlades = true
elseif nOk == -2 then