Merge branch 'SOLO_DEMO' into develop

This commit is contained in:
andrea.villa
2025-10-29 15:10:32 +01:00
11 changed files with 108 additions and 27 deletions
+19 -6
View File
@@ -230,10 +230,13 @@ if BEAM.FLAG == 0 then
-- TODO valutare se fare script separato
elseif BEAM.FLAG == 9 then
if type( BEAM.FEATUREID) == 'number' then
-- creo un gruppo temporaneo dove finiranno tutte le entità che non bisogna salvare, alla fine lo si cancella
local idTempGroup = BeamLib.CreateTempGroup()
local Part = {}
Part.id = EgtGetParent( EgtGetParent( BEAM.FEATUREID))
Part.b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( Part.id, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
local Proc = FeatureLib.GetProcFromTrimesh( BEAM.FEATUREID, Part)
Proc.nGrp = EgtGetInfo( Proc.id, 'GRP', 'i')
Proc.nPrc = EgtGetInfo( Proc.id, 'PRC', 'i')
@@ -251,8 +254,10 @@ elseif BEAM.FLAG == 9 then
else
BEAM.TOPOLOGY = 'NOT_IMPLEMENTED'
end
-- si cancella gruppo temporaneo contenente entità da cancellare
EgtErase( idTempGroup)
end
return
end
@@ -578,10 +583,9 @@ if bToProcess then
PARTS[i].NotClampableLength = { STD = { dHead = 0, dTail = 0}, SIDE = { dHead = 0, dTail = 0}, DOWN = { dHead = 0, dTail = 0}}
PARTS[i].sBTLInfo = EgtGetInfo( PARTS[i].id, 'PROJ', 's') or nil
-- TODO LE INFO BTL ci devono sempre essere!! ripristinare dopo aver sistemato lettura da BtlInfo
--PARTS[i].sAISetupConfig = EgtGetInfo( PARTS[i].id, 'AISETUP', 's') or GENERAL_PARAMETERS.BTL[PARTS[i].sBTLInfo].sAISetupConfig or GENERAL_PARAMETERS.PROJECT.sAISetupConfig or nil
PARTS[i].sAISetupConfig = EgtGetInfo( PARTS[i].id, 'AISETUP', 's') or GENERAL_PARAMETERS.PROJECT.sAISetupConfig or nil
PARTS[i].sAISetupConfig = EgtGetInfo( PARTS[i].id, 'AISETUP', 's') or
( GENERAL_PARAMETERS.BTL[PARTS[i].sBTLInfo] and GENERAL_PARAMETERS.BTL[PARTS[i].sBTLInfo].sAISetupConfig) or -- i parametri BTL potrebbero non esistere
GENERAL_PARAMETERS.PROJECT.sAISetupConfig or nil
-- si carica configurazione lavorazioni
BeamExec.GetStrategiesFromJSONinBD( PARTS[i].sAISetupConfig)
@@ -634,9 +638,18 @@ if bToProcess then
-- Lavoro le features
if not GetDataConfig() then return end
-- creo un gruppo temporaneo dove finiranno tutte le entità che non bisogna salvare, alla fine lo si cancella
BeamLib.CreateTempGroup()
BeamExec.GetProcessings( PARTS, bCalcBestPieceUnloadPosition)
BeamExec.GetCombinationMatrix( PARTS, bCalcBestPieceUnloadPosition)
BeamExec.ProcessMachinings( PARTS)
-- si cancella gruppo temporaneo contenente entità da cancellare
local idTempGroup = BeamLib.GetTempGroup()
EgtErase( idTempGroup)
local sOutput = ''
-- Scrittura json risultati
+3
View File
@@ -101,6 +101,9 @@ local function GetStrategies_Essetre( Proc)
---------------------------------------------------------------------
-- Feature : Saw Cut (0-13)
elseif ID.IsSawCut( Proc) then
if Proc.Topology.sName == 'Cut-1-Through' or Proc.Topology.sName == 'Bevel-1-Through' then
Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}, { sStrategyId = 'STR0010'}}
end
---------------------------------------------------------------------
-- Feature : Slot (0-16)
elseif ID.IsSlot( Proc) then
+4 -5
View File
@@ -482,12 +482,11 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS, b
PARTS[i].SplittingPoints = BeamLib.GetPartSplittingPoints( PARTS[i])
PARTS[i].NotClampableLength = { STD = { dHead = 0, dTail = 0}, SIDE = { dHead = 0, dTail = 0}, DOWN = { dHead = 0, dTail = 0}}
PARTS[i].dHeadOverMaterial = dDeltaS
PARTS[i].sBTLInfo = EgtGetInfo( PARTS[i].id, 'PROJECT', 's') or nil
-- TODO LE INFO BTL ci devono sempre essere!! ripristinare dopo aver sistemato lettura da BtlInfo
--PARTS[i].sAISetupConfig = EgtGetInfo( PARTS[i].id, 'AISETUP', 's') or GENERAL_PARAMETERS.BTL[PARTS[i].sBTLInfo].sAISetupConfig or GENERAL_PARAMETERS.PROJECT.sAISetupConfig or nil
PARTS[i].sAISetupConfig = EgtGetInfo( PARTS[i].id, 'AISETUP', 's') or GENERAL_PARAMETERS.PROJECT.sAISetupConfig or nil
PARTS[i].sBTLInfo = EgtGetInfo( PARTS[i].id, 'PROJ', 's') or nil
PARTS[i].sAISetupConfig = EgtGetInfo( PARTS[i].id, 'AISETUP', 's') or
( GENERAL_PARAMETERS.BTL[PARTS[i].sBTLInfo] and GENERAL_PARAMETERS.BTL[PARTS[i].sBTLInfo].sAISetupConfig) or -- i parametri BTL potrebbero non esistere
GENERAL_PARAMETERS.PROJECT.sAISetupConfig or nil
-- si carica configurazione lavorazioni
BeamExec.GetStrategiesFromJSONinBD( PARTS[i].sAISetupConfig)
+24 -6
View File
@@ -292,6 +292,24 @@ function BeamLib.CreateOrEmptyAddGroup( PartId)
return true
end
-------------------------------------------------------------------------------------------------------------
function BeamLib.CreateTempGroup()
local idTempGroup = BeamLib.GetTempGroup()
-- se non esiste, lo creo
if not idTempGroup then
idTempGroup = EgtGroup( GDB_ID.ROOT)
EgtSetName( idTempGroup, "#TEMP_GROUP#")
EgtSetLevel( idTempGroup, GDB_LV.TEMP)
end
return idTempGroup
end
-------------------------------------------------------------------------------------------------------------
function BeamLib.GetTempGroup()
local idTempGroup = EgtGetFirstNameInGroup( GDB_ID.ROOT, "#TEMP_GROUP#") or nil
return idTempGroup
end
-------------------------------------------------------------------------------------------------------------
function BeamLib.GetAddGroup( PartId)
-- recupero il nome del gruppo di lavoro corrente
@@ -482,7 +500,7 @@ function BeamLib.GetPieceGeneralParameters( Part, DefaultGeneralParamList)
GeneralParameters[DefaultGeneralParamList[i].sName] = xParameterValue
end
else
if GENERAL_PARAMETERS.BTL and GENERAL_PARAMETERS.BTL[Part.sBTLInfo] and GENERAL_PARAMETERS.BTL[Part.sBTLInfo][DefaultGeneralParamList[i].sName] then
if GENERAL_PARAMETERS.BTL and GENERAL_PARAMETERS.BTL[Part.sBTLInfo] and GENERAL_PARAMETERS.BTL[Part.sBTLInfo][DefaultGeneralParamList[i].sName] ~= nil then
GeneralParameters[DefaultGeneralParamList[i].sName] = GENERAL_PARAMETERS.BTL[Part.sBTLInfo][DefaultGeneralParamList[i].sName]
elseif GENERAL_PARAMETERS.PROJECT[DefaultGeneralParamList[i].sName] then
GeneralParameters[DefaultGeneralParamList[i].sName] = GENERAL_PARAMETERS.PROJECT[DefaultGeneralParamList[i].sName]
@@ -497,11 +515,11 @@ end
local function GetInheritedParameter( Part, sSourceParamName)
local sValue = nil
if sSourceParamName and #sSourceParamName > 0 then
if Part.GeneralParameters[sSourceParamName] then
if Part.GeneralParameters[sSourceParamName] ~= nil then
sValue = Part.GeneralParameters[sSourceParamName]
elseif GENERAL_PARAMETERS.BTL and GENERAL_PARAMETERS.BTL[Part.sBTLInfo] and GENERAL_PARAMETERS.BTL[Part.sBTLInfo][sSourceParamName] then
elseif GENERAL_PARAMETERS.BTL and GENERAL_PARAMETERS.BTL[Part.sBTLInfo] and GENERAL_PARAMETERS.BTL[Part.sBTLInfo][sSourceParamName] ~= nil then
sValue = GENERAL_PARAMETERS.BTL[Part.sBTLInfo][sSourceParamName]
elseif GENERAL_PARAMETERS.PROJECT[sSourceParamName] then
elseif GENERAL_PARAMETERS.PROJECT[sSourceParamName] ~= nil then
sValue = GENERAL_PARAMETERS.PROJECT[sSourceParamName]
end
end
@@ -593,13 +611,13 @@ function BeamLib.LoadGeneralParametersInList( DefaultGeneralParamList)
-- aggiornamento parametri BTL
local BTLInfo = EgtGetNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL
for j = 1, #BTLInfo do
local BTLName = EgtGetInfo( BTLInfo[j], 'PROJECT', 's')
local BTLName = EgtGetInfo( BTLInfo[j], 'PROJ', 's')
if BTLName then
UpdatedParameters.BTL[BTLName] = {}
UpdatedParameters.BTL[BTLName].sAISetupConfig = EgtGetInfo( BTLInfo[j], 'AISETUP', 's') or nil
for i = 1, #DefaultGeneralParamList do
local sParamNameNGE = DefaultGeneralParamList[i].sNameNge
local xParameterValue = EgtGetInfo( BTLInfo[j], sParamNameNGE, 's') or DefaultGeneralParamList[i].sValue
local xParameterValue = EgtGetInfo( BTLInfo[j], sParamNameNGE, 's')
-- salvataggio dato su lista con accesso diretto
if DefaultGeneralParamList[i].sType == 'b' then
UpdatedParameters.BTL[BTLName][DefaultGeneralParamList[i].sName] = xParameterValue == 'true' or xParameterValue == '1' or xParameterValue == true
+39 -3
View File
@@ -50,6 +50,39 @@ local function IsFeatureCuttingEntireLength( b3Proc, Part)
( b3Proc:getDimZ() > ( Part.b3Part:getDimZ() - 500 * GEO.EPS_SMALL) and b3Proc:getDimX() > ( Part.b3Part:getDimX() - 500 * GEO.EPS_SMALL)))
end
-------------------------------------------------------------------------------------------------------------
-- restituisce vero se tutti i lati della faccia passata si trovano sul grezzo
local function AreAllFaceEdgesOnRaw( Part, Proc, idFace)
local bEdgeOnRaw = true
local idTempGroup = BeamLib.GetTempGroup()
local nLoopId, nLoopCnt = EgtExtractSurfTmFacetLoops( Proc.id, idFace, idTempGroup)
if nLoopCnt > 1 then
error( 'AreAllFaceEdgesOnRaw : too many loops')
end
if nLoopId then
local dUmin, dUmax = EgtCurveDomain( nLoopId)
for dU = dUmin, dUmax-1 do
local ptMid = ( EgtUP( nLoopId, dU, GDB_ID.ROOT) + EgtUP( nLoopId, dU+1, GDB_ID.ROOT)) / 2
-- se punto medio dell'entita NON si trova su faccia testa o coda
if ptMid:getX() < Part.b3Part:getMin():getX() + 100 * GEO.EPS_SMALL or ptMid:getX() > Part.b3Part:getMax():getX() - 100 * GEO.EPS_SMALL or
ptMid:getY() < Part.b3Part:getMin():getY() + 100 * GEO.EPS_SMALL or ptMid:getY() > Part.b3Part:getMax():getY() - 100 * GEO.EPS_SMALL or
ptMid:getZ() < Part.b3Part:getMin():getZ() + 100 * GEO.EPS_SMALL or ptMid:getZ() > Part.b3Part:getMax():getZ() - 100 * GEO.EPS_SMALL then
bEdgeOnRaw = true
else
bEdgeOnRaw = false
break
end
end
--for j = 1, nLoopCnt do
-- EgtErase( nLoopId + j - 1)
--end
end
return bEdgeOnRaw
end
---------------------------------------------------------------------
-- recupero topologia della feature
function FeatureLib.NeedTopologyFeature( Proc, Part)
@@ -85,9 +118,7 @@ function FeatureLib.NeedTopologyFeature( Proc, Part)
elseif ID.IsStepJointNotch( Proc) then -- (0-80)
return true
-- feature con calcolo topologia da geometria SOLO se rispettano certe condizioni, altrimenti riconoscimento specifico
elseif ID.IsSawCut( Proc) and Proc.nFct == 1
and ( IsFeatureCuttingEntireSection( Proc.b3Box, Part)
or IsFeatureCuttingEntireLength( Proc.b3Box, Part)) then -- (0-13)
elseif ID.IsSawCut( Proc) and Proc.nFct == 1 and AreAllFaceEdgesOnRaw( Part, Proc, 0) then
return true
elseif ID.IsHipValleyRafterNotch( Proc) and Proc.nFct < 4 then -- (0-25)
return true
@@ -908,6 +939,11 @@ function FeatureLib.CalculateFeatureNotClampableLengths( Proc, Part)
local dNotClampableLengthHead = 0
local dNotClampableLengthTail = 0
-- se il grezzo non è definito, prendo il box del pezzo
if not Part.b3Raw then
Part.b3Raw = Part.b3Part
end
-- TODO se la feature ha più di 3 facce non viene mai calcolato!! Es. Tenone ecc....
if Proc.nFct < 3 then
-- eventuale segnalazione ingombro di testa o coda
+8
View File
@@ -79,6 +79,7 @@ PARTS = {} -- tabella contenente tutte le informazioni di ogni pezzo
local BeamData = require( 'BeamData')
-- carico librerie
local BeamExec = require( 'BeamExec')
local BeamLib = require( 'BeamLib')
-- Variabili di modulo
local dRawW
@@ -299,6 +300,9 @@ end
-- *** Inserimento delle lavorazioni nelle travi ***
-------------------------------------------------------------------------------------------------------------
local function MyProcessFeatures()
-- creo un gruppo temporaneo dove finiranno tutte le entità che non bisogna salvare, alla fine lo si cancella
local idTempGroup = BeamLib.CreateTempGroup()
BeamExec.GetProcessings( PARTS, bCalcBestPieceUnloadPosition)
BeamExec.GetCombinationMatrix( PARTS, bCalcBestPieceUnloadPosition)
BeamExec.ProcessMachinings( PARTS)
@@ -342,6 +346,10 @@ local function MyProcessFeatures()
end
end
end
-- cancello gruppo temporaneo
EgtErase( idTempGroup)
if #sOutput > 0 then EgtOutLog( sOutput) end
if nErrCnt > 0 then
EgtOutBox( sOutput, 'Lavora Travi', 'ERRORS')
+5 -1
View File
@@ -61,7 +61,11 @@
"nPrc": 13,
"nGrp": 0,
"TopologyList" : [
{ "sName": "Feature",
{ "sName": "Cut-1-Through",
"sImage": "ConfigStrategy\\Cut-1-Through.png",
"StrategyList" : [ { "sStrategyId": "STR0002" }, { "sStrategyId": "STR0005" }, { "sStrategyId": "STR0010" } ]
},
{ "sName": "Bevel-1-Through",
"sImage": "ConfigStrategy\\Cut-1-Through.png",
"StrategyList" : [ { "sStrategyId": "STR0002" }, { "sStrategyId": "STR0005" }, { "sStrategyId": "STR0010" } ]
}
+1 -1
View File
@@ -94,7 +94,7 @@
"nGroup": "MACHINING STRATEGY",
"sName": "GEN_bReduceBladePath",
"sNameNge": "REDUCE_BLADE_PATH",
"sValue": "false",
"sValue": "true",
"sDescriptionShort": "Use entire blade diameter to shorten path",
"sDescriptionLong": "",
"sType": "b",
+1 -1
View File
@@ -25,7 +25,7 @@
{
"sName": "bExecutePreCut",
"sNameNge": "EXEC_PRECUT",
"sValue": "true",
"sValue": "false",
"sDescriptionShort": "Force to add PreCuts",
"sDescriptionLong": "Autocam will apply a machining on the theoretical zero, to avoid collision if the theoretical piece length doesn't correspond to the real length",
"sType": "b",
+1 -1
View File
@@ -1,5 +1,5 @@
{
"sStrategyId": "STR0009",
"sStrategyId": "STR0015",
"sStrategyName": "Mill Heading",
"ParameterList" : [
{
+3 -3
View File
@@ -209,7 +209,7 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters)
-- taglio eventuali facce di chiusura
for i = 1, #LongFaces do
local Cutting = {}
local OptionalParametersFaceByBlade = { bIsSplitFeature = bIsSplitFeature, dExtendAfterTail = dExtendAfterTail, nToolIndex = nToolIndex}
local OptionalParametersFaceByBlade = { bIsSplitFeature = bIsSplitFeature, dExtendAfterTail = 9999, nToolIndex = nToolIndex}
Cutting = FaceByBlade.Make( Proc, Part, LongFaces[i], LongFaces[i].MainEdges.BottomEdge, OptionalParametersFaceByBlade)
Cutting.nInternalSortingPriority = 1
Cutting.dResultWeight = 0.15
@@ -217,7 +217,7 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters)
end
-- taglio con codolo faccia di fondo
local dDepthToMachine = BottomEdgeToMachine.dElevation / 2 - OptionalParameters.dStripWidth / 2
local dDepthToMachine = BottomEdgeToMachine.dElevation - OptionalParameters.dStripWidth
local OptionalParametersFaceByBlade = { dDepthToMachine = dDepthToMachine, bIsSplitFeature = bIsSplitFeature, dExtendAfterTail = dExtendAfterTail, nToolIndex = nToolIndex}
-- primo lato
Cutting1 = FaceByBlade.Make( Proc, Part, BottomFace, BottomEdgeToMachine, OptionalParametersFaceByBlade)
@@ -229,7 +229,7 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters)
Cutting2 = FaceByBlade.Make( Proc, Part, BottomFace, BottomEdgeToMachine, OptionalParametersFaceByBlade)
Cutting2.nInternalSortingPriority = 3
Cutting2.dResultWeight = 0.3
table.insert( CalculatedMachinings, Cutting2)
--table.insert( CalculatedMachinings, Cutting2)
-- fresatura eventuali facce di chiusura
if bFinishWithMill then