- Prima versione strategia standard SPLITCUT e aggiunta chiamata della strategia

- Prima versione strategia core FACEBYBLADE
- Aggiunte altre UserNotes e corretto append se più note
This commit is contained in:
andrea.villa
2024-08-09 09:46:01 +02:00
parent 74279896e9
commit 9acd52ea10
12 changed files with 549 additions and 45 deletions
+24 -15
View File
@@ -13,20 +13,39 @@ local BeamData = require( 'BeamData')
local ID = require( 'Identity')
-- TODO tabella da compleatare man mano che si inseriscono le varie strategie
-- ESEMPIO SCRITTURA TABELLA CON STRATEGIE DISPONIBILI
---------------------------------------------------------------------
-- Feature : Cut
-- if ID.TipoFeature( Proc) then
-- if Proc.Topology.sName == 'QQQQQQQQQ' then
-- Strategies = {
-- { sStrategyId = 'STR9999',
-- Parameters = {
-- { sName = 'Val_1', sValue = '15', sType = 'd'},
-- { sName = 'Val_2', sValue = 'false', sType = 'b'}
-- }
-- }
-- { sStrategyId = 'STR9998'}
-- }
-- end
-- end
----------------------------------------------------------------------------------
-- *** EGALWARE ***
----------------------------------------------------------------------------------
local function GetStrategies_Egalware( Proc)
local Strategies = {}
-- TODO tabella da compleatare man mano che si inseriscono le varie strategie
---------------------------------------------------------------------
-- Feature : Cut
if ID.IsHeadCut( Proc) then
Strategies = { { sStrategyId = 'HEADCUT'}}
---------------------------------------------------------------------
-- Feature : Cut
elseif ID.IsSplitCut( Proc) then
Strategies = { { sStrategyId = 'SPLITCUT'}}
---------------------------------------------------------------------
-- Feature : Cut
elseif ID.IsCut( Proc) then
@@ -277,24 +296,14 @@ end
local function GetStrategies_Essetre( Proc)
local Strategies = {}
-- TODO tabella da compleatare man mano che si inseriscono le varie strategie
---------------------------------------------------------------------
-- Feature : Cut
if ID.IsHeadCut( Proc) then -- TODO TOGLIERE STRATEGIA. Inserita solo per mostrare come devono essere scritti i dati
if Proc.Topology.sName == 'QQQQQQQQQ' then
Strategies = {
{ sStrategyId = 'STR9999',
Parameters = {
{ sName = 'Step', sValue = '15', sType = 'd'},
{ sName = 'AntiSplint', sValue = 'false', sType = 'b'}
}
}
}
end
if ID.IsHeadCut( Proc) then
Strategies = { { sStrategyId = 'HEADCUT'}}
---------------------------------------------------------------------
-- Feature : Cut
elseif ID.IsSplitCut( Proc) then
Strategies = { { sStrategyId = 'SPLITCUT'}}
---------------------------------------------------------------------
-- Feature : Cut
elseif ID.IsCut( Proc) then
+4 -1
View File
@@ -152,7 +152,7 @@ function BeamExec.GetToolsFromDB()
Tool.bIsPen = abs( Tool.dSpeed) < 5
-- recupero parametri propri delle lame
elseif sToolFamily == 'SAWBLADE' then
Tool.bIsUsedForLongCut = EgtGetValInNotes( Tool.sUserNotes, 'LONGCUT') == 1 or false -- false coem valore di default
Tool.bIsUsedForLongCut = EgtGetValInNotes( Tool.sUserNotes, 'LONGCUT') == 1 or false -- false come valore di default
Tool.dStep = EgtGetValInNotes( Tool.sUserNotes, 'STEP') or Tool.dThickness -- se non settato nell'utensile, considero lo spessore lama
Tool.dSideStep = EgtGetValInNotes( Tool.sUserNotes, 'SIDESTEP') or Tool.dMaxMaterial -- se non settato nell'utensile, considero un quarto del diametro
-- recupero parametri propri delle motoseghe
@@ -344,6 +344,9 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS)
PARTS[i].dDistanceToNextPiece = dDelta
PARTS[i].dRestLength = dLen
PARTS[i].b3Raw = EgtGetRawPartBBox( PARTS[i].idRaw)
PARTS[i].dLength = PARTS[i].b3Raw:getDimX()
PARTS[i].dWidth = PARTS[i].b3Raw:getDimY()
PARTS[i].dHeight = PARTS[i].b3Raw:getDimZ()
PARTS[i].b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[i].id, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
else
local sOut = 'Error: part L(' .. EgtNumToString( dPartLen, 1) .. ') too big for raw part L(' .. EgtNumToString( dLen - 0.1, 1) .. ')'
+4
View File
@@ -20,6 +20,10 @@ function FeatureData.NeedTopologyFeature( Proc)
-- features tipo taglio
if ID.IsCut( Proc) then
return true
elseif ID.IsHeadCut( Proc) then
return true
elseif ID.IsSplitCut( Proc) then
return true
elseif ID.IsDoubleCut( Proc) then
return true
elseif ID.IsSawCut( Proc) then
+36 -22
View File
@@ -206,8 +206,14 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters)
end
if bIsToolCompatible then
nBestToolIndex = i
break
if not nBestToolIndex then
nBestToolIndex = i
else
-- prediligo utensile per tagli lunghi, se richiesto
if ToolSearchParameters.bForceLongcutBlade and not TOOLS[nBestToolIndex].bIsUsedForLongCut and TOOLS[i].bIsUsedForLongCut then
nBestToolIndex = i
end
end
end
end
@@ -307,27 +313,27 @@ function MachiningLib.AddNewMachining( ProcToAdd, MachiningToAdd, AuxiliaryDataT
return false
end
-- Drilling
if MachiningToAdd.nType == MCH_MY.DRILLING then
MachiningToAdd.sTypeName = 'Drill_'
-- Milling
elseif MachiningToAdd.nType == MCH_MY.MILLING then
-- se utensile lama
if TOOLS[MachiningToAdd.nToolIndex].sFamily == 'SAWBLADE' then
MachiningToAdd.sTypeName = 'Cut_'
else
MachiningToAdd.sTypeName = 'Mill_'
end
-- Pocketing
elseif MachiningToAdd.nType == MCH_MY.POCKETING then
MachiningToAdd.sTypeName = 'Pocket_'
-- Mortising
elseif MachiningToAdd.nType == MCH_MY.MORTISING then
MachiningToAdd.sTypeName = 'ChSaw_'
end
-- se nome non definito, assegno alla lavorazioen un nome standard
if not MachiningToAdd.sOperationName then
MachiningToAdd.sOperationName = MachiningToAdd.sTypeName .. ( EgtGetName( ProcToAdd.id) or tostring( ProcToAdd.id)) .. '_' .. tostring( MachiningToAdd.Geometry[1][2])
-- Drilling
if MachiningToAdd.nType == MCH_MY.DRILLING then
MachiningToAdd.sTypeName = 'Drill_'
-- Milling
elseif MachiningToAdd.nType == MCH_MY.MILLING then
-- se utensile lama
if TOOLS[MachiningToAdd.nToolIndex].sFamily == 'SAWBLADE' then
MachiningToAdd.sTypeName = 'Cut_'
else
MachiningToAdd.sTypeName = 'Mill_'
end
-- Pocketing
elseif MachiningToAdd.nType == MCH_MY.POCKETING then
MachiningToAdd.sTypeName = 'Pocket_'
-- Mortising
elseif MachiningToAdd.nType == MCH_MY.MORTISING then
MachiningToAdd.sTypeName = 'ChSaw_'
end
MachiningToAdd.sOperationName = MachiningToAdd.sTypeName .. ( EgtGetName( ProcToAdd.id) or tostring( ProcToAdd.id)) -- .. '_' .. tostring( MachiningToAdd.Geometry)
end
if not MachiningToAdd.sToolName then
MachiningToAdd.sToolName = TOOLS[MachiningToAdd.nToolIndex].sName
@@ -401,7 +407,13 @@ function MachiningLib.AddOperations( vProc, Part)
-- parametri da scrivere nelle note utente
local UserNotes = {
{ sName = 'dMaxElev', sMchParam = 'MaxElev'}
{ sName = 'dMaxElev', sMchParam = 'MaxElev'},
{ sName = 'dOpenMinSafe', sMchParam = 'OpenMinSafe'},
{ sName = 'nVMRS', sMchParam = 'VMRS'},
{ sName = 'dStartZmax', sMchParam = 'StartZmax'},
{ sName = 'nOutRaw', sMchParam = 'OutRaw'},
{ sName = 'nOpenOutRaw', sMchParam = 'OpenOutRaw'},
{ sName = 'nPlunge', sMchParam = 'Plunge'}
}
-- parametri da scrivere nelle note di sistema
@@ -476,6 +488,7 @@ function MachiningLib.AddOperations( vProc, Part)
end
if sValue then
local sUserNotes = ''
sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
sUserNotes = EgtSetValInNotes( sUserNotes, UserNotes[k].sMchParam, sValue)
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
end
@@ -494,6 +507,7 @@ function MachiningLib.AddOperations( vProc, Part)
end
if sValue then
local sSystemNotes = ''
sSystemNotes = EgtSetMachiningParam( MCH_MP.SYSNOTES)
sSystemNotes = EgtSetValInNotes( sSystemNotes, SystemNotes[k].sMchParam, sValue)
EgtSetMachiningParam( MCH_MP.SYSNOTES, sSystemNotes)
end
+7 -1
View File
@@ -7,7 +7,7 @@
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
EgtEnableDebug( true)
-- Imposto direttorio libreria specializzata per Travi
EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua')
@@ -42,6 +42,11 @@ _G.package.loaded.BasicCustomerStrategies = nil
_G.package.loaded.FeatureData = nil
_G.package.loaded.FaceData = nil
_G.package.loaded.MachiningLib = nil
-- strategie di base sempre presenti
_G.package.loaded['SPLITCUT\\SPLITCUT'] = nil
_G.package.loaded['SPLITCUT\\SPLITCUTConfig'] = nil
_G.package.loaded['HEADCUT\\HEADCUT'] = nil
_G.package.loaded['HEADCUT\\HEADCUTConfig'] = nil
-- TODO controllare se c'è un modo migliore per resettare librerie delle strategie caricate precedentemente
-- Per ottimizzare potremmo anche ciclare solo fino al numero di strategie raggiunto per il momento.
@@ -66,6 +71,7 @@ for i = 1, #vtCoreStrategiesNames do
end
end
local BeamExec = require( 'BeamExec')
-- Variabili globali
+115
View File
@@ -0,0 +1,115 @@
-- Strategia: FACEBYBLADE
-- Descrizione
-- Strategia di base per la lavorazione di una faccia con lama
-- Feature: tutte
-- carico librerie
local BeamLib = require( 'BeamLib')
local BeamData = require( 'BeamData')
local MachiningLib = require( 'MachiningLib')
-- Tabella per definizione modulo
local FACEBYBLADE = {}
-------------------------------------------------------------------------------------------------------------
local function CalculateLeadInOut( EdgeToMachine)
local LeadIn = {}
local LeadOut = {}
LeadIn.dStartAddLength = 0
LeadOut.dEndAddLength = 0
LeadIn.nType = MCH_MILL_LI.LINEAR
LeadOut.nType = MCH_MILL_LI.LINEAR
LeadIn.dTangentDistance = 0
LeadOut.dTangentDistance = 0
if EdgeToMachine.Elev > -10 * GEO.EPS_SMALL then
LeadIn.dPerpDistance = EdgeToMachine.dElevation + BeamData.CUT_SIC
LeadOut.dPerpDistance = EdgeToMachine.dElevation + BeamData.CUT_SIC
else
LeadIn.dPerpDistance = BeamData.CUT_SIC
LeadOut.dPerpDistance = BeamData.CUT_SIC
end
LeadIn.dElevation = 0
LeadOut.dElevation = 0
LeadIn.dCompLength = 0
LeadOut.dCompLength = 0
LeadIn.dStartAddLength = BeamData.CUT_EXTRA
LeadOut.dEndAddLength = BeamData.CUT_EXTRA
return LeadIn, LeadOut
end
-------------------------------------------------------------------------------------------------------------
-- TODO da sistemare
local function GetSCC( vtMachiningDirection)
local nSCC = MCH_SCC.NONE
if vtMachiningDirection:getZ() < -0.9 then
nSCC = MCH_SCC.ADIR_ZM
elseif vtMachiningDirection:getZ() > 0.9 then
nSCC = MCH_SCC.ADIR_ZP
elseif vtMachiningDirection:getY() < -0.707 then
nSCC = MCH_SCC.ADIR_YM
elseif vtMachiningDirection:getY() > 0.707 then
nSCC = MCH_SCC.ADIR_YP
elseif vtMachiningDirection:getX() < -0.707 then
nSCC = MCH_SCC.ADIR_XM
elseif vtMachiningDirection:getX() > 0.707 then
nSCC = MCH_SCC.ADIR_XP
end
return nSCC
end
-------------------------------------------------------------------------------------------------------------
-- TODO funziona da fare completamente
function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalParameters)
local Cutting = {}
local vtMachiningDirection = EdgeToMachine.Norm
local vtN = Proc.Faces[FaceToMachine+1].vtN
Cutting.nFaceuse = OptionalParameters.nFaceuse
Cutting.sDepth = OptionalParameters.sDepth
-- utilizzo i parametri di collegamento passati, altrimenti ricalcolo
if OptionalParameters.LeadIn and OptionalParameters.LeadOut then
Cutting.LeadIn, Cutting.LeadOut = OptionalParameters.LeadIn, OptionalParameters.LeadOut
else
Cutting.LeadIn, Cutting.LeadOut = CalculateLeadInOut( EdgeToMachine)
end
Cutting.nType = MCH_MY.MILLING
Cutting.nToolIndex = OptionalParameters.nToolIndex
Cutting.Geometry = {{ Proc.id, FaceToMachine}}
Cutting.id = Proc.id
Cutting.nSCC = GetSCC( vtMachiningDirection)
Cutting.sUserNotes = EgtSetValInNotes( sUserNotes, 'VtFaceUse', vtMachiningDirection)
if OptionalParameters.sUserNotes then
Cutting.sUserNotes = Cutting.sUserNotes .. OptionalParameters.sUserNotes
end
local bIsSawCCW = TOOLS[Cutting.nToolIndex].bIsCCW
local bInvert
-- se la lama ruota in senso antiorario inverto la direzione di lavorazione, per avere rotazione lama opposta a avanzamento
if bInvert == nil then
bInvert = ( not bIsSawCCW)
if bIsSawCCW then
bInvert = (( Cutting.nFaceuse == MCH_MILL_FU.ORTHO_FRONT and vtN:getX() < 0) or ( Cutting.nFaceuse == MCH_MILL_FU.ORTHO_BACK and vtN:getX() > 0))
else
bInvert = (( Cutting.nFaceuse == MCH_MILL_FU.ORTHO_FRONT and vtN:getX() > 0) or ( Cutting.nFaceuse == MCH_MILL_FU.ORTHO_BACK and vtN:getX() < 0))
end
end
Cutting.bInvert = bInvert
Cutting.nWorkside = EgtIf( bInvert, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)
return Cutting
end
-------------------------------------------------------------------------------------------------------------
return FACEBYBLADE
+37
View File
@@ -0,0 +1,37 @@
-- Strategia: HEADCUT
-- Descrizione
-- HeadCut
-- Feature: HeadCut
-- carico librerie
local BeamLib = require( 'BeamLib')
local BeamData = require( 'BeamData')
local MachiningLib = require( 'MachiningLib')
local FeatureData = require( 'FeatureData')
-- strategie di base
local SlotByBlade = require( 'SLOTBYBLADE')
local SlotByChainSaw = require( 'SLOTBYCHAINSAW')
-- Tabella per definizione modulo
local HEADCUT = {}
local Strategy = {}
-------------------------------------------------------------------------------------------------------------
function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
local StrategyLib = {}
StrategyLib.Config = require( 'HEADCUT\\HEADCUTConfig')
Strategy.sName = StrategyLib.Config.sStrategyId
CustomParameters = BeamLib.GetUpdateCustomParameters( CustomParameters, StrategyLib.Config.Parameters)
Strategy.Parameters = BeamLib.LoadCustomParametersInStrategy( CustomParameters)
Strategy.Result = {}
Strategy.Result.sInfo = ''
local bAreAllMachiningsAdded = true
return bAreAllMachiningsAdded, Strategy.Result
end
-------------------------------------------------------------------------------------------------------------
return HEADCUT
@@ -0,0 +1,11 @@
-- Parametri configurabili da cliente per strategia: HEADCUT
local HEADCUTData = {
sStrategyId = 'HEADCUT',
Parameters = {
{ sName = 'bForceChainSaw', sValue = 'false', sDescriptionShort = 'Force to use chain saw', sDescriptionLong = 'Force to use chain saw', sType = 'b', sMessageId = '', sMinUserLevel = '1'},
{ sName = 'bFinishWithMill', sValue = 'true', sDescriptionShort = 'Finish with mill', sDescriptionLong = 'Use a mill to finish the surface if splitted with chain saw', sType = 'b', sMessageId = '', sMinUserLevel = '1'}
}
}
return HEADCUTData
+289
View File
@@ -0,0 +1,289 @@
-- Strategia: SPLITCUT
-- Descrizione
-- Taglio di separazione
-- Feature: SplitCut
-- carico librerie
local BeamLib = require( 'BeamLib')
local BeamData = require( 'BeamData')
local MachiningLib = require( 'MachiningLib')
local FeatureData = require( 'FeatureData')
-- strategie di base
local FaceByBlade = require('FACEBYBLADE')
-- Tabella per definizione modulo
local SPLITCUT = {}
local Strategy = {}
-------------------------------------------------------------------------------------------------------------
local function LoadStrategyParameters( CustomParameters)
local StrategyLib = {}
StrategyLib.Config = require( 'SPLITCUT\\SPLITCUTConfig')
Strategy.sName = StrategyLib.Config.sStrategyId
CustomParameters = BeamLib.GetUpdateCustomParameters( CustomParameters, StrategyLib.Config.Parameters)
Strategy.Parameters = BeamLib.LoadCustomParametersInStrategy( CustomParameters)
Strategy.Result = {}
Strategy.Machining = {}
Strategy.Result.sInfo = ''
return Strategy
end
-------------------------------------------------------------------------------------------------------------
local function CalculateLeadInOut( Machining, EdgeToMachine)
local LeadIn = {}
local LeadOut = {}
LeadIn.dStartAddLength = 0
LeadOut.dEndAddLength = 0
LeadIn.nType = MCH_MILL_LI.LINEAR
LeadOut.nType = MCH_MILL_LI.LINEAR
LeadIn.dTangentDistance = 0
LeadOut.dTangentDistance = 0
if EdgeToMachine.Elev > -10 * GEO.EPS_SMALL then
LeadIn.dPerpDistance = EdgeToMachine.Elev + BeamData.CUT_SIC
LeadOut.dPerpDistance = EdgeToMachine.Elev + BeamData.CUT_SIC
else
LeadIn.dPerpDistance = BeamData.CUT_SIC
LeadOut.dPerpDistance = BeamData.CUT_SIC
end
LeadIn.dElevation = 0
LeadOut.dElevation = 0
LeadIn.dCompLength = 0
LeadOut.dCompLength = 0
LeadIn.dStartAddLength = BeamData.CUT_EXTRA
LeadOut.dEndAddLength = BeamData.CUT_EXTRA
return LeadIn, LeadOut
end
-------------------------------------------------------------------------------------------------------------
local function MakeChamfer()
-- TODO funzionalità da aggiungere
end
-------------------------------------------------------------------------------------------------------------
local function GetEdgeToMachine( Proc, vtEdge)
local Edge
for i = 1, #Proc.Faces[1].Edges do
if AreSameVectorApprox( Proc.Faces[1].Edges[i].Norm, vtEdge) then
Edge = Proc.Faces[1].Edges[i]
end
end
return Edge
end
-------------------------------------------------------------------------------------------------------------
local function GetSplitStrategy( Proc, Part)
-- se non sono stati caricati i parametri, si ricaricano
if not Strategy.Parameters then
Strategy = LoadStrategyParameters()
end
-- separazione solo se esiste grezzo successivo con pezzi o scaricabile
local nNextRawId = EgtGetNextRawPart( Part.idRaw)
Strategy.bSplit = ( nNextRawId and ( EgtGetPartInRawPartCount( nNextRawId) > 0 or EgtGetRawPartBBox( nNextRawId):getDimX() >= BeamData.dMinRaw))
-- imposto paraemtri di ricerca utensile in base a topologia
local Machining = {}
-- sTypeMachining = BladeSideSingle\ BladeSideDouble\ BladeHorizontalSingle\ BladeHorizontalDouble\ ChainSawHorizontal\ ChainSawSideSingle\ ChainSawSideDouble\ ChainSawPlusBlade\ Mill\ None
Machining.sTypeMachining = 'None'
local Splitting = {}
local ToolSearchParameters = {}
ToolSearchParameters.vtToolDirection = Proc.Faces[1].vtN
-- ===== RICERCA UTENSILE =====
-- cerco lama sopra
Splitting.bIsApplicable = false
ToolSearchParameters.bAllowTopHead = true
ToolSearchParameters.bAllowBottomHead = false
Splitting.ToolInfo = {}
Splitting.ToolInfo = MachiningLib.FindBlade( Proc, ToolSearchParameters)
if Splitting.ToolInfo.nToolIndex then
Splitting.bIsApplicable = true
local ParametersMRR = {}
ParametersMRR.nToolIndex = Splitting.ToolInfo.nToolIndex
Splitting.dMRR = MachiningLib.GetToolMRR( ParametersMRR)
end
table.insert( Machining, Splitting)
-- cerco lama sotto
Splitting = {}
Splitting.bIsApplicable = false
ToolSearchParameters.bAllowTopHead = false
ToolSearchParameters.bAllowBottomHead = true
Splitting.ToolInfo = {}
Splitting.ToolInfo = MachiningLib.FindBlade( Proc, ToolSearchParameters)
if Splitting.ToolInfo.nToolIndex then
Splitting.bIsApplicable = true
local ParametersMRR = {}
ParametersMRR.nToolIndex = Splitting.ToolInfo.nToolIndex
Splitting.dMRR = MachiningLib.GetToolMRR( ParametersMRR)
end
table.insert( Machining, Splitting)
-- cerco motosega
Splitting = {}
Splitting.bIsApplicable = false
table.insert( Machining, Splitting)
-- cerco fresa
Splitting = {}
Splitting.bIsApplicable = false
table.insert( Machining, Splitting)
-- ===== SCELTA LAVORAZIONI =====
-- forzature da parametri
if Strategy.Parameters.bForceChainSaw then
Machining[1].bIsApplicable = false
Machining[2].bIsApplicable = false
end
-- setto valori di default. Impossibile che taglio di separazione sia incompleto
Strategy.Result.sStatus = 'Completed'
Strategy.Result.nCompletionIndex = FeatureData.GetFeatureCompletionIndex( 100)
Strategy.Result.dMRR = 1
-- correzioni sul massimo materiale lama, considerando ingombri vari
local dMaxMatBladeSideSingle
local dMaxMatBladeSideDouble
local dMaxMatBladeHorizontalSingle
local dMaxMatBladeHorizontalDouble
if Machining[1].bIsApplicable then
local dMaxMat = TOOLS[Machining[1].ToolInfo.nToolIndex].dMaxMaterial
local dRadius = TOOLS[Machining[1].ToolInfo.nToolIndex].dDiameter / 2
local sHead = TOOLS[Machining[1].ToolInfo.nToolIndex].sHead
-- se taglio di fianco disponibile, si controlla il massimo materiale reale. Per pezzi alti, bisogna controllare anche l'ingombro asse Z nelle 4 direzioni.
if Part.dHeight < BeamData.MIN_DIM_HBEAM then
dMaxMat = min( dMaxMat, BeamData.MAX_DIM_HTCUT)
dMaxMatBladeSideSingle = dMaxMat
dMaxMatBladeSideDouble = dMaxMat * 2
else
if BeamData.GetMaxMatReductionBladeCut then
dMaxMatBladeSideSingle = min( max( dRadius - BeamData.GetMaxMatReductionBladeCut( sHead, Y_AX()), dRadius - BeamData.GetMaxMatReductionBladeCut( sHead, -Y_AX())),
TOOLS[Machining[1].ToolInfo.nToolIndex].dMaxMaterial)
dMaxMatBladeSideDouble = dRadius - BeamData.GetMaxMatReductionBladeCut( sHead, Y_AX()) + dRadius - BeamData.GetMaxMatReductionBladeCut( sHead, -Y_AX())
else
dMaxMatBladeSideSingle = abs( BeamData.MAX_DIM_HTCUT_HBEAM)
dMaxMatBladeSideDouble = abs( BeamData.MAX_DIM_HTCUT_HBEAM) * 2
end
end
-- se taglio orizzontale
if BeamData.GetMaxMatReductionBladeCut then
dMaxMatBladeHorizontalSingle = min( TOOLS[Machining[1].ToolInfo.nToolIndex].dMaxMaterial, dRadius - BeamData.GetMaxMatReductionBladeCut( TOOLS[Machining[1].ToolInfo.nToolIndex].sHead, -Z_AX()))
else
dMaxMatBladeHorizontalSingle = TOOLS[Machining[1].ToolInfo.nToolIndex].dMaxMaterial
end
end
if Machining[2].bIsApplicable then
local dRadius = TOOLS[Machining[2].ToolInfo.nToolIndex].dDiameter / 2
dMaxMatBladeHorizontalDouble = min( TOOLS[Machining[2].ToolInfo.nToolIndex].dMaxMaterial, dRadius - BeamData.GetMaxMatReductionBladeCut( TOOLS[Machining[2].ToolInfo.nToolIndex].sHead, Z_AX()))
end
-- TODO considerare di tagliare con il massimo materiale possibile per non salire troppo in Z (macchine tipo PF), oppure non scendere troppo (tipo Kairos)
-- BladeSideSingle (taglio di lama singolo di fianco)
if Machining[1].bIsApplicable and ( dMaxMatBladeSideSingle - BeamData.CUT_EXTRA) > Part.dWidth + 10 * GEO.EPS_SMALL then
Machining.sTypeMachining = 'BladeSideSingle'
Machining[2].bIsApplicable = false
Machining[3].bIsApplicable = false
Machining[4].bIsApplicable = false
return Machining
-- TODO considerare di tagliare con il massimo materiale possibile per non salire troppo in Z (macchine tipo PF), oppure non scendere troppo (tipo Kairos)
-- BladeSideDouble (taglio di lama doppio di fianco)
elseif Machining[1].bIsApplicable and ( dMaxMatBladeSideDouble - BeamData.CUT_EXTRA) > Part.dWidth + 10 * GEO.EPS_SMALL then
Machining.sTypeMachining = 'BladeSideDouble'
Machining[2].bIsApplicable = false
Machining[3].bIsApplicable = false
Machining[4].bIsApplicable = false
return Machining
-- BladeHorizontalSingle (taglio di lama singolo orizzontale)
elseif Machining[1].bIsApplicable and ( dMaxMatBladeHorizontalSingle - BeamData.CUT_EXTRA) > Part.dHeight + 10 * GEO.EPS_SMALL then
Machining.sTypeMachining = 'BladeHorizontalSingle'
Machining[2].bIsApplicable = false
Machining[3].bIsApplicable = false
Machining[4].bIsApplicable = false
return Machining
-- BladeHorizontalDouble (taglio di lama doppio orizzontale)
elseif Machining[1].bIsApplicable and Machining[2].bIsApplicable and
( dMaxMatBladeHorizontalSingle + dMaxMatBladeHorizontalDouble - BeamData.CUT_EXTRA) > Part.dHeight + 10 * GEO.EPS_SMALL then
Machining.sTypeMachining = 'BladeHorizontalDouble'
Machining[3].bIsApplicable = false
Machining[4].bIsApplicable = false
return Machining
-- TODO : casi con motosega da completare
-- ChainSawHorizontal (motosega)
-- ChainSawSideSingle (motosega)
-- ChainSawSideDouble (motosega)
-- ChainSawPlusBlade (motosega più lama orizzontale)
-- Mill (svuotatura)
end
-- se non ho trovato neanche una lavorazione completa, non posso separare
if Machining.sTypeMachining == 'None' then
Strategy.Result.sStatus = 'Not-Applicable'
Strategy.Result.nCompletionIndex = 0
Strategy.Result.dMRR = 0
Strategy.Result.nQuality = 0
Strategy.Result.sInfo = 'Split not possible'
end
return Machining
end
-------------------------------------------------------------------------------------------------------------
function SPLITCUT.Make( bAddMachining, Proc, Part, CustomParameters)
Strategy = LoadStrategyParameters( CustomParameters)
local bAreAllMachiningsAdded = true
local Splitting = {}
Strategy.sSplitStrategy = GetSplitStrategy( Proc, Part)
if bAddMachining then
-- inserimento smussi su spigoli del taglio
if Strategy.Parameters.bMakeChamfer then
MakeChamfer()
end
local OptionalParameters = {}
-- applico le lavorazioni
if Strategy.sSplitStrategy.sTypeMachining == 'BladeSideSingle' then
OptionalParameters.nToolIndex = Strategy.sSplitStrategy[1].ToolInfo.nToolIndex
OptionalParameters.nFaceuse = MCH_MILL_FU.ORTHO_BACK
OptionalParameters.sDepth = 0
if Strategy.bSplit then
OptionalParameters.sUserNotes = 'Split;'
else
OptionalParameters.sUserNotes = 'Cut;'
end
local EdgeToMachine = GetEdgeToMachine( Proc, -Y_AX())
-- approccio e retrazione
OptionalParameters.LeadIn, OptionalParameters.LeadOut = CalculateLeadInOut( Splitting, EdgeToMachine)
Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1].id, EdgeToMachine, OptionalParameters)
MachiningLib.AddNewMachining( Proc, Splitting)
elseif Strategy.sSplitStrategy.sTypeMachining == 'BladeSideDouble' then
; -- TODO
elseif Strategy.sSplitStrategy.sTypeMachining == 'BladeHorizontalSingle' then
; -- TODO
elseif Strategy.sSplitStrategy.sTypeMachining == 'BladeHorizontalDouble' then
; -- TODO
elseif Strategy.sSplitStrategy.sTypeMachining == 'ChainSawHorizontal' then
; -- TODO
elseif Strategy.sSplitStrategy.sTypeMachining == 'ChainSawSideSingle' then
; -- TODO
elseif Strategy.sSplitStrategy.sTypeMachining == 'ChainSawSideDouble' then
; -- TODO
elseif Strategy.sSplitStrategy.sTypeMachining == 'ChainSawPlusBlade' then
; -- TODO
elseif Strategy.sSplitStrategy.sTypeMachining == 'Mill' then
; -- TODO
end
return bAreAllMachiningsAdded, Strategy.Result
else
return nil, Strategy.Result
end
end
-------------------------------------------------------------------------------------------------------------
return SPLITCUT
@@ -0,0 +1,12 @@
-- Parametri configurabili da cliente per strategia: SPLITCUT
local SPLITCUTData = {
sStrategyId = 'SPLITCUT',
Parameters = {
{ sName = 'bMakeChamfer', sValue = 'false', sDescriptionShort = 'Execute Chamfer', sDescriptionLong = 'Use the V-Mill to execute chamfers on cut-edges', sType = 'b', sMessageId = '', sMinUserLevel = '1'},
{ sName = 'bForceChainSaw', sValue = 'false', sDescriptionShort = 'Force to use chain saw', sDescriptionLong = 'Force to use chain saw', sType = 'b', sMessageId = '', sMinUserLevel = '1'},
{ sName = 'bFinishWithMill', sValue = 'true', sDescriptionShort = 'Finish with mill', sDescriptionLong = 'Use a mill to finish the surface if splitted with chain saw', sType = 'b', sMessageId = '', sMinUserLevel = '1'}
}
}
return SPLITCUTData
+6 -6
View File
@@ -82,7 +82,7 @@ end
-------------------------------------------------------------------------------------------------------------
local function GetBestPocketingStrategy( Proc)
-- imposto paraemtri di ricerca utensile in base a topologia
-- imposto parametri di ricerca utensile in base a topologia
local Machining = {}
local Milling = {}
local ToolSearchParameters = {}
@@ -509,7 +509,7 @@ function STR0002.Make( bAddMachining, Proc, Part, CustomParameters)
return false, Strategy.Result
end
local bAreAllApplyOk = true
local bAreAllMachiningsAdded = true
local ToolInfo = {}
local Pocketing = {}
@@ -541,7 +541,7 @@ function STR0002.Make( bAddMachining, Proc, Part, CustomParameters)
-- se ho una sola trimesh, sto lavorando la Proc direttamente e non ho spezzato. Applico direttamente alla geometria calcolata prima
if #vAddId == 1 then
Pocketing.Geometry = {{ Strategy.Machining[j].idProc, Strategy.Machining[j].idFaceToMachine}}
bAreAllApplyOk = MachiningLib.AddNewMachining( Proc, Pocketing)
bAreAllMachiningsAdded = MachiningLib.AddNewMachining( Proc, Pocketing)
else
-- TODO settare parametro per indicare qual è lo spezzone che deve essere fatto dopo il taglio di separazione
for k = 1, Proc.nFct do
@@ -550,7 +550,7 @@ function STR0002.Make( bAddMachining, Proc, Part, CustomParameters)
_, vtNSplitFace = EgtSurfTmFacetCenter( dIdTm, k - 1, GDB_ID.ROOT)
if vtNSplitFace and AreSameVectorApprox( vtNSplitFace * EgtIf( Pocketing.bToolInvert, -1, 1), Strategy.Machining[j].vtFaceNormal) then
Pocketing.Geometry = {{ dIdTm, k - 1}}
bAreAllApplyOk = bAreAllApplyOk and MachiningLib.AddNewMachining( Proc, Pocketing)
bAreAllMachiningsAdded = bAreAllMachiningsAdded and MachiningLib.AddNewMachining( Proc, Pocketing)
break
end
end
@@ -559,10 +559,10 @@ function STR0002.Make( bAddMachining, Proc, Part, CustomParameters)
end
end
else
bAreAllApplyOk = false
bAreAllMachiningsAdded = false
end
return bAreAllApplyOk, Strategy.Result
return bAreAllMachiningsAdded, Strategy.Result
end
-------------------------------------------------------------------------------------------------------------
+4
View File
@@ -137,6 +137,10 @@ STR0003 = Topologia tipo LapJoint. Lama + motosega
251,0,Feature,
; Feature : Aperture
252,0,Feature,
; Feature : HEADCUT
340,0,Feature,HEADCUT
; Feature : SPLITCUT
350,0,Feature,SPLITCUT
; Feature : Variant
900,0,Feature,
; Feature Decor