- qualche piccola modifica a WallExec

- in LapJoint (MakeTwoFaces e altri make, manca MakeMoreFaces) implementata parzialmente gestione doppio
- in MachiningLib aggiunta la possibilità di forzare una testa per milling e pocketing
This commit is contained in:
luca.mazzoleni
2023-07-14 19:02:13 +02:00
parent f2027d03a3
commit 5b5ce504b1
3 changed files with 147 additions and 19 deletions
+11 -6
View File
@@ -3,7 +3,8 @@
-- 2023/03/09 Piccola correzione alla SideDepth in FindMilling
-- In FindMilling aggiunta gestione spessore e massimo materiale nel caso di lam
-- 2023/05/25 Aggiunta funzione AddMachining che incapsula EgtAddMachining trascrivendo le priorità btl dalle feature alle lavorazioni.
-- 2023/06/07 Alla funzione AddMachining aggiunta la scrittura dell'info ISOUTLINE alle lavorazioni.
-- 2023/06/07 Alla funzione AddMachining aggiunta la scrittura di alcune info alle lavorazioni.
-- 2023/07/13 In FindMilling, FindPocketing aggiunta la possibilità di limitare la ricerca lavorazioni alla sola testa specificata.
-- Tabella per definizione modulo
local WMachiningLib = {}
@@ -55,7 +56,7 @@ function WMachiningLib.FindCutting( sType, dDepth, nTool_ID)
end
---------------------------------------------------------------------
function WMachiningLib.FindMilling( sType, dDepth, sTuuid, nTool_ID, dMaxDiam, dMaxMat, bTipFeed, dMinSideElev)
function WMachiningLib.FindMilling( sType, dDepth, sTuuid, nTool_ID, dMaxDiam, dMaxMat, bTipFeed, dMinSideElev, sHead)
for i = 1, #Millings do
local Milling = Millings[i]
if Milling.On and Milling.Type == sType and SetCurrMachiningAndTool( Milling.Name) then
@@ -69,6 +70,7 @@ function WMachiningLib.FindMilling( sType, dDepth, sTuuid, nTool_ID, dMaxDiam, d
local dTTipFeed = EgtTdbGetCurrToolParam( MCH_TP.TIPFEED)
local dTMaxDepthOnSide = EgtIf( bIsBlade, EgtTdbGetCurrToolParam( MCH_TP.MAXMAT), min( EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDEDEPTH', 'd') or 999, 0.5 * ( dTDiam - dTDiamTh)))
local nMyTool_ID = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'Tool_ID', 'i')
local sMyHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
if nMchType == MCH_MY.MILLING and
( not sTuuid or sTuuid == sMyTuuid) and
( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and
@@ -76,7 +78,8 @@ function WMachiningLib.FindMilling( sType, dDepth, sTuuid, nTool_ID, dMaxDiam, d
( not dMaxMat or dTMaxMat < dMaxMat + GEO.EPS_SMALL) and
( not bTipFeed or dTTipFeed > 1) and
( not dMinSideElev or dTMaxDepthOnSide > dMinSideElev - GEO.EPS_SMALL) and
( not nTool_ID or nTool_ID == 0 or nTool_ID == nMyTool_ID) then
( not nTool_ID or nTool_ID == 0 or nTool_ID == nMyTool_ID) and
( not sHead or sHead == sMyHead) then
return Milling.Name, dTMaxDepth, dTMaxMat, dTDiam
end
end
@@ -99,18 +102,20 @@ function WMachiningLib.FindNailing( nType)
end
---------------------------------------------------------------------
function WMachiningLib.FindPocketing( sType, dMaxDiam, dDepth, nTool_ID)
function WMachiningLib.FindPocketing( sType, dMaxDiam, dDepth, nTool_ID, sHead)
for i = 1, #Pocketings do
local Pocketing = Pocketings[i]
if Pocketing.On and Pocketing.Type == sType and SetCurrMachiningAndTool( Pocketing.Name) then
local nMchType = EgtMdbGetCurrMachiningParam( MCH_MP.TYPE)
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTMaxDepth = EgtIf( WD.MILL_MAX_DEPTH_AS_MAT, EgtTdbGetCurrToolParam( MCH_TP.MAXMAT), EgtTdbGetCurrToolMaxDepth())
local nMyTool_ID = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'Tool_ID', 'i')
local nMyTool_ID = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'Tool_ID', 'i')
local sMyHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
if nMchType == MCH_MY.POCKETING and
( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and
( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and
( not nTool_ID or nTool_ID == 0 or nTool_ID == nMyTool_ID) then
( not nTool_ID or nTool_ID == 0 or nTool_ID == nMyTool_ID) and
( not sHead or sHead == sMyHead) then
return Pocketing.Name, dTDiam, dTMaxDepth
end
end
+126 -7
View File
@@ -731,6 +731,56 @@ local function MakeLocalSurf( ptP1, ptP2, ptP3, nAddGrpId)
return nidFace
end
---------------------------------------------------------------------
local function IsToolDoubleOk( sToolMasterName, sToolDoubleName)
local bIsToolDoubleOk = false
-- dimensioni utensile master
EgtTdbSetCurrTool( sToolMasterName)
local bIsBlade = ( EgtTdbGetCurrToolParam( MCH_TP.TYPE) & MCH_TF.SAWBLADE ~= 0) or false
local dTMaxMat = EgtIf( bIsBlade, EgtTdbGetCurrToolParam( MCH_TP.THICK), EgtTdbGetCurrToolParam( MCH_TP.MAXMAT))
local dTMaxDepth = EgtIf( WD.MILL_MAX_DEPTH_AS_MAT, dTMaxMat, EgtTdbGetCurrToolMaxDepth())
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTDiamTh = EgtTdbGetCurrToolThDiam() or 0
local bTipFeed = EgtTdbGetCurrToolParam( MCH_TP.TIPFEED) > 0
local dTMaxDepthOnSide = EgtIf( bIsBlade, EgtTdbGetCurrToolParam( MCH_TP.MAXMAT), min( EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDEDEPTH', 'd') or 999, 0.5 * ( dTDiam - dTDiamTh)))
-- dimensioni utensile double
EgtTdbSetCurrTool( sToolDoubleName)
local bIsBladeDouble = ( EgtTdbGetCurrToolParam( MCH_TP.TYPE) & MCH_TF.SAWBLADE ~= 0) or false
local dTMaxMatDouble = EgtIf( bIsBladeDouble, EgtTdbGetCurrToolParam( MCH_TP.THICK), EgtTdbGetCurrToolParam( MCH_TP.MAXMAT))
local dTMaxDepthDouble = EgtIf( WD.MILL_MAX_DEPTH_AS_MAT, dTMaxMatDouble, EgtTdbGetCurrToolMaxDepth())
local dTDiamDouble = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTDiamThDouble = EgtTdbGetCurrToolThDiam() or 0
local bTipFeedDouble = EgtTdbGetCurrToolParam( MCH_TP.TIPFEED) > 0
local dTMaxDepthOnSideDouble = EgtIf( bIsBladeDouble, EgtTdbGetCurrToolParam( MCH_TP.MAXMAT), min( EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDEDEPTH', 'd') or 999, 0.5 * ( dTDiamDouble - dTDiamThDouble)))
-- controllo che siano uguali
bIsToolDoubleOk = ( bIsBlade == bIsBladeDouble) and
( abs( dTMaxMat - dTMaxMatDouble) < 100 * GEO.EPS_SMALL) and
( abs( dTMaxDepth - dTMaxDepthDouble) < 100 * GEO.EPS_SMALL) and
( abs( dTDiam - dTDiamDouble) < 100 * GEO.EPS_SMALL) and
( abs( dTDiamTh - dTDiamThDouble) < 100 * GEO.EPS_SMALL) and
( bTipFeed == bTipFeedDouble) and
( abs( dTMaxDepthOnSide - dTMaxDepthOnSideDouble) < GEO.EPS_SMALL) and
EgtTdbGetCurrToolParam( MCH_TP.ACTIVE)
return bIsToolDoubleOk
end
---------------------------------------------------------------------
local function IsMachiningOkForDouble( sMachining)
local bDoubleOk = false
if sMachining and EgtMdbSetCurrMachining( sMachining) then
-- recupero l'utensile della lavorazione
local sToolMasterName = EgtMdbGetCurrMachiningParam( MCH_MP.TOOL)
if EgtTdbSetCurrTool( sToolMasterName or '') then
-- cerco eventuale utensile in doppio
local sToolDoubleName = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'DOUBLE', 's')
if sToolDoubleName and EgtTdbSetCurrTool( sToolDoubleName) then
bDoubleOk = IsToolDoubleOk( sToolMasterName, sToolDoubleName)
end
end
end
return bDoubleOk
end
---------------------------------------------------------------------
local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTypeConeCut, nAddGrpId,
dToolDiam, dThick, sMilling, dOffsAng, dDepthMach,
@@ -1282,6 +1332,14 @@ local function MakeByMill( Proc, nFacet, nOthFac, nRawId, b3Raw, dSideDist)
local _, vtRef = EgtSurfTmFacetCenter( Proc.Id, nOthFac, GDB_ID.ROOT)
-- recupero la lavorazione
local sMilling = WM.FindMilling( 'Side')
if Proc.Double and Proc.Double == 2 then
local sMillingBackup = sMilling
sMilling = WM.FindMilling( 'Side', nil, nil, nil, nil, nil, nil, nil, 'H1')
if not IsMachiningOkForDouble( sMilling) then
Proc.Double = 0
sMilling = sMillingBackup
end
end
if not sMilling then return false end
-- recupero i dati dell'utensile
local dMillDiam = 20
@@ -1345,6 +1403,16 @@ local function MakeByMill( Proc, nFacet, nOthFac, nRawId, b3Raw, dSideDist)
-- imposto modo di lavorare la faccia
local nFaceUse = WL.GetNearestOrthoOpposite( vtRef, vtN)
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- leggo eventuali note esistenti della lavorazione
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
-- se lavorazione in doppio aggiungo le rispettive note
if Proc.Double and Proc.Double == 2 then
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double)
sUserNotes = EgtSetValInNotes( sUserNotes, 'MirrorAx', Proc.MirrorAx)
sUserNotes = EgtSetValInNotes( sUserNotes, 'DeltaZ', Proc.MirrorDeltaZ)
end
-- scrivo le note della lavorazione
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
@@ -1355,7 +1423,7 @@ local function MakeByMill( Proc, nFacet, nOthFac, nRawId, b3Raw, dSideDist)
end
---------------------------------------------------------------------
local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, dMaxDepthOnSide, bEnablePreMill, bMachFromDn, dAng, bAsEnablePreMill, nSinglePass, bExcludeFinishing)
local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, dMaxDepthOnSide, bEnablePreMill, bMachFromDn, dAng, bAsEnablePreMill, nSinglePass, bExcludeFinishing, bDoubleCustomMach)
local sWarn
-- dati della faccia principale (la più verticale)
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacet, GDB_ID.ROOT)
@@ -1376,9 +1444,20 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
-- se ho lavorazione custom
if sCustomMach then
sMilling = sCustomMach
-- se avevo stabilito che la customMach non era adatta al double, setto per non specchiare
if not bDoubleCustomMach then Proc.Double = 0 end
-- altrimenti la cerco
else
sMilling = WM.FindMilling( 'SideGroove', nil, nil, nil, nil, min( dH, dV))
-- se Proc è settata per essere specchiata cerco la lavorazione adatta e verifico possa essere effettivamente specchiata
if Proc.Double and Proc.Double == 2 then
local sMillOnSideBackup = sMilling
sMilling = WM.FindMilling( 'SideGroove', nil, nil, nil, nil, min( dH, dV), nil, nil, 'H1')
if not IsMachiningOkForDouble( sMilling) then
Proc.Double = 0
sMilling = sMillOnSideBackup
end
end
end
if not sMilling then
local sErr = 'Error : SideGroove not found in library'
@@ -1832,6 +1911,12 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
-- aggiungo alle note massima elevazione
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dMaxElev, 3))
-- se lavorazione in doppio aggiungo le rispettive note
if Proc.Double and Proc.Double == 2 then
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double)
sUserNotes = EgtSetValInNotes( sUserNotes, 'MirrorAx', Proc.MirrorAx)
sUserNotes = EgtSetValInNotes( sUserNotes, 'DeltaZ', Proc.MirrorDeltaZ)
end
-- scrivo le note della lavorazione
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- setto il lato di lavoro standard
@@ -2093,11 +2178,28 @@ local function MakeByPocketing( Proc, nFacet, nRawId, b3Raw, bCheckQPar)
local sPocketing = WM.FindPocketing( 'Pocket', dDiam, dElev)
if not sPocketing then
sPocketing = WM.FindPocketing( 'Pocket', dDiam)
if Proc.Double and Proc.Double == 2 then
local sPocketingBackup = sPocketing
sPocketing = WM.FindPocketing( 'Pocket', dDiam, nil, nil, 'H1')
if not IsMachiningOkForDouble( sPocketing) then
Proc.Double = 0
sPocketing = sPocketingBackup
end
end
if not sPocketing then
local sErr = 'Error : pocketing not found in library'
EgtOutLog( sErr)
return false, sErr
end
else
if Proc.Double and Proc.Double == 2 then
local sPocketingBackup = sPocketing
sPocketing = WM.FindPocketing( 'Pocket', dDiam, dElev, nil, 'H1')
if not IsMachiningOkForDouble( sPocketing) then
Proc.Double = 0
sPocketing = sPocketingBackup
end
end
end
-- recupero i dati dell'utensile
local dMillDiam = 20
@@ -2147,6 +2249,12 @@ local function MakeByPocketing( Proc, nFacet, nRawId, b3Raw, bCheckQPar)
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
-- imposto elevazione
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( min( dElev, dMaxDepth), 1))
-- se lavorazione in doppio aggiungo le rispettive note
if Proc.Double and Proc.Double == 2 then
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double)
sUserNotes = EgtSetValInNotes( sUserNotes, 'MirrorAx', Proc.MirrorAx)
sUserNotes = EgtSetValInNotes( sUserNotes, 'DeltaZ', Proc.MirrorDeltaZ)
end
-- scrivo le note della lavorazione
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
@@ -2279,7 +2387,18 @@ local function MakeTwoFaces( Proc, nRawId, b3Raw)
dMinSideElev = dDimY[2]
end
end
local sMillOnSide, dTMaxDepth, dMaxMat, dDiam = WM.FindMilling( 'SideMill', nil, nil, nil, nil, dMaxThick, nil, dMinSideElev)
local sMillOnSide = WM.FindMilling( 'SideMill', nil, nil, nil, nil, dMaxThick, nil, dMinSideElev)
-- se Proc è settata per essere specchiata cerco la lavorazione adatta e verifico possa essere effettivamente specchiata
local bDoubleMillOnSide = false
if Proc.Double and Proc.Double == 2 then
local sMillOnSideBackup = sMillOnSide
sMillOnSide = WM.FindMilling( 'SideMill', nil, nil, nil, nil, dMaxThick, nil, dMinSideElev, 'H1')
if IsMachiningOkForDouble( sMillOnSide) then
bDoubleMillOnSide = true
else
sMillOnSide = sMillOnSideBackup
end
end
local bEnableMillOnSide
if sMillOnSide and nUseMillOnSide >= 1 then
dMaxZVers = 0.866
@@ -2340,7 +2459,7 @@ local function MakeTwoFaces( Proc, nRawId, b3Raw)
end
-- se posso eseguire la lavorazione per distanza inferiore utensile o lavorazione preceduta da sgossatura gola
if bInsertMach then
return MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, EgtIf( bEnableMillOnSide and dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng)
return MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, EgtIf( bEnableMillOnSide and dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, nil, nil, nil, bDoubleMillOnSide)
else
local sErr = 'Error feature not machinable (dimensions)'
EgtOutLog( sErr)
@@ -2408,10 +2527,10 @@ local function MakeTwoFaces( Proc, nRawId, b3Raw)
local bMachFromDn = false
local bInsertMach
if dSideDist and dSideDist < dMaxDist then
-- se abilitata SideMill
if bEnableMillOnSide and dMaxDepthOnSide > 0 then
-- se abilitata SideMill oppure se la specchiata guarda in basso e quindi l'attacco deve essere a filo
if ( bEnableMillOnSide and dMaxDepthOnSide > 0) or ( Proc.Double == 2 and Proc.MirrorDeltaZ and abs( Proc.MirrorDeltaZ) > GEO.EPS_SMALL) then
bLikeAsMakeFirstGroove = false
return MakeSideGrooveByMill( Proc, nFacetVert, nRawId, b3Raw, EgtIf( bEnableMillOnSide and dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, bLikeAsMakeFirstGroove)
return MakeSideGrooveByMill( Proc, nFacetVert, nRawId, b3Raw, EgtIf( bEnableMillOnSide and dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, bLikeAsMakeFirstGroove, nil, nil, bDoubleMillOnSide)
else
local bOk, sErr = MakeByMill( Proc, nFacet, 1 - nFacet, nRawId, b3Raw, dSideDist)
-- se angolo ottuso riprendo il lato quasi verticale
@@ -2422,7 +2541,7 @@ local function MakeTwoFaces( Proc, nRawId, b3Raw)
end
elseif bEnableMillOnSide and dMaxDepthOnSide > 0 then
bLikeAsMakeFirstGroove = true
local bOk, sErr = MakeSideGrooveByMill( Proc, nFacetVert, nRawId, b3Raw, EgtIf( bEnableMillOnSide and dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, bLikeAsMakeFirstGroove)
local bOk, sErr = MakeSideGrooveByMill( Proc, nFacetVert, nRawId, b3Raw, EgtIf( bEnableMillOnSide and dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, bLikeAsMakeFirstGroove, nil, nil, bDoubleMillOnSide)
if bOk then return true end
end
-- se non inclinate o capacità di taglio non sufficiente o non molto grandi (80mm), provo con contornatura o svuotatura
+10 -6
View File
@@ -641,18 +641,18 @@ function InsertScrapRemoval( nPhase)
end
-------------------------------------------------------------------------------------------------------------
-- Cerca in vProc la presenza di feature da lavorare in doppio e, se trovate, ne setta i parametri
-- Controlla in vProc la presenza di feature da lavorare in doppio e, se trovate, ne setta i parametri
local function SetMirroredFeatures( vProc, b3Raw)
for i = 1, #vProc do
local Proc = vProc[i]
if Proc.Flg ~= 0 then
-- AGGIUNGERE DIPENDENZA DA COSTANTE WALLDATA!!
-- tasca sul fianco (non groove)
if Proc.TopologyLongName == 'Rabbet-Through-RightAngles-Parallel-2'or
Proc.TopologyLongName == 'Groove-Blind-RightAngles-Parallel-3' or
Proc.TopologyLongName == 'Groove-Blind-RightAngles-Parallel-4' or
Proc.TopologyLongName == 'Tunnel-Blind-RightAngles-Parallel-5' then
Proc.TopologyLongName == 'Tunnel-Blind-RightAngles-Parallel-5' or
( Proc.TopologyLongName == 'Groove-Through-RightAngles-Parallel-3' and Proc.AffectedFaces.Front) then
-- feature rivolta verso Y- e parallela a X
local bIsFeatureFacingFrontSide = Proc.AffectedFaces.Front
-- feature vicino al bordo Y- del grezzo
@@ -723,9 +723,6 @@ local function SetMirroredFeatures( vProc, b3Raw)
Proc.MirrorDeltaZ = dDeltaZ
end
-- groove passante
elseif Proc.TopologyLongName == 'Groove-Through-RightAngles-Parallel-3' then
end
end
end
@@ -792,6 +789,13 @@ function WallExec.ProcessFeatures()
end
end
EgtOutLog( ' *** End AddMachinings ***', 1)
-------
-- LAVORAZIONI IN DOPPIO - QUI INSERIRE:
-- ELIMINAZIONE LAVORAZIONI MIRROR IN BASE A SETTAGGIO MACHININGTODELETE IN PROC
-- VERIFICA E UPDATE NOTE PER LAVORAZIONI IN CUI SI CONTROLLA SE I PERCORSI SONO SPECCHIATI
-------
-- se macchina pareti
if not WD.BEAM_MACHINE then
-- riordino le lavorazioni tra tutti i pezzi