Merge branch 'Feature/FindMirroredFeatures' into develop
This commit is contained in:
+143
-74
@@ -955,7 +955,7 @@ local function ClassifyFeatures( vProc, b3Raw, Stats)
|
||||
end
|
||||
|
||||
-- se senza geometria (già disabilitato
|
||||
if Proc.Flg == 0 then
|
||||
if Proc.Flg == 0 and not Proc.Double then
|
||||
bOk = false
|
||||
-- se intestatura
|
||||
elseif Hcut.Identify( Proc) then
|
||||
@@ -1370,88 +1370,162 @@ local function MoveDrillsOnTenon( vProc)
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- Estrazione parametri P da lavorazioni di tipo DtMortise
|
||||
local function GetPParametersDtMortise( Proc)
|
||||
local vPParameters = {
|
||||
{ 'P01', 'd'},
|
||||
{ 'P02', 'd'},
|
||||
{ 'P03', 'd'},
|
||||
{ 'P04', 'i'},
|
||||
{ 'P05', 'i'},
|
||||
{ 'P06', 'd'},
|
||||
{ 'P07', 'd'},
|
||||
{ 'P09', 'd'},
|
||||
{ 'P10', 'd'},
|
||||
{ 'P11', 'd'},
|
||||
{ 'P12', 'd'},
|
||||
{ 'P13', 'd'},
|
||||
{ 'P14', 'd'},
|
||||
{ 'P15', 'd'}
|
||||
}
|
||||
for i = 1, #vPParameters do
|
||||
vPParameter = vPParameters[i]
|
||||
vPParameter[3] = EgtGetInfo( Proc.Id, vPParameter[1], vPParameter[2])
|
||||
end
|
||||
return vPParameters
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- Controlla se la feature ProcMirror è la specchiata di Proc, per feature di tipo DtMortise
|
||||
local function CheckMirrorDtMortise( Proc, ProcMirror, dHBeam)
|
||||
local function CheckMirrorDtMortise( Proc, ProcMirror, b3Raw, AuxId)
|
||||
local bIsMirror = true
|
||||
local vPParametersProc = GetPParametersDtMortise( Proc)
|
||||
local vPParametersMirror = GetPParametersDtMortise( ProcMirror)
|
||||
local nP02, nP06 = 2, 6
|
||||
-- controllo che i parametri P delle due feature, tranne P02 e P06, siano uguali
|
||||
for i = 1, #vPParametersProc do
|
||||
local vPParameterProc = vPParametersProc[i]
|
||||
local vPParameterMirror = vPParametersMirror[i]
|
||||
if vPParameterProc[1] ~= 'P02' and vPParameterProc[1] ~= 'P06'then
|
||||
bIsMirror = ( abs( vPParameterProc[3] - vPParameterMirror[3]) < 100 * GEO.EPS_SMALL)
|
||||
if bIsMirror == false then break end
|
||||
elseif vPParameterProc[1] == 'P02' then
|
||||
nP02 = i
|
||||
elseif vPParameterProc[1] == 'P06' then
|
||||
nP06 = i
|
||||
end
|
||||
|
||||
-- recupero i dati geometrici della curva Proc
|
||||
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
||||
local ptBC = EgtGP( AuxId, GDB_RT.GLOB)
|
||||
local rfDtMrt = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0, GDB_RT.GLOB)
|
||||
local b3DtMrt = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, rfDtMrt)
|
||||
-- determino l'asse della curva Proc
|
||||
local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB)
|
||||
|
||||
-- recupero e verifico l'entità curva ProcMirror
|
||||
local AuxIdMirror = EgtGetInfo( ProcMirror.Id, 'AUXID', 'i')
|
||||
if AuxIdMirror then AuxIdMirror = AuxIdMirror + ProcMirror.Id end
|
||||
if not AuxIdMirror or ( EgtGetType( AuxIdMirror) & GDB_FY.GEO_CURVE) == 0 then
|
||||
bIsMirror = false
|
||||
end
|
||||
-- se gli altri parametri P sono uguali, verifico che P02 e P06 siano compatibili con feature specchiate
|
||||
if bIsMirror == true then
|
||||
bIsMirror = ( ( vPParametersProc[nP02][3] == 0 and abs( vPParametersMirror[nP02][3] - dHBeam) < 100 * GEO.EPS_SMALL) and
|
||||
( vPParametersProc[nP06][3] == 90 and vPParametersMirror[nP06][3] == -90)) or
|
||||
( ( vPParametersMirror[nP02][3] == 0 and abs( vPParametersProc[nP02][3] - dHBeam) < 100 * GEO.EPS_SMALL) and
|
||||
( vPParametersMirror[nP06][3] == 90 and vPParametersProc[nP06][3] == -90))
|
||||
-- recupero i dati geometrici della curva ProcMirror
|
||||
local vtExtrMirror = EgtCurveExtrusion( AuxIdMirror, GDB_RT.GLOB)
|
||||
local ptBCMirror = EgtGP( AuxIdMirror, GDB_RT.GLOB)
|
||||
local b3DtMrtMirror = EgtGetBBoxRef( ProcMirror.Id, GDB_BB.STANDARD, rfDtMrt)
|
||||
-- determino l'asse della curva ProcMirror
|
||||
local vtAxMirror = EgtEV( AuxIdMirror, GDB_RT.GLOB) - EgtSV( AuxIdMirror, GDB_RT.GLOB)
|
||||
|
||||
-- verifico se le mortase sono specchiate
|
||||
if bIsMirror then
|
||||
local vtDisplacement = ptBC - ptBCMirror
|
||||
local ptCenRaw = b3Raw:getCenter()
|
||||
-- controllo che il centro delle due mortase sia allineato e che queste siano equidistanti dalla mezzeria della trave
|
||||
if AreSameOrOppositeVectorApprox( vtExtr, Y_AX()) then
|
||||
bIsMirror = abs( vtDisplacement:getX()) < 500 * GEO.EPS_SMALL and abs( vtDisplacement:getZ()) < 500 * GEO.EPS_SMALL and
|
||||
( abs( ptBC:getY() - ptCenRaw:getY()) - abs( ptBCMirror:getY() - ptCenRaw:getY())) < 500 * GEO.EPS_SMALL
|
||||
elseif AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then
|
||||
bIsMirror = abs( vtDisplacement:getX()) < 500 * GEO.EPS_SMALL and abs( vtDisplacement:getY()) < 500 * GEO.EPS_SMALL and
|
||||
( abs( ptBC:getZ() - ptCenRaw:getZ()) - abs( ptBCMirror:getZ() - ptCenRaw:getZ())) < 500 * GEO.EPS_SMALL
|
||||
end
|
||||
-- controllo che le dimensioni dei due box siano le stesse
|
||||
bIsMirror = bIsMirror and abs( b3DtMrt:getDimX() - b3DtMrtMirror:getDimX()) < 500 * GEO.EPS_SMALL and
|
||||
abs( b3DtMrt:getDimY() - b3DtMrtMirror:getDimY()) < 500 * GEO.EPS_SMALL and
|
||||
abs( b3DtMrt:getDimZ() - b3DtMrtMirror:getDimZ()) < 500 * GEO.EPS_SMALL
|
||||
-- controllo che l'asse delle due mortase sia allineato
|
||||
bIsMirror = bIsMirror and AreSameVectorApprox( vtAx, vtAxMirror)
|
||||
end
|
||||
return bIsMirror
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- Cerca se esiste una feature specchiata di Proc e nel caso ne restituisce la posizione in vProc
|
||||
local function FindMirrorFeature( vProc, Proc, sFeatureType, dHBeam)
|
||||
local nProcMirror
|
||||
-- Verifica se Proc è lavorabile in doppio e nel caso ne restituisce la direzione di specchiatura.
|
||||
local function IsFeatureMirrored( vProc, Proc, sFeatureType, b3Raw)
|
||||
local nDouble = 0
|
||||
-- se mortasa a coda di rondine
|
||||
if sFeatureType == 'DtMortise' then
|
||||
Proc.Side = EgtGetInfo( Proc.Id, 'SIDE', 'i')
|
||||
-- recupero e verifico l'entità curva
|
||||
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
|
||||
if AuxId then AuxId = AuxId + Proc.Id end
|
||||
if not AuxId or ( EgtGetType( AuxId) & GDB_FY.GEO_CURVE) == 0 then
|
||||
local sErr = 'Missing profile geometry : Error on DtMortise ' .. tostring( Proc.Id)
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- recupero i dati geometrici della curva
|
||||
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
||||
local bPocket = ( EgtGetInfo( Proc.Id, 'P05', 'i') == 1)
|
||||
-- recupero il raggio minimo della mortasa
|
||||
local dMinRad = 1000
|
||||
local nSt, nEnd = EgtCurveDomain( AuxId)
|
||||
for i = nSt, nEnd - 1 do
|
||||
local dRad = EgtCurveCompoRadius( AuxId, i)
|
||||
if dRad > 0 and dRad < dMinRad then
|
||||
dMinRad = dRad
|
||||
end
|
||||
end
|
||||
local dMaxDiam = 2 * dMinRad
|
||||
local sMilling = ML.FindMilling( 'DtMortise', nil, nil, dMaxDiam, nil, true, false, _, true)
|
||||
if sMilling then EgtMdbSetCurrMachining( sMilling) end
|
||||
local sToolDoubleName = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'TOOLDOUBLE', 's')
|
||||
-- verifico che l'utensile indicato abbia un diametro coerente con la curva
|
||||
local dToolDoubleDiam = 9999
|
||||
if sToolDoubleName and EgtTdbSetCurrTool( sToolDoubleName) then
|
||||
dToolDoubleDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM, 'd')
|
||||
end
|
||||
if dToolDoubleDiam < dMaxDiam + GEO.EPS_SMALL and ( AreSameOrOppositeVectorApprox( vtExtr, Y_AX()) or AreSameOrOppositeVectorApprox( vtExtr, Z_AX())) and not bPocket then
|
||||
for i = 1, #vProc do
|
||||
local ProcMirror = vProc[i]
|
||||
if DtMortise.SideIdentify(ProcMirror) then
|
||||
ProcMirror.Side = EgtGetInfo( ProcMirror.Id, 'SIDE', 'i')
|
||||
if ( Proc.Side == 1 and ProcMirror.Side == 3) or ( Proc.Side == 3 and ProcMirror.Side == 1) or
|
||||
( Proc.Side == 2 and ProcMirror.Side == 4) or ( Proc.Side == 4 and ProcMirror.Side == 2) then
|
||||
local bIsMirror = CheckMirrorDtMortise( Proc, ProcMirror, dHBeam)
|
||||
if bIsMirror then nProcMirror = i end
|
||||
if DtMortise.SideIdentify(ProcMirror) and ProcMirror.Id ~= Proc.Id then
|
||||
if CheckMirrorDtMortise( Proc, ProcMirror, b3Raw, AuxId) then
|
||||
if AreSameVectorApprox( vtExtr, Y_AX()) then
|
||||
nDouble = 2
|
||||
elseif AreSameVectorApprox( vtExtr, Z_AX()) then
|
||||
nDouble = 3
|
||||
else
|
||||
Proc.Flg = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se foratura
|
||||
elseif sFeatureType == 'Drill' then
|
||||
-- recupero e verifico l'entità foro
|
||||
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0
|
||||
if AuxId then AuxId = AuxId + Proc.Id end
|
||||
if not AuxId or EgtGetType( AuxId) ~= GDB_TY.CRV_ARC then
|
||||
local sErr = 'Error : missing drill geometry'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- recupero direzione e dimensioni del foro
|
||||
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
||||
local dDiam = 2 * EgtArcRadius( AuxId)
|
||||
local dLen = abs( EgtCurveThickness( AuxId))
|
||||
local dMachiningDepth = dLen / 2 + BD.DRILL_OVERLAP
|
||||
-- verifico che l'utensile di foratura abbia indicato il suo doppio nelle note
|
||||
local sDrilling, sType, dMaxDepth = ML.FindDrilling( dDiam, dMachiningDepth, true, false, true)
|
||||
if not sDrilling then
|
||||
sDrilling, sType, dMaxDepth = ML.FindDrilling( dDiam, 0, true, false, true)
|
||||
dMachiningDepth = dMaxDepth or dMachiningDepth
|
||||
end
|
||||
local sToolDoubleName
|
||||
if sDrilling and sType == 'Drill' and EgtMdbSetCurrMachining( sDrilling) then
|
||||
EgtTdbSetCurrTool( EgtMdbGetCurrMachiningParam( MCH_MP.TOOL))
|
||||
sToolDoubleName = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'TOOLDOUBLE', 's')
|
||||
end
|
||||
-- verifico le dimensioni dell'utensile indicato
|
||||
local dToolDoubleDiam = 0
|
||||
local dMaxDepthDouble = 0
|
||||
if sToolDoubleName and EgtTdbSetCurrTool( sToolDoubleName) and EgtTdbGetCurrToolParam( MCH_TP.TYPE, 'd') == MCH_TY.DRILL_STD then
|
||||
if EgtTdbGetCurrToolParam( MCH_TP.ACTIVE) then
|
||||
dToolDoubleDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM, 'd')
|
||||
dMaxDepthDouble = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
|
||||
end
|
||||
end
|
||||
dMachiningDepth = min( dMachiningDepth, dMaxDepthDouble)
|
||||
if abs( Proc.Flg) == 2 and dToolDoubleDiam < dDiam + 10 * GEO.EPS_SMALL and dToolDoubleDiam > dDiam - BD.DRILL_TOL - 10 * GEO.EPS_SMALL then
|
||||
if Proc.Flg == -2 then vtExtr = vtExtr * -1 end
|
||||
if Proc.Fce ~= 0 then
|
||||
if AreSameVectorApprox( vtExtr, Y_AX()) then
|
||||
nDouble = 2
|
||||
Proc.MachDepthDouble = dMachiningDepth
|
||||
elseif AreSameVectorApprox( vtExtr, Z_AX()) and BD.DOWN_HEAD then
|
||||
nDouble = 3
|
||||
Proc.MachDepthDouble = dMachiningDepth
|
||||
elseif AreSameOrOppositeVectorApprox( vtExtr, Y_AX()) or ( AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) and BD.DOWN_HEAD) then
|
||||
Proc.Flg = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se foratura (da implementare)
|
||||
return nProcMirror
|
||||
return nDouble
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- Cerca in vProc la presenza di feature specchiate. Se le trova scrive in Proc e nelle info l'Id della specchiata.
|
||||
local function SetMirroredFeatures( vProc, dHBeam)
|
||||
-- Cerca in vProc la presenza di feature da lavorare in doppio. Se le trova scrive in Proc la direzione di specchiatura e l'utensile da utilizzare.
|
||||
local function SetMirroredFeatures( vProc, b3Raw)
|
||||
for i = 1, #vProc do
|
||||
local Proc = vProc[i]
|
||||
local sFeatureType
|
||||
@@ -1460,14 +1534,10 @@ local function SetMirroredFeatures( vProc, dHBeam)
|
||||
elseif Drill.Identify(Proc) then
|
||||
sFeatureType = 'Drill'
|
||||
end
|
||||
if ( sFeatureType == 'DtMortise' or sFeatureType == 'Drill') and not Proc.MirrorId then
|
||||
local nProcMirror = FindMirrorFeature( vProc, Proc, sFeatureType, dHBeam)
|
||||
if nProcMirror then
|
||||
Proc.MirrorId = vProc[nProcMirror].Id
|
||||
vProc[nProcMirror].MirrorId = Proc.Id
|
||||
EgtSetInfo( Proc.Id, 'MIRRORID', vProc[nProcMirror].Id)
|
||||
EgtSetInfo( vProc[nProcMirror].Id, 'MIRRORID', Proc.Id)
|
||||
end
|
||||
if ( sFeatureType == 'DtMortise' and BD.DOUBLE_HEAD_DOVETAIL) or ( sFeatureType == 'Drill' and BD.DOUBLE_HEAD_DRILLING) then
|
||||
local nDouble = IsFeatureMirrored( vProc, Proc, sFeatureType, b3Raw)
|
||||
-- 0: nessuna specchiatura, 1: specchiatura X, 2: specchiatura Y, 3: specchiatura Z
|
||||
Proc.Double = nDouble
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1567,9 +1637,8 @@ function BeamExec.ProcessFeatures()
|
||||
SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeIntersectingDrillings)
|
||||
end
|
||||
-- verifica presenza di feature specchiate per eventuali lavorazioni simultanee
|
||||
local bConcurrentDoubleHead = BD.DOUBLE_HEAD_MIRRORED_FEATURES and ( BD.TWO_EQUAL_HEADS or BD.TWO_UP_DOWN_HEADS)
|
||||
if bConcurrentDoubleHead then
|
||||
SetMirroredFeatures( vProc, EgtGetRawPartBBox( nRawId):getDimZ())
|
||||
if BD.TWO_EQUAL_HEADS or BD.DOWN_HEAD then
|
||||
SetMirroredFeatures( vProc, b3Raw)
|
||||
end
|
||||
-- le ordino lungo X
|
||||
OrderFeatures( vProc, b3Raw)
|
||||
|
||||
@@ -224,7 +224,7 @@ function ReturnParams( MachiningType, MachiningName, sType, ToolParams)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead, bExcludeH3)
|
||||
local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead, bExcludeH3, bExcludeH2)
|
||||
if bTopHead == nil and bDownHead == nil then
|
||||
bTopHead = true
|
||||
bDownHead = false
|
||||
@@ -276,7 +276,7 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead,
|
||||
end
|
||||
-- recupero dati utensile
|
||||
local bToolActive, sToolName, bH2, bFixed, bH3 = SetCurrMachiningAndTool( Machining.Name)
|
||||
if Machining.On and sMachiningType == sType and bToolActive and ( not bH3 or bH3 == not bExcludeH3) then
|
||||
if Machining.On and sMachiningType == sType and bToolActive and ( not bH3 or bH3 == not bExcludeH3) and ( not bH2 or bH2 == not bExcludeH2) then
|
||||
local bOk, ToolParams = VerifyTool( MachiningType, sType, Params, bH2)
|
||||
if bOk then
|
||||
if MachineHeadUse == ONE_HEAD then
|
||||
@@ -367,8 +367,8 @@ function MachiningLib.FindCutting( sType, bTopHead, bDownHead)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function MachiningLib.FindDrilling( dDiam, dDepth, bTopHead, bDownHead)
|
||||
local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, 'Drill', { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead)
|
||||
function MachiningLib.FindDrilling( dDiam, dDepth, bTopHead, bDownHead, bExcludeH2)
|
||||
local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, 'Drill', { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead, _, bExcludeH2)
|
||||
if not MachiningName or MachiningName == '' then
|
||||
MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, 'Pocket', { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead)
|
||||
end
|
||||
@@ -386,8 +386,8 @@ function MachiningLib.FindAngleDrilling( dDiam, dDepth, bTopHead, bDownHead)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bTopHead, bDownHead, bExcludeH3)
|
||||
return FindMachining( MCH_MY.MILLING, sType, { Depth = dDepth, TuuidMstr = sTuuidMstr, MaxDiam = dMaxDiam, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead, bExcludeH3)
|
||||
function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bTopHead, bDownHead, bExcludeH3, bExcludeH2)
|
||||
return FindMachining( MCH_MY.MILLING, sType, { Depth = dDepth, TuuidMstr = sTuuidMstr, MaxDiam = dMaxDiam, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead, bExcludeH3, bExcludeH2)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- ProcessCut.lua by Egaltech s.r.l. 2022/09/30
|
||||
-- ProcessCut.lua by Egaltech s.r.l. 2022/12/19
|
||||
-- Gestione calcolo singoli tagli di lama per Travi
|
||||
-- 2021/05/18 I due tagli con testa da sotto di un cubetto sono fatti di seguito.
|
||||
-- 2021/06/06 Correzioni per tagli con testa da sotto.
|
||||
@@ -284,9 +284,9 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
-- se la faccia occupa tutta la trave in X e Z o occupa sicuramente la faccia in Z e almeno 3/4 della faccia in X e sborda in X,
|
||||
if ( ( abs( Proc.Box:getMin():getX() - b3Solid:getMin():getX()) < 10*GEO.EPS_SMALL and abs( Proc.Box:getMax():getX() - b3Solid:getMax():getX()) < 10*GEO.EPS_SMALL) or
|
||||
( ( abs( Proc.Box:getMin():getX() - b3Solid:getMin():getX()) < 10*GEO.EPS_SMALL or abs( Proc.Box:getMax():getX() - b3Solid:getMax():getX()) < 10*GEO.EPS_SMALL) and
|
||||
Proc.Box:getDimX() > 0.75 * b3Solid:getDimX())) and
|
||||
Proc.Box:getDimX() > 0.90 * b3Solid:getDimX())) and
|
||||
abs( Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()) < 10*GEO.EPS_SMALL and abs( Proc.Box:getMax():getZ() - b3Solid:getMax():getZ()) < 10*GEO.EPS_SMALL then
|
||||
local sErr = 'Error : Impossible to machine by orientation (on side)'
|
||||
local sErr = 'Error : Impossible to machine by orientation (on side A)'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
@@ -304,7 +304,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
-- se la faccia termina davanti o dietro la trave e arriva in coda e non interessa la faccia inferiore, forzo il taglio a cubetti a partire dal davanti
|
||||
if ( abs( Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()) < 10*GEO.EPS_SMALL or abs( Proc.Box:getMax():getZ() - b3Solid:getMax():getZ()) < 10*GEO.EPS_SMALL) and
|
||||
abs( Proc.Box:getMin():getX() - b3Solid:getMin():getX()) < 10*GEO.EPS_SMALL then
|
||||
local sErr = 'Error : Impossible to machine by orientation (on side)'
|
||||
local sErr = 'Error : Impossible to machine by orientation (on side B)'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
|
||||
@@ -269,11 +269,17 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
|
||||
-- abilitazione foratura da sotto
|
||||
local bDrillDown = ( bDownDrill and ( Proc.Down or vtExtr:getZ() < -0.1 or vtExtr:getZ() < 0.259))
|
||||
local bDrillUp = ( bDownDrill and vtExtr:getZ() > -0.421)
|
||||
local bExcludeH2 = false
|
||||
if Proc.Double and Proc.Double > 0 then
|
||||
bMillUp = true
|
||||
bDrillDown = false
|
||||
bExcludeH2 = true
|
||||
end
|
||||
-- primo gruppo di controlli con lunghezza utensile pari a metà foro se passante
|
||||
-- recupero la lavorazione
|
||||
local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown)
|
||||
local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown, bExcludeH2)
|
||||
if not sDrilling and dCheckDepth then
|
||||
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown)
|
||||
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown, bExcludeH2)
|
||||
if sDrilling then dCheckDepth = nil end
|
||||
end
|
||||
if not sDrilling then
|
||||
@@ -393,7 +399,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
|
||||
local dMaxElev
|
||||
local sMyWarn
|
||||
-- se c'è un taglio precedente di testa o coda in cui il foro "entra" devo ricalcolare i dati della foratura
|
||||
if (( Proc.MachineAfterHeadCutId and vtExtr:getX() > 0) or ( Proc.MachineAfterTailCutId and vtExtr:getX() < 0)) then
|
||||
if ( not Proc.Double or Proc.Double == 0) and(( Proc.MachineAfterHeadCutId and vtExtr:getX() > 0) or ( Proc.MachineAfterTailCutId and vtExtr:getX() < 0)) then
|
||||
local bIntersectionOk, _, vDistance = EgtLineSurfTmInters( ptCen, -vtExtr, Proc.MachineAfterHeadCutId or Proc.MachineAfterTailCutId, GDB_RT.GLOB)
|
||||
if bIntersectionOk then
|
||||
local dHoleToCutDistance = vDistance[1]
|
||||
@@ -463,6 +469,11 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
-- imposto affondamento
|
||||
if Proc.Double and Proc.Double > 0 and dDepth > Proc.MachDepthDouble + 10 * GEO.EPS_SMALL then
|
||||
sMyWarn = 'Warning in double head drilling : depth (' .. EgtNumToString( dDepth, 1) .. ') reduced to (' .. EgtNumToString( Proc.MachDepthDouble, 1) .. ') to match H2 max tool depth'
|
||||
dDepth = Proc.MachDepthDouble
|
||||
dMaxElev = Proc.MachDepthDouble
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||
-- imposto il valore della distanza di sicurezza per l'attacco. Se il valore del db utensili è troppo basso lo alzo a 10.
|
||||
local dToolDbStartPos = EgtGetMachiningParam( MCH_MP.STARTPOS)
|
||||
@@ -480,10 +491,10 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
|
||||
sUserNotes = sUserNotes .. 'Open=1;'
|
||||
end
|
||||
-- se lavorazione in doppio
|
||||
if EgtExistsInfo( Proc.Id, 'MAIN') then
|
||||
sUserNotes = sUserNotes .. 'Double;'
|
||||
elseif EgtExistsInfo( Proc.Id, 'DOU') then
|
||||
sUserNotes = sUserNotes .. 'Main;'
|
||||
if Proc.Double and Proc.Double > 0 then
|
||||
local sToolNameDouble = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'TOOLDOUBLE', 's')
|
||||
sUserNotes = sUserNotes .. 'DOUBLE=' .. Proc.Double .. ','
|
||||
sUserNotes = sUserNotes .. sToolNameDouble .. ';'
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
||||
-- eseguo
|
||||
|
||||
@@ -232,10 +232,16 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
elseif bMillAngTrasm then
|
||||
sMchExt = '_AT'
|
||||
end
|
||||
local bExcludeH2 = false
|
||||
if Proc.Double and Proc.Double > 0 then
|
||||
bMillUp = true
|
||||
bMillDown = false
|
||||
bExcludeH2 = true
|
||||
end
|
||||
-- recupero la lavorazione : prima ricerca per sola tipologia
|
||||
local sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, nil, nil, bMillUp, bMillDown)
|
||||
local sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, nil, nil, bMillUp, bMillDown, _, bExcludeH2)
|
||||
if not sMilling and bMillUp then
|
||||
sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown)
|
||||
sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown, _, bExcludeH2)
|
||||
end
|
||||
if not sMilling then
|
||||
local sErr = 'Milling not found in library : Error on DtMortise ' .. tostring( Proc.Id)
|
||||
@@ -243,9 +249,9 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
return false, sErr
|
||||
end
|
||||
-- recupero la lavorazione : seconda ricerca con tipologia e diametro massimo
|
||||
sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown)
|
||||
sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown, _, bExcludeH2)
|
||||
if not sMilling and bMillUp then
|
||||
sMilling = ML.FindMilling( sMillType, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown)
|
||||
sMilling = ML.FindMilling( sMillType, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown, _, bExcludeH2)
|
||||
sMchExt = ''
|
||||
end
|
||||
if not sMilling then
|
||||
@@ -412,8 +418,15 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if nSCC then
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
end
|
||||
local sUserNotes = ''
|
||||
-- dichiaro non si generano sfridi per VMill
|
||||
local sUserNotes = 'MaxElev='.. EgtNumToString( dAltMort, 1) .. '; VMRS=0;'
|
||||
sUserNotes = 'MaxElev='.. EgtNumToString( dAltMort, 1) .. '; VMRS=0;'
|
||||
-- se lavorazione in doppio
|
||||
if Proc.Double and Proc.Double > 0 then
|
||||
local sToolNameDouble = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'TOOLDOUBLE', 's')
|
||||
sUserNotes = sUserNotes .. 'DOUBLE=' .. Proc.Double .. ','
|
||||
sUserNotes = sUserNotes .. sToolNameDouble .. ';'
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
@@ -489,8 +502,16 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if nSCC then
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
end
|
||||
local sUserNotes = ''
|
||||
-- dichiaro non si generano sfridi per VMill
|
||||
local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;'
|
||||
sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;'
|
||||
-- se lavorazione in doppio
|
||||
if Proc.Double and Proc.Double > 0 then
|
||||
local sToolNameDouble = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'TOOLDOUBLE', 's')
|
||||
sUserNotes = sUserNotes .. 'DOUBLE=' .. Proc.Double .. ','
|
||||
sUserNotes = sUserNotes .. sToolNameDouble .. ';'
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
-- ProcessSawCut.lua by Egaltech s.r.l. 2022/03/07
|
||||
-- ProcessSawCut.lua by Egaltech s.r.l. 2022/12/19
|
||||
-- Gestione calcolo taglio di lama per Travi
|
||||
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
|
||||
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe).
|
||||
-- 2022/12/19 Aggiunta gestione testa da sotto.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessSawCut = {}
|
||||
@@ -80,8 +81,12 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
|
||||
end
|
||||
-- recupero flag per inizio e fine interni
|
||||
local bInside = (( EgtGetInfo( Proc.Id, 'Q01', 'i') or 0) ~= 0)
|
||||
-- abilitazione lavorazione da sotto
|
||||
local bDownHead = ( BD.DOWN_HEAD and vtDir:getZ() < -0.341)
|
||||
local bTopHead = ( BD.DOWN_HEAD and ( vtDir:getZ() > -0.342 or not bDownHead))
|
||||
-- recupero la lavorazione
|
||||
local sCutting = ML.FindCutting( 'HeadSide')
|
||||
local sCutting
|
||||
sCutting, bDownHead = ML.FindCutting( 'HeadSide', bTopHead, bDownHead)
|
||||
if not sCutting then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library'
|
||||
EgtOutLog( sErr)
|
||||
@@ -101,7 +106,7 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
|
||||
end
|
||||
-- determino se lavorazione da davanti o da dietro e se da sotto
|
||||
local bFront = ( vtDir ^ vtN):getX() > 0
|
||||
local bDownUp = ( vtN:getZ() < -0.259)
|
||||
local bDownUp = ( not bDownHead and vtN:getZ() < -0.259)
|
||||
local bFillAreaPiece
|
||||
-- se non da sotto
|
||||
if not bDownUp then
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- ProcessTenon.lua by Egaltech s.r.l. 2022/12/12
|
||||
-- ProcessTenon.lua by Egaltech s.r.l. 2022/12/20
|
||||
-- Gestione calcolo tenone per Travi
|
||||
-- 2021/10/04 Corretto calcolo HCING per pezzi piccoli.
|
||||
-- 2022/02/15 Aggiornata VerifyOrientation per macchine con testa da sotto.
|
||||
@@ -7,6 +7,7 @@
|
||||
-- 2022/09/20 Migliorato il calcolo delle passate laterali; ora considera la reale distanza tra contorno del tenone e estremi della faccia
|
||||
-- 2022/11/03 Corretto uso di bH2 (da sotto solo se anche bMillDown vero).
|
||||
-- 2022/12/12 Su macchine con rulli pressori e pinze separate si riduce di meno l'ingombro con tenoni inclinati.
|
||||
-- 2022/12/20 Aggiunta gestione smusso. Migliorata scelta tra sopra e sotto per il punto di inizio. In VerifyOrientation aggiunta trave medio alta.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessTenon = {}
|
||||
@@ -32,8 +33,8 @@ local function VerifyOrientation( Proc, vtN, b3Raw)
|
||||
end
|
||||
-- se trave molto bassa
|
||||
if b3Raw:getDimZ() <= 120 then
|
||||
-- se tenone praticamente in asse, accetto fino a -45 deg
|
||||
if abs( vtN:getY()) < 0.04 then
|
||||
-- se non testa PF e tenone praticamente in asse, accetto fino a -45 deg
|
||||
if not BD.C_SIMM and abs( vtN:getY()) < 0.04 then
|
||||
return ( vtN:getZ() >= -0.7072)
|
||||
-- altrimenti accetto fino a -30deg
|
||||
else
|
||||
@@ -57,6 +58,15 @@ local function VerifyOrientation( Proc, vtN, b3Raw)
|
||||
else
|
||||
return ( vtN:getZ() >= -0.174)
|
||||
end
|
||||
-- se trave medio alta
|
||||
elseif b3Raw:getDimZ() <= 400 then
|
||||
-- se tenone praticamente in asse, accetto fino a -15 deg
|
||||
if abs( vtN:getY()) < 0.04 then
|
||||
return ( vtN:getZ() >= -0.259)
|
||||
-- altrimenti, accetto fino a -5 deg
|
||||
else
|
||||
return ( vtN:getZ() >= -0.088)
|
||||
end
|
||||
-- altrimenti
|
||||
else
|
||||
-- accetto fino a -5deg
|
||||
@@ -197,6 +207,43 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se vero tenone e richiesto, eseguo lo smusso
|
||||
if Proc.Prc ~= 52 and EgtGetInfo( Proc.Id, 'P05', 'i') == 1 then
|
||||
-- profondità smusso
|
||||
local dDepth = EgtGetInfo( Proc.Id, 'Q01', 'd') or 0
|
||||
if dDepth > 0.1 then
|
||||
local dExtra = 2
|
||||
-- recupero la lavorazione
|
||||
local sMilling = ML.FindMilling( 'Mark', nil, nil, nil, nil, bMillUp, bMillDown)
|
||||
if not sMilling then
|
||||
local sErr = 'Error : milling (Mark) not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- Inserisco la lavorazione
|
||||
local sName1 = 'TenC_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMch1Id = EgtAddMachining( sName1, sMilling)
|
||||
if not nMch1Id then
|
||||
local sErr = 'Error adding machining ' .. sName1 .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
-- assegno affondamento e offset radiale
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, -dTenH + dDepth + dExtra)
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dDepth + dExtra, 1) .. ';')
|
||||
-- assegno lato di lavoro
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchId, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
local sMillType = 'Tenon'
|
||||
local sMilling, _, _, bH2 = ML.FindMilling( sMillType, dTenH, nil, nil, nil, bMillUp, bMillDown)
|
||||
@@ -226,8 +273,14 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local OVERLAP_COEFF = 0.7
|
||||
-- porto inizio curva il più possibile sul bordo in alto o in basso
|
||||
local dMaxDist = OVERLAP_COEFF * dMillDiam * MAX_PASS
|
||||
local bFromBottom
|
||||
local bMyShortPart = ( bShortPart and vtN:getX() < 0 and abs( vtN:getX()) < 0.999 and abs( vtN:getY()) < 0.259)
|
||||
BL.PutStartNearestToEdge( AuxId, b3Solid, dMaxDist, EgtIf( bH2 and bMillDown, not bMyShortPart, bMyShortPart))
|
||||
if bH2 and bMillDown then
|
||||
bFromBottom = EgtIf( bMyShortPart and vtN:getZ() < -0.018, false, true)
|
||||
else
|
||||
bFromBottom = EgtIf( bMyShortPart and vtN:getZ() > 0.018, true, false)
|
||||
end
|
||||
BL.PutStartNearestToEdge( AuxId, b3Solid, dMaxDist, bFromBottom)
|
||||
-- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente
|
||||
local sWarn
|
||||
local dDepth = 0
|
||||
|
||||
Reference in New Issue
Block a user