- in BeamExec -> RunStrategyLibraries corretti percorsi require
- in FaceData piccole correzioni - in MachiningLib pesanti modifiche per contemplare cloni lavorazioni con parametri diversi (es: per step aggiuntivi o spezzatura). Parametri lavorazione ora sono tutti scritti in tabella e ciclati invece di essere scritti uno a uno. - in SLOTBYCHAINSAW alcune correzioni - in STR0003 gestita aggiunta lavorazioni a MACHININGS e output risultati strategia
This commit is contained in:
@@ -643,15 +643,18 @@ local function GetFeatureInfoAndDependency( vProcSingleRot, Part)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- TODO contemplare anche strategie speciali
|
||||
local function RunStrategyLibraries( sStrategyId)
|
||||
local StrategyConfigName = sStrategyId .. '\\' .. sStrategyId .. 'Config'
|
||||
local StrategyConfigPath = BEAM.BASEDIR .. '\\Strategies\\' .. StrategyConfigName .. '.lua'
|
||||
local StrategyScriptName = sStrategyId .. '\\' .. sStrategyId
|
||||
local StrategyScriptPath = BEAM.BASEDIR .. '\\Strategies\\' .. StrategyScriptName .. '.lua'
|
||||
local StrategyConfigPathStandard = BEAM.BASEDIR .. '\\Strategies\\Standard\\' .. StrategyConfigName .. '.lua'
|
||||
local StrategyScriptPathStandard = BEAM.BASEDIR .. '\\Strategies\\Standard\\' .. StrategyScriptName .. '.lua'
|
||||
local StrategyConfigPathSpecial = BEAM.BASEDIR .. '\\Strategies\\Special\\' .. StrategyConfigName .. '.lua'
|
||||
local StrategyScriptPathSpecial = BEAM.BASEDIR .. '\\Strategies\\Special\\' .. StrategyScriptName .. '.lua'
|
||||
local StrategyLib = {}
|
||||
if EgtExistsFile( StrategyConfigPath) and EgtExistsFile( StrategyScriptPath) then
|
||||
if ( EgtExistsFile( StrategyConfigPathStandard) and EgtExistsFile( StrategyScriptPathStandard)) or
|
||||
( EgtExistsFile( StrategyConfigPathSpecial) and EgtExistsFile( StrategyScriptPathSpecial)) then
|
||||
StrategyLib.Config = require( StrategyConfigName)
|
||||
-- eseguo file script strategia
|
||||
StrategyLib.Script = require( StrategyScriptName)
|
||||
return StrategyLib
|
||||
else
|
||||
|
||||
+20
-18
@@ -186,7 +186,7 @@ local function GetTunnelFaces( Proc, Part)
|
||||
EgtCutSurfTmPlane( TunnelAddedFaces.MiddleFaceTm.id, Proc.Faces[i].ptCenter, -Proc.Faces[i].vtN, false, GDB_ID.ROOT)
|
||||
end
|
||||
-- TODO c'è un modo più elegante per raccogliere le informazioni delle facce aggiunte
|
||||
TunnelAddedFaces.MiddleFaceTm.Type = 'Tunnel'
|
||||
TunnelAddedFaces.MiddleFaceTm.sType = 'Tunnel'
|
||||
TunnelAddedFaces.MiddleFaceTm.nFct = 1
|
||||
TunnelAddedFaces.MiddleFaceTm.Faces = FaceData.GetFacesInfo( TunnelAddedFaces.MiddleFaceTm, Part)
|
||||
|
||||
@@ -225,7 +225,7 @@ local function GetBottomFaces( Proc)
|
||||
return nil
|
||||
end
|
||||
|
||||
BottomFaces[1].Type = 'Bottom'
|
||||
BottomFaces[1].sType = 'Bottom'
|
||||
BottomFaces[1].MainEdges = {}
|
||||
BottomFaces[1].MainEdges.LongEdges = {}
|
||||
BottomFaces[1].MainEdges.SideEdges = {}
|
||||
@@ -262,16 +262,16 @@ local function GetBottomFaces( Proc)
|
||||
|
||||
if i == nFirstLongEdgeIndex then
|
||||
BottomFaces[1].MainEdges.LongEdges[1] = CurrentEdge
|
||||
BottomFaces[1].MainEdges.LongEdges[1].Type = 'Long'
|
||||
BottomFaces[1].MainEdges.LongEdges[1].sType = 'Long'
|
||||
elseif nNextEdgeIndex == nFirstLongEdgeIndex then
|
||||
BottomFaces[1].MainEdges.SideEdges[1] = CurrentEdge
|
||||
BottomFaces[1].MainEdges.SideEdges[1].Type = 'Side'
|
||||
BottomFaces[1].MainEdges.SideEdges[1].sType = 'Side'
|
||||
elseif nPreviousEdgeIndex == nFirstLongEdgeIndex then
|
||||
BottomFaces[1].MainEdges.SideEdges[2] = CurrentEdge
|
||||
BottomFaces[1].MainEdges.SideEdges[2].Type = 'Side'
|
||||
BottomFaces[1].MainEdges.SideEdges[2].sType = 'Side'
|
||||
else
|
||||
BottomFaces[1].MainEdges.LongEdges[2] = CurrentEdge
|
||||
BottomFaces[1].MainEdges.LongEdges[2].Type = 'Long'
|
||||
BottomFaces[1].MainEdges.LongEdges[2].sType = 'Long'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -321,7 +321,7 @@ local function GetLongFaces( Proc, MainFaces)
|
||||
end
|
||||
|
||||
for i = 1, #LongFaces do
|
||||
LongFaces[i].Type = 'Long'
|
||||
LongFaces[i].sType = 'Long'
|
||||
LongFaces[i].MainEdges = {}
|
||||
LongFaces[i].MainEdges.SideEdges = {}
|
||||
LongFaces[i].MainEdges.OppositeEdges = {}
|
||||
@@ -348,22 +348,24 @@ local function GetLongFaces( Proc, MainFaces)
|
||||
if Proc.Topology.sFamily == 'Tunnel' then
|
||||
if CurrentEdge.idAdjacentFace > -1 then
|
||||
table.insert( LongFaces[i].MainEdges.SideEdges, CurrentEdge)
|
||||
LongFaces[i].MainEdges.SideEdges[#LongFaces[i].MainEdges.SideEdges].sType = 'Side'
|
||||
else
|
||||
table.insert( LongFaces[i].MainEdges.OppositeEdges, CurrentEdge)
|
||||
LongFaces[i].MainEdges.OppositeEdges[#LongFaces[i].MainEdges.OppositeEdges].sType = 'Opposite'
|
||||
end
|
||||
else
|
||||
if CurrentEdge.idAdjacentFace == BottomFace.id then
|
||||
LongFaces[i].MainEdges.BottomEdge = CurrentEdge
|
||||
LongFaces[i].MainEdges.BottomEdge.Type = 'Bottom'
|
||||
LongFaces[i].MainEdges.BottomEdge.sType = 'Bottom'
|
||||
elseif LongFaces[i].Edges[nNextEdgeIndex].Adj == BottomFace.id then
|
||||
LongFaces[i].MainEdges.SideEdges[1] = CurrentEdge
|
||||
LongFaces[i].MainEdges.SideEdges[1].Type = 'Side'
|
||||
LongFaces[i].MainEdges.SideEdges[1].sType = 'Side'
|
||||
elseif LongFaces[i].Edges[nPreviousEdgeIndex].Adj == BottomFace.id then
|
||||
LongFaces[i].MainEdges.SideEdges[2] = CurrentEdge
|
||||
LongFaces[i].MainEdges.SideEdges[2].Type = 'Side'
|
||||
LongFaces[i].MainEdges.SideEdges[2].sType = 'Side'
|
||||
else
|
||||
table.insert( LongFaces[i].MainEdges.OppositeEdges, CurrentEdge)
|
||||
LongFaces[i].MainEdges.OppositeEdges[#LongFaces[i].MainEdges.OppositeEdges].Type = 'Opposite'
|
||||
LongFaces[i].MainEdges.OppositeEdges[#LongFaces[i].MainEdges.OppositeEdges].sType = 'Opposite'
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -397,15 +399,15 @@ local function GetSideFaces( Proc, MainFaces)
|
||||
end
|
||||
if idFirstSideFace > -1 and Proc.Faces[idFirstSideFace + 1].bIsOkForMachining then
|
||||
table.insert( SideFaces, Proc.Faces[idFirstSideFace + 1])
|
||||
SideFaces[#SideFaces].Type = 'Side'
|
||||
SideFaces[#SideFaces].sType = 'Side'
|
||||
end
|
||||
if idSecondSideFace > -1 and Proc.Faces[idSecondSideFace + 1].bIsOkForMachining then
|
||||
table.insert( SideFaces, Proc.Faces[idSecondSideFace + 1])
|
||||
SideFaces[#SideFaces].Type = 'Side'
|
||||
SideFaces[#SideFaces].sType = 'Side'
|
||||
end
|
||||
|
||||
for i = 1, #SideFaces do
|
||||
SideFaces[i].Type = 'Side'
|
||||
SideFaces[i].sType = 'Side'
|
||||
SideFaces[i].MainEdges = {}
|
||||
SideFaces[i].MainEdges.LongEdges = {}
|
||||
SideFaces[i].MainEdges.OppositeEdges = {}
|
||||
@@ -438,16 +440,16 @@ local function GetSideFaces( Proc, MainFaces)
|
||||
else
|
||||
if CurrentEdge.idAdjacentFace == BottomFace.id then
|
||||
SideFaces[i].MainEdges.BottomEdge = CurrentEdge
|
||||
SideFaces[i].MainEdges.BottomEdge.Type = 'Bottom'
|
||||
SideFaces[i].MainEdges.BottomEdge.sType = 'Bottom'
|
||||
elseif SideFaces[i].Edges[nNextEdgeIndex].Adj == BottomFace.id then
|
||||
SideFaces[i].MainEdges.LongEdges[1] = CurrentEdge
|
||||
SideFaces[i].MainEdges.LongEdges[1].Type = 'Long'
|
||||
SideFaces[i].MainEdges.LongEdges[1].sType = 'Long'
|
||||
elseif SideFaces[i].Edges[nPreviousEdgeIndex].Adj == BottomFace.id then
|
||||
SideFaces[i].MainEdges.LongEdges[2] = CurrentEdge
|
||||
SideFaces[i].MainEdges.LongEdges[2].Type = 'Long'
|
||||
SideFaces[i].MainEdges.LongEdges[2].sType = 'Long'
|
||||
else
|
||||
table.insert( SideFaces[i].MainEdges.OppositeEdges, CurrentEdge)
|
||||
SideFaces[i].MainEdges.OppositeEdges[#SideFaces[i].MainEdges.OppositeEdges].Type = 'Opposite'
|
||||
SideFaces[i].MainEdges.OppositeEdges[#SideFaces[i].MainEdges.OppositeEdges].sType = 'Opposite'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
+167
-149
@@ -64,10 +64,10 @@ local function GetToolEntryAngle( Proc, vtTool)
|
||||
function MachiningLib.GetMachiningSteps( dMachiningDepth, dStep)
|
||||
|
||||
local MachiningSteps = {}
|
||||
MachiningSteps.dStepLength = 0
|
||||
MachiningSteps.dStep = 0
|
||||
MachiningSteps.nCount = ceil( ( dMachiningDepth - 10 * GEO.EPS_SMALL) / dStep)
|
||||
if MachiningSteps.nCount > 1 then
|
||||
MachiningSteps.dStepLength = ( dMachiningDepth - dStep) / ( MachiningSteps.nCount - 1)
|
||||
MachiningSteps.dStep = ( dMachiningDepth - dStep) / ( MachiningSteps.nCount - 1)
|
||||
end
|
||||
|
||||
return MachiningSteps
|
||||
@@ -249,6 +249,8 @@ function MachiningLib.FindChainSaw( Proc, ToolSearchParameters)
|
||||
bIsToolCompatible = TOOLS[i].SetupInfo.bIsTopHead
|
||||
elseif ToolSearchParameters.bAllowBottomHead and not ToolSearchParameters.bAllowTopHead then
|
||||
bIsToolCompatible = TOOLS[i].SetupInfo.bIsBottomHead
|
||||
else
|
||||
bIsToolCompatible = true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -292,7 +294,7 @@ end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- salva in lista globale la lavorazione appena calcolata
|
||||
function MachiningLib.AddNewMachining( ProcToAdd, MachiningToAdd)
|
||||
function MachiningLib.AddNewMachining( ProcToAdd, MachiningToAdd, AuxiliaryDataToAdd)
|
||||
-- Controllo parametri obbligatori
|
||||
if not MachiningToAdd.nType or not MachiningToAdd.nToolIndex or not MachiningToAdd.Geometry or not ProcToAdd.id then
|
||||
return false
|
||||
@@ -326,6 +328,7 @@ function MachiningLib.AddNewMachining( ProcToAdd, MachiningToAdd)
|
||||
local Machining = {}
|
||||
Machining.Proc = ProcToAdd
|
||||
Machining.Machining = MachiningToAdd
|
||||
Machining.AuxiliaryData = AuxiliaryDataToAdd or {}
|
||||
table.insert( MACHININGS, Machining)
|
||||
return true
|
||||
end
|
||||
@@ -337,156 +340,171 @@ function MachiningLib.AddOperations( vProc, Part)
|
||||
local sErr = ''
|
||||
local bAreAllMachiningApplyOk = true
|
||||
|
||||
-- parametri generali lavorazione
|
||||
local MachiningParameters = {
|
||||
{ sName = 'sDepth', nMchParam = MCH_MP.DEPTH_STR},
|
||||
{ sName = 'bInvert', nMchParam = MCH_MP.INVERT},
|
||||
{ sName = 'nWorkside', nMchParam = MCH_MP.WORKSIDE},
|
||||
{ sName = 'nFaceuse', nMchParam = MCH_MP.FACEUSE},
|
||||
{ sName = 'nSCC', nMchParam = MCH_MP.SCC},
|
||||
{ sName = 'bToolInvert', nMchParam = MCH_MP.TOOLINVERT},
|
||||
{ sName = 'sBlockedAxis', nMchParam = MCH_MP.BLOCKEDAXIS},
|
||||
{ sName = 'sInitialAngles', nMchParam = MCH_MP.INITANGS},
|
||||
{ sName = 'nHeadSide', nMchParam = MCH_MP.HEADSIDE},
|
||||
{ sName = 'nSubType', nMchParam = MCH_MP.SUBTYPE},
|
||||
{ sName = 'dOverlap', nMchParam = MCH_MP.OVERL},
|
||||
{ sName = 'nStepType', nMchParam = MCH_MP.STEPTYPE},
|
||||
{ sName = 'dStartPos', nMchParam = MCH_MP.STARTPOS},
|
||||
{ sName = 'dReturnPos', nMchParam = MCH_MP.RETURNPOS},
|
||||
{ sName = 'dRadialOffset', nMchParam = MCH_MP.OFFSR},
|
||||
{ sName = 'dLongitudinalOffset', nMchParam = MCH_MP.OFFSL},
|
||||
{ sName = 'dStartSlowLen', nMchParam = MCH_MP.STARTSLOWLEN},
|
||||
{ sName = 'dEndSlowLen', nMchParam = MCH_MP.ENDSLOWLEN},
|
||||
{ sName = 'dThrouAddLen', nMchParam = MCH_MP.THROUADDLEN},
|
||||
{ sName = 'sSystemNotes', nMchParam = MCH_MP.SYSNOTES},
|
||||
{ sName = 'sUserNotes', nMchParam = MCH_MP.USERNOTES}
|
||||
}
|
||||
|
||||
-- parametri relativi allo step
|
||||
MachiningParameters.Steps = {
|
||||
{ sName = 'nStepType', nMchParam = MCH_MP.STEPTYPE},
|
||||
{ sName = 'dStep', nMchParam = MCH_MP.STEP},
|
||||
{ sName = 'dSideStep', nMchParam = MCH_MP.SIDESTEP}
|
||||
}
|
||||
|
||||
-- parametri relativi all'approccio
|
||||
MachiningParameters.LeadIn = {
|
||||
{ sName = 'nType', nMchParam = MCH_MP.LEADINTYPE},
|
||||
{ sName = 'dStartAddLength', nMchParam = MCH_MP.STARTADDLEN},
|
||||
{ sName = 'dTangentDistance', nMchParam = MCH_MP.LITANG},
|
||||
{ sName = 'dPerpDistance', nMchParam = MCH_MP.LIPERP},
|
||||
{ sName = 'dElevation', nMchParam = MCH_MP.LIELEV},
|
||||
{ sName = 'dCompLength', nMchParam = MCH_MP.LICOMPLEN}
|
||||
}
|
||||
|
||||
-- parametri relativi alla retrazione
|
||||
MachiningParameters.LeadOut = {
|
||||
{ sName = 'nType', nMchParam = MCH_MP.LEADOUTTYPE},
|
||||
{ sName = 'dEndAddLength', nMchParam = MCH_MP.ENDADDLEN},
|
||||
{ sName = 'dTangentDistance', nMchParam = MCH_MP.LOTANG},
|
||||
{ sName = 'dPerpDistance', nMchParam = MCH_MP.LOPERP},
|
||||
{ sName = 'dElevation', nMchParam = MCH_MP.LOELEV},
|
||||
{ sName = 'dCompLength', nMchParam = MCH_MP.LOCOMPLEN}
|
||||
}
|
||||
|
||||
-- parametri da scrivere nelle note utente
|
||||
local UserNotes = {
|
||||
{ sName = 'dMaxElev', sMchParam = 'MaxElev'}
|
||||
}
|
||||
|
||||
-- parametri da scrivere nelle note di sistema
|
||||
local SystemNotes = {
|
||||
}
|
||||
|
||||
for i = 1, #MACHININGS do
|
||||
-- creazione lavorazione
|
||||
local nOperationId = EgtCreateMachining( MACHININGS[i].Machining.sOperationName, MACHININGS[i].Machining.nType, MACHININGS[i].Machining.sToolName)
|
||||
|
||||
if nOperationId then
|
||||
-- impostazione geometria
|
||||
EgtSetMachiningGeometry( MACHININGS[i].Machining.Geometry)
|
||||
|
||||
-- impostazione parametri lavorazione
|
||||
if MACHININGS[i].Machining.sDepth then
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH_STR, MACHININGS[i].Machining.sDepth)
|
||||
end
|
||||
if MACHININGS[i].Machining.bInvert then
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, MACHININGS[i].Machining.bInvert)
|
||||
end
|
||||
if MACHININGS[i].Machining.nWorkside then
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MACHININGS[i].Machining.nWorkside)
|
||||
end
|
||||
if MACHININGS[i].Machining.nFaceuse then
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, MACHININGS[i].Machining.nFaceuse)
|
||||
end
|
||||
if MACHININGS[i].Machining.nSCC then
|
||||
EgtSetMachiningParam( MCH_MP.SCC, MACHININGS[i].Machining.nSCC)
|
||||
end
|
||||
if MACHININGS[i].Machining.bToolInvert then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, MACHININGS[i].Machining.bToolInvert)
|
||||
end
|
||||
if MACHININGS[i].Machining.sBlockedAxis then
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, MACHININGS[i].Machining.sBlockedAxis)
|
||||
end
|
||||
if MACHININGS[i].Machining.sInitialAngles then
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, MACHININGS[i].Machining.sInitialAngles)
|
||||
end
|
||||
if MACHININGS[i].Machining.nHeadSide then
|
||||
EgtSetMachiningParam( MCH_MP.HEADSIDE, MACHININGS[i].Machining.nHeadSide)
|
||||
end
|
||||
if MACHININGS[i].Machining.nSubType then
|
||||
EgtSetMachiningParam( MCH_MP.SUBTYPE, MACHININGS[i].Machining.nSubType)
|
||||
end
|
||||
if MACHININGS[i].Machining.dOverlap then
|
||||
EgtSetMachiningParam( MCH_MP.OVERL, MACHININGS[i].Machining.dOverlap)
|
||||
end
|
||||
|
||||
-- step
|
||||
if MACHININGS[i].Machining.Steps then
|
||||
if MACHININGS[i].Machining.Steps.dStepType then
|
||||
EgtSetMachiningParam( MCH_MP.STEPTYPE, MACHININGS[i].Machining.Steps.dStepType)
|
||||
end
|
||||
if MACHININGS[i].Machining.Steps.dStep then
|
||||
EgtSetMachiningParam( MCH_MP.STEP, MACHININGS[i].Machining.Steps.dStep)
|
||||
end
|
||||
if MACHININGS[i].Machining.Steps.dSideStep then
|
||||
EgtSetMachiningParam( MCH_MP.SIDESTEP, MACHININGS[i].Machining.Steps.dSideStep)
|
||||
end
|
||||
end
|
||||
|
||||
if MACHININGS[i].Machining.dStartPos then
|
||||
EgtSetMachiningParam( MCH_MP.STARTPOS, MACHININGS[i].Machining.dStartPos)
|
||||
end
|
||||
if MACHININGS[i].Machining.dReturnPos then
|
||||
EgtSetMachiningParam( MCH_MP.RETURNPOS, MACHININGS[i].Machining.dReturnPos)
|
||||
end
|
||||
|
||||
if MACHININGS[i].Machining.dRadialOffset then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, MACHININGS[i].Machining.dRadialOffset)
|
||||
end
|
||||
if MACHININGS[i].Machining.dLongitudinalOffset then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSL, MACHININGS[i].Machining.dLongitudinalOffset)
|
||||
end
|
||||
|
||||
-- paraemtri attacco
|
||||
if MACHININGS[i].Machining.LeadIn then
|
||||
if MACHININGS[i].Machining.LeadIn.nType then
|
||||
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MACHININGS[i].Machining.LeadIn.nType)
|
||||
end
|
||||
if MACHININGS[i].Machining.LeadIn.dStartAddLength then
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, MACHININGS[i].Machining.LeadIn.dStartAddLength)
|
||||
end
|
||||
if MACHININGS[i].Machining.LeadIn.dTangentDistance then
|
||||
EgtSetMachiningParam( MCH_MP.LITANG, MACHININGS[i].Machining.LeadIn.dTangentDistance)
|
||||
end
|
||||
if MACHININGS[i].Machining.LeadIn.dPerpDistance then
|
||||
EgtSetMachiningParam( MCH_MP.LIPERP, MACHININGS[i].Machining.LeadIn.dPerpDistance)
|
||||
end
|
||||
if MACHININGS[i].Machining.LeadIn.dElevation then
|
||||
EgtSetMachiningParam( MCH_MP.LIELEV, MACHININGS[i].Machining.LeadIn.dElevation)
|
||||
end
|
||||
if MACHININGS[i].Machining.LeadIn.dCompLength then
|
||||
EgtSetMachiningParam( MCH_MP.LICOMPLEN, MACHININGS[i].Machining.LeadIn.dCompLength)
|
||||
end
|
||||
end
|
||||
-- parametri uscita
|
||||
if MACHININGS[i].Machining.LeadOut then
|
||||
if MACHININGS[i].Machining.LeadOut.nType then
|
||||
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MACHININGS[i].Machining.LeadOut.nType)
|
||||
end
|
||||
if MACHININGS[i].Machining.LeadOut.dEndAddLength then
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, MACHININGS[i].Machining.LeadOut.dEndAddLength)
|
||||
end
|
||||
if MACHININGS[i].Machining.LeadOut.dTangentDistance then
|
||||
EgtSetMachiningParam( MCH_MP.LOTANG, MACHININGS[i].Machining.LeadOut.dTangentDistance)
|
||||
end
|
||||
if MACHININGS[i].Machining.LeadOut.dPerpDistance then
|
||||
EgtSetMachiningParam( MCH_MP.LOPERP, MACHININGS[i].Machining.LeadOut.dPerpDistance)
|
||||
end
|
||||
if MACHININGS[i].Machining.LeadOut.dElevation then
|
||||
EgtSetMachiningParam( MCH_MP.LOELEV, MACHININGS[i].Machining.LeadOut.dElevation)
|
||||
end
|
||||
if MACHININGS[i].Machining.LeadOut.dCompLength then
|
||||
EgtSetMachiningParam( MCH_MP.LOCOMPLEN, MACHININGS[i].Machining.LeadOut.dCompLength)
|
||||
end
|
||||
end
|
||||
|
||||
if MACHININGS[i].Machining.dStartSlowLen then
|
||||
EgtSetMachiningParam( MCH_MP.STARTSLOWLEN, MACHININGS[i].Machining.dStartSlowLen)
|
||||
end
|
||||
if MACHININGS[i].Machining.dEndSlowLen then
|
||||
EgtSetMachiningParam( MCH_MP.ENDSLOWLEN, MACHININGS[i].Machining.dEndSlowLen)
|
||||
end
|
||||
if MACHININGS[i].Machining.dThrouAddLen then
|
||||
EgtSetMachiningParam( MCH_MP.THROUADDLEN, MACHININGS[i].Machining.dThrouAddLen)
|
||||
end
|
||||
|
||||
-- parametri da settare nelle note di sistema
|
||||
-- TODO da decidere quali sono le note da salvare qui. Probabilmente tutte quelle relative all'ordine delle lavorazioni
|
||||
local sSystemNotes = EgtGetMachiningParam( MCH_MP.SYSNOTES)
|
||||
--if MACHININGS[i].Machining.nMachiningOrder then
|
||||
-- sSystemNotes = EgtSetValInNotes( sSystemNotes, 'MachiningOrder', MACHININGS[i].Machining.nMachiningOrder)
|
||||
--end
|
||||
EgtSetMachiningParam( MCH_MP.SYSNOTES, sSystemNotes)
|
||||
|
||||
-- parametri da settare nelle note utente
|
||||
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
|
||||
if MACHININGS[i].Machining.dMaxElev then
|
||||
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', MACHININGS[i].Machining.dMaxElev)
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
||||
|
||||
local bIsApplyOk = MachiningLib.ApplyMachining( true, false)
|
||||
if not bIsApplyOk then
|
||||
bAreAllMachiningApplyOk = false
|
||||
nErr, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nOperationId, false)
|
||||
end
|
||||
else
|
||||
return false, 'UNEXPECTED ERROR: Error on creating machining'
|
||||
local nClonesToAdd = 1
|
||||
if MACHININGS[i].AuxiliaryData.Clones then
|
||||
nClonesToAdd = #MACHININGS[i].AuxiliaryData.Clones
|
||||
end
|
||||
for j = 1, nClonesToAdd do
|
||||
-- creazione lavorazione
|
||||
local nOperationId = EgtCreateMachining( MACHININGS[i].Machining.sOperationName, MACHININGS[i].Machining.nType, MACHININGS[i].Machining.sToolName)
|
||||
|
||||
if nOperationId then
|
||||
-- impostazione geometria
|
||||
EgtSetMachiningGeometry( MACHININGS[i].Machining.Geometry)
|
||||
|
||||
-- impostazione parametri lavorazione
|
||||
-- TODO scrivere sempre Steps, LeadIn, LeadOut nelle tabelle in modo da non dover controllare ogni volta che ci siano
|
||||
for k = 1, #MachiningParameters do
|
||||
local sValue
|
||||
if MACHININGS[i].AuxiliaryData.Clones and MACHININGS[i].AuxiliaryData.Clones[j][MachiningParameters[k].sName] then
|
||||
sValue = MACHININGS[i].AuxiliaryData.Clones[j][MachiningParameters[k].sName]
|
||||
elseif MACHININGS[i].Machining[MachiningParameters[k].sName] then
|
||||
sValue = MACHININGS[i].Machining[MachiningParameters[k].sName]
|
||||
end
|
||||
if sValue then
|
||||
EgtSetMachiningParam( MachiningParameters[k].nMchParam, sValue)
|
||||
end
|
||||
end
|
||||
for k = 1, #MachiningParameters.Steps do
|
||||
local sValue
|
||||
if MACHININGS[i].AuxiliaryData.Clones and MACHININGS[i].AuxiliaryData.Clones[j].Steps and MACHININGS[i].AuxiliaryData.Clones[j].Steps[MachiningParameters.Steps[k].sName] then
|
||||
sValue = MACHININGS[i].AuxiliaryData.Clones[j].Steps[MachiningParameters.Steps[k].sName]
|
||||
elseif MACHININGS[i].Machining.Steps and MACHININGS[i].Machining.Steps[MachiningParameters.Steps[k].sName] then
|
||||
sValue = MACHININGS[i].Machining.Steps[MachiningParameters.Steps[k].sName]
|
||||
end
|
||||
if sValue then
|
||||
EgtSetMachiningParam( MachiningParameters.Steps[k].nMchParam, sValue)
|
||||
end
|
||||
end
|
||||
for k = 1, #MachiningParameters.LeadIn do
|
||||
local sValue
|
||||
if MACHININGS[i].AuxiliaryData.Clones and MACHININGS[i].AuxiliaryData.Clones[j].LeadIn and MACHININGS[i].AuxiliaryData.Clones[j].LeadIn[MachiningParameters.LeadIn[k].sName] then
|
||||
sValue = MACHININGS[i].AuxiliaryData.Clones[j].LeadIn[MachiningParameters.LeadIn[k].sName]
|
||||
elseif MACHININGS[i].Machining.LeadIn and MACHININGS[i].Machining.LeadIn[MachiningParameters.LeadIn[k].sName] then
|
||||
sValue = MACHININGS[i].Machining.LeadIn[MachiningParameters.LeadIn[k].sName]
|
||||
end
|
||||
if sValue then
|
||||
EgtSetMachiningParam( MachiningParameters.LeadIn[k].nMchParam, sValue)
|
||||
end
|
||||
end
|
||||
for k = 1, #MachiningParameters.LeadOut do
|
||||
local sValue
|
||||
if MACHININGS[i].AuxiliaryData.Clones and MACHININGS[i].AuxiliaryData.Clones[j].LeadOut and MACHININGS[i].AuxiliaryData.Clones[j].LeadOut[MachiningParameters.LeadOut[k].sName] then
|
||||
sValue = MACHININGS[i].AuxiliaryData.Clones[j].LeadOut[MachiningParameters.LeadOut[k].sName]
|
||||
elseif MACHININGS[i].Machining.LeadOut and MACHININGS[i].Machining.LeadOut[MachiningParameters.LeadOut[k].sName] then
|
||||
sValue = MACHININGS[i].Machining.LeadOut[MachiningParameters.LeadOut[k].sName]
|
||||
end
|
||||
if sValue then
|
||||
EgtSetMachiningParam( MachiningParameters.LeadOut[k].nMchParam, sValue)
|
||||
end
|
||||
end
|
||||
for k = 1, #UserNotes do
|
||||
local sValue
|
||||
if MACHININGS[i].AuxiliaryData.Clones and MACHININGS[i].AuxiliaryData.Clones[j][UserNotes[k].sName] then
|
||||
sValue = MACHININGS[i].AuxiliaryData.Clones[j][UserNotes[k].sName]
|
||||
elseif MACHININGS[i].Machining[UserNotes[k].sName] then
|
||||
sValue = MACHININGS[i].Machining[UserNotes[k].sName]
|
||||
end
|
||||
if sValue then
|
||||
local sUserNotes = ''
|
||||
sUserNotes = EgtSetValInNotes( sUserNotes, UserNotes[k].sMchParam, sValue)
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
||||
end
|
||||
end
|
||||
-- parametri da settare nelle note di sistema
|
||||
-- TODO da decidere quali sono le note da salvare qui. Probabilmente tutte quelle relative all'ordine delle lavorazioni
|
||||
--if MACHININGS[i].Machining.nMachiningOrder then
|
||||
-- sSystemNotes = EgtSetValInNotes( sSystemNotes, 'MachiningOrder', MACHININGS[i].Machining.nMachiningOrder)
|
||||
--end
|
||||
for k = 1, #SystemNotes do
|
||||
local sValue
|
||||
if MACHININGS[i].AuxiliaryData.Clones and MACHININGS[i].AuxiliaryData.Clones[j][SystemNotes[k].sName] then
|
||||
sValue = MACHININGS[i].AuxiliaryData.Clones[j][SystemNotes[k].sName]
|
||||
elseif MACHININGS[i].Machining[SystemNotes[k].sName] then
|
||||
sValue = MACHININGS[i].Machining[SystemNotes[k].sName]
|
||||
end
|
||||
if sValue then
|
||||
local sSystemNotes = ''
|
||||
sSystemNotes = EgtSetValInNotes( sSystemNotes, SystemNotes[k].sMchParam, sValue)
|
||||
EgtSetMachiningParam( MCH_MP.SYSNOTES, sSystemNotes)
|
||||
end
|
||||
end
|
||||
|
||||
local bIsApplyOk = MachiningLib.ApplyMachining( true, false)
|
||||
if not bIsApplyOk then
|
||||
bAreAllMachiningApplyOk = false
|
||||
nErr, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nOperationId, false)
|
||||
end
|
||||
else
|
||||
return false, 'UNEXPECTED ERROR: Error on creating machining'
|
||||
end
|
||||
end
|
||||
end
|
||||
return bAreAllMachiningApplyOk, sErr
|
||||
|
||||
return bAreAllMachiningApplyOk, sErr
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
+8
-7
@@ -7,13 +7,13 @@
|
||||
-- Intestazioni
|
||||
require( 'EgtBase')
|
||||
_ENV = EgtProtectGlobal()
|
||||
EgtEnableDebug( true)
|
||||
EgtEnableDebug( false)
|
||||
|
||||
-- Imposto direttorio libreria specializzata per Travi
|
||||
EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua')
|
||||
-- Imposto direttorio strategie. N.B. Le strategie dovranno essere caricate con il nome del direttorio padre
|
||||
EgtAddToPackagePath( BEAM.BASEDIR .. '\\Strategies\\?.lua')
|
||||
EgtAddToPackagePath( BEAM.BASEDIR .. '\\CoreStrategies\\?.lua')
|
||||
EgtAddToPackagePath( BEAM.BASEDIR .. '\\Strategies\\Standard\\?.lua')
|
||||
EgtAddToPackagePath( BEAM.BASEDIR .. '\\Strategies\\Core\\?.lua')
|
||||
|
||||
-- Verifico che la macchina corrente sia abilitata per la lavorazione delle Travi
|
||||
local sMachDir = EgtGetCurrMachineDir()
|
||||
@@ -47,7 +47,7 @@ _G.package.loaded.MachiningLib = nil
|
||||
-- Per ottimizzare potremmo anche ciclare solo fino al numero di strategie raggiunto per il momento.
|
||||
-- Infatti difficile ci siano 9999 strategie.
|
||||
-- reset strategie caricate come librerie
|
||||
for i = 1, 999 do
|
||||
for i = 1, 9999 do
|
||||
local IdSTRTemp = EgtReplaceString( tostring( i/10000, 4), '0.', '')
|
||||
local sLibraryToReload = "STR" .. IdSTRTemp .. "\\STR" .. IdSTRTemp
|
||||
local sLibraryConfigToReload = sLibraryToReload .. "Config"
|
||||
@@ -58,10 +58,11 @@ for i = 1, 999 do
|
||||
_G.package.loaded[sLibraryConfigToReload] = nil
|
||||
end
|
||||
end
|
||||
local vtCoreStrategiesNames = EgtFindAllFiles( BEAM.BASEDIR .. '\\CoreStrategies\\*.lua')
|
||||
local vtCoreStrategiesNames = EgtFindAllFiles( BEAM.BASEDIR .. '\\Strategies\\Core\\*.lua')
|
||||
for i = 1, #vtCoreStrategiesNames do
|
||||
if _G.package.loaded[vtCoreStrategiesNames[i]] then
|
||||
_G.package.loaded[vtCoreStrategiesNames[i]] = nil
|
||||
local sCurrentName = EgtSplitString( vtCoreStrategiesNames[i], '.')[1]
|
||||
if _G.package.loaded[sCurrentName] then
|
||||
_G.package.loaded[sCurrentName] = nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ local function CalculateLeadInOut( Machining, EdgeToMachine, sSideToMachine, dLe
|
||||
LeadOut.dEndAddLength = 0
|
||||
if Machining.bIsStartClosed then
|
||||
if sSideToMachine == 'Start' then
|
||||
LeadIn.dStartAddLength = dLengthToMachine + BeamData.CUT_EXTRA - EdgeToMachine.dLength
|
||||
LeadIn.dStartAddLength = -dAddLengthToReduce - dLengthToMachine - BeamData.CUT_EXTRA + EdgeToMachine.dLength
|
||||
else
|
||||
LeadIn.dStartAddLength = -dAddLengthToReduce
|
||||
end
|
||||
@@ -81,9 +81,9 @@ local function CalculateLeadInOut( Machining, EdgeToMachine, sSideToMachine, dLe
|
||||
end
|
||||
if Machining.bIsEndClosed then
|
||||
if sSideToMachine == 'End' then
|
||||
LeadIn.dStartAddLength = dLengthToMachine + BeamData.CUT_EXTRA - EdgeToMachine.dLength
|
||||
LeadOut.dEndAddLength = -dAddLengthToReduce - dLengthToMachine - BeamData.CUT_EXTRA + EdgeToMachine.dLength
|
||||
else
|
||||
LeadIn.dStartAddLength = -dAddLengthToReduce
|
||||
LeadOut.dEndAddLength = -dAddLengthToReduce
|
||||
end
|
||||
else
|
||||
LeadOut.dEndAddLength = BeamData.CUT_EXTRA
|
||||
@@ -98,7 +98,7 @@ function SLOTBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
|
||||
local Mortising = {}
|
||||
Mortising.bIsApplicable = true
|
||||
Mortising.dDepthToMachine = 0
|
||||
Mortising.dResidualDepth = EdgeToMachine.dElevation
|
||||
Mortising.dResidualDepth = abs( EdgeToMachine.dElevation)
|
||||
Mortising.sMessage = ''
|
||||
Mortising.idProc = Proc.id
|
||||
Mortising.sEdgeType = EdgeToMachine.sType
|
||||
@@ -110,13 +110,14 @@ function SLOTBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
|
||||
local dCustomMaxElev = OptionalParameters.dMaxElev or abs( EdgeToMachine.dElevation)
|
||||
local bStopAtHalfElevation = OptionalParameters.bStopAtHalfElevation or false
|
||||
|
||||
-- altezza tasca, in base alla topologia
|
||||
local dPocketHeight = 0
|
||||
if Proc.Topology.sFamily == 'Tunnel' then
|
||||
dPocketHeight = Proc.MainFaces.SideFaces[1].MainEdges.OppositeEdges[1].dLength
|
||||
else
|
||||
if FaceToMachine.Type == 'Long' then
|
||||
if FaceToMachine.sType == 'Long' then
|
||||
dPocketHeight = Proc.MainFaces.BottomFaces[1].MainEdges.SideEdges[1].dLength
|
||||
elseif FaceToMachine.Type == 'Side' then
|
||||
elseif FaceToMachine.sType == 'Side' then
|
||||
dPocketHeight = Proc.MainFaces.BottomFaces[1].MainEdges.LongEdges[1].dLength
|
||||
end
|
||||
end
|
||||
@@ -146,7 +147,7 @@ function SLOTBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
|
||||
ToolInfo = MachiningLib.FindChainSaw( Proc, ToolSearchParameters)
|
||||
Mortising.nToolIndex = ToolInfo.nToolIndex
|
||||
Mortising.nType = MCH_OY.MORTISING
|
||||
if not TOOLS[Mortising.nToolIndex].sName then
|
||||
if not TOOLS[Mortising.nToolIndex] or not TOOLS[Mortising.nToolIndex].sName then
|
||||
Mortising.sMessage = 'Chainsaw not found'
|
||||
Mortising.bIsApplicable = false
|
||||
EgtOutLog( Mortising.sMessage)
|
||||
@@ -191,6 +192,7 @@ function SLOTBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
|
||||
Mortising.dDepthToMachine = Mortising.dDepthToMachine + TOOLS[Mortising.nToolIndex].dCornerRadius
|
||||
end
|
||||
if TOOLS[Mortising.nToolIndex].dMaxMaterial > Mortising.dDepthToMachine - 10 * GEO.EPS_SMALL then
|
||||
Mortising.dResidualDepth = 0
|
||||
if EdgeToMachine.dElevation > -10 * GEO.EPS_SMALL then
|
||||
Mortising.dLongitudinalOffset = 0
|
||||
else
|
||||
@@ -207,6 +209,8 @@ function SLOTBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
|
||||
Mortising.sMessage = 'Feature '.. Proc.idFeature .. ' : chainsaw elevation (' .. EgtNumToString( EdgeToMachine.dElevation, 1) .. ') bigger than max tool depth (' .. EgtNumToString( Mortising.dDepthToMachine, 1) .. ')'
|
||||
EgtOutLog( Mortising.sMessage)
|
||||
end
|
||||
-- completamento
|
||||
Mortising.dCompletionPercentage = 100 - Mortising.dResidualDepth / Mortising.dDepthToMachine
|
||||
-- massima elevazione
|
||||
if dCustomMaxElev < Mortising.dDepthToMachine - 10 * GEO.EPS_SMALL then
|
||||
Mortising.dMaxElev = dCustomMaxElev
|
||||
|
||||
@@ -9,7 +9,7 @@ local BeamData = require( 'BeamData')
|
||||
local MachiningLib = require( 'MachiningLib')
|
||||
local FeatureData = require( 'FeatureData')
|
||||
-- strategie di base
|
||||
local SlotByChainSaw = BEAM.BASEDIR .. '\\CoreStrategies\\SLOTBYCHAINSAW.lua'
|
||||
local SlotByChainSaw = require( 'SLOTBYCHAINSAW')
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local STR0003 = {}
|
||||
@@ -174,9 +174,9 @@ function Blade.CalculateMachiningParameters( Proc, Part, FaceToMachine, EdgeToMa
|
||||
if Proc.Topology.sFamily == 'Tunnel' then
|
||||
dPocketHeight = Proc.MainFaces.SideFaces[1].MainEdges.OppositeEdges[1].dLength
|
||||
else
|
||||
if FaceToMachine.Type == 'Long' then
|
||||
if FaceToMachine.sType == 'Long' then
|
||||
dPocketHeight = Proc.MainFaces.BottomFaces[1].MainEdges.SideEdges[1].dLength
|
||||
elseif FaceToMachine.Type == 'Side' then
|
||||
elseif FaceToMachine.sType == 'Side' then
|
||||
dPocketHeight = Proc.MainFaces.BottomFaces[1].MainEdges.LongEdges[1].dLength
|
||||
end
|
||||
end
|
||||
@@ -265,7 +265,7 @@ function Blade.CalculateMachiningParameters( Proc, Part, FaceToMachine, EdgeToMa
|
||||
-- step verticale e offset longitudinale
|
||||
Cutting.Steps = MachiningLib.GetMachiningSteps( dPocketHeight, TOOLS[Cutting.nToolIndex].dThickness)
|
||||
Cutting.Steps.nStepType = MCH_MILL_ST.ONEWAY
|
||||
Cutting.dMaxElev = Cutting.Steps.dStepLength * Cutting.Steps.nCount - 10 * GEO.EPS_SMALL
|
||||
Cutting.dMaxElev = Cutting.Steps.dStep * Cutting.Steps.nCount - 10 * GEO.EPS_SMALL
|
||||
if Cutting.bToolInvert and Cutting.Steps.nCount > 1 then
|
||||
Cutting.dLongitudinalOffset = - dPocketHeight
|
||||
else
|
||||
@@ -293,7 +293,7 @@ function Blade.CalculateMachiningParameters( Proc, Part, FaceToMachine, EdgeToMa
|
||||
Cutting.HorizontalSteps = MachiningLib.GetMachiningSteps( Cutting.dDepthToMachine, TOOLS[Cutting.nToolIndex].dSideStep)
|
||||
else
|
||||
Cutting.HorizontalSteps.nCount = 1
|
||||
Cutting.HorizontalSteps.dStepLength = 0
|
||||
Cutting.HorizontalSteps.dStep = 0
|
||||
end
|
||||
-- lunghezza impronta lama
|
||||
if Cutting.bIsStartClosed and Cutting.bIsEndClosed then
|
||||
@@ -330,232 +330,67 @@ function Blade.AddResult( Cutting)
|
||||
end
|
||||
|
||||
|
||||
function Blade.AddMachiningAllSteps( Proc, Cutting)
|
||||
function Blade.AddMachiningAllSteps( Proc, Cutting, AuxiliaryData)
|
||||
local bMachiningAdded = false
|
||||
local sCuttingApplyMessage = ''
|
||||
if not AuxiliaryData then
|
||||
AuxiliaryData = {}
|
||||
end
|
||||
AuxiliaryData.Clones = {}
|
||||
|
||||
local dOriginalRadialOffset = Cutting.dRadialOffset
|
||||
local dOriginalLeadInPerpDistance = Cutting.LeadIn.dPerpDistance
|
||||
local dOriginalLeadOutPerpDistance = Cutting.LeadOut.dPerpDistance
|
||||
for i = Cutting.HorizontalSteps.nCount, 1, -1 do
|
||||
Cutting.dRadialOffset = dOriginalRadialOffset + Cutting.HorizontalSteps.dStepLength * ( i - 1)
|
||||
AuxiliaryData.Clones[i] = {}
|
||||
AuxiliaryData.Clones[i].LeadIn = {}
|
||||
AuxiliaryData.Clones[i].LeadOut = {}
|
||||
AuxiliaryData.Clones[i].dRadialOffset = dOriginalRadialOffset + Cutting.HorizontalSteps.dStep * ( i - 1)
|
||||
-- update distanza perpendicolare attacco per contemplare l'offset applicato
|
||||
Cutting.LeadIn.dPerpDistance = dOriginalLeadInPerpDistance - Cutting.dRadialOffset
|
||||
Cutting.LeadOut.dPerpDistance = dOriginalLeadOutPerpDistance - Cutting.dRadialOffset
|
||||
-- applicazione lavorazione
|
||||
bMachiningAdded = MachiningLib.AddNewMachining( Proc, Cutting)
|
||||
-- update messaggi
|
||||
if sCuttingApplyMessage and #sCuttingApplyMessage > 0 then
|
||||
sCuttingApplyMessage = sCuttingApplyMessage .. 'Apply : ' .. sCuttingApplyMessage .. '\n'
|
||||
end
|
||||
AuxiliaryData.Clones[i].LeadIn.dPerpDistance = dOriginalLeadInPerpDistance - Cutting.dRadialOffset
|
||||
AuxiliaryData.Clones[i].LeadOut.dPerpDistance = dOriginalLeadOutPerpDistance - Cutting.dRadialOffset
|
||||
end
|
||||
bMachiningAdded = MachiningLib.AddNewMachining( Proc, Cutting, AuxiliaryData)
|
||||
|
||||
return bMachiningAdded
|
||||
end
|
||||
|
||||
|
||||
function Chainsaw.CalculateMachiningParameters( Proc, Part, FaceToMachine, EdgeToMachine)
|
||||
local Mortising = {}
|
||||
Mortising.bIsApplicable = true
|
||||
Mortising.dDepthToMachine = 0
|
||||
Mortising.sMessage = ''
|
||||
Mortising.idProc = Proc.id
|
||||
-- OneSide | OneSideAndExtend | BothSides | BothSidesAndExtend
|
||||
local sMortisingType
|
||||
local dResidualDepth = 0
|
||||
|
||||
local dPocketHeight = 0
|
||||
if Proc.Topology.sFamily == 'Tunnel' then
|
||||
dPocketHeight = Proc.MainFaces.SideFaces[1].MainEdges.OppositeEdges[1].dLength
|
||||
else
|
||||
if FaceToMachine.Type == 'Long' then
|
||||
dPocketHeight = Proc.MainFaces.BottomFaces[1].MainEdges.SideEdges[1].dLength
|
||||
elseif FaceToMachine.Type == 'Side' then
|
||||
dPocketHeight = Proc.MainFaces.BottomFaces[1].MainEdges.LongEdges[1].dLength
|
||||
end
|
||||
end
|
||||
|
||||
-- ricerca utensile
|
||||
local ToolSearchParameters = {}
|
||||
local ToolInfo = {}
|
||||
ToolSearchParameters.vtToolDirection = EdgeToMachine.vtToolDirection
|
||||
ToolSearchParameters.bAllowTopHead = true
|
||||
ToolSearchParameters.bAllowBottomHead = false
|
||||
if Proc.Topology.sFamily == 'Tunnel' then
|
||||
sMortisingType = 'OneSideAndExtend'
|
||||
ToolSearchParameters.bExtendWithCornerRadius = true
|
||||
ToolSearchParameters.dElevation = abs( EdgeToMachine.dElevation) + BeamData.CUT_EXTRA
|
||||
ToolInfo = MachiningLib.FindChainSaw( Proc, ToolSearchParameters)
|
||||
if ToolInfo.dResidualDepth > 10 * GEO.EPS_SMALL then
|
||||
sMortisingType = 'BothSidesAndExtend'
|
||||
ToolSearchParameters.dElevation = abs( EdgeToMachine.dElevation) / 2 + BeamData.CUT_EXTRA_MIN
|
||||
ToolInfo = MachiningLib.FindChainSaw( Proc, ToolSearchParameters)
|
||||
end
|
||||
elseif EdgeToMachine.sType == 'Side' and #( Proc.MainFaces.SideFaces) == 0 then
|
||||
sMortisingType = 'BothSidesAndExtend'
|
||||
ToolSearchParameters.bExtendWithCornerRadius = true
|
||||
ToolSearchParameters.dElevation = abs( EdgeToMachine.dElevation) / 2 + BeamData.CUT_EXTRA_MIN
|
||||
ToolInfo = MachiningLib.FindChainSaw( Proc, ToolSearchParameters)
|
||||
else
|
||||
sMortisingType = 'OneSide'
|
||||
ToolSearchParameters.bExtendWithCornerRadius = false
|
||||
ToolSearchParameters.dElevation = abs( EdgeToMachine.dElevation) + BeamData.CUT_EXTRA
|
||||
ToolInfo = MachiningLib.FindChainSaw( Proc, ToolSearchParameters)
|
||||
end
|
||||
if ToolSearchParameters.bExtendWithCornerRadius and ToolInfo.dResidualDepth > 10 * GEO.EPS_SMALL then
|
||||
if sMortisingType == 'BothSidesAndExtend' then
|
||||
sMortisingType = 'BothSides'
|
||||
elseif sMortisingType == 'OneSideAndExtend' then
|
||||
sMortisingType = 'OneSide'
|
||||
end
|
||||
ToolSearchParameters.bExtendWithCornerRadius = false
|
||||
ToolSearchParameters.dElevation = nil
|
||||
ToolInfo = MachiningLib.FindChainSaw( Proc, ToolSearchParameters)
|
||||
end
|
||||
Mortising.nToolIndex = ToolInfo.nToolIndex
|
||||
Mortising.nType = MCH_OY.MORTISING
|
||||
if not TOOLS[Mortising.nToolIndex].sName then
|
||||
Mortising.sMessage = 'Feature '.. Proc.idFeature .. ' : strategy ' .. Strategy.sName .. ' not applicable - chainsaw not found'
|
||||
Mortising.bIsApplicable = false
|
||||
EgtOutLog( Mortising.sMessage)
|
||||
return Mortising, EdgeToMachine.dElevation
|
||||
end
|
||||
|
||||
-- verifica dimensioni tasca compatibili
|
||||
-- se tasca meno spessa della sega a catena la strategia non è applicabile
|
||||
if TOOLS[Mortising.nToolIndex].dThickness > dPocketHeight + 10 * GEO.EPS_SMALL then
|
||||
Mortising.sMessage = 'Feature '.. Proc.idFeature .. ' : strategy ' .. Strategy.sName .. ' not applicable - pocket too narrow for chainsaw thickness'
|
||||
Mortising.bIsApplicable = false
|
||||
EgtOutLog( Mortising.sMessage)
|
||||
return Mortising, EdgeToMachine.dElevation
|
||||
end
|
||||
if #( Proc.MainFaces.SideFaces) > 1 then
|
||||
-- se tasca più stretta della sega a catena la strategia non è applicabile
|
||||
if TOOLS[Mortising.nToolIndex].dWidth > EdgeToMachine.dLength + 10 * GEO.EPS_SMALL then
|
||||
Mortising.sMessage = 'Feature '.. Proc.idFeature .. ' : strategy ' .. Strategy.sName .. ' not applicable - pocket too narrow for chainsaw width'
|
||||
Mortising.bIsApplicable = false
|
||||
EgtOutLog( Mortising.sMessage)
|
||||
return Mortising, EdgeToMachine.dElevation
|
||||
end
|
||||
end
|
||||
|
||||
-- parametri della lavorazione
|
||||
-- profondità (parametro DEPTH) non usata
|
||||
Mortising.sDepth = 'TH'
|
||||
-- inizio e fine aperti o chiusi
|
||||
Mortising.bIsStartClosed = not EdgeToMachine.bIsStartOpen
|
||||
Mortising.bIsEndClosed = not EdgeToMachine.bIsEndOpen
|
||||
-- lato di lavoro e inversioni
|
||||
Mortising.bInvert = false
|
||||
if EdgeToMachine.dElevation > -10 * GEO.EPS_SMALL then
|
||||
Mortising.nWorkside = MCH_MILL_WS.RIGHT
|
||||
Mortising.bToolInvert = false
|
||||
else
|
||||
Mortising.nWorkside = MCH_MILL_WS.LEFT
|
||||
Mortising.bToolInvert = true
|
||||
end
|
||||
-- profondità e offset longitudinale
|
||||
if sMortisingType == 'OneSide' then
|
||||
Mortising.dDepthToMachine = abs( EdgeToMachine.dElevation)
|
||||
elseif sMortisingType == 'OneSideAndExtend' then
|
||||
Mortising.dDepthToMachine = abs( EdgeToMachine.dElevation) + TOOLS[Mortising.nToolIndex].dCornerRadius + BeamData.CUT_EXTRA_MIN
|
||||
elseif sMortisingType == 'BothSides' then
|
||||
Mortising.dDepthToMachine = abs( EdgeToMachine.dElevation) / 2
|
||||
elseif sMortisingType == 'BothSidesAndExtend' then
|
||||
Mortising.dDepthToMachine = abs( EdgeToMachine.dElevation) / 2 + TOOLS[Mortising.nToolIndex].dCornerRadius + BeamData.CUT_EXTRA_MIN
|
||||
end
|
||||
if TOOLS[Mortising.nToolIndex].dMaxMaterial > Mortising.dDepthToMachine - 10 * GEO.EPS_SMALL then
|
||||
if EdgeToMachine.dElevation > -10 * GEO.EPS_SMALL then
|
||||
Mortising.dLongitudinalOffset = 0
|
||||
else
|
||||
Mortising.dLongitudinalOffset = abs( EdgeToMachine.dElevation) - Mortising.dDepthToMachine
|
||||
end
|
||||
else
|
||||
Mortising.dDepthToMachine = TOOLS[Mortising.nToolIndex].dMaxMaterial - 1
|
||||
dResidualDepth = abs( EdgeToMachine.dElevation) - Mortising.dDepthToMachine
|
||||
if EdgeToMachine.dElevation > -10 * GEO.EPS_SMALL then
|
||||
Mortising.dLongitudinalOffset = EdgeToMachine.dElevation - Mortising.dDepthToMachine
|
||||
else
|
||||
Mortising.dLongitudinalOffset = 0
|
||||
end
|
||||
Mortising.sMessage = 'Feature '.. Proc.idFeature .. ' : chainsaw elevation (' .. EgtNumToString( EdgeToMachine.dElevation, 1) .. ') bigger than max tool depth (' .. EgtNumToString( Mortising.dDepthToMachine, 1) .. ')'
|
||||
EgtOutLog( Mortising.sMessage)
|
||||
end
|
||||
-- offset radiale
|
||||
Mortising.dRadialOffset = 0
|
||||
-- distanza di sicurezza
|
||||
Mortising.dStartSafetyLength = max( EdgeToMachine.dElevation, 10)
|
||||
-- overlap
|
||||
Mortising.dOverlap = 0
|
||||
-- step
|
||||
Mortising.Steps = {}
|
||||
if Strategy.Parameters.bUseZigZagMortising then
|
||||
Mortising.Steps.nStepType = MCH_MILL_ST.ZIGZAG
|
||||
else
|
||||
Mortising.Steps.nStepType = MCH_MILL_ST.ONEWAY
|
||||
end
|
||||
-- faceuse
|
||||
if EdgeToMachine.dElevation > - 10 * GEO.EPS_SMALL then
|
||||
Mortising.nFaceuse = BeamLib.GetNearestParalOpposite( EdgeToMachine.vtToolDirection)
|
||||
else
|
||||
Mortising.nFaceuse = BeamLib.GetNearestParalOpposite( -EdgeToMachine.vtToolDirection)
|
||||
end
|
||||
-- SCC
|
||||
Mortising.SCC = MCH_SCC.NONE
|
||||
-- asse bloccato e angoli suggeriti
|
||||
local vtRes = FaceToMachine.vtN ^ EdgeToMachine.vtToolDirection
|
||||
if abs( vtRes:getZ()) < 10 * GEO.EPS_SMALL then
|
||||
Mortising.sBlockedAxis = BeamLib.GetBlockedAxis( Mortising.nToolIndex, 'perpendicular', Part.b3Raw, FaceToMachine.vtN)
|
||||
Mortising.sSuggestedAngles = BeamLib.GetChainSawInitAngs( FaceToMachine.vtN, EdgeToMachine.vtToolDirection, 1)
|
||||
elseif EdgeToMachine.vtToolDirection:getZ() < 10 * GEO.EPS_SMALL then
|
||||
Mortising.sBlockedAxis = BeamLib.GetBlockedAxis( Mortising.nToolIndex, 'parallel', Part.b3Raw, FaceToMachine.vtN)
|
||||
Mortising.sSuggestedAngles = BeamLib.GetChainSawInitAngs( FaceToMachine.vtN, EdgeToMachine.vtToolDirection, 2)
|
||||
end
|
||||
-- approccio e retrazione
|
||||
Mortising.LeadIn, Mortising.LeadOut = CalculateLeadInOut( Mortising, EdgeToMachine)
|
||||
-- eventuale step verticale
|
||||
Mortising.VerticalSteps = MachiningLib.GetMachiningSteps( dPocketHeight, TOOLS[Mortising.nToolIndex].dThickness)
|
||||
-- geometria
|
||||
Mortising.Geometry = {{Proc.id, FaceToMachine.id}}
|
||||
-- nome operazione
|
||||
Mortising.sOperationName = 'Chainsaw_' .. ( EgtGetName( Mortising.idProc) or tostring( Mortising.idProc)) .. '_' .. tostring( FaceToMachine.id + 1)
|
||||
|
||||
-- eventuale avviso di danneggiamento pezzo successivo
|
||||
-- TODO da sostituire con check se si riesce a separare e il grezzo dietro è lungo a sufficienza
|
||||
-- local dOffsideLength = max( Mortising.LeadIn.dStartAddLength, Mortising.LeadOut.dEndAddLength) + TOOLS[Mortising.nToolIndex].dWidth / 2 + 10 * GEO.EPS_SMALL
|
||||
-- if ( not Proc.bTail or Proc.bAdvTail) and Proc.AffectedFaces.bLeft and ( Proc.dDistanceToNextPart < dOffsideLength) then
|
||||
-- local sDamageNextPieceMessage = 'Feature '.. Proc.idFeature .. ' : chainsaw can damage next piece.'
|
||||
-- if #Mortising.sMessage > 0 then
|
||||
-- Mortising.sMessage = Mortising.sMessage .. '\n' .. sDamageNextPieceMessage
|
||||
-- else
|
||||
-- Mortising.sMessage = sDamageNextPieceMessage
|
||||
-- end
|
||||
-- EgtOutLog( sDamageNextPieceMessage)
|
||||
-- end
|
||||
|
||||
return Mortising, dResidualDepth
|
||||
end
|
||||
|
||||
|
||||
function Chainsaw.AddResult( Mortising)
|
||||
AddResult( Mortising, Chainsaw.Result)
|
||||
table.insert( Chainsaw.Result, {})
|
||||
if not Chainsaw.Result.Bottom then
|
||||
Chainsaw.Result.Bottom = {}
|
||||
end
|
||||
if not Chainsaw.Result.Side then
|
||||
Chainsaw.Result.Side = {}
|
||||
end
|
||||
if not Chainsaw.Result.Opposite then
|
||||
Chainsaw.Result.Opposite = {}
|
||||
end
|
||||
if Mortising.sEdgeType == 'Bottom' then
|
||||
table.insert( Chainsaw.Result.Bottom, Mortising)
|
||||
elseif Mortising.sEdgeType == 'Side' then
|
||||
table.insert( Chainsaw.Result.Side, Mortising)
|
||||
elseif Mortising.sEdgeType == 'Opposite' then
|
||||
table.insert( Chainsaw.Result.Opposite, Mortising)
|
||||
else
|
||||
error('AddResult : unknown edge type')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function Chainsaw.AddMachiningAllSteps( Proc, Mortising)
|
||||
function Chainsaw.AddMachiningAllSteps( Proc, Mortising, AuxiliaryData)
|
||||
local bMachiningAdded = false
|
||||
local sMortisingApplyMessage = ''
|
||||
if not AuxiliaryData then
|
||||
AuxiliaryData = {}
|
||||
end
|
||||
AuxiliaryData.Clones = {}
|
||||
|
||||
local dOriginalRadialOffsetMortising = Mortising.dRadialOffset
|
||||
for i = Mortising.VerticalSteps.nCount, 1, -1 do
|
||||
Mortising.dRadialOffset = dOriginalRadialOffsetMortising + Mortising.VerticalSteps.dStepLength * ( i - 1)
|
||||
-- applicazione lavorazione
|
||||
bMachiningAdded = MachiningLib.AddNewMachining( Proc, Mortising)
|
||||
-- update messaggi
|
||||
if sMortisingApplyMessage and #sMortisingApplyMessage > 0 then
|
||||
Mortising.sMessage = Mortising.sMessage .. '\n' .. 'Apply : ' .. sMortisingApplyMessage .. '\n'
|
||||
end
|
||||
AuxiliaryData.Clones[i] = {}
|
||||
AuxiliaryData.Clones[i].dRadialOffset = dOriginalRadialOffsetMortising + Mortising.VerticalSteps.dStep * ( i - 1)
|
||||
end
|
||||
bMachiningAdded = MachiningLib.AddNewMachining( Proc, Mortising, AuxiliaryData)
|
||||
|
||||
return bMachiningAdded
|
||||
end
|
||||
@@ -571,6 +406,8 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
Strategy.Parameters = BeamLib.LoadCustomParametersInStrategy( CustomParameters)
|
||||
Strategy.Result = {}
|
||||
Strategy.Result.sInfo = ''
|
||||
Blade.Result = {}
|
||||
Chainsaw.Result = {}
|
||||
|
||||
if not IsTopologyOk( Proc) then
|
||||
local sErr = 'Feature '.. Proc.idFeature .. ' : strategy ' .. Strategy.sName .. ' not implemented'
|
||||
@@ -658,7 +495,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
Strategy.Result.sStatus = 'Not-Applicable'
|
||||
else
|
||||
dCompletionPercentage = GetCompletionPercentage( Proc, Blade.Result)
|
||||
if not Strategy.Parameters.bNotCompleteWithBladeRadius and ( ( nCanApplyCount == #Blade.Result) and dCompletionPercentage > 99 + 10 * GEO.EPS_SMALL) then
|
||||
if not Strategy.Parameters.bNotCompleteWithBladeRadius and ( ( nCanApplyCount == #Blade.Result) and dCompletionPercentage > 100 - 10 * GEO.EPS_SMALL) then
|
||||
Strategy.Result.sStatus = 'Completed'
|
||||
else
|
||||
Strategy.Result.sStatus = 'Not-Completed'
|
||||
@@ -674,7 +511,6 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
return bAreAllApplyOk, Strategy.Result
|
||||
end
|
||||
|
||||
|
||||
-- sega a catena
|
||||
local Mortising = {}
|
||||
if Proc.Topology.sName == 'Groove-4-Blind' or Proc.Topology.sName == 'Pocket-5-Blind' then
|
||||
@@ -701,7 +537,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
-- ancora materiale residuo - se possibile si lavora dal lato
|
||||
if Chainsaw.Result.Bottom[#Chainsaw.Result.Bottom].dResidualDepth > 10 * GEO.EPS_SMALL and #Proc.MainFaces.SideFaces == 1 then
|
||||
-- si lavora solamente l'impronta lama sul fondo
|
||||
if Blade.Result[2].dResidualDepth < 10 * GEO.EPS_SMALL then
|
||||
if ( #Blade.Result > 1) and Blade.Result[2].dResidualDepth < 10 * GEO.EPS_SMALL then
|
||||
if ( Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsStartOpen and Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1].dLength > 3 * Blade.Result[2].dBladeMarkLength - 10 * GEO.EPS_SMALL) then
|
||||
local OptionalParameters = { sSideToMachine = 'End', dLengthToMachine = Blade.Result[2].dBladeMarkLength, dMaxElev = 0}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
|
||||
@@ -711,66 +547,71 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
end
|
||||
-- si lavora tutto il lato
|
||||
else
|
||||
local dBladeResidualDepth
|
||||
if #Blade.Result > 1 then
|
||||
dBladeResidualDepth = Blade.Result[2].dResidualDepth
|
||||
else
|
||||
dBladeResidualDepth = Blade.Result[1].dResidualDepth
|
||||
end
|
||||
if Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsStartOpen then
|
||||
local OptionalParameters = { dMaxElev = Blade.Result[2].dResidualDepth + BeamData.CUT_EXTRA}
|
||||
local OptionalParameters = { dMaxElev = dBladeResidualDepth + BeamData.CUT_EXTRA}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
|
||||
elseif Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsEndOpen then
|
||||
local OptionalParameters = { dMaxElev = Blade.Result[2].dResidualDepth + BeamData.CUT_EXTRA}
|
||||
local OptionalParameters = { dMaxElev = dBladeResidualDepth + BeamData.CUT_EXTRA}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters)
|
||||
end
|
||||
end
|
||||
Chainsaw.AddResult( Mortising)
|
||||
end
|
||||
elseif Proc.Topology.sName == 'Groove-3-Through' then
|
||||
-- si lavora tutto il fondo
|
||||
if Blade.Result[1].dResidualDepth > 10 * GEO.EPS_SMALL then
|
||||
-- si lavora tutto il fondo
|
||||
local OptionalParameters = { dMaxElev = Blade.Result[1].dResidualDepth + BeamData.CUT_EXTRA}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
end
|
||||
-- ancora materiale residuo - si lavorano i lati
|
||||
if Chainsaw.Result.Bottom[1].dResidualDepth > 10 * GEO.EPS_SMALL then
|
||||
-- si lavora solamente l'impronta lama sul fondo
|
||||
if ( Blade.Result[2].dResidualDepth < 10 * GEO.EPS_SMALL and Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1].dLength > 3 * Blade.Result[2].dBladeMarkLength - 10 * GEO.EPS_SMALL) and
|
||||
( Blade.Result[3].dResidualDepth < 10 * GEO.EPS_SMALL and Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2].dLength > 3 * Blade.Result[3].dBladeMarkLength - 10 * GEO.EPS_SMALL) then
|
||||
|
||||
local OptionalParameters = { sSideToMachine = 'End', dLengthToMachine = Blade.Result[2].dBladeMarkLength, dMaxElev = 0}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
|
||||
-- ancora materiale residuo - si lavora da entrambi i lati
|
||||
if Chainsaw.Result.Side[1].dResidualDepth > 10 * GEO.EPS_SMALL then
|
||||
local OptionalParameters = { bStopAtHalfElevation = true, sSideToMachine = 'End', dLengthToMachine = Blade.Result[2].dBladeMarkLength, dMaxElev = 0}
|
||||
-- ancora materiale residuo - si lavorano i lati
|
||||
if Chainsaw.Result.Bottom[1].dResidualDepth > 10 * GEO.EPS_SMALL then
|
||||
-- si lavora solamente l'impronta lama sul fondo
|
||||
if ( Blade.Result[2].dResidualDepth < 10 * GEO.EPS_SMALL and Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1].dLength > 3 * Blade.Result[2].dBladeMarkLength - 10 * GEO.EPS_SMALL) and
|
||||
( Blade.Result[3].dResidualDepth < 10 * GEO.EPS_SMALL and Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2].dLength > 3 * Blade.Result[3].dBladeMarkLength - 10 * GEO.EPS_SMALL) then
|
||||
|
||||
local OptionalParameters = { sSideToMachine = 'End', dLengthToMachine = Blade.Result[2].dBladeMarkLength, dMaxElev = 0}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
OptionalParameters = {}
|
||||
OptionalParameters = { bStopAtHalfElevation = true, sSideToMachine = 'Start', dLengthToMachine = Blade.Result[2].dBladeMarkLength, dMaxElev = 0}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
-- lavorando dai due lati non c'è materiale residuo - si può eliminare la lavorazione del fondo
|
||||
if Chainsaw.Result.Side[2].dResidualDepth < 10 * GEO.EPS_SMALL then
|
||||
Chainsaw.Result.Bottom[1].bIsApplicable = false
|
||||
-- ancora materiale residuo - si lavora da entrambi i lati
|
||||
if Chainsaw.Result.Side[1].dResidualDepth > 10 * GEO.EPS_SMALL then
|
||||
local OptionalParameters = { bStopAtHalfElevation = true, sSideToMachine = 'End', dLengthToMachine = Blade.Result[2].dBladeMarkLength, dMaxElev = 0}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
OptionalParameters = {}
|
||||
OptionalParameters = { bStopAtHalfElevation = true, sSideToMachine = 'Start', dLengthToMachine = Blade.Result[2].dBladeMarkLength, dMaxElev = 0}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
-- lavorando dai due lati non c'è materiale residuo - si può eliminare la lavorazione del fondo
|
||||
if Chainsaw.Result.Side[2].dResidualDepth < 10 * GEO.EPS_SMALL then
|
||||
Chainsaw.Result.Bottom[1].bIsApplicable = false
|
||||
end
|
||||
end
|
||||
-- si lavora tutto il lato
|
||||
else
|
||||
Chainsaw.AddResult( Mortising)
|
||||
end
|
||||
-- si lavora tutto il lato
|
||||
else
|
||||
local OptionalParameters = { dMaxElev = Blade.Result[2].dResidualDepth + BeamData.CUT_EXTRA}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
|
||||
-- ancora materiale residuo - si lavora da entrambi i lati
|
||||
if Chainsaw.Result.Side[1].dResidualDepth > 10 * GEO.EPS_SMALL then
|
||||
local OptionalParameters = { dMaxElev = Blade.Result[2].dResidualDepth + BeamData.CUT_EXTRA}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
OptionalParameters = {}
|
||||
OptionalParameters = { dMaxElev = Blade.Result[3].dResidualDepth + BeamData.CUT_EXTRA}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
-- lavorando dai due lati non c'è materiale residuo - si può disabilitare la lavorazione del fondo
|
||||
if Chainsaw.Result.Side[2].dResidualDepth < 10 * GEO.EPS_SMALL then
|
||||
Chainsaw.Result.Bottom[1].bIsApplicable = false
|
||||
-- ancora materiale residuo - si lavora da entrambi i lati
|
||||
if Chainsaw.Result.Side[1].dResidualDepth > 10 * GEO.EPS_SMALL then
|
||||
Chainsaw.Result.Side[1].bIsApplicable = false
|
||||
local OptionalParameters = { dMaxElev = Blade.Result[2].dResidualDepth + BeamData.CUT_EXTRA}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
OptionalParameters = {}
|
||||
OptionalParameters = { dMaxElev = Blade.Result[3].dResidualDepth + BeamData.CUT_EXTRA}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
-- lavorando dai due lati non c'è materiale residuo - si può disabilitare la lavorazione del fondo
|
||||
if Chainsaw.Result.Side[2].dResidualDepth < 10 * GEO.EPS_SMALL then
|
||||
Chainsaw.Result.Bottom[1].bIsApplicable = false
|
||||
end
|
||||
end
|
||||
else
|
||||
Chainsaw.AddResult( Mortising)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -808,7 +649,9 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
else
|
||||
local OptionalParameters = { dMaxElev = Blade.Result[1].dResidualDepth + BeamData.CUT_EXTRA}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
if Chainsaw.Result.Opposite[1].dResidualDepth > GEO.EPS_SMALL then
|
||||
Chainsaw.Result.Opposite[1].bIsApplicable = false
|
||||
local OptionalParameters = { bStopAtHalfElevation = true, dMaxElev = Blade.Result[1].dResidualDepth + BeamData.CUT_EXTRA}
|
||||
SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
@@ -816,50 +659,73 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
OptionalParameters = { bStopAtHalfElevation = true, dMaxElev = Blade.Result[2].dResidualDepth + BeamData.CUT_EXTRA}
|
||||
SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
else
|
||||
Chainsaw.AddResult( Mortising)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- TODO aggiunta delle lavorazioni a MACHININGS. Gli step sono da ciclare qui.
|
||||
-- TODO gestione e output dei risultati
|
||||
|
||||
-- TODO da rifare
|
||||
local nCanApplyCount = 0
|
||||
local nApplyOkCount = 0
|
||||
local bAreAllApplyOk
|
||||
local dCompletionPercentage = 0
|
||||
for i = 1, #Chainsaw.Result do
|
||||
Strategy.Result.sInfo = Strategy.Result.sInfo .. '\n' .. Chainsaw.Result[i].sMessage .. '\n' .. ( Chainsaw.Result[i].sApplyMessage or '')
|
||||
if Chainsaw.Result[i].bIsApplicable then
|
||||
nCanApplyCount = nCanApplyCount + 1
|
||||
end
|
||||
if Chainsaw.Result[i].bIsApplyOk then
|
||||
nApplyOkCount = nApplyOkCount + 1
|
||||
local nIsApplicableCount = 0
|
||||
local dFinalCompletionPercentage = 100
|
||||
local bAreAllMachiningsAdded = true
|
||||
for i = 1, #Chainsaw.Result.Bottom do
|
||||
if Chainsaw.Result.Bottom[i].bIsApplicable then
|
||||
nIsApplicableCount = nIsApplicableCount + 1
|
||||
if bAddMachining then
|
||||
local bIsMachiningAdded = Chainsaw.AddMachiningAllSteps( Proc, Chainsaw.Result.Bottom[i])
|
||||
if not bIsMachiningAdded then
|
||||
bAreAllMachiningsAdded = false
|
||||
end
|
||||
end
|
||||
Strategy.Result.sInfo = Strategy.Result.sInfo .. '\n' .. Chainsaw.Result.Bottom[i].sMessage
|
||||
end
|
||||
end
|
||||
if bAddMachining then
|
||||
bAreAllApplyOk = ( nApplyOkCount == #Chainsaw.Result)
|
||||
for i = 1, #Chainsaw.Result.Side do
|
||||
if Chainsaw.Result.Side[i].bIsApplicable then
|
||||
nIsApplicableCount = nIsApplicableCount + 1
|
||||
if bAddMachining then
|
||||
local bIsMachiningAdded = Chainsaw.AddMachiningAllSteps( Proc, Chainsaw.Result.Side[i])
|
||||
if not bIsMachiningAdded then
|
||||
bAreAllMachiningsAdded = false
|
||||
end
|
||||
end
|
||||
Strategy.Result.sInfo = Strategy.Result.sInfo .. '\n' .. Chainsaw.Result.Side[i].sMessage
|
||||
end
|
||||
end
|
||||
if nCanApplyCount == 0 then
|
||||
Strategy.Result.sStatus = 'Not-Applicable'
|
||||
else
|
||||
dCompletionPercentage = GetCompletionPercentage( Proc, Chainsaw.Result)
|
||||
if ( nCanApplyCount == #Chainsaw.Result) and dCompletionPercentage > 99 + 10 * GEO.EPS_SMALL then
|
||||
for i = 1, #Chainsaw.Result.Opposite do
|
||||
if Chainsaw.Result.Opposite[i].bIsApplicable then
|
||||
nIsApplicableCount = nIsApplicableCount + 1
|
||||
if bAddMachining then
|
||||
local bIsMachiningAdded = Chainsaw.AddMachiningAllSteps( Proc, Chainsaw.Result.Opposite[i])
|
||||
if not bIsMachiningAdded then
|
||||
bAreAllMachiningsAdded = false
|
||||
end
|
||||
end
|
||||
Strategy.Result.sInfo = Strategy.Result.sInfo .. '\n' .. Chainsaw.Result.Opposite[i].sMessage
|
||||
end
|
||||
end
|
||||
if nIsApplicableCount > 0 then
|
||||
if Mortising.dCompletionPercentage > 100 - 10 * GEO.EPS_SMALL then
|
||||
Strategy.Result.sStatus = 'Completed'
|
||||
else
|
||||
Strategy.Result.sStatus = 'Not-Completed'
|
||||
-- TODO al momento si assume che la percentuale di completamento dell'ultima lavorazione sia quella rilevante
|
||||
dFinalCompletionPercentage = Mortising.dCompletionPercentage
|
||||
end
|
||||
else
|
||||
Strategy.Result.sStatus = 'Not-Applicable'
|
||||
end
|
||||
Strategy.Result.nCompletionIndex = FeatureData.GetFeatureCompletionIndex( dCompletionPercentage)
|
||||
Strategy.Result.nCompletionIndex = FeatureData.GetFeatureCompletionIndex( dFinalCompletionPercentage)
|
||||
Strategy.Result.nQuality = FeatureData.GetFeatureQuality( 'Chainsaw')
|
||||
local MRRParameters = { dStep = TOOLS[Cutting.nToolIndex].dThickness,
|
||||
local MRRParametersBlade = { dStep = TOOLS[Cutting.nToolIndex].dThickness,
|
||||
dSideStep = min( TOOLS[Cutting.nToolIndex].dSideStep, Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1].dLength),
|
||||
dFeed = TOOLS[Cutting.nToolIndex].Feeds.dFeed}
|
||||
Strategy.Result.dMRR = MachiningLib.GetToolMRR( MRRParameters)
|
||||
local MRRParametersChainsaw = { dStep = min( TOOLS[Mortising.nToolIndex].dStep, Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1].dLength),
|
||||
dSideStep = TOOLS[Mortising.nToolIndex].dThickness,
|
||||
dFeed = TOOLS[Mortising.nToolIndex].Feeds.dFeed}
|
||||
local dMRRBlade = MachiningLib.GetToolMRR( MRRParametersBlade)
|
||||
local dMRRChainsaw = MachiningLib.GetToolMRR( MRRParametersChainsaw)
|
||||
Strategy.Result.dMRR = dMRRBlade * dMRRChainsaw
|
||||
|
||||
return bAreAllApplyOk, Strategy.Result
|
||||
return bAreAllMachiningsAdded, Strategy.Result
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user