- Prima versione pulizia corner con lama
- Funzione "FaceData.GetFacesInfo" accetta ora una lista di facce sulle quali calcolare le info, per evitare di calcolarle tutte in caso siano molte - In "BCS.GetToolsFromMachDataFile", se lista tag vuota, si esce subito
This commit is contained in:
@@ -544,17 +544,18 @@ end
|
||||
local function GetToolsFromMachDataFile( MachiningDataList, TagListToGet)
|
||||
local ToolList = {}
|
||||
|
||||
if MachiningDataList and #MachiningDataList > 0 then
|
||||
if MachiningDataList and #MachiningDataList > 0 and #TagListToGet > 0 then
|
||||
for nIndex = 1, #MachiningDataList do
|
||||
-- se utensile attivo e compatibile con TAG
|
||||
if MachiningDataList[nIndex].On and Contains( TagListToGet, MachiningDataList[nIndex].Type) then
|
||||
-- se è nuova versione, prendo il tool
|
||||
if MachiningDataList[nIndex].Tool then
|
||||
table.insert( ToolList, MachiningDataList[nIndex].Tool)
|
||||
table.insert( ToolList, { sName = MachiningDataList[nIndex].Tool})
|
||||
-- altrimenti dalla lavorazione si ricava il tool
|
||||
else
|
||||
EgtMdbSetCurrMachining( MachiningDataList[nIndex].Name)
|
||||
table.insert( ToolList, { sName = EgtMdbGetCurrMachiningParam( MCH_MP.TOOL)})
|
||||
elseif MachiningDataList[nIndex].Name then
|
||||
if EgtMdbSetCurrMachining( MachiningDataList[nIndex].Name) then
|
||||
table.insert( ToolList, { sName = EgtMdbGetCurrMachiningParam( MCH_MP.TOOL)})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
+13
-2
@@ -146,10 +146,21 @@ function FaceData.GetEdgesInfo( ProcOrId, idFace )
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function FaceData.GetFacesInfo( Proc, Part)
|
||||
function FaceData.GetFacesInfo( Proc, Part, FacesToGet)
|
||||
EgtOutLog( '---Faces START---')
|
||||
local Faces = {}
|
||||
|
||||
local function FaceIsToGet( nIndex)
|
||||
if not FacesToGet then return false end
|
||||
for i = 1, #FacesToGet do
|
||||
-- correggo indice perche' id delle facce è 0-based
|
||||
if FacesToGet[i] == nIndex - 1 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local vAdj
|
||||
if Proc.AdjacencyMatrix then
|
||||
vAdj = Proc.AdjacencyMatrix
|
||||
@@ -165,7 +176,7 @@ function FaceData.GetFacesInfo( Proc, Part)
|
||||
Faces[i] = {}
|
||||
Faces[i].id = i - 1
|
||||
Faces[i].ptCenter, Faces[i].vtN = EgtSurfTmFacetCenter( Proc.id, i - 1, GDB_ID.ROOT)
|
||||
if Proc.nFct < 6 then
|
||||
if Proc.nFct < 6 or FaceIsToGet( i) then
|
||||
-- frame OCS faccia
|
||||
Faces[i].vtFrameHV = Frame3d( Faces[i].ptCenter, Faces[i].vtN)
|
||||
-- elevazione calcolata rispetto al box della parte
|
||||
|
||||
@@ -231,7 +231,7 @@ function MachiningLib.GetSplitMachinings( Machinings, SplittingPoints, Part)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- funzione che ritorna la posizione nella quale si tyrova l'utensile cercato. Serve in caso l'utente voglia rispettare l'ordine degli utensili settato
|
||||
-- funzione che ritorna la posizione nella quale si trova l'utensile cercato. Serve in caso l'utente voglia rispettare l'ordine degli utensili settato
|
||||
local function GetIndexToolInAvailableToolList( AvailableToolList, sToolName)
|
||||
for nIndex = 1, #AvailableToolList do
|
||||
if sToolName == AvailableToolList[nIndex].sName then
|
||||
|
||||
@@ -87,6 +87,12 @@
|
||||
"sDescriptionLong": "",
|
||||
"sMessageId": ""
|
||||
},
|
||||
{
|
||||
"sValue": "NONE",
|
||||
"sDescriptionShort": "No machining",
|
||||
"sDescriptionLong": "",
|
||||
"sMessageId": ""
|
||||
},
|
||||
{
|
||||
"sValue": "BLADE_FORCED",
|
||||
"sDescriptionShort": "Blade forced",
|
||||
|
||||
@@ -9,15 +9,31 @@ local BeamLib = require( 'BeamLib')
|
||||
local BeamData = require( 'BeamData')
|
||||
local MachiningLib = require( 'MachiningLib')
|
||||
local FeatureLib = require( 'FeatureLib')
|
||||
local FaceData = require( 'FaceData')
|
||||
local ID = require( 'Identity')
|
||||
|
||||
-- strategie di base
|
||||
local BladeToWaste = require('BLADETOWASTE')
|
||||
local FaceByBlade = require('FACEBYBLADE')
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local STR0015 = {}
|
||||
local Strategy = {}
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function GetEdgeToMachine( Proc, idFace, vtEdge)
|
||||
local Edge
|
||||
local dBestEdgeAngle = 999
|
||||
for i = 1, #Proc.Faces[idFace].Edges do
|
||||
local dAngle = abs( GetAngle( Proc.Faces[idFace].Edges[i].vtN, vtEdge))
|
||||
if dAngle < dBestEdgeAngle then
|
||||
dBestEdgeAngle = dAngle
|
||||
Edge = Proc.Faces[idFace].Edges[i]
|
||||
end
|
||||
end
|
||||
return Edge
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function GetSawCutData( AuxId, vtNF)
|
||||
-- comincio con la normale a 45deg
|
||||
@@ -131,9 +147,98 @@ end
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function GetEdgeWithCornerStrategy( Proc, Part)
|
||||
local Machining = {}
|
||||
local Result = {}
|
||||
local Result = { dCompletionPercentage = 100}
|
||||
|
||||
local nFirstFacet = 0 -- faccia iniziale
|
||||
local nLastFacet = Proc.nFct - 1 -- faccia finale
|
||||
-- verifico se necessari ripassi agli estremi negli angoli
|
||||
local _, _, _, dFirstAng = EgtSurfTmFacetsContact( Proc.id, nFirstFacet, nFirstFacet + 1, GDB_ID.ROOT)
|
||||
local bFirstTrim = ( dFirstAng and dFirstAng < -30)
|
||||
local _, _, _, dLastAng = EgtSurfTmFacetsContact( Proc.id, nLastFacet, nLastFacet - 1, GDB_ID.ROOT)
|
||||
local bLastTrim = ( dLastAng and dLastAng < -30)
|
||||
local nMidFacet = ( nLastFacet + 1) // 2 -- faccia a metà circa
|
||||
local vtN = EgtSurfTmFacetNormVersor( Proc.id, nMidFacet, GDB_ID.ROOT)
|
||||
|
||||
|
||||
-- se non ci sono angoli da pulire si esce subito
|
||||
if Strategy.Parameters.sConcaveFaceStrategy == 'NONE' or ( not bFirstTrim and not bLastTrim) then
|
||||
return nil, nil
|
||||
end
|
||||
|
||||
local FacesToGet = {}
|
||||
if bFirstTrim then
|
||||
table.insert( FacesToGet, nFirstFacet)
|
||||
table.insert( FacesToGet, nFirstFacet+1)
|
||||
end
|
||||
if bLastTrim then
|
||||
table.insert( FacesToGet, nLastFacet - 1)
|
||||
table.insert( FacesToGet, nLastFacet)
|
||||
end
|
||||
-- ricavo info facce da lavorare
|
||||
Proc.Faces = FaceData.GetFacesInfo( Proc, Part, FacesToGet)
|
||||
|
||||
-- AUTO = preferisce lama. Se non è possibile prende fresa
|
||||
-- BLADE_FORCED = solo lama, altriemnti non applica nulla (potrebbe essere necessario un ribaltamento)
|
||||
-- MILL_FORCED = solo fresa, altriemnti non applica nulla (potrebbe essere necessario un ribaltamento)
|
||||
if Strategy.Parameters.sConcaveFaceStrategy == 'AUTO' or Strategy.Parameters.sConcaveFaceStrategy == 'BLADE_FORCED' then
|
||||
local vtCutDir1
|
||||
if vtN:getZ() > 0.707 then
|
||||
vtCutDir1 = Z_AX()
|
||||
elseif vtN:getZ() < -0.707 then
|
||||
vtCutDir1 = -Z_AX()
|
||||
elseif vtN:getY() > 0.707 then
|
||||
vtCutDir1 = Y_AX()
|
||||
elseif vtN:getY() < -0.707 then
|
||||
vtCutDir1 = -Y_AX()
|
||||
end
|
||||
|
||||
local vtCutDir2
|
||||
if vtN:getX() > 0 then
|
||||
vtCutDir2 = X_AX()
|
||||
else
|
||||
vtCutDir2 = -X_AX()
|
||||
end
|
||||
|
||||
-- TODO c'è una funzione che ritorni l'edge di connessione tra una faccia e un'altra?
|
||||
-- lavorazione faccia 1 spigolo finale
|
||||
if bLastTrim then
|
||||
local EdgeToMachine = GetEdgeToMachine( Proc, nLastFacet+1, vtCutDir1)
|
||||
local Cutting = FaceByBlade.Make( Proc, Part, Proc.Faces[nLastFacet+1], EdgeToMachine)
|
||||
if Cutting then
|
||||
table.insert( Machining, Cutting)
|
||||
end
|
||||
end
|
||||
|
||||
-- lavorazione faccia 1 spigolo iniziale
|
||||
if bFirstTrim then
|
||||
local EdgeToMachine = GetEdgeToMachine( Proc, nFirstFacet+1, vtCutDir1)
|
||||
local Cutting = FaceByBlade.Make( Proc, Part, Proc.Faces[nFirstFacet+1], EdgeToMachine)
|
||||
if Cutting then
|
||||
table.insert( Machining, Cutting)
|
||||
end
|
||||
end
|
||||
|
||||
-- lavorazione faccia 2 spigolo finale
|
||||
if bLastTrim then
|
||||
EdgeToMachine = GetEdgeToMachine( Proc, nLastFacet, vtCutDir2)
|
||||
Cutting = FaceByBlade.Make( Proc, Part, Proc.Faces[nLastFacet], EdgeToMachine)
|
||||
if Cutting then
|
||||
table.insert( Machining, Cutting)
|
||||
end
|
||||
end
|
||||
|
||||
-- lavorazione faccia 2 spigolo iniziale
|
||||
if bFirstTrim then
|
||||
local EdgeToMachine = GetEdgeToMachine( Proc, nFirstFacet, vtCutDir2)
|
||||
local Cutting = FaceByBlade.Make( Proc, Part, Proc.Faces[nFirstFacet], EdgeToMachine)
|
||||
if Cutting then
|
||||
table.insert( Machining, Cutting)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if not Machining or Strategy.Parameters.sConcaveFaceStrategy == 'MILL_FORCED' then
|
||||
-- TODO
|
||||
end
|
||||
|
||||
return Machining, Result
|
||||
@@ -472,7 +577,7 @@ local function GetFeatureResult( Proc)
|
||||
end
|
||||
end
|
||||
-- se lavorazioni corner
|
||||
if not Strategy.EdgeWithCorner.Machinings or #Strategy.EdgeWithCorner.Machinings == 0 then
|
||||
if Strategy.EdgeWithCorner.Machinings and #Strategy.EdgeWithCorner.Machinings == 0 then
|
||||
Result.dCompletionPercentage = Result.dCompletionPercentage - dPercentageEdgeCorner -- la pulizia dei corner incide per il 10%
|
||||
dPercentageEdgeCorner = 0
|
||||
Result.sInfo = Result.sInfo .. '- Corner not executed, material left\n'
|
||||
@@ -606,8 +711,13 @@ function STR0015.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
|
||||
-- lavorazione degli angoli interni
|
||||
if Strategy.EdgeWithCorner.Machinings then
|
||||
for i = 1, #Strategy.EdgeWithCorner.Machinings do
|
||||
local bIsMachiningAdded = MachiningLib.AddMachinings( Proc, Strategy.EdgeWithCorner.Machinings[i])
|
||||
if not bIsMachiningAdded then
|
||||
bAreAllMachiningsAdded = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
-- lavorazione del profilo
|
||||
if Strategy.Profile.Machinings then
|
||||
|
||||
Reference in New Issue
Block a user