Compare commits

..

1 Commits

Author SHA1 Message Date
luca.mazzoleni 7c8a1f2de6 - tabella Proc.Face in Collect da rendere read-only
- in ProcessBlockHouseFront chiamate a GetFaceHvRefDim sostituite con lettura di Proc.Face[]
2024-03-11 16:14:05 +01:00
15 changed files with 122 additions and 1064 deletions
+4 -4
View File
@@ -24,14 +24,14 @@ variables:
$FileList = Get-ChildItem("*.lua")
ForEach ($File in $FileList) {
$FileName = Split-Path $File -leaf
lua54 -o bin\$FileName -s $FileName
echo "lua54 -o bin\$FileName -s $FileName"
lua54 -o bin\$FileName $FileName
echo "lua54 -o bin\$FileName $FileName"
}
$FileList = Get-ChildItem("LuaLibs\*.lua")
ForEach ($File in $FileList) {
$FileName = Split-Path $File -leaf
lua54 -o bin\LuaLibs\$FileName -s LuaLibs\$FileName
echo "lua54 -o bin\LuaLibs\$FileName -s LuaLibs\$FileName"
lua54 -o bin\LuaLibs\$FileName LuaLibs\$FileName
echo "lua54 -o bin\LuaLibs\$FileName LuaLibs\$FileName"
}
# helper copia SORGENTI verso cartella di rete X:\ dei SORGENTI
+25 -46
View File
@@ -60,9 +60,6 @@
-- 2024/03/04 Creata funzione calcolo dipendenze tra feature con calcolo topologia.
-- 2024/03/07 Implementate le lavorazioni in doppio per fori specchiati non passanti e DrillPocket.
-- 2024/03/11 In CollectFeatures si scrive ora Width e Height della faccia sia trimmate con il grezzo che intere.
-- 2024/03/13 In CollectFeatures si scrive lunghezza foro su Proc e si controla se serve Predrill
-- In OrderFeature, preforo sempre prima del foro
-- 2024/04/11 In CollectFeatures aggiunta lettura info PRID, scritta in Proc.FeatureId
-- Tabella per definizione modulo
local BeamExec = {}
@@ -324,7 +321,6 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
-- leggo se ci sono feature collegate
local nAddAdjId = EgtGetInfo( ProcId, 'ADJID', 'i')
local nAddMainId = EgtGetInfo( ProcId, 'MAINID', 'i')
local nFeatureId = EgtGetInfo( ProcId, 'PRID', 'i')
if nGrp and nPrc and nDo == 1 then
local Proc = {}
Proc.PartId = PartId
@@ -338,7 +334,6 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
Proc.Fce = 0
Proc.CutId = nCutId
Proc.TaskId = nTaskId
Proc.FeatureId = nFeatureId or Proc.TaskId
-- se ci sono feature collegate ne scrivo il riferimento nella Proc
if nAddAdjId then
Proc.AdjId = Proc.Id + nAddAdjId
@@ -347,28 +342,41 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
end
Proc.Box = EgtGetBBoxGlob( ProcId, GDB_BB.STANDARD)
if b3Raw then
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
-- recupero l'elenco delle facce della parte interessate dalla feature
Proc.AffectedFaces = BL.GetProcessAffectedFaces( Proc)
-- recupero informazioni sulle facce della feature
if not Proc.Face then
Proc.Face = BL.GetFacetsInfo( Proc, b3Raw)
Proc.Face = {}
for i = 1, Proc.Fct do
Proc.Face[i] = { Id = i - 1, VtN = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT )}
if Proc.Fct < 10 then
local frHV, dFaceWidthTrimmed, dFaceHeightTrimmed = BL.GetFaceHvRefDim( Proc.Id, i - 1, b3Raw)
-- frame OCS faccia
Proc.Face[i].FrameHV = frHV
-- larghezza OCS faccia trimmata con grezzo
Proc.Face[i].WidthTrimmed = dFaceWidthTrimmed
-- altezza OCS faccia trimmata con grezzo
Proc.Face[i].HeightTrimmed = dFaceHeightTrimmed
local _, dFaceWidth, dFaceHeight = BL.GetFaceHvRefDim( Proc.Id, i - 1)
-- larghezza OCS faccia
Proc.Face[i].Width = dFaceWidth
-- altezza OCS faccia
Proc.Face[i].Height = dFaceHeight
-- elevazione calcolata rispetto al box della parte
Proc.Face[i].Elevation = EgtSurfTmFacetElevationInBBox( Proc.Id, i - 1, b3Solid, true, GDB_ID.ROOT)
end
end
end
end
if Proc.Box and not Proc.Box:isEmpty() then
if Proc.Box and not Proc.Box:isEmpty() then
Proc.Head = IsHeadFeature( Proc, b3Raw, dCurrOvmH)
Proc.Tail, Proc.AdvTail = IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT)
table.insert( vProc, Proc)
-- se foro
if Drill.Identify( Proc) then
-- assegno diametro e facce di ingresso e uscita (dati tabelle sempre per riferimento)
Proc.Diam, Proc.Len, Proc.Fcs, Proc.Fce = Drill.GetData( Proc, b3Raw)
-- verifico se devo inserire i prefori
if Drill.IsPredrillNeeded( Proc) then
local bAddProc, PredrillProc= Drill.AddPredrillFromDrillProc( Proc)
if bAddProc then
table.insert( vProc, PredrillProc)
end
end
Proc.Diam, Proc.Fcs, Proc.Fce = Drill.GetData( Proc, b3Raw)
-- verifico se necessaria seconda lavorazione da parte opposta per foro più lungo della punta
if Drill.Split( Proc, b3Raw) then
-- aggiorno flags prima parte foro (dati tabelle sempre per riferimento)
@@ -385,7 +393,6 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
Proc2.Box = BBox3d( Proc.Box)
Proc2.Fct = Proc.Fct
Proc2.Diam = Proc.Diam
Proc2.Len = Proc.Len
Proc2.Head = Drill.IsHeadFeature( Proc2, b3Raw, dCurrOvmH)
Proc2.Tail = Drill.IsTailFeature( Proc2, b3Raw, dCurrOvmH)
Proc2.Fcs = Proc.Fce
@@ -395,13 +402,6 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
Proc2.AdjId = Proc.AdjId
Proc2.MainId = Proc.MainId
table.insert( vProc, Proc2)
-- verifico se devo inserire i prefori
if Drill.IsPredrillNeeded( Proc2) then
local bAddProc, PredrillProc= Drill.AddPredrillFromDrillProc( Proc2)
if bAddProc then
table.insert( vProc, PredrillProc)
end
end
end
-- se BlockHaus HalfLap
elseif Proc.Prc == 37 then
@@ -922,11 +922,7 @@ local function OrderFeatures( vProc, b3Raw)
end
-- se entrambi fori con posizione praticamente uguale ordino secondo diametro e faccia di inizio (Fcs)
if B1.Prc == 40 and B2.Prc == 40 and abs( B1.Box:getCenter():getX() - B2.Box:getCenter():getX()) < dSmallDrillRange then
if B1.IsPredrill and not B2.IsPredrill then
return true
elseif not B1.IsPredrill and B2.IsPredrill then
return false
elseif abs( B1.Diam - B2.Diam) < 1.0 then
if abs( B1.Diam - B2.Diam) < 1.0 then
if B1.Fcs == B2.Fcs then
if abs( B1.Box:getCenter():getX() - B2.Box:getCenter():getX()) < 1.0 then
if abs( B1.Box:getCenter():getY() - B2.Box:getCenter():getY()) < 1.0 then
@@ -1974,11 +1970,6 @@ local function AreDrillingsMirrored( Proc, ProcMirror, b3Raw)
end
end
-- fori della stessa profondità
if abs( Proc.Len - ProcMirror.Len) > 10 * GEO.EPS_SMALL then
return false
end
return true
end
@@ -2056,7 +2047,7 @@ function BeamExec.ProcessFeatures()
-- verifica presenza forature influenzate da lavorazioni di testa o coda
if BD.IMPROVE_HEAD_TAIL_DRILLINGS then
local vMachBeforeIntersDrillings = CalcHeadTailMachBeforeIntersDrillings( vProc, b3Raw)
vMachBeforeIntersDrillings = CalcHeadTailMachBeforeIntersDrillings( vProc, b3Raw)
SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachBeforeIntersDrillings)
end
-- verifica presenza di feature specchiate per eventuali lavorazioni simultanee
@@ -2100,10 +2091,6 @@ function BeamExec.ProcessFeatures()
-- creo la lavorazione
local Proc = vProc[i]
if Proc.Flg ~= 0 and Proc.Down then
-- dato che ho ruotato, aggiorno alcune proprietà della feature
Proc.Box = EgtGetBBoxGlob( Proc.Id, GDB_BB.STANDARD)
Proc.Face = BL.GetFacetsInfo( Proc, b3Raw)
Proc.AffectedFaces = BL.GetProcessAffectedFaces( Proc)
Proc.PrevDouble = nPrevDouble
nPrevDouble = Proc.Double
local bOk, sMsg, nNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bNeedHCut, b3Raw, nOrd, sDownOrSideOrStd, nil, nil, dCurrOvmT)
@@ -2181,10 +2168,6 @@ function BeamExec.ProcessFeatures()
-- creo la lavorazione
local Proc = vProc[i]
if Proc.Flg ~= 0 and Proc.Side then
-- dato che ho ruotato, aggiorno alcune proprietà della feature
Proc.Box = EgtGetBBoxGlob( Proc.Id, GDB_BB.STANDARD)
Proc.Face = BL.GetFacetsInfo( Proc, b3Raw)
Proc.AffectedFaces = BL.GetProcessAffectedFaces( Proc)
Proc.PrevDouble = nPrevDouble
nPrevDouble = Proc.Double
local bOk, sMsg, nNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dCurrOvmT)
@@ -2250,10 +2233,6 @@ function BeamExec.ProcessFeatures()
-- creo la lavorazione
local Proc = vProc[i]
if Proc.Flg ~= 0 and ( not ( Proc.Down or Proc.Side) or BD.DOWN_HEAD or BD.TURN) then
-- dato che ho ruotato, aggiorno alcune proprietà della feature
Proc.Box = EgtGetBBoxGlob( Proc.Id, GDB_BB.STANDARD)
Proc.Face = BL.GetFacetsInfo( Proc, b3Raw)
Proc.AffectedFaces = BL.GetProcessAffectedFaces( Proc)
Proc.PrevDouble = nPrevDouble
nPrevDouble = Proc.Double
local bOk, sMsg, nNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw, nOrd, sDownOrSideOrStd, nil, nil, dCurrOvmT)
+1 -44
View File
@@ -1169,47 +1169,4 @@ function BeamLib.IsFeatureCuttingEntireSection( b3Proc, dRawW, dRawH)
end
-------------------------------------------------------------------------------------------------------------
function BeamLib.GetAdjacentFaces( Proc, nFacet)
local AdjacentFaces = {}
local vFaceAdjacencies = EgtSurfTmFacetAdjacencies( Proc.Id, nFacet)[1]
for i = 1, #vFaceAdjacencies do
if vFaceAdjacencies[i] > -1 then
local _, ptP1, ptP2 = EgtSurfTmFacetsContact( Proc.Id, nFacet, vFaceAdjacencies[i], GDB_ID.ROOT)
local dLen = dist( ptP1, ptP2)
table.insert( AdjacentFaces, { Id = vFaceAdjacencies[i], LengthOnMainFace = dLen})
end
end
return AdjacentFaces
end
-------------------------------------------------------------------------------------------------------------
function BeamLib.GetFacetsInfo( Proc, b3Raw)
Face = {}
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( Proc.PartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
for i = 1, Proc.Fct do
Face[i] = { Id = i - 1, VtN = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT )}
if Proc.Fct < 10 then
local frHV, dFaceWidthTrimmed, dFaceHeightTrimmed = BeamLib.GetFaceHvRefDim( Proc.Id, i - 1, b3Raw)
-- frame OCS faccia
Face[i].FrameHV = frHV
-- larghezza OCS faccia trimmata con grezzo
Face[i].WidthTrimmed = dFaceWidthTrimmed
-- altezza OCS faccia trimmata con grezzo
Face[i].HeightTrimmed = dFaceHeightTrimmed
local _, dFaceWidth, dFaceHeight = BeamLib.GetFaceHvRefDim( Proc.Id, i - 1)
-- larghezza OCS faccia
Face[i].Width = dFaceWidth
-- altezza OCS faccia
Face[i].Height = dFaceHeight
-- elevazione calcolata rispetto al box della parte
Face[i].Elevation = EgtSurfTmFacetElevationInBBox( Proc.Id, i - 1, b3Solid, true, GDB_ID.ROOT)
end
end
return Face
end
-------------------------------------------------------------------------------------------------------------
return BeamLib
return BeamLib
+6 -2
View File
@@ -27,7 +27,6 @@
-- 2024/01/18 Gestita lama con aggregato con asse bloccato per massimizzare capacità di taglio verticale, se da sotto.
-- Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile.
-- 2024/02/22 Migliorato calcolo area non pinzabile in testa HCING e coda TCING
-- 2024/03/27 In MakeTwo rimossa gestione calcolo differente su ultima passata in caso di macchina FAST
-- Tabella per definizione modulo
local FacesBySaw = {}
@@ -619,7 +618,12 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
local vtOrthO = EgtIf( ( i % 2) == 1, vtRef[nOtInd], vtRef[nUpInd])
-- lavoro la faccia
for j = 1, #vCuts[i] do
local bOk, sErr = FacesBySaw.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthO, dNzLimDwnUp, dCutExtra, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
-- se FAST, pezzo alto e ultimo taglio verticale -> allungo uscita per consentire eventuale rotazione B sul posto
local dAccEnd = 0
if not BD.C_SIMM and BD.MAX_HEIGHT_ROT_B_ABOVE and b3Raw:getDimZ() > BD.MAX_HEIGHT_ROT_B_ABOVE and vtOrthO:getZ() > 0.866 and j == #vCuts[i] then
dAccEnd = - ( dSawDiam / 2 + BD.CUT_SIC)
end
local bOk, sErr = FacesBySaw.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthO, dNzLimDwnUp, dCutExtra, BD.CUT_SIC, 0, 0, dAccEnd, nil, b3Raw)
if not bOk then
return bOk, sErr
end
+4 -12
View File
@@ -6,7 +6,6 @@
-- 2023/11/03 In Classify ora si settano le AffectedFaces nella Proc, se non già presenti.
-- Aggiunta groove 2 facce, differenziata da rabbet.
-- 2024/03/04 Feature senza topologia, calcolato in BeamExec
-- 2024/05/06 A topologia Cut aggiunta IsThrough = true
-- Tabella per definizione modulo
local FeatureTopology = {}
@@ -114,11 +113,11 @@ end
---------------------------------------------------------------------
-- restituisce un vettore contenente gli indici delle facce di Proc parallele ad una delle direzioni principali; il check varia in base alla famiglia topologica
local function GetFacesParallelToPart( Proc, sFamily)
local function GetFacesParallelToPart( Proc, sFamily, bIsThrough)
local vFacesParallelToPart = {}
for i = 0, Proc.Fct - 1 do
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i, GDB_ID.ROOT)
if sFamily == 'Rabbet' or sFamily == 'Bevel' or sFamily == 'DoubleBevel' or sFamily == 'Strip' then
if sFamily == 'Rabbet' or sFamily == 'Bevel' or sFamily == 'DoubleBevel' or sFamily == 'Strip' or sFamily == 'Tunnel' or ( sFamily == 'Groove' and bIsThrough) then
local vTriangularFaces = GetTriangularFaces( Proc)
local bIsTriangularFace = false
-- verifico se la faccia è triangolare
@@ -181,12 +180,7 @@ function FeatureTopology.Classify( Proc, b3Raw)
end
-- calcoli
if not Proc.AffectedFaces then
Proc.AffectedFaces = BL.GetProcessAffectedFaces( Proc)
end
if not Proc.Face then
Proc.Face = BL.GetFacetsInfo( Proc, b3Raw)
end
if not Proc.AffectedFaces then Proc.AffectedFaces = BL.GetProcessAffectedFaces( Proc) end
local vAdj = GetAdjacencyMatrix( Proc)
local bAllAnglesConcave, bAllRightAngles = AreAllAnglesConcaveOrRight( vAdj)
@@ -205,7 +199,6 @@ function FeatureTopology.Classify( Proc, b3Raw)
local bIsThrough
if Proc.Fct == 1 and bIsAnyDimensionLongAsPart and bIsFeatureCuttingEntireSection then
sFamily = 'Cut'
bIsThrough = true
elseif Proc.Fct == 1 and bIsAnyDimensionLongAsPart then
sFamily = 'Bevel'
bIsThrough = true
@@ -246,7 +239,7 @@ function FeatureTopology.Classify( Proc, b3Raw)
end
-- verifico se facce parallele a quelle della trave
local vFacesParallelToPart = GetFacesParallelToPart( Proc, sFamily)
local vFacesParallelToPart = GetFacesParallelToPart( Proc, sFamily, bIsThrough)
local bIsParallel = ( #vFacesParallelToPart == Proc.Fct)
-- assegnazioni
@@ -256,7 +249,6 @@ function FeatureTopology.Classify( Proc, b3Raw)
Proc.IsThrough = bIsThrough
Proc.AllRightAngles = bAllRightAngles
Proc.IsParallel = bIsParallel
Proc.vAdj = vAdj
return true
else
Proc.Topology = 'OTHER'
+4 -14
View File
@@ -13,7 +13,6 @@
-- 2024/01/23 Nella GetMachinings vengono ora raccolti i parametri utensile necessari per i VerifyTool, scritti direttamente nella tabella Machining.Tool.
-- Le lavorazioni possono essere ora ordinate per dimensioni utensile (Longest, Shortest, Biggest, Smallest) se passato l'apposito parametro SortingCriterion in FindMachining. Al momento implementato solo per FindSawing.
-- 2024/03/01 In VerifyPocketing implementato l'ordinamento per dimensioni utensile.
-- 2024/03/13 Aggiunta gestione Predrill
-- Tabella per definizione modulo
local MachiningLib = {}
@@ -170,7 +169,7 @@ end
---------------------------------------------------------------------
function VerifyTool( Machining, MachiningType, Params, bH2)
if MachiningType == MCH_MY.DRILLING then
if Machining.SubType == 'Drill' or Machining.SubType == 'AngleDrill' or Machining.SubType == 'Predrill' then
if Machining.SubType == 'Drill' or Machining.SubType == 'AngleDrill' then
return VerifyDrill( Machining, Params.Diam, Params.Depth, bH2)
elseif Machining.SubType == 'DrillPocket' then
return VerifyDrillPocket( Machining, Params.Diam, Params.Depth, bH2)
@@ -226,8 +225,6 @@ function GetMachinings( MachiningType, sType)
Machining.SubType = 'AngleDrill'
elseif EgtStartsWith( Machining.Type, 'Pocket') then
Machining.SubType = 'DrillPocket'
elseif EgtStartsWith( Machining.Type, 'Predrill') then
Machining.SubType = 'Predrill'
end
end
Machining.Tool.Diameter = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
@@ -303,7 +300,7 @@ end
function ReturnParams( MachiningType, MachiningName, sType, ToolParams)
if MachiningType == MCH_MY.DRILLING then
local _, sOrigType = EgtEndsWith( sType, '_H2')
return MachiningName, sType, EgtIf( sOrigType == 'Drill' or sOrigType == 'Drill_AT' or sOrigType == 'AngleDrill' or sOrigType == 'Predrill' , ToolParams.TMaxMat, ToolParams.TMaxDepth), ToolParams.MaxToolLength, ToolParams.ToolDiam, ToolParams.DiamTh, ToolParams.FreeLen
return MachiningName, sType, EgtIf( sOrigType == 'Drill' or sOrigType == 'Drill_AT' or sOrigType == 'AngleDrill' , ToolParams.TMaxMat, ToolParams.TMaxDepth), ToolParams.MaxToolLength, ToolParams.ToolDiam, ToolParams.DiamTh, ToolParams.FreeLen
elseif MachiningType == MCH_MY.SAWING then
return MachiningName, ToolParams.H2
elseif MachiningType == MCH_MY.MILLING then
@@ -470,15 +467,8 @@ function MachiningLib.FindCutting( sType, bTopHead, bDownHead)
end
---------------------------------------------------------------------
function MachiningLib.FindDrilling( dDiam, dDepth, bTopHead, bDownHead, bExcludeH2, bAngleTransmission, bIsPredrill)
local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5, sTypeMach
-- se il foro è un predrill, cerco solo punte abilitate al Predrill
if bIsPredrill then
sTypeMach = 'Predrill'
else
sTypeMach = EgtIf( bAngleTransmission, 'Drill_AT', 'Drill')
end
MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, sTypeMach, { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead, bExcludeH2)
function MachiningLib.FindDrilling( dDiam, dDepth, bTopHead, bDownHead, bExcludeH2, bAngleTransmission)
local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, EgtIf( bAngleTransmission, 'Drill_AT', 'Drill'), { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead, bExcludeH2)
if ( not MachiningName or MachiningName == '') then
MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, EgtIf( bAngleTransmission, 'Pocket_AT', 'Pocket'), { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead)
end
+4 -1
View File
@@ -1,6 +1,7 @@
-- ProcessBlockHausFront.lua by Egaltech s.r.l. 2020/08/03
-- Gestione calcolo giunzione block house in testa
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- 2024/03/11 Chiamate a GetFaceHvRefDim sostituite con lettura di Proc.Face[]
-- Tabella per definizione modulo
local ProcessBlockHausFront = {}
@@ -268,7 +269,9 @@ function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dO
local vtRef2 = EgtIf( bHead, X_AX(), -X_AX())
-- se non ho il taglio sulla faccia interna
if not bIntCut then
local frHV, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, vFaceOrd[3] - 1)
local frHV = Proc.Face[ vFaceOrd[3]].FrameHV
local DimH = Proc.Face[ vFaceOrd[3]].Width
local DimV = Proc.Face[ vFaceOrd[3]].Height
if DimV > DimH then
vtRef2 = Vector3d( frHV:getVersX())
end
+1 -10
View File
@@ -25,7 +25,6 @@
-- 2023/10/27 In MakeFromTop corretto massimo materiale in caso di lavorazione da sotto.
-- 2023/12/07 Correzione in Classify in scelta ribaltamento trave quando si è in condizioni downUp.
-- 2024/01/18 Gestita superficie limitante opzionale da passare a diceCut.
-- 2024/05/10 In MakeFromTop ricalcolo direzione di lavorazione su facce a cubetti
-- Tabella per definizione modulo
local ProcessCut = {}
@@ -480,15 +479,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
if vtO then
vtOrthoO = Vector3d( vtO) * EgtIf( bOrthInv, -1, 1)
else
-- ricalcolo tipo taglio perché "bHorizCut" è calcolato sulla feature, mentre il cubetto potrebbe essere lavorato in un altro modo
local _, dLen, dWidth = BL.GetFaceHvRefDim( vCuts[i][1], 0, b3Raw)
local bCutDirection = bHorizCut
-- se bisogna tagliare di fianco ma la lunghezza faccia è più del massimo materiale, forzo lavorazione da sopra
if not bHorizCut and dLen > dMaxDepth then
bCutDirection = true
end
if bCutDirection then
if bHorizCut then
vtOrthoO = Z_AX()
else
if vtN:getZ() < dNzLimDwnUp then
+8 -80
View File
@@ -20,8 +20,6 @@
-- 2023/07/28 Aggiunta gestione rinvio 90deg solo per forature da sotto esattamente verticali.
-- 2023/09/26 Se errore in applicazione lavorazione si inverte e riprova solo se foratura singola su foro aperto.
-- 2023/11/06 Migliorata gestione dei fori con AngularTransmission.
-- 2024/03/13 Aggiunta gestione Predrill
-- 2024/03/18 Per Predrill corretta direzione estrusione per fori con direzione verso il basso
-- Tabella per definizione modulo
local ProcessDrill = {}
@@ -98,21 +96,20 @@ end
---------------------------------------------------------------------
-- Recupero dati foro e adattamento se speciale
function ProcessDrill.GetData( Proc, b3Raw)
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
-- verifico se foro da adattare
if EgtExistsInfo( Proc.Id, 'DiamUser') then
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if AuxId then AuxId = AuxId + Proc.Id end
if AuxId and EgtGetType( AuxId) == GDB_TY.CRV_ARC and BD.USER_HOLE_DIAM and BD.USER_HOLE_DIAM > 1 then
EgtModifyArcRadius( AuxId, BD.USER_HOLE_DIAM / 2)
end
end
-- recupero diametro e lunghezza
-- recupero diametro
local dDiam = EgtGetInfo( Proc.Id, 'P12', 'd') or 0
local dLen = abs( EgtCurveThickness( Proc.Id + AuxId)) or 0
-- recupero faccia di entrata e uscita
local nFcs = EgtGetInfo( Proc.Id, 'FCS', 'i') or 0
local nFce = EgtGetInfo( Proc.Id, 'FCE', 'i') or 0
return dDiam, dLen, nFcs, nFce
return dDiam, nFcs, nFce
end
---------------------------------------------------------------------
@@ -142,75 +139,6 @@ function ProcessDrill.Split( Proc, b3Raw)
return ( bOpen and ( bHoriz or BD.ROT90 or BD.DOWN_HEAD or BD.TURN or bAngTransm) and not bSlant)
end
---------------------------------------------------------------------
-- Verifica se bisogna aggiungere un preforo
function ProcessDrill.IsPredrillNeeded( Proc)
local dDepthPredrill = EgtGetInfo( Proc.Id, 'Q03', 'i')
-- se non c'è la Q oppure se zero, allora non è da fare
if not dDepthPredrill or dDepthPredrill <= 0 then
return false
-- altrimenti Predrill da fare
else
return true
end
end
---------------------------------------------------------------------
-- Aggiunge il preforo alla feature passata
function ProcessDrill.AddPredrillFromDrillProc( Proc)
local dDepthPredrill = EgtGetInfo( Proc.Id, 'Q03', 'i')
-- foro più corto del preforo, allora è il foro che diventa il preforo stesso
if Proc.Len <= dDepthPredrill then
Proc.IsPredrill = true
Proc.IsPredrillOf = Proc.Id
return false
-- altrimenti creo un nuovo process
else
-- recupero gruppo per geometria aggiuntiva
local nAddGrpId = BL.GetAddGroup( Proc.PartId)
-- recupero e verifico l'entità foro
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0
local ptCen = EgtCP( Proc.Id + AuxId, GDB_RT.GLOB)
local vtExtr = EgtCurveExtrusion( Proc.Id + AuxId, GDB_RT.GLOB)
-- copio foro originale
local nPreHoleId = EgtCopyGlob( Proc.Id, nAddGrpId)
local nPreHoleAux = EgtCopyGlob( Proc.Id + AuxId, nAddGrpId)
-- se foro invertito sposto geometria dall'altro lato del foro e inverto direzione estrusione
if Proc.Flg == -2 then
local vsExtr = -vtExtr * Proc.Len
EgtMove( nPreHoleAux, vsExtr, GDB_RT.GLOB)
EgtModifyCurveExtrusion( nPreHoleAux, -vtExtr, GDB_RT.GLOB)
end
EgtModifyCurveThickness( nPreHoleAux, -dDepthPredrill)
local PredrillProc = {}
-- definisco dati seconda parte
PredrillProc.PartId = Proc.PartId
PredrillProc.Id = nPreHoleId
PredrillProc.Grp = Proc.Grp
PredrillProc.Prc = Proc.Prc
PredrillProc.Flg = 1
PredrillProc.Box = Proc.Box
PredrillProc.Fct = Proc.Fct
PredrillProc.Diam = Proc.Diam
PredrillProc.Len = dDepthPredrill
PredrillProc.Head = Proc.Head
PredrillProc.Tail = Proc.Tail
PredrillProc.Fcs = Proc.Fcs
PredrillProc.Fce = 0 -- il preforo è sempre chiuso, non ha faccia di uscita
PredrillProc.CutId = Proc.CutId
PredrillProc.TaskId = Proc.TaskId
PredrillProc.AdjId = Proc.AdjId
PredrillProc.MainId = Proc.MainId
PredrillProc.IsPredrill = true
PredrillProc.IsPredrillOf = Proc.Id
return true, PredrillProc
end
end
---------------------------------------------------------------------
-- Classificazione della feature
function ProcessDrill.Classify( Proc, b3Raw)
@@ -361,15 +289,15 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
local bDrillUp = ( bDownDrill and vtExtr:getZ() > -0.421)
local bExcludeH2 = false
if Proc.Double and Proc.Double > 0 then
-- bMillUp = true
bMillUp = true
bDrillDown = false
bExcludeH2 = true
end
-- primo gruppo di controlli con lunghezza utensile pari a metà foro se passante
-- recupero la lavorazione
local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm, Proc.IsPredrill)
local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm)
if not sDrilling and dCheckDepth then
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm, Proc.IsPredrill)
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm)
if sDrilling then dCheckDepth = nil end
end
if not sDrilling then
@@ -526,7 +454,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
dMaxElev = dMaxDepth
end
-- inserisco la lavorazione
local sName = EgtIf( EgtStartsWith( sType, 'Predrill'), 'Predrill_', 'Drill_') .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local sName = 'Drill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sDrilling)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sDrilling
@@ -536,7 +464,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- eventuale inversione
if sType == 'Drill' or sType == 'Drill_H2' or sType == 'Drill_AT' or sType == 'AngleDrill' or sType == 'Predrill' then
if sType == 'Drill' or sType == 'Drill_H2' or sType == 'Drill_AT' or sType == 'AngleDrill' then
EgtSetMachiningParam( MCH_MP.INVERT, bToInvert)
else
EgtSetMachiningParam( MCH_MP.TOOLINVERT, bToInvert)
+12 -743
View File
@@ -1,4 +1,4 @@
-- ProcessLapJoint.lua by Egaltech s.r.l. 2024/03/15
-- ProcessLapJoint.lua by Egaltech s.r.l. 2023/09/26
-- Gestione calcolo mezzo-legno per Travi
-- 2019/10/08 Agg. gestione OpenPocket.
-- 2021/01/24 Con sega a catena ora sempre impostato asse A.
@@ -99,12 +99,6 @@
-- 2024/02/29 In lapjoint 2 facce (TestTwoFacesDownHead) migliorata la scelta della lama da sotto.
-- 2024/03/01 Migliorata VerifyPocket.
-- 2024/03/04 Implementato attacco esterno se tasca 4 facce sulla coda ma nessun pezzo successivo.
-- 2024/03/15 Correzione a calcolo ingombro per feature basse e lunghe dalla testa.
-- 2024/04/02 In ForceSideMill escluso caso 4 facce senza possibilità di ingresso lungo Y.
-- 2024/04/11 Aggiunta strategia SawPlusChain per lavorazione tasche con lama + sega a catena opzionale. Attivata con Q11.
-- 2024/04/15 In SideMillAsSaw gestito anche rabbet
-- 2024/04/17 In MakeMoreLongFaces corretto calcolo divisione in parti per evitare problemi di ceil con interi perfetti (ceil(3) = 3 o 4??)
-- 2024/04/22 In IsTailFeature se LapJoint a 2 facce che taglia intera sezione, deve essere fatto dopo taglio di coda
-- Tabella per definizione modulo
local ProcessLapJoint = {}
@@ -178,7 +172,6 @@ local function AssignQIdent( Proc)
Q_ANTISPLINT_TYPE = ''
Q_MAX_ELEVATION = 'Q10'
Q_STAIRCASE = ''
Q_SAW_PLUS_CHAIN = 'Q11'
if ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 16 then
Q_FORCE_BLADE = 'Q01' -- i
@@ -553,9 +546,9 @@ local function VerifySideMillAsSaw( Proc, nAddGrpId, vtN, dDiam, dFacElev)
-- cancello la copia del percorso
EgtErase( nTestId)
-- eseguo test
if not bNewIsU and not Proc.TopologyLongName == 'Rabbet-Through-RightAngles-Parallel-2' then
return false
end
if not bNewIsU then
return false
end
-- Verifico sia abbastanza lunga
if not (( Proc.TotBox and Proc.TotBox:getDimX() > ( BD.MIN_LEN_LAMELLO or 1000)) or
( not Proc.TotBox and Proc.Box:getDimX() > ( BD.MIN_LEN_LAMELLO or 1000))) then
@@ -668,10 +661,8 @@ local function UpdateEncumbrance( Proc, nRawId, b3Raw, b3Solid)
elseif Proc.Box:getCenter():getX() > b3Solid:getCenter():getX() then
local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX()
local dDist = b3Solid:getMax():getX() - Proc.Box:getMax():getX()
-- se pinze a 45° e pinza abbastanza materiale, compenso comunque, ma solo inclinazione morse
if not bIsVertClamps and dDeltaZClamp > BD.VICE_MINH and BD.VICE_MAXH then
dOffs = min( dOffs, BD.VICE_MAXH - BD.VICE_MINH)
end
-- se concavo aumento la distanza (rimane una punta...)
--if dAngT < 0 then dDist = dDist + 10 end
BL.UpdateHCING( nRawId, dOffs, dDist)
end
end
@@ -733,20 +724,6 @@ function ProcessLapJoint.IsTailFeature( Proc, b3Raw)
return true
end
end
-- se interessa l'intera sezione
if BL.IsFeatureCuttingEntireSection( Proc.Box, b3Raw:getDimY(), b3Raw:getDimZ()) then
-- caso con due facce
if Proc.Fct == 2 then
-- verifico che il versore risultante delle normali delle due facce sia orientato verso X-
local vtResult = ( EgtSurfTmFacetNormVersor( Proc.Id, 0, GDB_ID.ROOT) + EgtSurfTmFacetNormVersor( Proc.Id, 1, GDB_ID.ROOT))
vtResult:normalize()
if vtResult:getX() < 0.5 then
return true
end
end
end
-- in base al tipo di feature attribuisco il significato dei parametri Q
AssignQIdent( Proc)
-- se può essere fatto con utensile tipo lama
@@ -4603,704 +4580,6 @@ local function MakeTunnelByChainSaw( Proc, sSawing, nLundIdFace, vtOrtho, dWorkD
return true
end
---------------------------------------------------------------------
--#region SawPlusChain
-- 5 facce: la faccia di fondo è il fondo della tasca, la faccia da lavorare è grande, le facce laterali sono le due piccole
-- 4 facce con faccia di fondo piccola: la faccia da lavorare è grande (2 adj) e l'unica faccia laterale è piccola
-- 4 facce con faccia di fondo grande: la faccia da lavorare è piccola (3 adj) e le facce laterali sono le due piccole
-- 3 facce: la faccia di fondo è il fondo della tasca, la faccia da lavorare è grande, non ci sono facce laterali
-- TODO gestione messaggi in funzione apposita (almeno per append)
-- TODO gestire topologia tunnel (anche da due lati)
local SawPlusChain = {}
SawPlusChain.Saw = {}
SawPlusChain.Chainsaw = {}
function SawPlusChain.IsTopologyOk( Proc)
if Proc.TopologyLongName == 'Pocket-Blind-RightAngles-Parallel-5' or
Proc.TopologyLongName == 'Groove-Through-RightAngles-Parallel-3' or
Proc.TopologyLongName == 'Groove-Blind-RightAngles-Parallel-4' then
return true
else
return false
end
end
function SawPlusChain.GetBottomFace( Proc)
-- la faccia di fondo ha sempre Fct - 1 adiacenze. Se si trovano più facce di fondo si sceglie quella con minor elevazione
local vBottomFace = Topology.GetFacesWithGivenAdjacencyNumber( Proc, Proc.vAdj, Proc.Fct - 1)
local nBottomFace
if #vBottomFace > 1 then
local dMinElevation = GEO.INFINITO
for i = 1, #vBottomFace do
for j = 1, Proc.Fct do
if vBottomFace[i] == Proc.Face[j].Id then
if Proc.Face[j].Elevation < dMinElevation then
dMinElevation = Proc.Face[j].Elevation
nBottomFace = Proc.Face[j].Id
end
end
end
end
else
nBottomFace = vBottomFace[1]
end
local BottomFace = {}
BottomFace.Id = nBottomFace
BottomFace.Width = Proc.Face[nBottomFace + 1].Width
BottomFace.Height = Proc.Face[nBottomFace + 1].Height
BottomFace.Elevation = Proc.Face[nBottomFace + 1].Elevation
BottomFace.VtN = Proc.Face[nBottomFace + 1].VtN
if BottomFace.Height > BottomFace.Width then
BottomFace.Height, BottomFace.Width = BottomFace.Width, BottomFace.Height
end
return BottomFace
end
function SawPlusChain.GetFaceToMachine( Proc)
if not Proc.Pocket.BottomFace or not Proc.Pocket.BottomFace.Id then
Proc.Pocket.BottomFace = SawPlusChain.GetBottomFace( Proc)
end
-- facce adiacenti a quella di fondo, ordinate
local FacesAdjacentToBottom = BL.GetAdjacentFaces( Proc, Proc.Pocket.BottomFace.Id)
table.sort( FacesAdjacentToBottom, function( a, b) return a.LengthOnMainFace > b.LengthOnMainFace end)
-- si sceglie la faccia adiacente sul lato più lungo
local FaceToMachine = {}
FaceToMachine.Id = FacesAdjacentToBottom[1].Id
for i = 1, Proc.Fct do
if FaceToMachine.Id == Proc.Face[i].Id then
FaceToMachine.Width = Proc.Face[i].Width
FaceToMachine.Height = Proc.Face[i].Height
FaceToMachine.Elevation = Proc.Face[i].Elevation
FaceToMachine.VtN = Proc.Face[i].VtN
if FaceToMachine.Height > FaceToMachine.Width then
FaceToMachine.Height, FaceToMachine.Width = FaceToMachine.Width, FaceToMachine.Height
end
end
end
return FaceToMachine
end
function SawPlusChain.GetSideFaces( Proc)
if not Proc.Pocket.BottomFace or not Proc.Pocket.BottomFace.Id then
Proc.Pocket.BottomFace = SawPlusChain.GetBottomFace( Proc)
end
if not Proc.Pocket.FaceToMachine or not Proc.Pocket.FaceToMachine.Id then
Proc.Pocket.FaceToMachine = SawPlusChain.GetFaceToMachine( Proc)
end
-- facce adiacenti a quella di fondo, ordinate
local FacesAdjacentToBottom = BL.GetAdjacentFaces( Proc, Proc.Pocket.BottomFace.Id)
table.sort( FacesAdjacentToBottom, function( a, b) return a.LengthOnMainFace > b.LengthOnMainFace end)
-- si determina il criterio di scelta delle facce laterali
local FacesAdjacentToFaceToMachine = BL.GetAdjacentFaces( Proc, Proc.Pocket.FaceToMachine.Id)
local bIsFaceToMachineTheLargest = not ( Proc.Fct == 4 and #FacesAdjacentToFaceToMachine == 3)
local SideFaces = {}
for i = 1, #FacesAdjacentToBottom do
if ( not bIsFaceToMachineTheLargest and i < #FacesAdjacentToBottom) or
( bIsFaceToMachineTheLargest and i > 2) then
table.insert( SideFaces, FacesAdjacentToBottom[i])
SideFaces[ #SideFaces].Id = FacesAdjacentToBottom[i].Id
SideFaces[ #SideFaces].Width = Proc.Face[FacesAdjacentToBottom[i].Id + 1].Width
SideFaces[ #SideFaces].Height = Proc.Face[FacesAdjacentToBottom[i].Id + 1].Height
SideFaces[ #SideFaces].Elevation = Proc.Face[FacesAdjacentToBottom[i].Id + 1].Elevation
SideFaces[ #SideFaces].VtN = Proc.Face[FacesAdjacentToBottom[i].Id + 1].VtN
if SideFaces[ #SideFaces].Height > SideFaces[ #SideFaces].Width then
SideFaces[ #SideFaces].Height, SideFaces[ #SideFaces].Width = SideFaces[ #SideFaces].Width, SideFaces[ #SideFaces].Height
end
end
end
return SideFaces
end
function SawPlusChain.GetToolFromMachining( sMachiningName)
local Tool = {}
if EgtMdbSetCurrMachining( sMachiningName) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
Tool.Name = EgtTdbGetCurrToolParam( MCH_TP.NAME)
Tool.IsCCW = ( EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0)
Tool.Type = EgtTdbGetCurrToolParam( MCH_TP.TYPE)
Tool.Diameter = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or 0
-- lama
if Tool.Type == MCH_TY.SAW_STD or Tool.Type == MCH_TY.SAW_FLAT then
Tool.Thickness = EgtTdbGetCurrToolParam(MCH_TP.THICK) or 0
Tool.MaxDepth = EgtTdbGetCurrToolMaxDepth() or 0
Tool.SideStep = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDESTEP', 'd')
-- sega a catena
elseif Tool.Type == MCH_TY.MORTISE_STD then
Tool.Length = EgtTdbGetCurrToolParam( MCH_TP.LEN) or 0
Tool.MaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or 0
Tool.Width = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or 0
Tool.Thickness = EgtTdbGetCurrToolParam( MCH_TP.THICK) or 0
Tool.CornerRadius = EgtTdbGetCurrToolParam( MCH_TP.CORNRAD) or 0
-- altri utensili al momento non previsti
else
error( 'Wrong tool type')
end
end
end
return Tool
end
function SawPlusChain.GetVerticalSteps( Proc, Machining)
if not Proc.Pocket or not Proc.Pocket.Height then
error( 'Missing pocket depth')
elseif not Machining.Tool or not Machining.Tool.Thickness then
error( 'Missing tool thickness')
end
local VerticalSteps = {}
VerticalSteps.StepLength = 0
VerticalSteps.Count = ceil( ( Proc.Pocket.Height - 10 * GEO.EPS_SMALL) / Machining.Tool.Thickness)
if VerticalSteps.Count > 1 then
VerticalSteps.StepLength = ( Proc.Pocket.Height - Machining.Tool.Thickness) / ( VerticalSteps.Count - 1)
end
return VerticalSteps
end
function SawPlusChain.GetHorizontalSteps( Machining)
if not Machining.Depth then
error( 'Missing machining depth')
end
local HorizontalSteps = {}
HorizontalSteps.StepLength = 0
HorizontalSteps.Count = ceil( ( Machining.Depth - 10 * GEO.EPS_SMALL) / Machining.Tool.SideStep)
if HorizontalSteps.Count > 1 then
HorizontalSteps.StepLength = ( Machining.Depth - Machining.Tool.SideStep) / ( HorizontalSteps.Count - 1)
end
return HorizontalSteps
end
function SawPlusChain.CalculateLeadInOut( Proc, Machining)
-- TODO implementare le funzioni di Tool Collision Avoidance (vedi wiki e FacesBysaw -> CalcLeadInOutPerpGeom)
-- si determina se l'inizio o la fine della lavorazione sono chiusi e l'eventuale riduzione da applicare
local bIsStartClosed = false
local bIsEndClosed = false
local bIsMortising = ( Machining.Type == MCH_OY.MORTISING)
local dAddLengthToReduce = 0
if bIsMortising then
dAddLengthToReduce = Machining.Tool.Diameter / 2
else
dAddLengthToReduce = sqrt( Machining.Depth * Machining.Tool.Diameter - Machining.Depth * Machining.Depth)
end
if #( Proc.Pocket.SideFaces) == 2 then
bIsStartClosed = true
bIsEndClosed = true
elseif #( Proc.Pocket.SideFaces) == 1 then
local CCWDirection = ( Machining.FaceToMachine.VtN ^ Proc.Pocket.BottomFace.VtN)
if Machining.ToolInvert or bIsMortising then
CCWDirection = - CCWDirection
end
if CCWDirection * Proc.Pocket.SideFaces[1].VtN > 10 * GEO.EPS_SMALL then
if Machining.Tool.IsCCW then
bIsStartClosed = true
else
bIsEndClosed = true
end
else
if Machining.Tool.IsCCW then
bIsEndClosed = true
else
bIsStartClosed = true
end
end
end
local LeadIn = {}
local LeadOut = {}
LeadIn.StartAddLength = 0
LeadOut.EndAddLength = 0
if not bIsMortising then
LeadIn.Type = MCH_MILL_LI.LINEAR
LeadOut.Type = MCH_MILL_LI.LINEAR
LeadIn.TangentDistance = 0
LeadOut.TangentDistance = 0
LeadIn.PerpDistance = Proc.Pocket.Depth + BD.CUT_SIC
LeadOut.PerpDistance = Proc.Pocket.Depth + BD.CUT_SIC
LeadIn.Elevation = 0
LeadOut.Elevation = 0
LeadIn.CompLength = 0
LeadOut.CompLength = 0
if bIsStartClosed and bIsEndClosed then
LeadIn.StartAddLength = -dAddLengthToReduce
LeadOut.EndAddLength = -dAddLengthToReduce
elseif bIsStartClosed then
LeadIn.StartAddLength = -dAddLengthToReduce
-- eventuale correzione per accorciamento maggiore di larghezza tasca
LeadOut.EndAddLength = max( -LeadIn.StartAddLength - Proc.Pocket.Width + 10 * BD.CUT_EXTRA, BD.CUT_EXTRA)
elseif bIsEndClosed then
LeadOut.EndAddLength = -dAddLengthToReduce
-- eventuale correzione per accorciamento maggiore di larghezza tasca
LeadIn.StartAddLength = max( -LeadOut.EndAddLength - Proc.Pocket.Width + 10 * BD.CUT_EXTRA, BD.CUT_EXTRA)
else
LeadIn.StartAddLength = BD.CUT_EXTRA
LeadOut.EndAddLength = BD.CUT_EXTRA
end
else
if bIsStartClosed then
LeadIn.StartAddLength = -dAddLengthToReduce
else
LeadIn.StartAddLength = BD.CUT_EXTRA
end
if bIsEndClosed then
LeadOut.EndAddLength = -dAddLengthToReduce
else
LeadOut.EndAddLength = BD.CUT_EXTRA
end
end
return LeadIn, LeadOut
end
function SawPlusChain.ApplyMachining( Machining, b3Raw)
local sErr = ''
local nOperationId = EgtAddMachining( Machining.OperationName, Machining.Name)
if not nOperationId then
sErr = 'Error adding machining ' .. Machining.OperationName .. '-' .. Machining.Name
EgtOutLog( sErr)
return false, sErr
end
-- impostazione parametri lavorazione
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
EgtSetMachiningGeometry( {{ Machining.ProcId, Machining.FaceToMachine.Id}})
EgtSetMachiningParam( MCH_MP.FACEUSE, Machining.Faceuse)
EgtSetMachiningParam( MCH_MP.SCC, Machining.SCC)
EgtSetMachiningParam( MCH_MP.INVERT, Machining.Invert)
EgtSetMachiningParam( MCH_MP.WORKSIDE, Machining.Workside)
EgtSetMachiningParam( MCH_MP.TOOLINVERT, Machining.ToolInvert)
EgtSetMachiningParam( MCH_MP.OFFSR, Machining.RadialOffset)
EgtSetMachiningParam( MCH_MP.OFFSL, Machining.LongitudinalOffset)
if Machining.Type ~= MCH_OY.MORTISING then
EgtSetMachiningParam( MCH_MP.LEADINTYPE, Machining.LeadIn.Type)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, Machining.LeadOut.Type)
EgtSetMachiningParam( MCH_MP.LITANG, Machining.LeadIn.TangentDistance)
EgtSetMachiningParam( MCH_MP.LOTANG, Machining.LeadOut.TangentDistance)
EgtSetMachiningParam( MCH_MP.LIPERP, Machining.LeadIn.PerpDistance)
EgtSetMachiningParam( MCH_MP.LOPERP, Machining.LeadOut.PerpDistance)
EgtSetMachiningParam( MCH_MP.LIELEV, Machining.LeadIn.Elevation)
EgtSetMachiningParam( MCH_MP.LOELEV, Machining.LeadOut.Elevation)
EgtSetMachiningParam( MCH_MP.LICOMPLEN, Machining.LeadIn.CompLength)
EgtSetMachiningParam( MCH_MP.LOCOMPLEN, Machining.LeadOut.CompLength)
end
EgtSetMachiningParam( MCH_MP.STARTADDLEN, Machining.LeadIn.StartAddLength)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, Machining.LeadOut.EndAddLength)
if Machining.Steps then
if Machining.Steps.StepType then
EgtSetMachiningParam( MCH_MP.STEPTYPE, Machining.Steps.StepType)
end
if Machining.Steps.StepLength then
EgtSetMachiningParam( MCH_MP.STEP, Machining.Steps.StepLength)
end
end
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( Machining.Name, Machining.BlockedAxis.Orientation, b3Raw, Machining.FaceToMachine.VtN, Machining.BlockedAxis.VtOut))
if Machining.Type == MCH_OY.MORTISING then
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( Machining.FaceToMachine.VtN, Machining.Direction, Machining.SuggestedAngles.Index))
end
EgtSetMachiningParam( MCH_MP.OVERL, Machining.Overlap)
EgtSetMachiningParam( MCH_MP.STARTPOS, max( Machining.StartSafetyLength, EgtGetMachiningParam( MCH_MP.STARTPOS)))
if Machining.MaxElev then
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', Machining.MaxElev)
end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
local bIsApplyOk = ML.ApplyMachining( true, false)
if not bIsApplyOk then
local nErr
nErr, sErr = EgtGetLastMachMgrError()
-- se mortasatura e l'errore è compatibile (Axes values not calculable) si prova con l'altra configurazione dell'asse bloccato
-- TODO valutare se c'è modo di capire preventivamente la configurazione dell'asse bloccato e quindi rimuovere questa parte di codice
if Machining.Type == MCH_OY.MORTISING and nErr == 2507 then
if Machining.BlockedAxis.Orientation == 'perpendicular' then
Machining.BlockedAxis.Orientation = 'parallel'
else
Machining.BlockedAxis.Orientation = 'perpendicular'
end
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( Machining.Name, Machining.BlockedAxis.Orientation, b3Raw, Machining.FaceToMachine.VtN, Machining.BlockedAxis.VtOut))
if Machining.SuggestedAngles.Index == 1 then
Machining.SuggestedAngles.Index = 2
else
Machining.SuggestedAngles.Index = 1
end
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( Machining.FaceToMachine.VtN, Machining.Direction, Machining.SuggestedAngles.Index))
sErr = ''
bIsApplyOk = ML.ApplyMachining( true, false)
end
if not bIsApplyOk then
nErr, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nOperationId, false)
return false, sErr
end
end
return true, sErr
end
function SawPlusChain.Saw.GetSCC( vtMachiningDirection)
-- TODO implementare SCC come per FacesBySaw
local nSCC = MCH_SCC.NONE
if AreSameVectorApprox( vtMachiningDirection, Z_AX()) then
nSCC = MCH_SCC.ADIR_ZP
elseif AreOppositeVectorApprox( vtMachiningDirection, Z_AX()) then
nSCC = MCH_SCC.ADIR_ZM
elseif AreSameVectorApprox( vtMachiningDirection, Y_AX()) then
nSCC = MCH_SCC.ADIR_YP
elseif AreOppositeVectorApprox( vtMachiningDirection, Y_AX()) then
nSCC = MCH_SCC.ADIR_YM
elseif AreSameVectorApprox( vtMachiningDirection, X_AX()) then
nSCC = MCH_SCC.ADIR_XP
elseif AreOppositeVectorApprox( vtMachiningDirection, X_AX()) then
nSCC = MCH_SCC.ADIR_XM
end
return nSCC
end
function SawPlusChain.Saw.CalculateMachiningParameters( Proc)
local Cutting = {}
Cutting.CanApply = true
Cutting.Message = ''
Cutting.ProcId = Proc.Id
-- ricerca lavorazione
Cutting.Name = ML.FindCutting( 'HeadSide', true, false)
if not Cutting.Name then
Cutting.Message = 'Feature '.. Proc.FeatureId .. ' : strategy ' .. Proc.Pocket.Strategy .. ' not applicable - saw blade not found'
Cutting.CanApply = false
EgtOutLog( Cutting.Message)
return Cutting
end
Cutting.Type = MCH_OY.MILLING
Cutting.Tool = SawPlusChain.GetToolFromMachining( Cutting.Name)
Cutting.FaceToMachine = Proc.Pocket.FaceToMachine
-- verifica dimensioni tasca compatibili
-- se tasca meno spessa della lama la strategia non è applicabile
if Cutting.Tool.Thickness > Proc.Pocket.Height + 10 * GEO.EPS_SMALL then
Cutting.Message = 'Feature '.. Proc.FeatureId .. ' : strategy ' .. Proc.Pocket.Strategy .. ' not applicable - pocket too narrow for saw blade thickness'
Cutting.CanApply = false
EgtOutLog( Cutting.Message)
return Cutting
end
if #( Proc.Pocket.SideFaces) > 1 then
-- se tasca più stretta della lama la strategia non è applicabile
if Cutting.Tool.Diameter > Proc.Pocket.Width + 10 * GEO.EPS_SMALL then
Cutting.Message = 'Feature '.. Proc.FeatureId .. ' : strategy ' .. Proc.Pocket.Strategy .. ' not applicable - pocket too narrow for saw blade diameter'
Cutting.CanApply = false
EgtOutLog( Cutting.Message)
return Cutting
end
end
-- parametri della lavorazione
-- direzione utensile
Cutting.Direction = Proc.Pocket.Direction
-- lato di lavoro e inversioni
if Cutting.Tool.IsCCW then
Cutting.Workside = MCH_MILL_WS.RIGHT
Cutting.Invert = true
else
Cutting.Workside = MCH_MILL_WS.LEFT
Cutting.Invert = false
end
-- TODO gestire lama da sotto e lama downUp
if Cutting.FaceToMachine.VtN:getZ() < - 10 * GEO.EPS_SMALL then
Cutting.ToolInvert = true
Cutting.Invert = not Cutting.Invert
else
Cutting.ToolInvert = false
end
-- profondità e offset radiale
if Cutting.Tool.MaxDepth > Proc.Pocket.Depth - 10 * GEO.EPS_SMALL then
Cutting.Depth = Proc.Pocket.Depth
Cutting.RadialOffset = 0
else
Cutting.Depth = Cutting.Tool.MaxDepth
Cutting.RadialOffset = Proc.Pocket.Depth - Cutting.Depth
if Proc.Pocket.ApplyOnlySawblade then
Cutting.Message = 'Feature '.. Proc.FeatureId .. ' : sawblade elevation (' .. EgtNumToString( Proc.Pocket.Depth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( Cutting.Depth, 1) .. ')'
EgtOutLog( Cutting.Message)
end
end
-- step verticale e offset longitudinale
Cutting.Steps = SawPlusChain.GetVerticalSteps( Proc, Cutting)
Cutting.Steps.StepType = MCH_MILL_ST.ONEWAY
Cutting.MaxElev = Cutting.Steps.StepLength * Cutting.Steps.Count - 10 * GEO.EPS_SMALL
if Cutting.ToolInvert and Cutting.Steps.Count > 1 then
Cutting.LongitudinalOffset = - Proc.Pocket.Height
else
Cutting.LongitudinalOffset = 0
end
-- distanza di sicurezza
Cutting.StartSafetyLength = 10
-- overlap
Cutting.Overlap = 0
-- faceuse
Cutting.Faceuse = BL.GetNearestOrthoOpposite( Cutting.Direction)
-- SCC
Cutting.SCC = SawPlusChain.Saw.GetSCC( Cutting.Direction)
-- angoli suggeriti
Cutting.SuggestedAngles = ''
-- asse bloccato
Cutting.BlockedAxis = {}
Cutting.BlockedAxis.Orientation = 'perpendicular'
Cutting.BlockedAxis.VtOut = EgtIf( Cutting.FaceToMachine.VtN:getX() > 0, X_AX(), -X_AX())
-- approccio e retrazione
Cutting.LeadIn, Cutting.LeadOut = SawPlusChain.CalculateLeadInOut( Proc, Cutting)
-- eventuale step orizzontale
Cutting.HorizontalSteps = {}
if Cutting.Tool.SideStep then
Cutting.HorizontalSteps = SawPlusChain.GetHorizontalSteps( Cutting)
else
Cutting.HorizontalSteps.Count = 1
Cutting.HorizontalSteps.StepLength = 0
end
-- nome operazione
Cutting.OperationName = 'Cut_' .. ( EgtGetName( Cutting.ProcId) or tostring( Cutting.ProcId)) .. '_' .. tostring( Cutting.FaceToMachine.Id + 1)
-- eventuale avviso di danneggiamento pezzo successivo
local dOffsideLength = max( Cutting.LeadIn.StartAddLength, Cutting.LeadOut.EndAddLength) + Cutting.Tool.Diameter / 2 + 10 * GEO.EPS_SMALL
if ( not Proc.Tail or Proc.AdvTail) and Proc.AffectedFaces.Left and ( Proc.Pocket.DistanceToNextPart < dOffsideLength) then
local sDamageNextPieceMessage = 'Feature '.. Proc.FeatureId .. ' : sawblade can damage next piece.'
if #Cutting.Message > 0 then
Cutting.Message = Cutting.Message .. '\n' .. sDamageNextPieceMessage
else
Cutting.Message = sDamageNextPieceMessage
end
EgtOutLog( sDamageNextPieceMessage)
end
return Cutting
end
function SawPlusChain.Chainsaw.CalculateMachiningParameters( Proc)
local Chainsawing = {}
Chainsawing.CanApply = true
Chainsawing.Message = ''
Chainsawing.ProcId = Proc.Id
-- ricerca lavorazione
Chainsawing.Name = ML.FindSawing( 'Sawing', Proc.Pocket.Depth)
if not Chainsawing.Name then
Chainsawing.Name = ML.FindSawing( 'Sawing', nil, nil, 'Longest')
end
if not Chainsawing.Name then
Chainsawing.Message = 'Feature '.. Proc.FeatureId .. ' : strategy ' .. Proc.Pocket.Strategy .. ' not applicable - chainsaw not found'
Chainsawing.CanApply = false
EgtOutLog( Chainsawing.Message)
return Chainsawing
end
Chainsawing.Type = MCH_OY.MORTISING
Chainsawing.Tool = SawPlusChain.GetToolFromMachining( Chainsawing.Name)
Chainsawing.FaceToMachine = Proc.Pocket.FaceToMachine
-- verifica dimensioni tasca compatibili
-- se tasca meno spessa della sega a catena la strategia non è applicabile
if Chainsawing.Tool.Thickness > Proc.Pocket.Height + 10 * GEO.EPS_SMALL then
Chainsawing.Message = 'Feature '.. Proc.FeatureId .. ' : strategy ' .. Proc.Pocket.Strategy .. ' not applicable - pocket too narrow for chainsaw thickness'
Chainsawing.CanApply = false
EgtOutLog( Chainsawing.Message)
return Chainsawing
end
if #( Proc.Pocket.SideFaces) > 1 then
-- se tasca più stretta della sega a catena la strategia non è applicabile
if Chainsawing.Tool.Width > Proc.Pocket.Width + 10 * GEO.EPS_SMALL then
Chainsawing.Message = 'Feature '.. Proc.FeatureId .. ' : strategy ' .. Proc.Pocket.Strategy .. ' not applicable - pocket too narrow for chainsaw width'
Chainsawing.CanApply = false
EgtOutLog( Chainsawing.Message)
return Chainsawing
end
end
-- parametri della lavorazione
-- direzione utensile
Chainsawing.Direction = Proc.Pocket.Direction
-- lato di lavoro e inversioni
if Chainsawing.Tool.IsCCW then
Chainsawing.Workside = MCH_MILL_WS.RIGHT
Chainsawing.Invert = false
else
Chainsawing.Workside = MCH_MILL_WS.LEFT
Chainsawing.Invert = true
end
Chainsawing.ToolInvert = false
-- profondità e offset longitudinale
if Chainsawing.Tool.MaxMat > Proc.Pocket.Depth - 10 * GEO.EPS_SMALL then
Chainsawing.Depth = Proc.Pocket.Depth
Chainsawing.LongitudinalOffset = 0
else
Chainsawing.Depth = Chainsawing.Tool.MaxMat
Chainsawing.LongitudinalOffset = Proc.Pocket.Depth - Chainsawing.Depth
Chainsawing.Message = 'Feature '.. Proc.FeatureId .. ' : chainsaw elevation (' .. EgtNumToString( Proc.Pocket.Depth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( Chainsawing.Depth, 1) .. ')'
EgtOutLog( Chainsawing.Message)
end
-- offset radiale
Chainsawing.RadialOffset = 0
-- distanza di sicurezza
Chainsawing.StartSafetyLength = Proc.Pocket.Depth
-- overlap
Chainsawing.Overlap = 0
-- faceuse
Chainsawing.Faceuse = BL.GetNearestParalOpposite( Chainsawing.Direction)
-- SCC
Chainsawing.SCC = MCH_SCC.NONE
-- asse bloccato e angoli suggeriti
Chainsawing.BlockedAxis = {}
Chainsawing.BlockedAxis.Orientation = 'perpendicular'
Chainsawing.SuggestedAngles = {}
Chainsawing.SuggestedAngles.Index = 1
-- approccio e retrazione
Chainsawing.LeadIn, Chainsawing.LeadOut = SawPlusChain.CalculateLeadInOut( Proc, Chainsawing)
-- eventuale step verticale
Chainsawing.VerticalSteps = SawPlusChain.GetVerticalSteps( Proc, Chainsawing)
-- nome operazione
Chainsawing.OperationName = 'Chainsaw_' .. ( EgtGetName( Chainsawing.ProcId) or tostring( Chainsawing.ProcId)) .. '_' .. tostring( Chainsawing.FaceToMachine.Id + 1)
-- eventuale avviso di danneggiamento pezzo successivo
local dOffsideLength = max( Chainsawing.LeadIn.StartAddLength, Chainsawing.LeadOut.EndAddLength) + Chainsawing.Tool.Width / 2 + 10 * GEO.EPS_SMALL
if ( not Proc.Tail or Proc.AdvTail) and Proc.AffectedFaces.Left and ( Proc.Pocket.DistanceToNextPart < dOffsideLength) then
local sDamageNextPieceMessage = 'Feature '.. Proc.FeatureId .. ' : chainsaw can damage next piece.'
if #Chainsawing.Message > 0 then
Chainsawing.Message = Chainsawing.Message .. '\n' .. sDamageNextPieceMessage
else
Chainsawing.Message = sDamageNextPieceMessage
end
EgtOutLog( sDamageNextPieceMessage)
end
return Chainsawing
end
function SawPlusChain.Make( Proc, nRawId, nPhase, bOnlySaw)
Proc.Pocket = {}
Proc.Pocket.ApplyOnlySawblade = bOnlySaw
Proc.Pocket.Strategy = 'SawPlusChain'
local b3Raw = EgtGetRawPartBBox( nRawId)
-- TODO per implementare la strategia con lapjoint lunghe bisogna prima riconoscere le topologie che arrivano
if Proc.IsSplittedLapJoint then
local sErr = 'Feature '.. Proc.FeatureId .. ' : strategy ' .. Proc.Pocket.Strategy .. ' not implemented for long lapjoint'
EgtOutLog( sErr)
return false, sErr
end
if not SawPlusChain.IsTopologyOk( Proc) then
local sErr = 'Feature '.. Proc.FeatureId .. ' : strategy ' .. Proc.Pocket.Strategy .. ' not implemented'
EgtOutLog( sErr)
return false, sErr
end
-- se tasca su faccia sotto la strategia non è applicabile (la sega a catena in generale non può lavorare da sotto)
-- TODO se OnlySaw questo test è da rimuovere ma bisogna considerare anche la lama da sotto
if Proc.AffectedFaces.Bottom and ( Proc.Fct > 3 or not Proc.AffectedFaces.Top) then
local sErr = 'Feature '.. Proc.FeatureId .. ' : strategy ' .. Proc.Pocket.Strategy .. ' not applicable - pocket on bottom face'
EgtOutLog( sErr)
return false, sErr
end
-- caratteristiche della tasca
Proc.Pocket.BottomFace = SawPlusChain.GetBottomFace( Proc)
Proc.Pocket.FaceToMachine = SawPlusChain.GetFaceToMachine( Proc)
Proc.Pocket.SideFaces = SawPlusChain.GetSideFaces( Proc)
Proc.Pocket.Width = Proc.Pocket.BottomFace.Width
Proc.Pocket.Height = Proc.Pocket.BottomFace.Height
Proc.Pocket.Depth = Proc.Pocket.BottomFace.Elevation
Proc.Pocket.Direction = Proc.Pocket.BottomFace.VtN
Proc.Pocket.DistanceToNextPart = BL.GetDistanceToNextPart( nRawId, nPhase)
-- parametri lavorazione di lama
local Cutting = SawPlusChain.Saw.CalculateMachiningParameters( Proc)
-- applicazione lavorazione di lama con eventuali step XY
local bIsCuttingOk = false
local sCuttingApplyMessage = ''
if Cutting.CanApply then
local dOriginalRadialOffset = Cutting.RadialOffset
local dOriginalLeadInPerpDistance = Cutting.LeadIn.PerpDistance
local dOriginalLeadOutPerpDistance = Cutting.LeadOut.PerpDistance
for i = Cutting.HorizontalSteps.Count, 1, -1 do
Cutting.RadialOffset = dOriginalRadialOffset + Cutting.HorizontalSteps.StepLength * ( i - 1)
-- update distanza perpendicolare attacco per contemplare l'offset applicato
Cutting.LeadIn.PerpDistance = dOriginalLeadInPerpDistance - Cutting.RadialOffset
Cutting.LeadOut.PerpDistance = dOriginalLeadOutPerpDistance - Cutting.RadialOffset
-- applicazione lavorazione
bIsCuttingOk, sCuttingApplyMessage = SawPlusChain.ApplyMachining( Cutting, b3Raw)
-- update messaggi
if sCuttingApplyMessage and #sCuttingApplyMessage > 0 then
Cutting.Message = Cutting.Message .. 'Apply : ' .. sCuttingApplyMessage .. '\n'
end
end
end
-- se tasca passante e la lama è arrivata sul fondo, non servono ulteriori lavorazioni
if #Proc.Pocket.SideFaces == 0 and Cutting.RadialOffset == 0 then
bOnlySaw = true
end
if bOnlySaw or not bIsCuttingOk then
return bIsCuttingOk, Cutting.Message
end
-- parametri lavorazione con sega a catena
local Chainsawing = SawPlusChain.Chainsaw.CalculateMachiningParameters( Proc)
-- si lavora solo quanto non lavorato dalla lama
Chainsawing.MaxElev = Cutting.RadialOffset + BD.CUT_EXTRA
-- applicazione lavorazione con sega a catena con eventuali step in Z
local bIsChainsawingOk = false
local sChainsawingApplyMessage = ''
if Chainsawing.CanApply then
local dOriginalRadialOffsetChainsawing = Chainsawing.RadialOffset
for i = Chainsawing.VerticalSteps.Count, 1, -1 do
Chainsawing.RadialOffset = dOriginalRadialOffsetChainsawing + Chainsawing.VerticalSteps.StepLength * ( i - 1)
-- applicazione lavorazione
bIsChainsawingOk, sChainsawingApplyMessage = SawPlusChain.ApplyMachining( Chainsawing, b3Raw)
-- update messaggi
if sChainsawingApplyMessage and #sChainsawingApplyMessage > 0 then
Chainsawing.Message = Chainsawing.Message .. '\n' .. 'Apply : ' .. sChainsawingApplyMessage
end
end
end
local sFinalMessage = ''
if #Cutting.Message > 0 or #Chainsawing.Message > 0 then
sFinalMessage = Cutting.Message .. '\n' .. Chainsawing.Message
end
return bIsChainsawingOk, sFinalMessage
end
--#endregion SawPlusChain
---------------------------------------------------------------------
local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePart, bPrevBhSideMill, bAllWithEndCap)
if not BD.MAXDIAM_POCK_CORNER then
@@ -5323,16 +4602,6 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
EgtOutLog( sErr)
return false, sErr
end
-- strategia lama + eventuale sega a catena
if ( EgtGetInfo( Proc.Id, Q_SAW_PLUS_CHAIN, 'i') or 0) > 0 then --TEST
local bOk
local sErr
local bOnlySaw = EgtGetInfo( Proc.Id, Q_SAW_PLUS_CHAIN, 'i') == 1
bOk, sErr = SawPlusChain.Make ( Proc, nRawId, nPhase, bOnlySaw)
return bOk, sErr
end
local bClosedOrthoFaces
local nFacInd, dFacElev, nFacInd2, dFacElev2
local nBottomFace
@@ -5472,9 +4741,9 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
local bIsU = ( Proc.Fct == 3 and not TestElleShape3( Proc))
-- verifico se due facce o L con una o due facce di terminazione
local bIsL = ( Proc.Fct == 2 or TestElleShape3( Proc) or TestElleShape4( Proc) == 2)
-- se parametro Q03=2 forzo la fresatura di lato; con Q03=3 forzo solo se la faccia di lavoro non è rivolta verso l'alto +/-10°; per rabbet che guardano in giù sempre fresatura di lato
-- se parametro Q03=2 forzo la fresatura di lato; con Q03=3 forzo solo se la faccia di lavoro non è rivolta verso l'alto +/-10°; se rabbet lungo X che guarda in giù sempre fresatura di lato
local bIsRabbetAlongXTowardsBottom = ( Proc.TopologyLongName == 'Rabbet-Through-RightAngles-Parallel-2' and ( Proc.AffectedFaces.Front or Proc.AffectedFaces.Back) and Proc.AffectedFaces.Bottom and Proc.AffectedFaces.Left and Proc.AffectedFaces.Right)
local bForceSideMill = bIsRabbetAlongXTowardsBottom or ( ( EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') == 2 or ( EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') == 3 and vtN:getZ() < 0.985)) and ( ( Proc.Fct == 4 and ( Proc.AffectedFaces.Front or Proc.AffectedFaces.Back)) or Proc.Fct == 3 or Proc.Fct == 2))
local bForceSideMill = bIsRabbetAlongXTowardsBottom or ( ( EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') == 2 or ( EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') == 3 and vtN:getZ() < 0.985)) and ( Proc.Fct == 4 or Proc.Fct == 3 or Proc.Fct == 2))
-- se fattibile con fresa BH di fianco e spessore utensile inferiore alla larghezza faccia
local bMakeBySideMill, bHead, bHeadDir, sMilling, dMaxMat, dToolDiam = VerifyBHSideMill( Proc, bIsU, bIsL, bSinglePart, bPrevBhSideMill)
if bPrevBhSideMill == nil then
@@ -6432,7 +5701,7 @@ local function MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- la divido in parti lungo X
local vAddId = {}
local bAllWithEndCap = bAddEndCapLeftSide or bAddEndCapRightSide
local nPart = max( ceil( Proc.Box:getDimX() / BD.LONGCUT_MAXLEN + 10 * GEO.EPS_SMALL), 2)
local nPart = max( ceil( Proc.Box:getDimX() / BD.LONGCUT_MAXLEN), 2)
local dPartLen = Proc.Box:getDimX() / nPart
local Xmin = Proc.Box:getMin():getX()
-- trimesh per la creazione degli EndCap
@@ -6514,12 +5783,12 @@ local function MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
for i = 1, #vAddId do
local b3Box = EgtGetBBoxGlob( vAddId[i], GDB_BB.STANDARD)
local nFct = EgtSurfTmFacetCount( vAddId[i])
local AddProc = { Id = vAddId[i], Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Box, TotBox = Proc.Box, Fct = nFct, Flg = Proc.Flg, PartId = Proc.PartId, TaskId = Proc.TaskId, FeatureId = Proc.FeatureId, IsSplittedLapJoint = true, AffectedFaces = Proc.AffectedFaces}
local AddProc = { Id = vAddId[i], Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Box, TotBox = Proc.Box, Fct = nFct, Flg = Proc.Flg, PartId = Proc.PartId}
Topology.Classify( AddProc, b3Raw)
-- lasciare il false nel sesto parametro (perchè internamente viene verificato se diverso da nil)
local bOk, sMyWarn
local bOk, sMyWarn
bOk, sMyWarn, bPrevBhSideMill = MakeMoreFaces( AddProc, nPhase, nRawId, nPartId, dOvmHead, bAllWithEndCap, bPrevBhSideMill, bAllWithEndCap)
if not sWarn or #sWarn == 0 then sWarn = sMyWarn end
if not sWarn then sWarn = sMyWarn end
if not bOk then return bOk, sWarn end
end
return true, sWarn
+46 -62
View File
@@ -34,8 +34,6 @@
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
-- 2024/01/18 Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile.
-- 2024/01/22 Implementata gestione seghe a catena multiple.
-- 2024/05/09 In Make, allungamento percorso ingresso per evitare collisioni durante approccio pezzo quando si setta OutRaw=3
-- In Make, se non trova fresa per pulizia, da messaggio di warning anziché di errore
-- Tabella per definizione modulo
local ProcessLongCut = {}
@@ -295,7 +293,7 @@ local function MakeAntiSplintBySaw( Proc, nFacet, vtN, b3Raw, nFacInd, bReduceDe
-- laterale sul punto medio della linea in comune
local frFc = Frame3d( ptPm, vtN) ;
local b3BoxLoc = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frFc)
local dDepth = b3BoxLoc:getDimZ() or 0
dDepth = b3BoxLoc:getDimZ() or 0
-- recupero i dati dell'utensile
local dSawDiam = 400
local dSawThick = 0
@@ -512,7 +510,6 @@ local function MakeSideFaceByChainSaw( nSurfId, dDepth, dOffs, dSal, dEal, bShor
local dSawCornerRad = 0
local dSawThick = 0
local dSawDiameter = 0
local sWarn
-- se non trova una lavorazione di sawing esco
if not sSawing then
local sErr = 'Error : Sawing not found in library'
@@ -972,57 +969,58 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
local dElev = BL.GetFaceElevation( Proc, 0, b3Solid)
-- recupero la lavorazione
local sMilling = ML.FindMilling( 'Long2Cut_H2', dElev, nil, nil, nil, not bCanUseUnderBlade, bCanUseUnderBlade)
if sMilling then
-- recupero i dati dell'utensile
local dToolDiam = 0
local dMaxDepth = 0
if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
if not sMilling then
local sErr = 'Error : milling Long2Cut (_H2) not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati dell'utensile
local dToolDiam = 0
local dMaxDepth = 0
if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
-- se ho facce di chiusura, per prima cosa faccio antischeggia
-- come richiesto da Fabio Squaratti il 03/09/2021
if ( bLimXmin and not bForcedLim) or bLimXmax then
local bMadeASbyBld, bOk, nFacet
bMadeASbyBld, bOk, sWarn = ManageAntiSplintBySaw( Proc, b3Raw, (( bLimXmin and not bForcedLim) and bLimXmax), vtN, nFacet, 0, sWarn, bCanUseUnderBlade, nil, sCutting)
if not bOk then return false, sWarn end
end
-- eventuale lavorazione della faccia limitante l'inizio
if not bStartFixed then
local vtIni = -X_AX()
for j = 1, Proc.Fct - 1 do
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, j, GDB_ID.ROOT)
if vtIni * vtN > 0 and nCountMilHead < 2 then
MakeSideFace( Proc.Id, j, nSide, sMilling, dToolDiam, nil, max(dStartDistUp,dStartDistDn), bCanUseUnderBlade)
nCountMilHead = nCountMilHead + 1
end
end
if bForcedLim and nCountMilHead < 1 then
MakeSideFace( Proc.Id, 0, nSide, sMilling, dToolDiam, bForcedLim, max(dStartDistUp,dStartDistDn), bCanUseUnderBlade)
end
-- se ho facce di chiusura, per prima cosa faccio antischeggia
-- come richiesto da Fabio Squaratti il 03/09/2021
if ( bLimXmin and not bForcedLim) or bLimXmax then
local bOk, nFacet
bMadeASbyBld, bOk, sWarn = ManageAntiSplintBySaw( Proc, b3Raw, (( bLimXmin and not bForcedLim) and bLimXmax), vtN, nFacet, 0, sWarn, bCanUseUnderBlade, nil, sCutting)
if not bOk then return false, sWarn end
end
-- eventuale lavorazione della faccia limitante l'inizio
if not bStartFixed then
local vtIni = -X_AX()
for j = 1, Proc.Fct - 1 do
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, j, GDB_ID.ROOT)
if vtIni * vtN > 0 and nCountMilHead < 2 then
MakeSideFace( Proc.Id, j, nSide, sMilling, dToolDiam, nil, max(dStartDistUp,dStartDistDn), bCanUseUnderBlade)
nCountMilHead = nCountMilHead + 1
end
end
if bForcedLim and nCountMilHead < 1 then
MakeSideFace( Proc.Id, 0, nSide, sMilling, dToolDiam, bForcedLim, max(dStartDistUp,dStartDistDn), bCanUseUnderBlade)
nCountMilHead = nCountMilHead + 1
end
end
-- eventuale lavorazione della faccia limitante la fine
if not bEndFixed then
local vtFin = X_AX()
for j = 1, Proc.Fct - 1 do
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, j, GDB_ID.ROOT)
if vtFin * vtN > 0 and nCountMilHead < 2 then
MakeSideFace( Proc.Id, j, nSide, sMilling, dToolDiam, nil, max(dEndDistUp,dEndDistDn), bCanUseUnderBlade)
nCountMilHead = nCountMilHead + 1
end
end
if bForcedLim and nCountMilHead < 2 then
MakeSideFace( Proc.Id, 0, nSide, sMilling, dToolDiam, bForcedLim, max(dEndDistUp,dEndDistDn), bCanUseUnderBlade)
-- eventuale lavorazione della faccia limitante la fine
if not bEndFixed then
local vtFin = X_AX()
for j = 1, Proc.Fct - 1 do
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, j, GDB_ID.ROOT)
if vtFin * vtN > 0 and nCountMilHead < 2 then
MakeSideFace( Proc.Id, j, nSide, sMilling, dToolDiam, nil, max(dEndDistUp,dEndDistDn), bCanUseUnderBlade)
nCountMilHead = nCountMilHead + 1
end
end
else
sWarn = 'Warning: milling Long2Cut (_H2) not found in library'
if bForcedLim and nCountMilHead < 2 then
MakeSideFace( Proc.Id, 0, nSide, sMilling, dToolDiam, bForcedLim, max(dEndDistUp,dEndDistDn), bCanUseUnderBlade)
nCountMilHead = nCountMilHead + 1
end
end
end
@@ -1217,6 +1215,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
if not bChainSawOk then return false, sErr end
end
end
-- se non è sotto e non uso fresa di fianco: lavorazione Long2Cut
elseif ( nSide ~= - 1 or BD.DOWN_HEAD) and nUseMillOnSide == 0 then
-- determino la massima elevazione
@@ -1427,21 +1426,6 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
if k < nO then
local sNotes = 'OutRaw=3;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
-- aumento ingresso su spezzoni per evitare collisione durante approccio pezzo
if bFront then
-- se invertito si allunga ingresso su tutti tranne su ultimo
if bInvert and i ~= nC then
EgtSetMachiningParam( MCH_MP.LIPERP, ( nO - k) * dStep + 10)
-- se non invertito si allunga solo il primo
elseif not bInvert and i == 1 then
EgtSetMachiningParam( MCH_MP.LIPERP, ( nO - k) * dStep + 10)
end
else
-- se invertito si allunga ingresso su tutti
if bInvert then
EgtSetMachiningParam( MCH_MP.LIPERP, ( nO - k) * dStep + 10)
end
end
end
-- eseguo
if not ML.ApplyMachining( true, false) then
+5 -6
View File
@@ -23,7 +23,6 @@
-- 2023/11/24 Aggiunta Q05 per utilizzo lama anche in feature cieche conme per LongCut.
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
-- 2024/01/18 Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile.
-- 2024/03/21 Corretto parametro passato a funzione BL.GetBlockedAxis. Ora tiene in considerazione anche testa sotto
-- Tabella per definizione modulo
local ProcessLong2Cut = {}
@@ -834,13 +833,11 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- recupero alcune informazioni utili dalla lavorazione attuale
local bIsCurrentBladeCCW
local sCuttingNameMach
if bIsTopBladeCurrent then
sCuttingNameMach = sCutting
EgtMdbSetCurrMachining( sCutting)
else
sCuttingNameMach = sCuttingDn
EgtMdbSetCurrMachining( sCuttingDn)
end
EgtMdbSetCurrMachining( sCuttingNameMach)
bIsCurrentBladeCCW = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0
-- imposto la direzione di lavoro per avere scarico del truciolo ottimale
@@ -883,7 +880,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- imposto angolo 3° asse rot
local vtOut = EgtIf( vtN[vOrd[j]]:getX() > 0, X_AX(), -X_AX())
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCuttingNameMach, 'perpendicular', b3Raw, vtN, vtOut))
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCutting, 'perpendicular', b3Raw, vtN, vtOut))
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
@@ -1780,6 +1777,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
sWarn = 'Warning in LongDoubleCut : depth (' .. EgtNumToString( vWidth[vOrd[i]] + dAgg, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepthDn - dCollSic, 1) .. ')'
end
dDepth = min( dMaxDepthDn - dCollSic, vWidth[vOrd[i]] + dAgg)
dDepth2 = vWidth[vOrd[i]] + dAgg - dDepth
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth - dExtraElev)
else
dCollSic = max( BD.COLL_SIC, ( dThDiam - dToolDiam) / 2 * EgtIf( abs(dNz) < GEO.EPS_SMALL, 1, abs( EgtIf( abs(vtN[vOrd[i]]:getY()) >= abs(vtN[vOrd[i]]:getZ()), vtN[vOrd[i]]:getZ(), vtN[vOrd[i]]:getY()) / dNz)))
@@ -1787,6 +1785,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
sWarn = 'Warning in LongDoubleCut : depth (' .. EgtNumToString( vWidth[vOrd[i]] + dAgg, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth - dCollSic, 1) .. ')'
end
dDepth = min( dMaxDepth - dCollSic, vWidth[vOrd[i]] + dAgg)
dDepth2 = vWidth[vOrd[i]] + dAgg - dDepth
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth - dExtraElev)
end
-- eseguo
+1 -1
View File
@@ -442,7 +442,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- recupero i dati della curva e del profilo
local dDepth = dMorH
local bDownHead = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1)
local bToolInv = ( not bDownHead and vtExtr:getZ() < -0.1 and Proc.Box:getDimZ() > b3Solid:getDimZ() - 5)
local bToolInv = ( not bDownHead and vtExtr:getZ() < -0.1 and b3Aux:getDimZ() > b3Raw:getDimZ() - 5)
local dExtra = 2
-- verifico se servono gli smussi. Se lavorazione principale di svuotatura significa che è solo da un lato
-38
View File
@@ -1,43 +1,5 @@
==== Beam Update Log ====
Versione 2.6e2 (10/05/2024)
- Fixed : correzioni a FeatureTopology
- Modif : in LongCut allungamento percorso ingresso per evitare collisioni durante approccio pezzo quando si setta OutRaw
- Modif : in LongCut se non trova fresa per pulizia dà messaggio di warning anziché di errore
Versione 2.6e1 (03/05/2024)
- Modif : in LapJoint Groove verso il basso lavorata di preferenza dal lato
- Modif : in LapJoint -> SideMillAsSaw gestito anche rabbet passante
- Fixed : in BeamExec box della feature aggiornato dopo rotazione
- Fixed : in BeamExec GetProcessAffectedFaces e GetFacetsInfo rilanciati dopo rotazione
- Fixed : In LapJoint -> MakeMoreLongFaces corretto calcolo divisione in parti per evitare problemi di ceil con interi perfetti
Versione 2.6d2 (11/04/2024)
- Added : in LapJoint aggiunta strategia per fare tasche con lama + sega a catena, attivata da Q11
Versione 2.6d1 (08/04/2024)
- Fixed : in Long2Cut corretto nome passato alla BL.GetBlockedAxis
- Fixed : in MakeTwo rimossa gestione calcolo differente su ultima passata in caso di macchina FAST
- Fixed : in LapJoint -> ForceSideMill escluso caso 4 facce senza possibilità di ingresso lungo Y.
Versione 2.6c4 (18/03/2024)
- Fixed : correzioni a gestione prefori.
Versione 2.6c3 (15/03/2024)
- Added : Aggiunta gestione prefori
- Fixed : in LapJoint correzione a calcolo ingombro per feature basse e lunghe dalla testa.
Versione 2.6c2 (12/03/2024)
- Added : in Mortase Aggiunta possibilità di inserire lavorazione di smusso
- Added : in FreeContour aggiunto smusso se lav. di svuotatura
- Added : in BeamExec creata funzione calcolo dipendenze tra feature
- Added : In BeamExec -> CollectFeatures si scrive ora Width e Height della faccia sia trimmate con il grezzo che intere
- Added : implementate le lavorazioni in doppio per fori specchiati non passanti e DrillPocket
- Modif : in LapJoint migliorata ricerca pocket (VerifyPocket)
- Modif : implementato attacco esterno se tasca 4 facce sulla coda ma nessun pezzo successivo
- Modif : rimossi simboli di debug da compile
- Fixed : In FreeContour corretto caso di smusso non passante
Versione 2.6c1 (29/02/2024)
- Modif : in FacesBySaw e LapJoint migliorato calcolo area non pinzabile in testa HCING e coda TCING
- Modif : vari miglioramenti all'ordinamento delle lavorazioni
+1 -1
View File
@@ -2,5 +2,5 @@
-- Gestione della versione di Beam
NAME = 'Beam'
VERSION = '2.6e2'
VERSION = '2.6c1'
MIN_EXE = '2.6a1'