Compare commits

...

2 Commits

2 changed files with 39 additions and 41 deletions
+19 -17
View File
@@ -777,9 +777,9 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
-- creo superfice locale o esco
local nSurfToAdd = MakeLocalSurf( tFacAdj[7], tFacAdj[8], tFacAdj[9], nAddGrpId)
if nSurfToAdd then
local nFacCntPre = EgtSurfTmFacetCount( nNewProc)
local nFacCntPre = EgtSurfTmFacetCount( nNewProc.Id)
-- creo copia del percorso principale e gli aggiungo la nuova faccia
nNewProcLoc = EgtCopyGlob( nNewProc, nAddGrpId)
nNewProcLoc = EgtCopyGlob( nNewProc.Id, nAddGrpId)
nNewProcLoc = EgtSurfTmBySewing( nAddGrpId, {nNewProcLoc,nSurfToAdd} , true)
-- riordino le facce
ReorderFacesFromTab( nNewProcLoc, vFace)
@@ -790,7 +790,7 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
return true, ''
end
else
nNewProcLoc = nNewProc
nNewProcLoc = nNewProc.Id
end
-- prendo il primo versore
local _, vtN1 = EgtSurfTmFacetCenter( nNewProcLoc, nFacInd, GDB_ID.ROOT)
@@ -847,7 +847,7 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
vtCheck:rotate( Z_AX(), dOffsAng)
end
-- controllo se c'è collisione con le facce della superfice
if nTypeConeCut == 1 and CalcInterference( nNewProc, vtCheck, tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), dDiam1, dDiam2,
if nTypeConeCut == 1 and CalcInterference( nNewProc.Id, vtCheck, tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), dDiam1, dDiam2,
dTall1, dTall2, dDiam3, dTall3) then
local sErr = 'Collision detect from clean corner tool and surface'
EgtOutLog( sErr)
@@ -944,6 +944,8 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
-- trasformo in percorso
if #pAuxId > 0 then
AuxId = EgtCurveCompo( nAddGrpId, pAuxId, true)
EgtSetInfo( AuxId, 'TASKID', nNewProc.TaskId)
EgtSetInfo( AuxId, 'CUTID', nNewProc.CutId)
end
-- se non c'é il percorso do errore
if not AuxId then
@@ -958,8 +960,8 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
EgtRotate( AuxId, tFacAdj[nIdEndPoint], Z_AX(), dOffsAng, GDB_RT.GLOB)
end
-- inserisco la lavorazione
local sName = 'Clean_' .. ( EgtGetName( nNewProc) or tostring( nNewProc))
local nMchId = WM.AddMachining( nNewProc, sName, sMilling)
local sName = 'Clean_' .. ( EgtGetName( nNewProc.Id) or tostring( nNewProc.Id))
local nMchId = WM.AddMachining( nNewProc.Id, sName, sMilling)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
@@ -1052,26 +1054,26 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
-- verifico se ciclo chiuso
local bClosed = ( abs( vFace[1].PrevAng) > 0.1)
-- copio la feature nel layer di appoggio
local nNewProc
local nNewProc = { CutId = Proc.CutId, TaskId = Proc.TaskId}
if nMasterNewProc then
nNewProc = nMasterNewProc
nNewProc.Id = nMasterNewProc
else
nNewProc = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
nNewProc.Id = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
end
local nFacCnt = EgtSurfTmFacetCount( nNewProc)
local nFacCnt = EgtSurfTmFacetCount( nNewProc.Id)
local nFacInd, dDepth, nSurfInt
local bMakeLocSurf
-- RIMUOVERE
if false and nFacCnt <= 4 then
-- recupero profondità e faccia di fondo
_, _, dDepth, _, _, nSurfInt = GetTunnelDimension( nNewProc, Proc.PartId, nAddGrpId, bClosed)
_, _, dDepth, _, _, nSurfInt = GetTunnelDimension( nNewProc.Id, Proc.PartId, nAddGrpId, bClosed)
if nSurfInt then
-- aggiungo la faccia di fondo appena calcolata
nNewProc = EgtSurfTmBySewing( nAddGrpId, { nNewProc, nSurfInt}, true)
nNewProc.Id = EgtSurfTmBySewing( nAddGrpId, { nNewProc.Id, nSurfInt}, true)
-- riordino le facce
ReorderFacesFromTab( nNewProc, vFace)
ReorderFacesFromTab( nNewProc.Id, vFace)
-- aggiorno numero di facce e assegno indice di quella di fondo (sempre ultima)
nFacCnt = EgtSurfTmFacetCount( nNewProc)
nFacCnt = EgtSurfTmFacetCount( nNewProc.Id)
nFacInd = nFacCnt - 1
else
return true
@@ -1119,7 +1121,7 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
ptLoc2 = vFace[k].PPrev
end
-- ricavo i punti e l'angolo interno
local _, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( nNewProc, nFace1, nFace2, GDB_ID.ROOT)
local _, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( nNewProc.Id, nFace1, nFace2, GDB_ID.ROOT)
-- se punti validi e angolo è interno e non è quasi piatto e >= 90 creo istanza
local tFacAdj = {}
if ptP1 and ptP2 and dAng < 0 and dAng < -6 and dAng > EgtIf( nTypeConeCut == 1, -(90 + 10 * GEO.EPS_SMALL), -(180-dAngleSmall + 10 * GEO.EPS_SMALL)) then
@@ -1157,8 +1159,8 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
i = i + 1
end
-- cancello la copia della superfice
if nNewProc then
EgtErase( nNewProc)
if nNewProc.Id then
EgtErase( nNewProc.Id)
end
return true
end
+20 -24
View File
@@ -760,9 +760,9 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
-- creo superfice locale o esco
local nSurfToAdd = MakeLocalSurf( tFacAdj[7], tFacAdj[8], tFacAdj[9], nAddGrpId)
if nSurfToAdd then
local nFacCntPre = EgtSurfTmFacetCount( nNewProc)
local nFacCntPre = EgtSurfTmFacetCount( nNewProc.Id)
-- creo copia del percorso principale e gli aggiungo la nuova faccia
nNewProcLoc = EgtCopyGlob( nNewProc, nAddGrpId)
nNewProcLoc = EgtCopyGlob( nNewProc.Id, nAddGrpId)
nNewProcLoc = EgtSurfTmBySewing( nAddGrpId, {nNewProcLoc,nSurfToAdd} , true)
-- riordino le facce
nNewProcLoc = ReorderFacesFromTab( nNewProcLoc, vFace)
@@ -775,7 +775,7 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
return true, ''
end
else
nNewProcLoc = nNewProc
nNewProcLoc = nNewProc.Id
end
-- prendo il primo versore
local _, vtN1 = EgtSurfTmFacetCenter( nNewProcLoc, nFacInd, GDB_ID.ROOT)
@@ -829,7 +829,7 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
vtCheck:rotate( Z_AX(), dOffsAng)
end
-- controllo se c'è collisione con le facce della superfice
if nTypeConeCut == 1 and CalcInterference( nNewProc, vtCheck, tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), dDiam1, dDiam2,
if nTypeConeCut == 1 and CalcInterference( nNewProc.Id, vtCheck, tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), dDiam1, dDiam2,
dTall1, dTall2, dDiam3, dTall3) then
local sErr = 'Collision detect from clean corner tool and surface'
EgtOutLog( sErr)
@@ -926,6 +926,8 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
-- trasformo in percorso
if #pAuxId > 0 then
AuxId = EgtCurveCompo( nAddGrpId, pAuxId, true)
EgtSetInfo( AuxId, 'TASKID', nNewProc.TaskId)
EgtSetInfo( AuxId, 'CUTID', nNewProc.CutId)
end
-- se non c'é il percorso do errore
if not AuxId then
@@ -940,8 +942,8 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
EgtRotate( AuxId, tFacAdj[nIdEndPoint], Z_AX(), dOffsAng, GDB_RT.GLOB)
end
-- inserisco la lavorazione
local sName = 'Clean_' .. ( EgtGetName( nNewProc) or tostring( nNewProc))
local nMchId = WM.AddMachining( nNewProc, sName, sMilling)
local sName = 'Clean_' .. ( EgtGetName( nNewProc.Id) or tostring( nNewProc.Id))
local nMchId = WM.AddMachining( nNewProc.Id, sName, sMilling)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
@@ -1035,27 +1037,27 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
end
end
-- copio la feature nel layer di appoggio
local nNewProc
local nNewProc = { CutId = Proc.CutId, TaskId = Proc.TaskId}
if nMasterNewProc then
nNewProc = nMasterNewProc
nNewProc.Id = nMasterNewProc
else
nNewProc = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
nNewProc.Id = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
end
local nFacCnt = EgtSurfTmFacetCount( nNewProc)
local nFacCnt = EgtSurfTmFacetCount( nNewProc.Id)
local nFacInd, dDimMin, dDimMax, dDepth, nSurfInt
local bMakeLocSurf
-- RIMUOVERE
if false and nFacCnt <= 4 then
-- ottengo le dimensioni apertura, la normale e la faccia inferiore
dDimMin, dDimMax, dDepth, _, _, nSurfInt = GetTunnelDimension( nNewProc, Proc.PartId, nAddGrpId)
dDimMin, dDimMax, dDepth, _, _, nSurfInt = GetTunnelDimension( nNewProc.Id, Proc.PartId, nAddGrpId)
if nSurfInt then
-- uso la dimensione minima anche nel caso che la cava sborda perchè la lavorazione potrebbe collidere con un pezzo limitrofo
local dMinWidth = dDimMin
nNewProc = EgtSurfTmBySewing( nAddGrpId, {nNewProc,nSurfInt} , true)
nNewProc.Id = EgtSurfTmBySewing( nAddGrpId, {nNewProc.Id,nSurfInt} , true)
-- riordino le facce
nNewProc = ReorderFacesFromTab( nNewProc, vFace)
nNewProc.Id = ReorderFacesFromTab( nNewProc.Id, vFace)
-- acquisisco il numero della faccia
nFacCnt = EgtSurfTmFacetCount( nNewProc)
nFacCnt = EgtSurfTmFacetCount( nNewProc.Id)
nFacInd = nFacCnt - 1
else
local sErr = 'Error : cannot create base surface'
@@ -1107,7 +1109,7 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
ptLoc2 = vFace[k].PPrev
end
-- ricavo i punti e l'angolo interno
local _, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( nNewProc, nFace1, nFace2, GDB_ID.ROOT)
local _, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( nNewProc.Id, nFace1, nFace2, GDB_ID.ROOT)
-- se punti validi e angolo è interno e non è quasi piatto e >= 90 creo istanza
local tFacAdj = {}
if ptP1 and ptP2 and dAng < 0 and dAng < -6 and dAng > EgtIf( nTypeConeCut == 1, -(90 + 10 * GEO.EPS_SMALL), -(180-dAngleSmall + 10 * GEO.EPS_SMALL)) then
@@ -1145,8 +1147,8 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
i = i + 1
end
-- cancello la copia della superfice
if nNewProc then
EgtErase(nNewProc)
if nNewProc.Id then
EgtErase( nNewProc.Id)
end
return true
end
@@ -1691,13 +1693,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
dExtraLongEnd = 0
end
-- se ho abilitato la lavorazione di fresatura per garantire passaggio gambo utensile, inserisco la lavorazione
local bThroughRaw = false
if bEnablePreMill then
-- verifico se feature e' passante
if ((Proc.Box:getMin():getX() < ( b3Raw:getMin():getX() + 50)) and (Proc.Box:getMax():getX() > ( b3Raw:getMax():getX() - 50))) or
((Proc.Box:getMin():getY() < ( b3Raw:getMin():getY() + 50)) and (Proc.Box:getMax():getY() > ( b3Raw:getMax():getY() - 50))) then
bThroughRaw = true
end
-- recupero la lavorazione di taglio
local sCuttingGorge = WM.FindCutting( 'Standard')
@@ -1745,7 +1741,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
local bSawInvertSE = false
-- se non passante, aggiungo fresatura area della fresa
if not bThroughRaw and nNumStep - 1 > 0 then
if not Proc.IsThrough and nNumStep - 1 > 0 then
local SquareId -- Id della composita da fresare
local dSawShortening = sqrt( b3Raw:getDimZ() * ( dSawDiam - b3Raw:getDimZ())) -- da calcolare in base a raggio lama e spessore grezzo
-- gruppo ausiliario