CamAuto 3.1c1 :
- modifiche ai talloni con waterjet - unite le lavorazioni con waterjet di angoli interni in sovrasquadra - eliminata rettifica degli archi con waterjet e relativi parametri ( per come era scritto il codice non veniva mai fatta).
This commit is contained in:
+152
-178
@@ -17,7 +17,7 @@ _ENV = EgtProtectGlobal()
|
||||
EgtEnableDebug( false)
|
||||
|
||||
-- Versione
|
||||
local CAMAUTO_VER = 'ver 3.1b1'
|
||||
local CAMAUTO_VER = 'ver 3.1c1'
|
||||
|
||||
-- Determino il tipo di macchina
|
||||
local bIsMultiCut = ( EgtGetHeadId( 'H101') ~= nil)
|
||||
@@ -84,11 +84,6 @@ local dOffsetHoleWj = tonumber( EgtGetStringFromIni( 'Nest', 'HolesOffsetWJ', '5
|
||||
-- minimo raggio raccordo (se entità arco ha un raggio maggiore non esegue il preforo)
|
||||
local dMinRadiusWj = tonumber( EgtGetStringFromIni( 'Nest', 'MinRadiusWJ', '5', sMachIni))
|
||||
|
||||
-- parametri **Rectification** WaterJet
|
||||
local bRectificationWj = ( EgtGetStringFromIni( 'Nest', 'RectificationSubSqWJ', '0', sMachIni) == '1')
|
||||
local dOffsetRectificationWj = tonumber( EgtGetStringFromIni( 'Nest', 'OffsetRectificationWJ', '0', sMachIni))
|
||||
local dMaxAngRectificationWj = tonumber( EgtGetStringFromIni( 'Nest', 'MinAngRectificationWJ', '-45', sMachIni))
|
||||
|
||||
-- parametro di altezza massima per abilitare **tagli speciali** per girare attorno al pezzo
|
||||
local HighPieceZ = tonumber( EgtGetStringFromIni( 'RawMove', 'MaxHeightPiece', '800', sMachIni))
|
||||
|
||||
@@ -184,21 +179,11 @@ local TabPocketLay = {}
|
||||
-- Eventuale valore asse bloccato
|
||||
local AxisBlock = 0
|
||||
|
||||
|
||||
local function SquaringWJ( MyTabRtf, TabOutCrv, TabInCrv)
|
||||
local nCountHeel = 0
|
||||
local nCountRect = 0
|
||||
local bExists = false
|
||||
|
||||
if #MyTabRtf > 0 then
|
||||
-- recupero l'ID del part
|
||||
local PartId = EgtGetParent( EgtGetParent( MyTabRtf[1][1]))
|
||||
local RtfLay = EgtGetFirstNameInGroup( PartId, 'WjRectification')
|
||||
if RtfLay then bExists = true end
|
||||
end
|
||||
|
||||
for index = 1 , #MyTabRtf do
|
||||
|
||||
--[[ recupero le informazioni del secondo taglio (misura OnTop):
|
||||
--[[ Funzione che calcola le due curve per le due lavorazioni associate al tallone.
|
||||
Recupero le informazioni del secondo taglio ( misura OnTop):
|
||||
______ ______
|
||||
/ | H| |
|
||||
/ |T | |T
|
||||
@@ -206,122 +191,107 @@ local function SquaringWJ( MyTabRtf, TabOutCrv, TabInCrv)
|
||||
| ______ | \____|
|
||||
dOrigSideAng>0: SideAng1=0, Offset1=(Th-H)*tan(a) | SideAng2=a, Offset2=0, Depth2=Th-H
|
||||
dOrigSideAng<0: SideAng1=a, Offset1=H*tan(a) | SideAng2=0, Offset2=0, Depth=H
|
||||
]]--
|
||||
]]--
|
||||
|
||||
EgtOutLog( 'Nuova gestione rettifica talloni con WJ')
|
||||
|
||||
local TabTrimCrvs = {}
|
||||
|
||||
for i = 1, #MyTabRtf do
|
||||
|
||||
local nEntId = MyTabRtf[i][1]
|
||||
local _, dSideAng = CAM.GetSideAng( nEntId)
|
||||
local _, dSideAng2 = CAM.GetSideAng( nEntId, 2)
|
||||
local _, dPrevAng = CAM.GetPrevAngle( nEntId)
|
||||
local _, dNextAng = CAM.GetNextAngle( nEntId)
|
||||
|
||||
local nEntId = MyTabRtf[index][1]
|
||||
local _, Heel = CAM.GetHeel( nEntId)
|
||||
local _, dOffset = CAM.GetOffset( nEntId, 2)
|
||||
local _, dSideAng = CAM.GetSideAng( nEntId, 2)
|
||||
|
||||
if bExists then
|
||||
if MyTabRtf[index][2] == 0 then
|
||||
table.insert( TabOutCrv, nRtfId)
|
||||
else
|
||||
table.insert( TabInCrv, nRtfId)
|
||||
-- verifico se è vero tallone che necessita di due lavorazioni
|
||||
if abs( dSideAng) > GEO.EPS_ANG_SMALL or abs( dSideAng2) > GEO.EPS_ANG_SMALL then
|
||||
|
||||
-- recupero il primo layer del pezzo con nome 'WjRectification', altrimenti lo creo
|
||||
local nPartId = EgtGetParent( EgtGetParent( nEntId))
|
||||
local nRtfLayId = EgtGetFirstNameInGroup( nPartId, 'WjRectification')
|
||||
if not nRtfLayId then
|
||||
nRtfLayId = EgtGroup( nPartId, GDB_RT.GLOB)
|
||||
EgtSetName( nRtfLayId, 'WjRectification')
|
||||
end
|
||||
else
|
||||
-- Se è stato definito un Heel allora IGNORO la rettifica
|
||||
if Heel > 0 then
|
||||
EgtOutLog('Nuova gestione rettifica tagli inclinati con WJ')
|
||||
nCountHeel = nCountHeel + 1
|
||||
-- costruisco i layers
|
||||
local ParentId = EgtGetParent( nEntId)
|
||||
ParentId = EgtGetParent( ParentId)
|
||||
-- recupero il primo Layer con nome 'WjRectification', altrimenti lo creo
|
||||
local RtfLay = EgtGetFirstNameInGroup( ParentId, 'WjRectification')
|
||||
if not RtfLay then
|
||||
RtfLay = EgtGroup( ParentId, GDB_RT.GLOB)
|
||||
EgtSetName( RtfLay, 'WjRectification')
|
||||
|
||||
-- costruisco l'entità per lavorazione inclinata
|
||||
local nNewId = EgtCopyGlob( nEntId, nRtfLayId)
|
||||
EgtSetInfo( nNewId, 'CopyEnt', nEntId)
|
||||
if dSideAng2 > 0 then
|
||||
-- riporto l'informazione su SideAng perchè è l'unica info letta nel calcolare la lavorazione
|
||||
EgtSetInfo( nNewId, 'SideAng', dSideAng2)
|
||||
end
|
||||
-- costruisco l'entità per lavorazione non inclinata
|
||||
local nRtfId = EgtCopyGlob( nEntId, nRtfLayId)
|
||||
EgtSetInfo( nRtfId, 'CopyEnt', nEntId)
|
||||
EgtSetInfo( nRtfId, 'SideAng', 0)
|
||||
|
||||
-- offset: se sovrasquadra devo offsettare il tratto non inclinato, se sottosquadra quello inclinato
|
||||
local _, dOffset = CAM.GetOffset( nEntId)
|
||||
local nOffsEntId = EgtIf( dSideAng2 > 0, nRtfId, nNewId)
|
||||
EgtOffsetCurve( nOffsEntId, dOffset, GDB_OT.FILLET)
|
||||
EgtSetInfo( nNewId, 'Offset', 0)
|
||||
EgtSetInfo( nRtfId, 'Offset', 0)
|
||||
|
||||
-- estensione: se sovrasquadra gli angoli esterni devono essere uniti, quindi allungo opportunamente le curve non inclinate per trovarle con estremi coincidenti
|
||||
-- durante l'analisi dei concatenamenti del waterjet
|
||||
if dSideAng2 > 0 then
|
||||
if dPrevAng > GEO.EPS_ANG_SMALL then
|
||||
local dSWE = EgtGetInfo( nEntId, 'SWE', 'd') or 0
|
||||
EgtExtendCurveStartByLen( nRtfId, dSWE)
|
||||
EgtRemoveInfo( nRtfId, 'SWE')
|
||||
end
|
||||
-- copio l'entità e aggiorno le info del secondo taglio da applicare
|
||||
local nRtfId = EgtCopyGlob( nEntId, RtfLay)
|
||||
-- rimuovo da entrambe le entità le info SideAng2 e Offset2 per aggiornare le info SindeAng e Offset
|
||||
EgtRemoveInfo( nRtfId, 'SideAng2')
|
||||
EgtRemoveInfo( nRtfId, 'Offset2')
|
||||
-- indico il valore di SideAng del taglio (
|
||||
EgtSetInfo( nRtfId, 'SideAng', dSideAng)
|
||||
|
||||
-- azzero offset (perchè mi preoccupo di applicarlo veramente)
|
||||
EgtSetInfo( nRtfId, 'Offset', 0)
|
||||
-- applico offset
|
||||
EgtOffsetCurve( nRtfId, -dOffset, GDB_OT.FILLET)
|
||||
-- estendo le curve della quantità calcolata
|
||||
local swe = EgtGetInfo( nRtfId, 'SWE', 'd') or 0
|
||||
local ewe = EgtGetInfo( nRtfId, 'EWE', 'd') or 0
|
||||
|
||||
local dDir = 1
|
||||
-- if dSideAng < 0 then
|
||||
-- dDir = -1
|
||||
-- end
|
||||
|
||||
EgtExtendCurveStartByLen( nRtfId, dDir * swe)
|
||||
EgtExtendCurveEndByLen( nRtfId, dDir * ewe)
|
||||
EgtRemoveInfo( nRtfId, 'SWE')
|
||||
EgtRemoveInfo( nRtfId, 'EWE')
|
||||
|
||||
-- azzero offset (perchè mi preoccupo di applicarlo veramente)
|
||||
local _, dOffset1 = CAM.GetOffset( nEntId)
|
||||
EgtSetInfo( nEntId, 'Offset', 0)
|
||||
-- applico offset
|
||||
EgtOffsetCurve( nEntId, dOffset1, GDB_OT.FILLET)
|
||||
|
||||
-- -- indico il valore di Offset del taglio
|
||||
-- EgtSetInfo( nRtfId, 'Offset', dOffset)
|
||||
|
||||
-- local vtDir = EgtMV( nRtfId, GDB_ID.ROOT)
|
||||
-- vtDir:rotate( Z_AX(), -90)
|
||||
-- local x1 = EgtSplitCurve( nRtfId, 2)
|
||||
-- local x2 = x1 + 1
|
||||
-- EgtExtendCurveEndByLen( x1, -10)
|
||||
-- EgtTrimCurveStartAtLen( x2, 10)
|
||||
-- local l1 = EgtLinePVL( RtfLay, EgtEP( x1, GDB_ID.ROOT), vtDir, 100, GDB_ID.ROOT)
|
||||
-- local l2 = EgtLinePVL( RtfLay, EgtSP( x2, GDB_ID.ROOT), vtDir, 100, GDB_ID.ROOT)
|
||||
-- EgtInvertCurve( { l2})
|
||||
-- l1 = EgtCurveCompo( RtfLay, {x1, l1})
|
||||
-- l2 = EgtCurveCompo( RtfLay, {l2, x2})
|
||||
|
||||
-- assego l'entità appena creata alla tabella delle entità da lavorare
|
||||
if MyTabRtf[index][2] == 0 then
|
||||
table.insert( TabOutCrv, nRtfId)
|
||||
-- table.insert( TabOutCrv, l1)
|
||||
-- table.insert( TabOutCrv, l2)
|
||||
else
|
||||
table.insert( TabInCrv, nRtfId)
|
||||
if dNextAng > GEO.EPS_ANG_SMALL then
|
||||
local dEWE = EgtGetInfo( nEntId, 'EWE', 'd') or 0
|
||||
EgtExtendCurveEndByLen( nRtfId, dEWE)
|
||||
EgtRemoveInfo( nRtfId, 'EWE')
|
||||
end
|
||||
|
||||
elseif bRectificationWj then
|
||||
-- solo per tagli in sotto squadra (anche se angolo dMax impostato positivo)!
|
||||
if dSideAng < 0 and abs( dSideAng) < abs( dMaxAngRectificationWj) then
|
||||
nCountRect = nCountRect + 1
|
||||
-- **costruisco i layers**
|
||||
local ParentId = EgtGetParent( nEntId)
|
||||
ParentId = EgtGetParent( ParentId)
|
||||
-- recupero il primo Layer con nome 'WjRectification', altrimenti lo creo
|
||||
local RtfLay = EgtGetFirstNameInGroup( ParentId, 'WjRectification')
|
||||
if not RtfLay then
|
||||
RtfLay = EgtGroup( ParentId, GDB_RT.GLOB)
|
||||
EgtSetName( RtfLay, 'WjRectification')
|
||||
end
|
||||
-- ivi copio l'entità e aggiorno le info del secondo taglio da applicare
|
||||
local nRtfId = EgtCopyGlob( nEntId, RtfLay)
|
||||
EgtRemoveInfo( nRtfId, 'SideAng')
|
||||
EgtSetInfo( nRtfId, 'Offset', dMaxAngRectificationWj)
|
||||
|
||||
if MyTabRtf[index][2] == 0 then
|
||||
table.insert( TabOutCrv, nRtfId)
|
||||
else
|
||||
table.insert( TabInCrv, nRtfId)
|
||||
end
|
||||
end
|
||||
|
||||
-- inserisco le nuove entità tra quelle da lavorare nell'ordine corretto. La prima sostituisce la curva di partenza, la seconda viene aggiunta in fondo al vettore
|
||||
-- Nel caso di sovrasquadra viene fatta prima la lavorazione non inclinata e poi quella inclinata, nel caso di sottosquadra il contrario
|
||||
local TabCrvRef = EgtIf( MyTabRtf[i][2] == 0, TabOutCrv, TabInCrv)
|
||||
local nFirstEnt = EgtIf( dSideAng2 > 0, nRtfId, nNewId)
|
||||
local nSecondEnt = EgtIf( dSideAng2 > 0, nNewId, nRtfId)
|
||||
for j = 1, #TabCrvRef do
|
||||
if MyTabRtf[i][1] == TabCrvRef[j] then
|
||||
TabCrvRef[j] = nFirstEnt
|
||||
table.insert( TabCrvRef, nSecondEnt)
|
||||
break
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- se sottosquadra e angolo interno salvo la curva inclinata tra quelle da trimmare
|
||||
if dSideAng2 == 0 and ( dPrevAng < GEO.EPS_ANG_SMALL or dNextAng < GEO.EPS_ANG_SMALL) then
|
||||
table.insert( TabTrimCrvs, { nId = nNewId, nOrigId = nEntId, dSideAng = dSideAng, bStart = ( dPrevAng < GEO.EPS_ANG_SMALL), bEnd = ( dNextAng < GEO.EPS_ANG_SMALL)})
|
||||
end
|
||||
end
|
||||
end
|
||||
if nCountHeel >0 and nCountRect >0 then
|
||||
EgtOutLog('ATTENZIONE: esistono tagli di rettifica (bRectificationWj) e con Heel nello stesso progetto!')
|
||||
|
||||
-- le curve di angoli interni in sottosquadra devono essere concatenate per garantire lavorazione completa, quindi ne faccio trim per trovarle con estremi coincidenti
|
||||
-- durante l'analisi dei concatenamenti del waterjet
|
||||
for i = 1, #TabTrimCrvs do
|
||||
if TabTrimCrvs[i].bStart then
|
||||
for j = 1, #TabTrimCrvs do
|
||||
if i ~= j and TabTrimCrvs[j].bEnd then
|
||||
-- verifico se le curve originali sono concatenabili
|
||||
if abs( TabTrimCrvs[i].dSideAng - TabTrimCrvs[j].dSideAng) < GEO.EPS_ANG_SMALL and
|
||||
AreSamePointApprox( EgtSP( TabTrimCrvs[i].nOrigId, GDB_ID.ROOT), EgtEP( TabTrimCrvs[j].nOrigId, GDB_ID.ROOT), 10 * GEO.EPS_SMALL) then
|
||||
-- trim delle curve nel loro punto di intersezione
|
||||
local ptInt = EgtIP( TabTrimCrvs[i].nId, TabTrimCrvs[j].nId, EgtSP( TabTrimCrvs[i].nId, GDB_ID.ROOT), GDB_ID.ROOT)
|
||||
local dPar = EgtCurveParamAtPoint( TabTrimCrvs[i].nId, ptInt, 10 * GEO.EPS_SMALL, GDB_RT.GLOB)
|
||||
EgtTrimCurveStartAtParam( TabTrimCrvs[i].nId, dPar)
|
||||
local dParPrev = EgtCurveParamAtPoint( TabTrimCrvs[j].nId, ptInt, 10 * GEO.EPS_SMALL, GDB_RT.GLOB)
|
||||
EgtTrimCurveEndAtParam( TabTrimCrvs[j].nId, dParPrev)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
--
|
||||
|
||||
-- Funzione che raccoglie gli identificativi delle entità di un pezzo da lavorare
|
||||
function CAM.AnalyzePart( nPartId)
|
||||
@@ -334,10 +304,8 @@ function CAM.AnalyzePart( nPartId)
|
||||
local nEntId = EgtGetFirstInGroup( nOutLayId)
|
||||
while nEntId do
|
||||
local nType = EgtGetType(nEntId)
|
||||
-- Se waterjet attivo ed entità con angolo
|
||||
-- if sWaterJet ~= '' and ( CAM.GetSideAngNotNull( nEntId) or nType == GDB_TY.CRV_ARC) then
|
||||
-- (ver 2.7e1)
|
||||
if sWaterJet ~= '' and ( CAM.GetHeelNotNull( nEntId) or nType == GDB_TY.CRV_ARC) then
|
||||
-- Se waterjet attivo ed entità con tallone
|
||||
if sWaterJet ~= '' and CAM.GetHeelNotNull( nEntId) then
|
||||
table.insert( TabOutCrv, nEntId)
|
||||
table.insert( MyTabRtf, {nEntId, 0})
|
||||
else
|
||||
@@ -370,10 +338,8 @@ function CAM.AnalyzePart( nPartId)
|
||||
local nEntId = EgtGetFirstInGroup( nInLayId)
|
||||
while nEntId do
|
||||
local nType = EgtGetType(nEntId)
|
||||
-- Se waterjet attivo ed entità con angolo o arco
|
||||
-- if sWaterJet ~= '' and ( CAM.GetSideAngNotNull( nEntId) or nType == GDB_TY.CRV_ARC) then
|
||||
-- (ver 2.7e1)
|
||||
if sWaterJet ~= '' and ( CAM.GetHeelNotNull( nEntId) or nType == GDB_TY.CRV_ARC) then
|
||||
-- Se waterjet attivo ed entità con tallone
|
||||
if sWaterJet ~= '' and CAM.GetHeelNotNull( nEntId) then
|
||||
table.insert( TabInCrv, nEntId)
|
||||
table.insert( MyTabInLoop, nEntId)
|
||||
table.insert( MyTabRtf, {nEntId, 1})
|
||||
@@ -522,40 +488,9 @@ function CAM.AnalyzePart( nPartId)
|
||||
nInLayId = EgtGetNextName( nInLayId, 'InLoop')
|
||||
end
|
||||
|
||||
-- prima di passare al layer successivo verifico se la rettifica dei tagli inclinati
|
||||
-- verifico se necessario ricalcolo delle curve di lavorazione per talloni
|
||||
if sWaterJet ~= '' then
|
||||
|
||||
SquaringWJ( MyTabRtf, TabOutCrv, TabInCrv)
|
||||
|
||||
-- for index = 1 , #MyTabRtf do
|
||||
-- local nEntId = MyTabRtf[index][1]
|
||||
-- -- verifico se esiste un lato inclinato e se è stato inseriot il parametro Heel
|
||||
-- local _, SideAng = CAM.GetSideAng( nEntId, 2)
|
||||
-- if SideAng < dMaxAngRectificationWj then
|
||||
-- -- **costruisco i layers**
|
||||
-- local ParentId = EgtGetParent( nEntId)
|
||||
-- ParentId = EgtGetParent( ParentId)
|
||||
-- local RtfLay = EgtGroup( ParentId, GDB_RT.GLOB)
|
||||
-- EgtSetName( RtfLay, 'WjRectification')
|
||||
-- local nRtfId = EgtCopyGlob( nEntId, RtfLay)
|
||||
-- EgtRemoveInfo( nRtfId, 'SideAng')
|
||||
-- EgtSetInfo( nRtfId, 'Offset', dMaxAngRectificationWj)
|
||||
--
|
||||
-- local ptStr = EgtSP( nEntId, GDB_ID.ROOT)
|
||||
-- local ptEnd = EgtEP( nEntId, GDB_ID.ROOT)
|
||||
-- EgtOutLog(' ENT: '..tostring(nEntId))
|
||||
-- EgtOutLog(' st: '..tostring(ptStr[1])..','..tostring(ptStr[2]))
|
||||
-- EgtOutLog(' en: '..tostring(ptEnd[1])..','..tostring(ptEnd[2]))
|
||||
--
|
||||
-- if MyTabRtf[index][2] == 0 then
|
||||
-- table.insert( TabOutCrv, nRtfId)
|
||||
-- else
|
||||
-- table.insert( TabInCrv, nRtfId)
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
|
||||
MyTabRtf = {}
|
||||
end
|
||||
|
||||
-- |FILOTOP|
|
||||
@@ -1602,8 +1537,8 @@ function CAM.ApplyWaterJettings( TabEnt, TabPartMch, sLay)
|
||||
local RecMPartC2 = TabMPartC[j]
|
||||
if ( RecMPartC2.OperId == 0 or RecMPartC2.EndStrict) and ( RecMPartC2.Join or #TabEnt == 0) then
|
||||
local ptEnd = EgtEP( RecMPartC2.EntId, GDB_ID.ROOT)
|
||||
-- se estremi coincidono e angoli coincidono e non positivi
|
||||
-- (tolti i positivi il 2021/03/24 per fare rettangoli con lati indipendenti anche con misure sul top)
|
||||
-- se estremi e angoli coincidono
|
||||
-- (tolti i positivi il 2021/03/24 per fare rettangoli con lati indipendenti anche con misure sul top, poi reintrodotti)
|
||||
if AreSamePointEpsilon( ptStart, ptEnd, 10 * GEO.EPS_SMALL) and
|
||||
abs( RecMPartC.SideAng - RecMPartC2.SideAng) < 10 * GEO.EPS_ANG_SMALL then
|
||||
--and ( not bSizeAlwaysOnTop or RecMPartC.SideAng <= 10 * GEO.EPS_ANG_SMALL) then
|
||||
@@ -1611,6 +1546,41 @@ function CAM.ApplyWaterJettings( TabEnt, TabPartMch, sLay)
|
||||
RecMPartC2.NextInd = i
|
||||
break
|
||||
end
|
||||
|
||||
-- se angoli interni in sovrasquadra le curve di lavorazione non hanno estremi coincidenti ma le lavorazioni devono essere unite per essere complete
|
||||
-- quindi confronto le curve del loop originale
|
||||
if RecMPartC.PrevAng < - GEO.EPS_ANG_SMALL and RecMPartC.SideAng > GEO.EPS_ANG_SMALL and
|
||||
abs( RecMPartC.SideAng - RecMPartC2.SideAng) < 10 * GEO.EPS_ANG_SMALL then
|
||||
|
||||
-- recupero tratto di riferimento ( se entità per tallone è in una info altrimenti è l'entità stessa)
|
||||
local nRefEntId = EgtGetInfo( RecMPartC.EntId, 'CopyEnt', 'i') or RecMPartC.EntId
|
||||
-- recupero la curva originale
|
||||
local nLoopLayer = EgtGetParent( nRefEntId)
|
||||
local nPart = EgtGetParent( nLoopLayer)
|
||||
local nOrigLoopLayer = EgtGetFirstNameInGroup( nPart, EgtGetName( nLoopLayer) .. '.orig')
|
||||
local nOrig = EgtGetFirstNameInGroup( nOrigLoopLayer, EgtGetName( nRefEntId))
|
||||
|
||||
local nRefEntId2 = EgtGetInfo( RecMPartC2.EntId, 'CopyEnt', 'i') or RecMPartC2.EntId
|
||||
local nLoopLayer2 = EgtGetParent( nRefEntId2)
|
||||
local nPart2 = EgtGetParent( nLoopLayer2)
|
||||
local nOrigLoopLayer2 = EgtGetFirstNameInGroup( nPart2, EgtGetName( nLoopLayer2) .. '.orig')
|
||||
local nOrig2 = EgtGetFirstNameInGroup( nOrigLoopLayer2, EgtGetName( nRefEntId2))
|
||||
|
||||
if AreSamePointEpsilon( EgtSP( nOrig, GDB_ID.ROOT), EgtEP( nOrig2, GDB_ID.ROOT), 10 * GEO.EPS_SMALL) then
|
||||
-- estendo le curve in modo che vengano trovate come consecutive e salvo l'info di accorciamento per tornare alla dimensione originale ( per separazione)
|
||||
local dLenOld = EgtCurveLength( RecMPartC.EntId)
|
||||
EgtModifyCurveStartPoint( RecMPartC.EntId, EgtSP( nOrig, GDB_ID.ROOT), GDB_RT.GLOB)
|
||||
EgtSetInfo( RecMPartC.EntId, 'SWE', dLenOld - EgtCurveLength( RecMPartC.EntId))
|
||||
|
||||
local dLenOld2 = EgtCurveLength( RecMPartC2.EntId)
|
||||
EgtModifyCurveEndPoint( RecMPartC2.EntId, EgtEP( nOrig2, GDB_ID.ROOT), GDB_RT.GLOB)
|
||||
EgtSetInfo( RecMPartC2.EntId, 'EWE', dLenOld2 - EgtCurveLength( RecMPartC2.EntId))
|
||||
|
||||
RecMPartC.PrevInd = j
|
||||
RecMPartC2.NextInd = i
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1666,7 +1636,8 @@ function CAM.ApplyWaterJettings( TabEnt, TabPartMch, sLay)
|
||||
table.insert( tabMid, RecMPartCe.PrevInd)
|
||||
end
|
||||
-- |LAVORAZIONE| costruisco la lavorazione dell'entità **i-esima**
|
||||
local nMill = EgtAddMachining( 'Waterjet' .. tostring( RecMPartCs.EntId) .. 'S', sWaterJet)
|
||||
local nRefEntId = EgtGetInfo( RecMPartCs.EntId, 'CopyEnt', 'i') or RecMPartCs.EntId
|
||||
local nMill = EgtAddMachining( 'Waterjet' .. tostring( nRefEntId) .. 'S', sWaterJet)
|
||||
if nMill then
|
||||
local sName = EgtGetName( nMill)
|
||||
|
||||
@@ -1679,7 +1650,7 @@ function CAM.ApplyWaterJettings( TabEnt, TabPartMch, sLay)
|
||||
|
||||
-- aggiustamenti vari
|
||||
local dRad = 0.5 * CAM.GetToolDiameter() -- diametro utensile
|
||||
local dUserOffsR = EgtGetMachiningParam( MCH_MP.OFFSR) -- offset radiale
|
||||
local dUserOffsR = EgtGetMachiningParam( MCH_MP.OFFSR) -- offset radiale
|
||||
-- verifico se percorso chiuso: tra punto **i-esimo** e **j-esimo**
|
||||
local ptStart = EgtSP( RecMPartCs.EntId, GDB_ID.ROOT)
|
||||
local ptEnd = EgtEP( RecMPartCe.EntId, GDB_ID.ROOT)
|
||||
@@ -1745,7 +1716,7 @@ function CAM.ApplyWaterJettings( TabEnt, TabPartMch, sLay)
|
||||
EgtSetMachiningParam( MCH_MP.SIDEANGLE, RecMPartCs.SideAng + dTaperAng)
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dUserOffsR + RecMPartCs.Offset)
|
||||
-- suggerisco angoli iniziali
|
||||
CAM.HintWaterJetAngC( RecMPartCs.SideAng + dTaperAng, ( sLay == 'OutLoop'), RecMPartCs.EntId)
|
||||
CAM.HintWaterJetAngC( RecMPartCs.SideAng + dTaperAng, ( sLay == 'OutLoop'), nRefEntId)
|
||||
-- assegno geometria
|
||||
if EgtSetMachiningGeometry( tabEnt) then
|
||||
if EgtPreviewMachining() then
|
||||
@@ -1755,7 +1726,7 @@ function CAM.ApplyWaterJettings( TabEnt, TabPartMch, sLay)
|
||||
if abs( RecMPartCs.SideAng + dTaperAng) > GEO.EPS_ANG_SMALL and not EgtApplyMachining( true) and EgtGetOutstrokeInfo() then
|
||||
-- se aperto, cambio gli angoli iniziali
|
||||
if not bClosed then
|
||||
CAM.HintWaterJetAngC( RecMPartCs.SideAng + dTaperAng, ( sLay ~= 'OutLoop'), RecMPartCs.EntId)
|
||||
CAM.HintWaterJetAngC( RecMPartCs.SideAng + dTaperAng, ( sLay ~= 'OutLoop'), nRefEntId)
|
||||
-- altrimenti chiuso, spezzo a metà
|
||||
else
|
||||
-- lunghezza della geometria
|
||||
@@ -1843,7 +1814,8 @@ function CAM.ApplyWaterJettings( TabEnt, TabPartMch, sLay)
|
||||
-- completo singolo
|
||||
if not RecMPartC.StartDone and RecMPartC.OperId == 0 then
|
||||
-- |LAVORAZIONE|
|
||||
local nMill = EgtAddMachining( 'Waterjet'..tostring(RecMPartC.EntId)..'S', sWaterJet)
|
||||
local nRefEntId = EgtGetInfo( RecMPartC.EntId, 'CopyEnt', 'i') or RecMPartC.EntId
|
||||
local nMill = EgtAddMachining( 'Waterjet'..tostring( nRefEntId)..'S', sWaterJet)
|
||||
if nMill then
|
||||
local sName = EgtGetName( nMill)
|
||||
-- aggiustamenti vari
|
||||
@@ -1897,7 +1869,7 @@ function CAM.ApplyWaterJettings( TabEnt, TabPartMch, sLay)
|
||||
EgtSetMachiningParam( MCH_MP.SIDEANGLE, RecMPartC.SideAng + dTaperAng)
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, RecMPartC.Offset + dUserOffsR)
|
||||
-- suggerisco angoli iniziali
|
||||
CAM.HintWaterJetAngC( RecMPartC.SideAng + dTaperAng, ( sLay == 'OutLoop'), RecMPartC.EntId)
|
||||
CAM.HintWaterJetAngC( RecMPartC.SideAng + dTaperAng, ( sLay == 'OutLoop'), nRefEntId)
|
||||
-- aggiungo la geometria
|
||||
if EgtSetMachiningGeometry( {RecMPartC.EntId}) then
|
||||
-- verifico che la lavorazione parziale non interferisca con altri pezzi
|
||||
@@ -1909,7 +1881,7 @@ function CAM.ApplyWaterJettings( TabEnt, TabPartMch, sLay)
|
||||
if abs( RecMPartC.SideAng + dTaperAng) > GEO.EPS_ANG_SMALL and not EgtApplyMachining( true) and EgtGetOutstrokeInfo() then
|
||||
-- se aperto, cambio gli angoli iniziali
|
||||
if not bClosed then
|
||||
CAM.HintWaterJetAngC( RecMPartC.SideAng + dTaperAng, ( sLay ~= 'OutLoop'), RecMPartC.EntId)
|
||||
CAM.HintWaterJetAngC( RecMPartC.SideAng + dTaperAng, ( sLay ~= 'OutLoop'), nRefEntId)
|
||||
-- altrimenti chiuso, spezzo a metà
|
||||
else
|
||||
-- lunghezza della geometria
|
||||
@@ -1959,7 +1931,8 @@ function CAM.ApplyWaterJettings( TabEnt, TabPartMch, sLay)
|
||||
end
|
||||
-- parziale singolo su **inizio**
|
||||
if not RecMPartC.StartDone and RecMPartC.StartStrict and RecMPartC.PrevAng >= - 5 then
|
||||
local nMill = EgtAddMachining( 'Waterjet'..tostring(RecMPartC.EntId)..'S', sWaterJet)
|
||||
local nRefEntId = EgtGetInfo( RecMPartC.EntId, 'CopyEnt', 'i') or RecMPartC.EntId
|
||||
local nMill = EgtAddMachining( 'Waterjet'..tostring( nRefEntId)..'S', sWaterJet)
|
||||
if nMill then
|
||||
local sName = EgtGetName( nMill)
|
||||
-- aggiustamenti vari
|
||||
@@ -1999,7 +1972,7 @@ function CAM.ApplyWaterJettings( TabEnt, TabPartMch, sLay)
|
||||
EgtSetMachiningParam( MCH_MP.SIDEANGLE, RecMPartC.SideAng + dTaperAng)
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, RecMPartC.Offset + dUserOffsR)
|
||||
-- suggerisco angoli iniziali
|
||||
CAM.HintWaterJetAngC( RecMPartC.SideAng + dTaperAng, ( sLay == 'OutLoop'), RecMPartC.EntId)
|
||||
CAM.HintWaterJetAngC( RecMPartC.SideAng + dTaperAng, ( sLay == 'OutLoop'), nRefEntId)
|
||||
|
||||
-- disattivo foro di ingresso
|
||||
EgtSetMachiningParam( MCH_MP.LIHOLE, false)
|
||||
@@ -2049,7 +2022,8 @@ function CAM.ApplyWaterJettings( TabEnt, TabPartMch, sLay)
|
||||
end
|
||||
-- parziale singolo su **fine**
|
||||
if not RecMPartC.EndDone and RecMPartC.EndStrict and RecMPartC.NextAng >= - 5 then
|
||||
local nMill = EgtAddMachining( 'Waterjet'..tostring(RecMPartC.EntId)..'E', sWaterJet)
|
||||
local nRefEntId = EgtGetInfo( RecMPartC.EntId, 'CopyEnt', 'i') or RecMPartC.EntId
|
||||
local nMill = EgtAddMachining( 'Waterjet'..tostring( nRefEntId)..'E', sWaterJet)
|
||||
if nMill then
|
||||
local sName = EgtGetName( nMill)
|
||||
-- aggiustamenti vari
|
||||
@@ -2089,7 +2063,7 @@ function CAM.ApplyWaterJettings( TabEnt, TabPartMch, sLay)
|
||||
EgtSetMachiningParam( MCH_MP.SIDEANGLE, RecMPartC.SideAng + dTaperAng)
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, RecMPartC.Offset + dUserOffsR)
|
||||
-- suggerisco angoli iniziali
|
||||
CAM.HintWaterJetAngC( RecMPartC.SideAng + dTaperAng, ( sLay == 'OutLoop'), RecMPartC.EntId)
|
||||
CAM.HintWaterJetAngC( RecMPartC.SideAng + dTaperAng, ( sLay == 'OutLoop'), nRefEntId)
|
||||
|
||||
-- disattivo foro di ingresso
|
||||
EgtSetMachiningParam( MCH_MP.LIHOLE, false)
|
||||
|
||||
Reference in New Issue
Block a user