DataWall :
- in Drill vanno accettati fori orizzontali sul bordo anche senza foratori orizzontali speciali - in FreeContour corretto riconoscimento lato esterno per percorsi aperti - in LapJoint gestione gorge con lama - migliorie varie a flip e nest.
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
-- ProcessFreeContour.lua by Egaltech s.r.l. 2022/02/25
|
||||
-- ProcessFreeContour.lua by Egaltech s.r.l. 2022/03/14
|
||||
-- Gestione calcolo profilo libero per Pareti
|
||||
-- 2021/11/15 Penna e chiodature sono sempre riportate sulla faccia sopra anche se nel progetto sono sotto.
|
||||
-- 2021/12/10 In taglio con lama aggiunta gestione SCC per testa Gearbox.
|
||||
-- 2022/01/13 Aggiunta gestione massimo affondamento in Z anche per pulizia spigoli con fresa 60deg (WD.MAX_CLEAN_CRN60).
|
||||
-- 2022/02/03 Corretto controllo massimo affondamento nella tavola.
|
||||
-- 2022/02/21 Corretti allungamenti/accorciamenti tagli inclinati con fresa. Migliorata gestione tagli trasversali per macchine travi.
|
||||
-- 2022/03/14 Corretto riconoscimento lato esterno per percorsi aperti.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local WPF = {}
|
||||
@@ -237,8 +238,10 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function ReorderFaces( nIdSurf, nNumFacet)
|
||||
-- recupero le adiacenze di tutte le facce
|
||||
local vAdj = {}
|
||||
for i = 1, nNumFacet do
|
||||
-- recupero le adiacenze della faccia
|
||||
local vFacAdj = EgtSurfTmFacetAdjacencies( nIdSurf, i - 1)[1]
|
||||
-- le conto
|
||||
local nCount = 0
|
||||
@@ -249,27 +252,37 @@ local function ReorderFaces( nIdSurf, nNumFacet)
|
||||
end
|
||||
vAdj[i] = nCount
|
||||
end
|
||||
-- sposto le facce isolate alla fine
|
||||
for i = #vAdj, 1, -1 do
|
||||
if vAdj[i] == 0 then
|
||||
if vAdj[#vAdj] == 0 then
|
||||
table.remove( vAdj, i)
|
||||
end
|
||||
EgtSurfTmSwapFacets( nIdSurf, i - 1, #vAdj)
|
||||
end
|
||||
end
|
||||
-- se facce tutte isolate, esco
|
||||
if #vAdj == 0 then return end
|
||||
-- cerco la faccia non isolata con il minor numero di adiacenze
|
||||
local nIdFace
|
||||
local nAdjMin = 1000
|
||||
for i = #vAdj, 1, -1 do
|
||||
if vAdj[i] <= nAdjMin then
|
||||
for i = 1, #vAdj do
|
||||
if vAdj[i] < nAdjMin then
|
||||
nAdjMin = vAdj[i]
|
||||
nIdFace = i
|
||||
end
|
||||
end
|
||||
-- se è presente una faccia isolata non faccio riordino
|
||||
if nAdjMin == 0 then return nIdSurf end
|
||||
-- se il numero faccia minore con minori adiacenze è <> 1 faccio lo scambio
|
||||
if nIdFace and nIdFace ~= 1 then
|
||||
-- se la faccia non isolata con minori adiacenze non è in prima posizione, eseguo scambio
|
||||
if nIdFace and nIdFace ~= 1 and nAdjMin == 1 then
|
||||
EgtSurfTmSwapFacets( nIdSurf, nIdFace-1, 0)
|
||||
end
|
||||
-- ordino il numero di facce in modo da avere una sequenza di facce concatenate
|
||||
for i = 1, (nNumFacet-1) do
|
||||
-- ordino le facce in modo da avere una sequenza di facce concatenate
|
||||
for i = 1, #vAdj - 1 do
|
||||
-- recupero l'angolo con la faccia precedente
|
||||
local bAdj, _, _, _ = EgtSurfTmFacetsContact( nIdSurf, i-1, i, GDB_ID.ROOT)
|
||||
-- se non ho adiacenza
|
||||
if not bAdj then
|
||||
for j = i+1, nNumFacet do
|
||||
for j = i+1, #vAdj do
|
||||
bAdj, _, _, _ = EgtSurfTmFacetsContact( nIdSurf, i-1, j-1, GDB_ID.ROOT)
|
||||
-- se ho adiacenza scambio le facce
|
||||
if bAdj then
|
||||
@@ -279,7 +292,6 @@ local function ReorderFaces( nIdSurf, nNumFacet)
|
||||
end
|
||||
end
|
||||
end
|
||||
return nIdSurf
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
@@ -288,10 +300,31 @@ local function RemoveBottomFaceAndReorder( Proc, nAddGrpId, nFaceToDel)
|
||||
local nNewProc = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
|
||||
EgtSurfTmRemoveFacet( nNewProc, nFaceToDel)
|
||||
local nNumFacet = EgtSurfTmFacetCount( nNewProc)
|
||||
nNewProc = ReorderFaces( nNewProc, nNumFacet)
|
||||
ReorderFaces( nNewProc, nNumFacet)
|
||||
return nNewProc, nNumFacet
|
||||
end
|
||||
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function GetFacesExternalSide( Proc)
|
||||
-- 3=sinistra, 4=destra
|
||||
-- se meno di due facce considero esterno come dichiarato dal gruppo
|
||||
local nNumFacet = EgtSurfTmFacetCount( Proc.Id)
|
||||
if nNumFacet < 2 then return Proc.Grp end
|
||||
-- se facce isoate, considero esterno come dichiarato dal gruppo
|
||||
local bAdj, ptV1, ptV2, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT)
|
||||
if not bAdj then return Proc.Grp end
|
||||
-- calcolo dell'esterno rispetto all'avanzamento
|
||||
local ptC1, vtN1 = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
local ptV = ( ptV1 + ptV2) / 2
|
||||
local vtDir1 = ptV - ptC1
|
||||
if ( vtN1 ^ vtDir1):getZ() > 0 then
|
||||
return 4
|
||||
else
|
||||
return 3
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function GetFacesData( Proc, bOpposite, bCalclForBlade, dToolDiam, dToolMaxDepth, dToolThick, nAddGrpId, b3Raw, nMasterNewProc)
|
||||
--se richiesto, copio la superficie nel gruppo ausiliario
|
||||
@@ -786,7 +819,7 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
|
||||
nNewProcLoc = EgtCopyGlob( nNewProc, nAddGrpId)
|
||||
nNewProcLoc = EgtSurfTmBySewing( nAddGrpId, {nNewProcLoc,nSurfToAdd} , true)
|
||||
-- riordino le facce
|
||||
nNewProcLoc = ReorderFacesFromTab( nNewProcLoc, vFace)
|
||||
ReorderFacesFromTab( nNewProcLoc, vFace)
|
||||
-- acquisisco il numero della faccia
|
||||
nFacCnt = EgtSurfTmFacetCount( nNewProcLoc)
|
||||
nFacInd = nFacCnt - 1
|
||||
@@ -1070,7 +1103,7 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
|
||||
local dMinWidth = dDimMin
|
||||
nNewProc = EgtSurfTmBySewing( nAddGrpId, {nNewProc,nSurfInt} , true)
|
||||
-- riordino le facce
|
||||
nNewProc = ReorderFacesFromTab( nNewProc, vFace)
|
||||
ReorderFacesFromTab( nNewProc, vFace)
|
||||
-- acquisisco il numero della faccia
|
||||
nFacCnt = EgtSurfTmFacetCount( nNewProc)
|
||||
nFacInd = nFacCnt - 1
|
||||
@@ -1169,6 +1202,19 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function GetMaxDepth( vtNz, dMillDiam, dDiamTh, dMaxDepth, dFreeLen)
|
||||
local CosA = abs( vtNz)
|
||||
if CosA >= 0.05 then
|
||||
local SinA = sqrt( 1 - CosA * CosA)
|
||||
local dRad = dDiamTh / 2 + dMillDiam / 2 * EgtIf( vtNz > 0, -1, 1)
|
||||
local dSlantFreeLen = dFreeLen - ( dRad * CosA / SinA)
|
||||
return min( dMaxDepth, dSlantFreeLen)
|
||||
else
|
||||
return dMaxDepth
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAddGrpId)
|
||||
-- flag per fresature non passanti
|
||||
@@ -1178,11 +1224,15 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
|
||||
-- recupero i dati dell'utensile
|
||||
local dMillDiam = 20
|
||||
local dMaxDepth = 0
|
||||
local dFreeLen = 0
|
||||
local dDiamTh = 0
|
||||
if EgtMdbSetCurrMachining( sMilling) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
|
||||
dMaxDepth = EgtIf( WD.MILL_MAX_DEPTH_AS_MAT, EgtTdbGetCurrToolParam( MCH_TP.MAXMAT), EgtTdbGetCurrToolMaxDepth()) or dMaxDepth
|
||||
dDiamTh = EgtTdbGetCurrToolThDiam()
|
||||
dFreeLen = EgtTdbGetCurrToolMaxDepth()
|
||||
dMaxDepth = EgtIf( WD.MILL_MAX_DEPTH_AS_MAT, EgtTdbGetCurrToolParam( MCH_TP.MAXMAT), dFreeLen) or dMaxDepth
|
||||
end
|
||||
end
|
||||
-- verifico se ciclo chiuso
|
||||
@@ -1201,7 +1251,7 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
|
||||
while i <= #vFace do
|
||||
-- se inizio faccia senza taglio e non è successiva di senza taglio, inserisco una fresatura
|
||||
local j = EgtIf( i > 1, i - 1, EgtIf( bClosed, #vFace, nil))
|
||||
if ( vFace[i].Type & 1) ~= 0 and ( not j or ( vFace[j].Type == 0 or vFace[j].Type == 1) or abs( vFace[i].SideAng) > 0.1) then
|
||||
if ( vFace[i].Type & 1) ~= 0 and ( not j or vFace[j].Type == 0 or vFace[j].Type == 1 or abs( vFace[i].SideAng) > 0.1 or abs( vFace[j].SideAng) > 0.1) then
|
||||
-- inserisco la lavorazione
|
||||
local sName = 'Free_' .. ( EgtGetName( Proc.PartId) or tostring( Proc.PartId))
|
||||
local nMchId = EgtAddMachining( sName, sMilling)
|
||||
@@ -1222,11 +1272,12 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
|
||||
dDepth = min( dDepth, dDepth - WD.MIN_Z_SAW + dMillDiam * vtNz / sqrt( 1 - vtNz * vtNz))
|
||||
end
|
||||
end
|
||||
local dCurrMaxDepth = GetMaxDepth( vtNz, dMillDiam, dDiamTh, dMaxDepth, dFreeLen)
|
||||
-- se affondamento superiore ai limiti della fresa
|
||||
if dDepth > dMaxDepth then
|
||||
if dDepth > dCurrMaxDepth then
|
||||
dOriDepth = dDepth
|
||||
-- lo limito e tolgo eventuali Tabs
|
||||
dDepth = dMaxDepth
|
||||
dDepth = dCurrMaxDepth
|
||||
EgtSetMachiningParam( MCH_MP.LEAVETAB, false)
|
||||
bNotThrou = true
|
||||
end
|
||||
@@ -1260,7 +1311,7 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
|
||||
-- se angolo interno dopo e faccia successiva inclinata verso l'alto oltre 16.1deg
|
||||
local k = EgtIf( i < #vFace, i + 1, EgtIf( bClosed, 1, nil))
|
||||
if k and vFace[k].PrevAng < -30 and vFace[k].Norm:getZ() < 0.96078 and vFace[k].Norm:getZ() > 0 then
|
||||
dEal = dEal + vFace[k].Width * vFace[j].Norm:getZ()
|
||||
dEal = dEal + vFace[k].Width * vFace[k].Norm:getZ()
|
||||
-- se l'inclinazione è inferiore a 46.1deg
|
||||
if vFace[k].Norm:getZ() > 0.72055 then
|
||||
dEal = dEal - vFace[k].Width
|
||||
@@ -1311,12 +1362,12 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
|
||||
dDepth = min( dDepth, dDepth - WD.MIN_Z_SAW + dMillDiam * vtNz / sqrt( 1 - vtNz * vtNz))
|
||||
end
|
||||
end
|
||||
local dCurrMaxDepth = GetMaxDepth( vtNz, dMillDiam, dDiamTh, dMaxDepth, dFreeLen)
|
||||
-- se affondamento superiore ai limiti della fresa
|
||||
if dDepth > dMaxDepth then
|
||||
if dDepth > dCurrMaxDepth then
|
||||
dOriDepth = dDepth
|
||||
-- lo limito e tolgo eventuali Tabs
|
||||
dDepth = dMaxDepth
|
||||
if abs( vFace[i].SideAng) > 15 then dDepth = dDepth - 20 end
|
||||
dDepth = dCurrMaxDepth
|
||||
EgtSetMachiningParam( MCH_MP.LEAVETAB, false)
|
||||
bNotThrou = true
|
||||
end
|
||||
@@ -1512,11 +1563,12 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
|
||||
dDepth = min( dDepth, dDepth - WD.MIN_Z_SAW + dMillDiam * vtNz / sqrt( 1 - vtNz * vtNz))
|
||||
end
|
||||
end
|
||||
local dCurrMaxDepth = GetMaxDepth( vtNz, dMillDiam, dDiamTh, dMaxDepth, dFreeLen)
|
||||
-- se affondamento superiore ai limiti della fresa
|
||||
if dDepth > dMaxDepth then
|
||||
if dDepth > dCurrMaxDepth then
|
||||
dOriDepth = dDepth
|
||||
-- lo limito e tolgo eventuali Tabs
|
||||
dDepth = dMaxDepth
|
||||
dDepth = dCurrMaxDepth
|
||||
EgtSetMachiningParam( MCH_MP.LEAVETAB, false)
|
||||
bNotThrou = true
|
||||
end
|
||||
@@ -1811,14 +1863,15 @@ local function MakeByCut( Proc, nRawId, b3Raw)
|
||||
end
|
||||
-- recupero la curva associata
|
||||
local bOpposite = false
|
||||
local bNegZ = false
|
||||
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
|
||||
if AuxId then
|
||||
AuxId = AuxId + Proc.Id
|
||||
local vtExtr= EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
||||
if vtExtr then
|
||||
bOpposite = ( Proc.Grp == 4 and vtExtr:getZ() < 0) or ( Proc.Grp == 3 and vtExtr:getZ() > 0)
|
||||
if vtExtr:getZ() < 0 then bNegZ = true end
|
||||
if GetFacesExternalSide( Proc) ~= Proc.Grp then
|
||||
bOpposite = not bOpposite
|
||||
end
|
||||
end
|
||||
end
|
||||
-- altezza massima delle facce
|
||||
@@ -2178,14 +2231,15 @@ local function MakeByPocket( Proc, nRawId, b3Raw)
|
||||
local bOpposite = false
|
||||
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0
|
||||
local vtExtr
|
||||
local bNegZ = false
|
||||
if AuxId then
|
||||
AuxId = AuxId + Proc.Id
|
||||
vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
||||
if vtExtr then
|
||||
bOpposite = ( Proc.Grp == 4 and vtExtr:getZ() < 0) or ( Proc.Grp == 3 and vtExtr:getZ() > 0)
|
||||
if GetFacesExternalSide( Proc) ~= Proc.Grp then
|
||||
bOpposite = not bOpposite
|
||||
end
|
||||
end
|
||||
if vtExtr:getZ() < 0 then bNegZ = true end
|
||||
end
|
||||
if not AuxId or ( EgtGetType( AuxId) & GDB_FY.GEO_CURVE) == 0 then
|
||||
local sErr = 'Error : missing profile geometry'
|
||||
|
||||
Reference in New Issue
Block a user