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:
+42
-8
@@ -54,6 +54,17 @@ local function WriteErrToLogFile( nErr, sMsg, nRot, nCutId, nTaskId)
|
||||
hFile:write( 'TASKID=' .. tostring( nTaskId or 0) .. '\n')
|
||||
hFile:close()
|
||||
end
|
||||
local function BWMessageId( nMsgId, sMsg, params)
|
||||
if WALL.BW and nMsgId and nMsgId > 0 then
|
||||
local sFinalMsg = '$$' .. nMsgId
|
||||
for Index = 1, #params do
|
||||
sFinalMsg = sFinalMsg .. ',' .. params[Index]
|
||||
end
|
||||
return sFinalMsg
|
||||
else
|
||||
return string.format( sMsg, table.unpack( params))
|
||||
end
|
||||
end
|
||||
|
||||
local function WriteTimeToLogFile( dTime)
|
||||
local hFile = io.open( sLogFile, 'a')
|
||||
@@ -175,7 +186,10 @@ if bToProcess then
|
||||
local dPanelLen
|
||||
local dPanelWidth
|
||||
local vWall = {}
|
||||
|
||||
-- flag per Nesting da Btl
|
||||
local bNestingFromBtl = false
|
||||
local nRawOutlineId = GDB_ID.NULL
|
||||
|
||||
-- Se necessario, apro il file Bwe
|
||||
if WALL.FLAG ~= 6 then
|
||||
if not EgtOpenFile( WALL.FILE) then
|
||||
@@ -274,9 +288,28 @@ if bToProcess then
|
||||
local nMGrpId = EgtGetCurrMachGroup()
|
||||
-- Pannello da creare
|
||||
bCreatePanel = true
|
||||
-- Lunghezza e larghezza del pannello
|
||||
dPanelLen = EgtGetInfo( nMGrpId, 'PANELLEN', 'd')
|
||||
dPanelWidth = EgtGetInfo( nMGrpId, 'PANELWIDTH', 'd')
|
||||
-- leggo se grezzo da nesting btl
|
||||
bNestingFromBtl = EgtGetInfo( nMGrpId, 'BTLNESTING', 'b') or false
|
||||
if bNestingFromBtl then
|
||||
-- recupero superficie
|
||||
nRawOutlineId = EgtGetInfo( nMGrpId, 'RAWOUTLINEID') or GDB_ID.NULL
|
||||
if nRawOutlineId ~= GDB_ID.NULL then
|
||||
local nRawPartId = EgtGetParent( EgtGetParent( nRawOutlineId))
|
||||
EgtSetStatus( nRawPartId, GDB_ST.ON)
|
||||
local b3RawSurf = EgtGetBBoxGlob( nRawPartId, GDB_BB.STANDARD)
|
||||
EgtSetStatus( nRawPartId, GDB_ST.OFF)
|
||||
--EgtSurfTmBBox( nRawOutlineId, b3RawSurf, false, GDB_RT.GLOB)
|
||||
if b3RawSurf then
|
||||
-- Lunghezza e larghezza del pannello
|
||||
dPanelLen = b3RawSurf:getDimX()
|
||||
dPanelWidth = b3RawSurf:getDimY()
|
||||
end
|
||||
end
|
||||
else
|
||||
-- Lunghezza e larghezza del pannello
|
||||
dPanelLen = EgtGetInfo( nMGrpId, 'PANELLEN', 'd')
|
||||
dPanelWidth = EgtGetInfo( nMGrpId, 'PANELWIDTH', 'd')
|
||||
end
|
||||
-- Recupero l'elenco ordinato delle pareti da inserire nel pannello
|
||||
for i = 1, 100 do
|
||||
local sKey = 'PART'..tostring( i)
|
||||
@@ -349,8 +382,9 @@ if bToProcess then
|
||||
-- Verifico dimensioni massime grezzo
|
||||
if dRawL > WD.MAX_LENGTH + 10 * GEO.EPS_SMALL or dRawW > WD.MAX_WIDTH + 10 * GEO.EPS_SMALL or dRawH > WD.MAX_HEIGHT + 10 * GEO.EPS_SMALL then
|
||||
ResetMachGroup( vWall)
|
||||
local sOut = 'Grezzo (' .. EgtNumToString( dRawL, 2) .. ' x ' .. EgtNumToString( dRawW, 2) .. ' x ' .. EgtNumToString( dRawH, 2) .. ') ' ..
|
||||
'oltre il limite della macchina ('..EgtNumToString( WD.MAX_LENGTH, 2)..' x '..EgtNumToString( WD.MAX_WIDTH, 2)..' x '..EgtNumToString( WD.MAX_HEIGHT, 2)..') '
|
||||
local sOut = BWMessageId( 1, 'Grezzo (%s x %s x %s) oltre il limite della macchina (%s x %s x %s)',
|
||||
{EgtNumToString( dRawL, 2), EgtNumToString( dRawW, 2), EgtNumToString( dRawH, 2),
|
||||
EgtNumToString( WD.MAX_LENGTH, 2), EgtNumToString( WD.MAX_WIDTH, 2), EgtNumToString( WD.MAX_HEIGHT, 2)})
|
||||
WALL.ERR = 17
|
||||
WALL.MSG = sOut
|
||||
WriteErrToLogFile( WALL.ERR, WALL.MSG)
|
||||
@@ -371,7 +405,7 @@ if bToProcess then
|
||||
end
|
||||
|
||||
-- Sistemo le pareti nel grezzo
|
||||
local bPbOk, sPbErr = WE.ProcessWalls( dRawL, dRawW, dRawH, vWall, WALL.FLAG == 6, true)
|
||||
local bPbOk, sPbErr = WE.ProcessWalls( dRawL, dRawW, dRawH, vWall, WALL.FLAG == 6, true, nRawOutlineId)
|
||||
if not bPbOk then
|
||||
WALL.ERR = 18
|
||||
WALL.MSG = sPbErr
|
||||
@@ -381,7 +415,7 @@ if bToProcess then
|
||||
else
|
||||
-- Scrivo altezza grezzo nel gruppo di lavoro corrente
|
||||
local nMGrpId = EgtGetCurrMachGroup()
|
||||
EgtSetInfo(nMGrpId, 'PANELHEIGHT', dRawH)
|
||||
EgtSetInfo( nMGrpId, 'PANELHEIGHT', dRawH)
|
||||
end
|
||||
-- altrimenti sistemo
|
||||
else
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- WProcessDrill.lua by Egaltech s.r.l. 2022/02/22
|
||||
-- WProcessDrill.lua by Egaltech s.r.l. 2022/03/08
|
||||
-- Gestione calcolo forature per Pareti
|
||||
-- 2021/08/29 DS Se foratura di fianco setto flag per farla dopo i tagli.
|
||||
-- 2021/12/04 DS Modifiche per forature speciali lungo Y.
|
||||
@@ -7,6 +7,7 @@
|
||||
-- 2022/01/20 DS Aggiunta gestione Q01 (flag forzatura solo contornatura).
|
||||
-- 2022/01/29 DS Corretta gestione ingombro portautensili per fori inclinati da sopra.
|
||||
-- 2022/02/22 ES Aggiunta gestione prefori.
|
||||
-- 2022/03/08 DS Vanno accettati fori orizzontali sul bordo anche senza foratori orizzontali speciali.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local WPD = {}
|
||||
@@ -76,6 +77,12 @@ function WPD.Classify( Proc, b3Raw)
|
||||
if WD.HOR_DRILL_DIAM and abs( dDiam - WD.HOR_DRILL_DIAM) < WD.DRILL_TOL and AreSameOrOppositeVectorApprox( vtExtr, Y_AX()) then
|
||||
return true
|
||||
end
|
||||
-- se foro orizzontale, verifico sia sul bordo del grezzo
|
||||
local b3RedRaw = BBox3d( b3Raw)
|
||||
b3RedRaw:expand( -20)
|
||||
if vtExtr:getZ() > -0.05 and not EnclosesPointXY( b3RedRaw, ptCen) then
|
||||
return true
|
||||
end
|
||||
-- altrimenti non lavorabile
|
||||
return false
|
||||
end
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -133,7 +133,7 @@ function WPL.Classify( Proc, b3Raw)
|
||||
-- una lama da 500
|
||||
local bAllowNegativeFace
|
||||
if vtN:getZ() < - 0.01 then
|
||||
if vtN:getZ() > - 0.05 and Proc.Box:getMin():getZ() - b3Raw:getMin():getZ() - (500 * abs(vtN:getZ())) >= 0 then
|
||||
if vtN:getZ() > - 0.088 and Proc.Box:getMin():getZ() - b3Raw:getMin():getZ() - (500 * abs(vtN:getZ())) >= 0 then
|
||||
bAllowNegativeFace = true
|
||||
end
|
||||
end
|
||||
@@ -1451,7 +1451,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
||||
local nFace2ndFace
|
||||
local dMaxDistToOut = EgtIf( bMachFromDn, 1800, 300)
|
||||
-- se orientato lungo la Y
|
||||
if abs( vtN:getX()) > 0.9 then
|
||||
if abs( vtN:getX()) > 0.866 then
|
||||
dExtraLongExtPlus = abs( Proc.Box:getMax():getY() - b3Raw:getMax():getY())
|
||||
dExtraLongExtNeg = abs( Proc.Box:getMin():getY() - b3Raw:getMin():getY())
|
||||
if dLongGorge + dMillDiamTh < b3Raw:getDimY() then
|
||||
@@ -1472,7 +1472,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
||||
bStartPos = true
|
||||
end
|
||||
-- se normale su X positivo parte dall'alto
|
||||
if vtN:getX() > 0.9 then
|
||||
if vtN:getX() > 0.866 then
|
||||
-- se deve partire dalla parte negativa setto il flag di inversione lavorazione
|
||||
if not bStartPos then
|
||||
bInvertMach = true
|
||||
@@ -1507,7 +1507,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
||||
end
|
||||
end
|
||||
-- altrimenti orientato lungo la X
|
||||
elseif abs( vtN:getY()) > 0.9 then
|
||||
elseif abs( vtN:getY()) > 0.866 then
|
||||
dExtraLongExtPlus = abs( Proc.Box:getMax():getX() - b3Raw:getMax():getX())
|
||||
dExtraLongExtNeg = abs( Proc.Box:getMin():getX() - b3Raw:getMin():getX())
|
||||
if dLongGorge + dMillDiamTh < b3Raw:getDimX() then
|
||||
@@ -1528,7 +1528,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
||||
bStartPos = true
|
||||
end
|
||||
-- se normale su Y positivo parte da sinistra (parte negativa)
|
||||
if vtN:getY() > 0.9 then
|
||||
if vtN:getY() > 0.866 then
|
||||
-- se deve partire dalla parte positiva setto il flag di inversione lavorazione
|
||||
if bStartPos then
|
||||
bInvertMach = true
|
||||
@@ -1538,7 +1538,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
||||
dExtraLongIni = EgtIf( nModifyLeadInOut == 2, 1, dExtraLongExtNeg + dMillDiam/2 + 5)
|
||||
dExtraLongEnd = EgtIf( nModifyLeadInOut > 0, 1, dExtraLongExtPlus + dMillDiam/2 + 5)
|
||||
end
|
||||
-- asseggno lato di lavoro seconda faccia
|
||||
-- assegno lato di lavoro seconda faccia
|
||||
if bMachFromDn then
|
||||
nFace2ndFace = MCH_MILL_FU.ORTUP_FRONT
|
||||
else
|
||||
@@ -1595,6 +1595,26 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
||||
end
|
||||
end
|
||||
|
||||
-- calcolo larghezza canale
|
||||
local dGorgeWidth = dMillDiam
|
||||
-- verifico se elevazione minore per fare meno tagli
|
||||
if dElev + 2 * WD.COLL_SIC < dGorgeWidth then
|
||||
dGorgeWidth = max( dElev + 2 * WD.COLL_SIC, 0)
|
||||
end
|
||||
|
||||
-- sottraggo lato esterno lapjoint per ottenere larghezza netta del gorge
|
||||
dGorgeWidth = dGorgeWidth - dSideElev
|
||||
|
||||
-- calcolo quanti passi devo fare in larghezza per scaricare l'area di impegno utensile
|
||||
local nNumStep = ceil( ( dGorgeWidth) / ( WD.SAWGORGE_INTERAX or 100))
|
||||
-- calcolo larghezza passate
|
||||
local dC = 0
|
||||
if ( nNumStep - 1) > 0 then
|
||||
dC = ( dGorgeWidth) / ( nNumStep)
|
||||
else
|
||||
nNumStep = 1
|
||||
end
|
||||
|
||||
-- dati utensile fresa piccola
|
||||
local dMillDiamFirst = 0
|
||||
local dMaxMatFirst = 0
|
||||
@@ -1602,7 +1622,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
||||
local bSawInvertSE = false
|
||||
|
||||
-- se non passante, aggiungo fresatura area della fresa
|
||||
if not bThroughRaw then
|
||||
if not bThroughRaw 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
|
||||
@@ -1610,35 +1630,35 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
||||
-- disegno quadrato di fresatura
|
||||
local p3Start
|
||||
-- se orientato lungo la Y (direzione)
|
||||
if abs( vtN:getX()) > 0.9 then
|
||||
local dStartX = EgtIf( vtN:getX() > 0.9, Proc.Box:getMax():getX(), Proc.Box:getMin():getX())
|
||||
if abs( vtN:getX()) > 0.866 then
|
||||
local dStartX = EgtIf( vtN:getX() > 0.866, Proc.Box:getMax():getX(), Proc.Box:getMin():getX())
|
||||
local dStartY = EgtIf( bStartPos, Proc.Box:getMin():getY(), Proc.Box:getMax():getY())
|
||||
p3Start = Point3d( dStartX, dStartY, Proc.Box:getMin():getZ())
|
||||
local vtNPerp = Vector3d( vtN)
|
||||
vtNPerp:rotate(-Z_AX(), 90 * EgtIf( bStartPos, 1, -1) * EgtIf( vtN:getX() > 0.9, 1, -1))
|
||||
vtNPerp:rotate(-Z_AX(), 90 * EgtIf( bStartPos, 1, -1) * EgtIf( vtN:getX() > 0.866, 1, -1))
|
||||
local FirstLineId = EgtLinePVL( nAddGrpId, p3Start, vtNPerp, dMillDiam / 2 , GDB_RT.GLOB) -- Y_AX()
|
||||
local SecondLineId = EgtLinePVL( nAddGrpId, EgtEP( FirstLineId, GDB_RT.GLOB), vtN, dMillDiam - dSideElev, GDB_RT.GLOB) -- -X_AX()
|
||||
local dThirdLineLen = min( (dMillDiam / 2) + ( Proc.Box:getMax():getY() - Proc.Box:getMin():getY()), dSawShortening + 10)
|
||||
local ThirdLineId = EgtLinePVL( nAddGrpId, EgtEP( SecondLineId, GDB_RT.GLOB), -vtNPerp, dThirdLineLen, GDB_RT.GLOB) -- -Y_AX()
|
||||
local FourthLineId = EgtLinePVL( nAddGrpId, EgtEP( ThirdLineId, GDB_RT.GLOB), -vtN, dMillDiam -dSideElev , GDB_RT.GLOB) -- X_AX()
|
||||
SquareId = EgtCurveCompo( nAddGrpId, { FirstLineId, SecondLineId, ThirdLineId, FourthLineId})
|
||||
bMillInvert = EgtIf( vtN:getX() > 0.9, not (bStartPos or false), bStartPos or false)
|
||||
bSawInvertSE = EgtIf( vtN:getX() > 0.9, bStartPos or false, not (bStartPos or false))
|
||||
bMillInvert = EgtIf( vtN:getX() > 0.866, not (bStartPos or false), bStartPos or false)
|
||||
bSawInvertSE = EgtIf( vtN:getX() > 0.866, bStartPos or false, not (bStartPos or false))
|
||||
-- altrimenti orientato lungo la X
|
||||
elseif abs( vtN:getY()) > 0.9 then
|
||||
elseif abs( vtN:getY()) > 0.866 then
|
||||
local dStartX = EgtIf( bStartPos, Proc.Box:getMin():getX(), Proc.Box:getMax():getX())
|
||||
local dStartY = EgtIf( vtN:getY() > 0.9, Proc.Box:getMax():getY(), Proc.Box:getMin():getY())
|
||||
local dStartY = EgtIf( vtN:getY() > 0.866, Proc.Box:getMax():getY(), Proc.Box:getMin():getY())
|
||||
p3Start = Point3d( dStartX, dStartY, Proc.Box:getMin():getZ())
|
||||
local vtNPerp = Vector3d( vtN)
|
||||
vtNPerp:rotate(-Z_AX(), 90 * EgtIf( bStartPos, -1, 1) * EgtIf( vtN:getY() > 0.9, 1, -1))
|
||||
vtNPerp:rotate(-Z_AX(), 90 * EgtIf( bStartPos, -1, 1) * EgtIf( vtN:getY() > 0.866, 1, -1))
|
||||
local FirstLineId = EgtLinePVL( nAddGrpId, p3Start, vtNPerp, dMillDiam / 2 , GDB_RT.GLOB) -- Y_AX()
|
||||
local SecondLineId = EgtLinePVL( nAddGrpId, EgtEP( FirstLineId, GDB_RT.GLOB), vtN, dMillDiam -dSideElev, GDB_RT.GLOB) -- -X_AX()
|
||||
local dThirdLineLen = min( (dMillDiam / 2) + ( Proc.Box:getMax():getX() - Proc.Box:getMin():getX()), dSawShortening + 10)
|
||||
local ThirdLineId = EgtLinePVL( nAddGrpId, EgtEP( SecondLineId, GDB_RT.GLOB), -vtNPerp, dThirdLineLen, GDB_RT.GLOB) -- -Y_AX()
|
||||
local FourthLineId = EgtLinePVL( nAddGrpId, EgtEP( ThirdLineId, GDB_RT.GLOB), -vtN, dMillDiam -dSideElev , GDB_RT.GLOB) -- X_AX()
|
||||
SquareId = EgtCurveCompo( nAddGrpId, { FirstLineId, SecondLineId, ThirdLineId, FourthLineId})
|
||||
bMillInvert = EgtIf( vtN:getY() > 0.9, bStartPos or false, not (bStartPos or false))
|
||||
bSawInvertSE = EgtIf( vtN:getY() > 0.9, not (bStartPos or false), bStartPos or false)
|
||||
bMillInvert = EgtIf( vtN:getY() > 0.866, bStartPos or false, not (bStartPos or false))
|
||||
bSawInvertSE = EgtIf( vtN:getY() > 0.866, not (bStartPos or false), bStartPos or false)
|
||||
end
|
||||
|
||||
-- recupero la lavorazione
|
||||
@@ -1702,24 +1722,6 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
||||
end
|
||||
end
|
||||
|
||||
-- calcolo larghezza canale
|
||||
local dGorgeWidth = dMillDiam
|
||||
-- verifico se elevazione minore per fare meno tagli
|
||||
if dElev + 2 * WD.COLL_SIC < dGorgeWidth then
|
||||
dGorgeWidth = max( dElev + 2 * WD.COLL_SIC, 0)
|
||||
end
|
||||
|
||||
-- sottraggo lato esterno lapjoint per ottenere larghezza netta del gorge
|
||||
dGorgeWidth = dGorgeWidth - dSideElev
|
||||
|
||||
-- calcolo quanti passi devo fare in larghezza per scaricare l'area di impegno utensile
|
||||
local nNumStep = ceil( ( dGorgeWidth) / WD.SAWGORGE_INTERAX)
|
||||
local dC = 0
|
||||
if ( nNumStep - 1) > 0 then
|
||||
dC = ( dGorgeWidth) / ( nNumStep)
|
||||
else
|
||||
nNumStep = 1
|
||||
end
|
||||
-- inserisco la lavorazione
|
||||
local nNm = 0
|
||||
-- passi di allargamento
|
||||
@@ -1785,7 +1787,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
||||
end
|
||||
EgtSetInfo( nMchFId, 'Part', Proc.PartId)
|
||||
-- se ho abilitato la lavorazione di lama per garantire passaggio utensile, setto la nota per spostare la fresatura dopo i tagli di lama
|
||||
if bEnablePreMill then
|
||||
if bEnablePreMill or bAsEnablePreMill then
|
||||
EgtSetInfo( nMchFId, 'MOVE_AFTER', 1)
|
||||
end
|
||||
-- aggiungo geometria
|
||||
@@ -2436,8 +2438,10 @@ local function MakeMoreFaces( Proc, nRawId, b3Raw)
|
||||
local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
-- se di fianco
|
||||
if not bPckt and Proc.Fct >= 3 and vtN:getZ() < WD.NZ_MINA then
|
||||
-- recupero elevazione faccia in feature
|
||||
local dSideElev = WL.GetFaceElevation( Proc.Id, nFacInd)
|
||||
-- se abilitata lavorazione ribasso con fresa di fianco e parametro Q03 abilitato
|
||||
local sMillOnSide, dTMaxDepth, dMaxMat, dDiam = WM.FindMilling( 'SideMill', nil, nil, nil, nil, min( dH, dV))
|
||||
local sMillOnSide, dTMaxDepth, dMaxMat, dDiam = WM.FindMilling( 'SideMill', nil, nil, nil, nil, min( dH, dV), nil, dSideElev)
|
||||
local _, nUseMillOnSide = EvaluateQParam( Proc)
|
||||
-- se ho abilitata lavorazione di fresa di fianco
|
||||
if Proc.Fct >= 3 and sMillOnSide and nUseMillOnSide >= 1 then
|
||||
@@ -2486,7 +2490,7 @@ local function MakeMoreFaces( Proc, nRawId, b3Raw)
|
||||
-- recupero i dati dell'utensile
|
||||
local dMaxMat = 1000
|
||||
local dMaxDepthOnSide = 0
|
||||
if EgtMdbSetCurrMachining( sMilling) then
|
||||
if sMilling and EgtMdbSetCurrMachining( sMilling) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
local dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
|
||||
|
||||
@@ -48,7 +48,7 @@ local Variant = require( 'WProcessVariant')
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- *** Inserimento delle pareti nel pannello ***
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function WallExec.ProcessWalls( dRawL, dRawW, dRawH, vWall, bMachGroupOk, bNewProcess)
|
||||
function WallExec.ProcessWalls( dRawL, dRawW, dRawH, vWall, bMachGroupOk, bNewProcess, nRawOutlineId)
|
||||
|
||||
-- Creazione nuovo gruppo di lavoro
|
||||
if not bMachGroupOk then
|
||||
@@ -94,7 +94,12 @@ function WallExec.ProcessWalls( dRawL, dRawW, dRawH, vWall, bMachGroupOk, bNewPr
|
||||
-- Impostazione dell'attrezzaggio di default
|
||||
EgtImportSetup()
|
||||
-- Creazione del grezzo e suo posizionamento in macchina
|
||||
local nRaw = EgtAddRawPart( Point3d(0,0,0), dRawL, dRawW, dRawH, WD.RAWCOL)
|
||||
local nRaw = GDB_ID.NULL
|
||||
if nRawOutlineId and nRawOutlineId ~= GDB_ID.NULL then
|
||||
nRaw = EgtAddRawPartWithPart( 0, nRawOutlineId, 0, WD.RAWCOL)
|
||||
else
|
||||
nRaw = EgtAddRawPart( Point3d(0,0,0), dRawL, dRawW, dRawH, WD.RAWCOL)
|
||||
end
|
||||
EgtMoveToCornerRawPart( nRaw, OrigOnTab, nCorner)
|
||||
EgtSetInfo( nRaw, 'ORD', 1)
|
||||
-- Inserimento dei pezzi nel grezzo
|
||||
|
||||
+62
-5
@@ -63,15 +63,15 @@ local function ClassifyFlip( vPartProc, b3Part)
|
||||
local bLapJoints = false
|
||||
|
||||
for nInd = 1, #vPartProc do
|
||||
if LapJoint.Identify( vPartProc[nInd]) then
|
||||
-- setto parametro Q
|
||||
if LapJoint.Identify( vPartProc[nInd]) then
|
||||
-- setto parametro Q
|
||||
if vPartProc[nInd].Prc == 30 then
|
||||
EgtSetInfo( vPartProc[nInd].Id, "Q08", 1)
|
||||
EgtSetInfo( vPartProc[nInd].Id, "Q08A", 1)
|
||||
else
|
||||
EgtSetInfo( vPartProc[nInd].Id, "Q03", 1)
|
||||
EgtSetInfo( vPartProc[nInd].Id, "Q03A", 1)
|
||||
end
|
||||
end
|
||||
bLapJoints = true
|
||||
local nFlip0, nFlip1 = LapJoint.FlipClassify(vPartProc[nInd])
|
||||
if nFlip0 and nFlip1 and nFlip0 ~= nFlip1 then
|
||||
@@ -160,7 +160,7 @@ local bManualRot = EgtGetInfo( NFAR.PARTID, "MANUALROT", 'b')
|
||||
-- FLIP
|
||||
local FlipFeatureStates, bLapJoints = ClassifyFlip( vPartProc, b3Part)
|
||||
|
||||
if not bManualFlip then
|
||||
if not bManualFlip then
|
||||
local bFlip
|
||||
-- analizzo stati flip delle feature
|
||||
local nFlip0Min = 100
|
||||
@@ -214,9 +214,66 @@ local FlipFeatureStates, bLapJoints = ClassifyFlip( vPartProc, b3Part)
|
||||
local nTotFlip = EgtIf( nPartFlip == 180, 0, 180)
|
||||
EgtSetInfo( NFAR.PARTID, "INVERTED", nTotFlip)
|
||||
EgtSetInfo( NFAR.PARTID, "FLIPROTMODIFIED", 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- rimuovo parametri Q
|
||||
local b3PartInside = BBox3d( b3Part)
|
||||
b3PartInside:expand( - WD.INSIDE_RAW_TOL)
|
||||
for nInd = 1, #vPartProc do
|
||||
local Proc = vPartProc[nInd]
|
||||
|
||||
if LapJoint.Identify( Proc) then
|
||||
-- cerco la faccia rivolta verso l'alto e la faccia rivolta verso il basso
|
||||
local nFaceInd = -1
|
||||
local nFaceDownInd = -1
|
||||
for nIdx = 0, Proc.Fct - 1 do
|
||||
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nIdx, GDB_ID.ROOT)
|
||||
if vtN:getZ() > 0.95 then
|
||||
nFaceInd = nIdx
|
||||
elseif vtN:getZ() < - 0.95 then
|
||||
nFaceDownInd = nIdx
|
||||
end
|
||||
end
|
||||
-- se è lap joint dall'alto
|
||||
if nFaceInd ~= -1 and nFaceDownInd == -1 then
|
||||
local ptCen = EgtSurfTmFacetCenter( Proc.Id, nFaceInd, GDB_ID.ROOT)
|
||||
-- se all'interno rimuovo info Q
|
||||
if EnclosesPointXY( b3PartInside, ptCen) then
|
||||
-- resetto parametro Q
|
||||
if Proc.Prc == 30 then
|
||||
EgtRemoveInfo( Proc.Id, "Q08")
|
||||
EgtRemoveInfo( Proc.Id, "Q08A")
|
||||
else
|
||||
EgtRemoveInfo( Proc.Id, "Q03")
|
||||
EgtRemoveInfo( Proc.Id, "Q03A")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
elseif DoubleCut.Identify( Proc) then
|
||||
-- verifico se due facce e rivolto verso l'alto
|
||||
if Proc.Fct == 2 then
|
||||
local vtN = {}
|
||||
vtN[1] = EgtSurfTmFacetNormVersor( Proc.Id, 0, GDB_ID.ROOT)
|
||||
vtN[2] = EgtSurfTmFacetNormVersor( Proc.Id, 1, GDB_ID.ROOT)
|
||||
|
||||
if ( vtN[1]:getZ() >= 0.95 or vtN[2]:getZ() >= 0.95) then
|
||||
local nFaceInd = EgtIf( vtN[1]:getZ() >= 0.95, 0, 1)
|
||||
local ptCen = EgtSurfTmFacetCenter( Proc.Id, nFaceInd, GDB_ID.ROOT)
|
||||
-- se all'interno rimuovo info Q
|
||||
if EnclosesPointXY( b3PartInside, ptCen) then
|
||||
-- resetto parametro Q
|
||||
if Proc.Prc == 12 then
|
||||
EgtRemoveInfo( Proc.Id, "Q02")
|
||||
EgtRemoveInfo( Proc.Id, "Q02A")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- ROTATION
|
||||
if not bManualRot then
|
||||
|
||||
+76
-69
@@ -220,11 +220,12 @@ local function IdentifyLJFromBottom( Proc, bCompute, nOutlineGrp)
|
||||
local nFacInd, dElev, nFacInd2, dElev2 = WL.GetFaceWithMostAdj( Proc.Id, Proc.PartId)
|
||||
if nFacInd ~= -2 and nFacInd ~= GDB_ID.NULL then
|
||||
vtFace[1] = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
|
||||
if not ( vtFace[1]:getZ() > dMinCompZ or vtFace[1]:getZ() < - dMinCompZ) then
|
||||
local nOtherFace = -1
|
||||
for nIdx = 0, 3 do
|
||||
local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, nIdx, GDB_ID.ROOT)
|
||||
if vtN2:getZ() > dMinCompZ or vtN2:getZ() < - dMinCompZ then
|
||||
if vtN2:getZ() > dMinCompZ or vtN2:getZ() < - dMinCompZ then
|
||||
nOtherFace = nIdx
|
||||
break
|
||||
end
|
||||
@@ -240,7 +241,20 @@ local function IdentifyLJFromBottom( Proc, bCompute, nOutlineGrp)
|
||||
nRectId = CreateToolRectangle( ptP1, 0, ptP2, WD.SIDEMILL_DIAM_DOWN / 2, vtFace[1], WD.SIDEMILL_DIAM_DOWN, nOutlineGrp)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nFacInd2 and nFacInd2 ~= GDB_ID.NULL then
|
||||
local vtFace2 = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd2, GDB_ID.ROOT)
|
||||
if ( vtFace2:getZ() < - dMinCompZ or vtFace[1]:getZ() < - dMinCompZ) then
|
||||
bLJFromBottom = true
|
||||
if vtFace[1]:getZ() < -dMinCompZ then vtFace[1] = vtFace2 end
|
||||
if bCompute then
|
||||
local bAdj, ptP1, ptP2 = EgtSurfTmFacetsContact( Proc.Id, nFacInd, nFacInd2, GDB_ID.ROOT)
|
||||
nRectId = CreateToolRectangle( ptP1, 0, ptP2, 0, vtFace[1], WD.SIDEMILL_DIAM_DOWN, nOutlineGrp)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -257,6 +271,8 @@ local function IdentifyLJFromTop( Proc, bCompute, nOutlineGrp)
|
||||
local bLJFromTop = false
|
||||
local vtFace, nRectId
|
||||
|
||||
if not WD.SIDEMILL_DIAM_UP or WD.SIDEMILL_DIAM_UP < GEO.EPS_SMALL then return end
|
||||
|
||||
local dMinComp = 0.95
|
||||
if Proc.Fct == 2 then
|
||||
local vtN = {}
|
||||
@@ -264,7 +280,7 @@ local function IdentifyLJFromTop( Proc, bCompute, nOutlineGrp)
|
||||
vtN[2] = EgtSurfTmFacetNormVersor( Proc.Id, 1, GDB_ID.ROOT)
|
||||
|
||||
-- se rivolto verso l'alto
|
||||
if ( vtN[1]:getZ() > dMinComp or vtN[2]:getZ() > dMinComp and WD.SIDEMILL_DIAM_UP > 0) then
|
||||
if (vtN[1]:getZ() > dMinComp or vtN[2]:getZ() > dMinComp) then
|
||||
bLJFromTop = true
|
||||
vtFace = EgtIf( vtN[1]:getZ() > dMinComp, vtN[2], vtN[1])
|
||||
if bCompute then
|
||||
@@ -420,52 +436,57 @@ local function ComputeToolOutlines( nPartId)
|
||||
|
||||
-- lati inclinati free contour
|
||||
if FreeContour.Identify( Proc) then
|
||||
for nInd = 0, Proc.Fct - 1 do
|
||||
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nInd, GDB_ID.ROOT)
|
||||
-- se inclinato
|
||||
if abs( vtN:getZ()) > GEO.EPS_SMALL then
|
||||
local bUnderCut = vtN:getZ() < - GEO.EPS_SMALL
|
||||
local bPocket = EgtGetInfo( Proc.Id, 'PCKT', 'b')
|
||||
if not bPocket then
|
||||
for nInd = 0, Proc.Fct - 1 do
|
||||
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nInd, GDB_ID.ROOT)
|
||||
-- se inclinato
|
||||
if abs( vtN:getZ()) > GEO.EPS_SMALL then
|
||||
local bUnderCut = vtN:getZ() < - GEO.EPS_SMALL
|
||||
|
||||
local dCosAlpha = (vtN ^ Z_AX()):len()
|
||||
local dVal
|
||||
if bUnderCut then
|
||||
dVal = ( NEST.OFFSET + 0.1) / dCosAlpha
|
||||
else
|
||||
dVal = ( NEST.OFFSET + 0.1) * dCosAlpha
|
||||
end
|
||||
|
||||
local frRect = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nInd, GDB_ID.ROOT)
|
||||
local vtX = frRect:getVersX()
|
||||
local vtY = Z_AX() ^ vtX
|
||||
local frLoc = Frame3d( ORIG(), vtX, vtY, Z_AX())
|
||||
vtN:toLoc( frLoc)
|
||||
|
||||
local dCosAlpha = vtN * Y_AX()
|
||||
local dVal
|
||||
if bUnderCut then
|
||||
dVal = ( NEST.OFFSET + 0.1) / dCosAlpha
|
||||
local frLoc, dDimX, dDimY = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nInd, GDB_ID.ROOT)
|
||||
local b3Face = EgtSurfTmGetFacetBBoxRef( Proc.Id, nInd, GDB_BB.STANDARD, frLoc)
|
||||
local ptA = b3Face:getMin()
|
||||
local ptC = b3Face:getMax()
|
||||
local ptB = ptA + dDimY * Y_AX()
|
||||
local ptD = ptA + dDimX * X_AX()
|
||||
ptA:toGlob( frLoc)
|
||||
ptB:toGlob( frLoc)
|
||||
ptC:toGlob( frLoc)
|
||||
ptD:toGlob( frLoc)
|
||||
|
||||
local ptP1, ptP2
|
||||
if bUnderCut then
|
||||
ptP1 = EgtIf( ptA:getZ() > ptC:getZ(), ptA, ptC)
|
||||
ptP2 = EgtIf( ptB:getZ() > ptD:getZ(), ptB, ptD)
|
||||
else
|
||||
dVal = ( NEST.OFFSET + 0.1) * dCosAlpha
|
||||
end
|
||||
ptP1 = EgtIf( ptA:getZ() < ptC:getZ(), ptA, ptC)
|
||||
ptP2 = EgtIf( ptB:getZ() < ptD:getZ(), ptB, ptD)
|
||||
end
|
||||
|
||||
local b3Face = EgtSurfTmGetFacetBBoxRef( Proc.Id, nInd, GDB_BB.STANDARD, frLoc)
|
||||
local dExtra = NEST.OFFSET / 2
|
||||
local dDim = b3Face:getDimX() + 2 * dExtra
|
||||
local vtDir = ptP2 - ptP1
|
||||
vtDir:normalize()
|
||||
ptP1 = ptP1 - vtDir * 0.5 * NEST.OFFSET
|
||||
ptP2 = ptP2 + vtDir * 0.5 * NEST.OFFSET
|
||||
local vtNxy = Vector3d( vtN:getX(), vtN:getY(), 0)
|
||||
vtNxy:normalize()
|
||||
local ptP4 = ptP2 + dVal * vtNxy
|
||||
|
||||
local dCoordZ = EgtIf( bUnderCut, b3Face:getDimZ(), 0)
|
||||
local ptP1
|
||||
if ( dCosAlpha < 0) then
|
||||
ptP1 = Point3d( b3Face:getMin():getX(), b3Face:getMin():getY(), dCoordZ)
|
||||
else
|
||||
ptP1 = Point3d( b3Face:getMax():getX(), b3Face:getMax():getY(), dCoordZ)
|
||||
dDim = -1 * dDim
|
||||
dExtra = -1 * dExtra
|
||||
end
|
||||
|
||||
ptP1 = ptP1 - dExtra * X_AX()
|
||||
local ptDir = ptP1 + dDim * X_AX()
|
||||
local ptCross = ptDir + dVal * Y_AX()
|
||||
ptP1:toGlob( frLoc)
|
||||
ptDir:toGlob( frLoc)
|
||||
ptCross:toGlob( frLoc)
|
||||
local nRectId = EgtRectangle3P( nOutlineGrp, ptP1, ptCross, ptDir)
|
||||
local nRectId = EgtRectangle3P( nOutlineGrp, ptP1, ptP4, ptP2)
|
||||
EgtSetColor( nRectId, EgtStdColor("AQUA"))
|
||||
if nRectId ~= GDB_ID.NULL then table.insert( ToolOutlineId, nRectId) end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -999,7 +1020,7 @@ local function ClassifyAngles( nPartId, RawPart, sRefOrig, bLockedRot, dMinSheet
|
||||
nAngle = 100
|
||||
end
|
||||
|
||||
elseif ResLapJoint.Nbr == 4 then
|
||||
elseif ResLapJoints.Nbr == 4 then
|
||||
nAngle = 100
|
||||
end
|
||||
|
||||
@@ -1335,19 +1356,6 @@ end
|
||||
|
||||
-- Funzione che sposta e aggiunge pezzi per nesting
|
||||
local function AddRawParts(RawParts, vDoneManually)
|
||||
-- -- creo tabella dei grezzi
|
||||
-- for nIndex, nLen in pairs( LEN) do
|
||||
-- table.insert(RawParts, {Len = nLen})
|
||||
-- end
|
||||
-- for nIndex, nWidth in pairs( WIDTH) do
|
||||
-- RawParts[tonumber(nIndex)].Width = nWidth
|
||||
-- end
|
||||
-- for nIndex, nQty in pairs( QTY) do
|
||||
-- RawParts[tonumber(nIndex)].Qty = nQty
|
||||
-- end
|
||||
-- for nIndex, nMaterial in pairs( MATERIAL) do
|
||||
-- RawParts[tonumber(nIndex)].Material = nMaterial
|
||||
-- end
|
||||
|
||||
local OUTLINE = "Outline"
|
||||
for nIndex = 1, #RawParts do
|
||||
@@ -1434,8 +1442,7 @@ local function AddParts(RawParts, vPartsDoneManually)
|
||||
-- posiziono con il nesting solo quelli mancanti
|
||||
nCount = nCount - nManuallyDone
|
||||
end
|
||||
|
||||
|
||||
|
||||
nPartIndex = nPartIndex + 1
|
||||
|
||||
-- calcolo bbox pezzo per rotazioni
|
||||
@@ -1821,17 +1828,17 @@ EgtAutoNestStart()
|
||||
-- lista dei grezzi
|
||||
local RawParts = {}
|
||||
-- creo tabella dei grezzi
|
||||
for nIndex, nLen in pairs( LEN) do
|
||||
table.insert(RawParts, {Len = nLen})
|
||||
for sIndex, dLen in pairs( LEN) do
|
||||
RawParts[tonumber(sIndex)] = { Len = dLen}
|
||||
end
|
||||
for sIndex, dWidth in pairs( WIDTH) do
|
||||
RawParts[tonumber(sIndex)].Width = dWidth
|
||||
end
|
||||
for nIndex, nWidth in pairs( WIDTH) do
|
||||
RawParts[tonumber(nIndex)].Width = nWidth
|
||||
for sIndex, nQty in pairs( QTY) do
|
||||
RawParts[tonumber(sIndex)].Qty = nQty
|
||||
end
|
||||
for nIndex, nQty in pairs( QTY) do
|
||||
RawParts[tonumber(nIndex)].Qty = nQty
|
||||
end
|
||||
for nIndex, nMaterial in pairs( MATERIAL) do
|
||||
RawParts[tonumber(nIndex)].Material = nMaterial
|
||||
for sIndex, sMaterial in pairs( MATERIAL) do
|
||||
RawParts[tonumber(sIndex)].Material = sMaterial
|
||||
end
|
||||
|
||||
--
|
||||
@@ -1930,7 +1937,7 @@ if bNestingOk then
|
||||
if RawParts[nIndex].PartId[nInd2] == nId then
|
||||
EgtSetInfo(nMachGroup, "PANELLEN", RawParts[nIndex].Len)
|
||||
EgtSetInfo(nMachGroup, "PANELWIDTH", RawParts[nIndex].Width)
|
||||
EgtSetInfo(nMachGroup, "MATERIAL", RawParts[nIndex].Material)
|
||||
EgtSetInfo(nMachGroup, "MATERIAL", NEST.MATERIAL)
|
||||
EgtSetInfo(nMachGroup, "AUTONEST", 1)
|
||||
-- scrivo dati per variabili P di comunicazione con la macchina in gruppo di lavorazione
|
||||
EgtSetInfo( nMachGroup, "PRODID", NEST.PRODID)
|
||||
|
||||
Reference in New Issue
Block a user