Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e0c4f85bfb | |||
| 675b730dcf | |||
| 0f122feaac | |||
| eec524a00f | |||
| d4b7fe1910 | |||
| 880cecfde2 | |||
| b05d1aa7b8 | |||
| b775610125 | |||
| 9e284d509b | |||
| dd7a1e80b2 | |||
| 919b32ca8d | |||
| fef5db6046 | |||
| 0d5dd4d348 | |||
| e526502177 | |||
| 325f30c61b | |||
| f824cde2d0 | |||
| a61b27f292 | |||
| e582f7a38b |
+11
-7
@@ -608,6 +608,11 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, vBeam, b
|
|||||||
local b3Part = EgtGetBBoxGlob( Pz or GDB_ID.NULL, GDB_BB.EXACT)
|
local b3Part = EgtGetBBoxGlob( Pz or GDB_ID.NULL, GDB_BB.EXACT)
|
||||||
local b3Solid = vBeam[i].Box
|
local b3Solid = vBeam[i].Box
|
||||||
if b3Part:isEmpty() or b3Solid:isEmpty() then break end
|
if b3Part:isEmpty() or b3Solid:isEmpty() then break end
|
||||||
|
-- creo o pulisco gruppo geometrie aggiuntive
|
||||||
|
if not BL.CreateOrEmptyAddGroup( Pz) then
|
||||||
|
local sOut = 'Error creating Additional Group in Part ' .. tostring( Pz)
|
||||||
|
return false, sOut
|
||||||
|
end
|
||||||
-- analizzo le features per valutare l'esistenza di feature head/tail che renderebbero inutili le rispettive finiture o di tagli di testa/coda sostituiti da cui leggere il parametro Q05
|
-- analizzo le features per valutare l'esistenza di feature head/tail che renderebbero inutili le rispettive finiture o di tagli di testa/coda sostituiti da cui leggere il parametro Q05
|
||||||
local vProc = CollectFeatures( Pz, b3Solid, 0)
|
local vProc = CollectFeatures( Pz, b3Solid, 0)
|
||||||
local bSFinishingNeeded, nReplacedHeadCutFeatureId, nHeadCuttingFeatureId = AnalyzeHeadFeatures( b3Solid, vProc, dRawW, dRawH)
|
local bSFinishingNeeded, nReplacedHeadCutFeatureId, nHeadCuttingFeatureId = AnalyzeHeadFeatures( b3Solid, vProc, dRawW, dRawH)
|
||||||
@@ -677,11 +682,7 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, vBeam, b
|
|||||||
-- assegno ordine in lavorazione
|
-- assegno ordine in lavorazione
|
||||||
Cnt = Cnt + 1
|
Cnt = Cnt + 1
|
||||||
EgtSetInfo( nRaw, 'ORD', Cnt)
|
EgtSetInfo( nRaw, 'ORD', Cnt)
|
||||||
-- creo o pulisco gruppo geometrie aggiuntive
|
|
||||||
if not BL.CreateOrEmptyAddGroup( Pz) then
|
|
||||||
local sOut = 'Error creating Additional Group in Part ' .. tostring( Pz)
|
|
||||||
return false, sOut
|
|
||||||
end
|
|
||||||
-- aggiungo faccia per taglio iniziale al pezzo
|
-- aggiungo faccia per taglio iniziale al pezzo
|
||||||
BL.AddPartStartFace( Pz, b3Solid)
|
BL.AddPartStartFace( Pz, b3Solid)
|
||||||
-- se sovramateriale di testa, lo notifico
|
-- se sovramateriale di testa, lo notifico
|
||||||
@@ -1944,7 +1945,9 @@ local function VerifyDrillMirrored( Proc, vProc, b3Raw)
|
|||||||
-- recupero la lunghezza della parte inclinata della punta
|
-- recupero la lunghezza della parte inclinata della punta
|
||||||
local dToolDoubleTipLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) - EgtTdbGetCurrToolParam( MCH_TP.LEN)
|
local dToolDoubleTipLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) - EgtTdbGetCurrToolParam( MCH_TP.LEN)
|
||||||
-- se foratura splittata, verifico che la distanza minima tra le due punte sia rispettata
|
-- se foratura splittata, verifico che la distanza minima tra le due punte sia rispettata
|
||||||
if abs( Proc.Flg) == 2 and not ( ( ( 2 * dDrillingStep - dToolTipLength - dToolDoubleTipLength) - MIRROR_DRILLINGS_MIN_DISTANCE) > 10 * GEO.EPS_SMALL) then
|
local dTipDistance = 2 * dDrillingStep - dToolTipLength - dToolDoubleTipLength
|
||||||
|
if abs( Proc.Flg) == 2 and not ( ( dTipDistance - MIRROR_DRILLINGS_MIN_DISTANCE) > 10 * GEO.EPS_SMALL) then
|
||||||
|
EgtOutLog( 'Double drilling skipped, tip distance too small ( ' .. dTipDistance .. ' mm) ')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
-- verifico se in doppio
|
-- verifico se in doppio
|
||||||
@@ -2138,7 +2141,8 @@ function GetFeatureInfoAndDependency( vProc, b3Raw, nPartId)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- verifico se feature tipo LapJoint è attraversata da almeno una mortasa a coda di rondine
|
-- verifico se feature tipo LapJoint è attraversata da almeno una mortasa a coda di rondine
|
||||||
if ( Proc.Topology == 'Pocket' or Proc.Topology == 'Tunnel' or Proc.Topology == 'Groove') and DtMortise.SideIdentify( ProcB) and Overlaps( Proc.Box, ProcB.Box) then
|
if ( Proc.Topology == 'Pocket' or Proc.Topology == 'Tunnel' or Proc.Topology == 'Groove')
|
||||||
|
and DtMortise.SideIdentify( ProcB) and Overlaps( Proc.Box, ProcB.Box) and DtMortise.IsDeeper( ProcB, b3Raw) then
|
||||||
Proc.PassedByDtMortise = true
|
Proc.PassedByDtMortise = true
|
||||||
end
|
end
|
||||||
-- se tenone è attraversato da foro allora il foro deve essere fatto prima
|
-- se tenone è attraversato da foro allora il foro deve essere fatto prima
|
||||||
|
|||||||
+12
-10
@@ -698,17 +698,19 @@ function BeamLib.GetFaceHvRefDim( nSurfId, nFacet, b3Raw)
|
|||||||
local b3HV = EgtSurfTmGetFacetBBoxRef( nSurfId, nFacet, GDB_BB.STANDARD, frHV)
|
local b3HV = EgtSurfTmGetFacetBBoxRef( nSurfId, nFacet, GDB_BB.STANDARD, frHV)
|
||||||
local dDimH = b3HV:getDimX()
|
local dDimH = b3HV:getDimX()
|
||||||
local dDimV = b3HV:getDimY()
|
local dDimV = b3HV:getDimY()
|
||||||
|
|
||||||
|
-- Si mantiene rettangolo minimo perchè in alcuni casi andava in collisione. Lascio il calcolo in caso si debba ripristinare.
|
||||||
-- se definito grezzo (o solido), applico eventuali limiti
|
-- se definito grezzo (o solido), applico eventuali limiti
|
||||||
if b3Raw then
|
-- if b3Raw then
|
||||||
local dCoeffY = abs( frHV:getVersX():getY())
|
-- local dCoeffY = abs( frHV:getVersX():getY())
|
||||||
if dCoeffY > GEO.EPS_SMALL then
|
-- if dCoeffY > GEO.EPS_SMALL then
|
||||||
dDimH = min( dDimH, b3Raw:getDimY() / dCoeffY)
|
-- dDimH = min( dDimH, b3Raw:getDimY() / dCoeffY)
|
||||||
end
|
-- end
|
||||||
local dCoeffZ = abs( frHV:getVersY():getZ())
|
-- local dCoeffZ = abs( frHV:getVersY():getZ())
|
||||||
if dCoeffZ > GEO.EPS_SMALL then
|
-- if dCoeffZ > GEO.EPS_SMALL then
|
||||||
dDimV = min( dDimV, b3Raw:getDimZ() / dCoeffZ)
|
-- dDimV = min( dDimV, b3Raw:getDimZ() / dCoeffZ)
|
||||||
end
|
-- end
|
||||||
end
|
-- end
|
||||||
-- restituisco i valori calcolati
|
-- restituisco i valori calcolati
|
||||||
return frHV, dDimH, dDimV
|
return frHV, dDimH, dDimV
|
||||||
end
|
end
|
||||||
|
|||||||
+11
-6
@@ -65,11 +65,14 @@ function ProcessCut.Classify( Proc, b3Raw)
|
|||||||
end
|
end
|
||||||
-- recupero i dati del taglio
|
-- recupero i dati del taglio
|
||||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||||
if vtN:getZ() <= - 0.5 and abs( vtN:getY()) > 0.1 or ( vtN:getZ() <= - 0.174 and abs( vtN:getY()) > 0.866) then
|
-- calcolo le massime estensioni lineari orizzontale e verticale della faccia
|
||||||
-- calcolo le massime estensioni lineari orizzontale e verticale della faccia
|
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
|
||||||
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
|
if ( vtN:getZ() <= - 0.5 and abs( vtN:getY()) > 0.1) or
|
||||||
|
( vtN:getZ() <= - 0.174 and abs( vtN:getY()) > 0.866) or
|
||||||
|
( vtN:getZ() <= - 0.174 and abs( vtN:getZ()) * DimV > BD.MAX_DIM_DICE)
|
||||||
|
then
|
||||||
-- confronto queste estensioni con la massima dimensione del DiceCut (impossibile lavorare se entrambe maggiori)
|
-- confronto queste estensioni con la massima dimensione del DiceCut (impossibile lavorare se entrambe maggiori)
|
||||||
if DimH > BD.MAX_DIM_DICE and DimV > BD.MAX_DIM_DICE then
|
if DimH > BD.MAX_DIM_DICE + 100 * GEO.EPS_SMALL and DimV > BD.MAX_DIM_DICE + 100 * GEO.EPS_SMALL then
|
||||||
return true, true
|
return true, true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -90,7 +93,7 @@ function ProcessCut.Classify( Proc, b3Raw)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- calcolo l'ingombro orizzontale della faccia
|
-- calcolo l'ingombro orizzontale della faccia
|
||||||
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0)
|
_, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0)
|
||||||
-- confronto questo ingombro con il doppio della massima dimensione del DiceCut (impossibile lavorare sotto da sopra se più di 2 tagli oppure se tipo PF, taglio inclinato in Y e non taglio singolo orizzontale)
|
-- confronto questo ingombro con il doppio della massima dimensione del DiceCut (impossibile lavorare sotto da sopra se più di 2 tagli oppure se tipo PF, taglio inclinato in Y e non taglio singolo orizzontale)
|
||||||
if DimH > 2 * BD.MAX_DIM_DICE or ( BD.C_SIMM and ( abs( vtN:getY()) > 0.1) and dMaxMat < DimH + BD.CUT_EXTRA) then
|
if DimH > 2 * BD.MAX_DIM_DICE or ( BD.C_SIMM and ( abs( vtN:getY()) > 0.1) and dMaxMat < DimH + BD.CUT_EXTRA) then
|
||||||
return true, true
|
return true, true
|
||||||
@@ -379,7 +382,9 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
|||||||
local vCuts = {}
|
local vCuts = {}
|
||||||
local dDicingOffsetP
|
local dDicingOffsetP
|
||||||
local dDicingOffsetO
|
local dDicingOffsetO
|
||||||
if ( ( not Proc.AdvTail) or bForceDicing) and ( dCutH > dMaxDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC or dCutV > dMaxVertDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC) then
|
if ( ( not Proc.AdvTail) or bForceDicing) and
|
||||||
|
( dCutH - 100 * GEO.EPS_SMALL > dMaxDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC or
|
||||||
|
dCutV - 100 * GEO.EPS_SMALL > dMaxVertDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC) then
|
||||||
local ptExtra, vtExtra
|
local ptExtra, vtExtra
|
||||||
local bAutoCalcSurf = true
|
local bAutoCalcSurf = true
|
||||||
if Proc.AdvTail then
|
if Proc.AdvTail then
|
||||||
|
|||||||
@@ -638,16 +638,6 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
|
|||||||
end
|
end
|
||||||
-- se lavorazione in doppio
|
-- se lavorazione in doppio
|
||||||
if Proc.Double and Proc.Double > 0 then
|
if Proc.Double and Proc.Double > 0 then
|
||||||
-- calcolo gli step reali
|
|
||||||
local dStep = EgtGetMachiningParam( MCH_MP.STEP)
|
|
||||||
local nNumStep = ceil( dDepth/dStep)
|
|
||||||
local dRealStep = dDepth / nNumStep
|
|
||||||
-- Se foro passante e nel penultimo step le punte si trovano più vicine del minimo ( MinDistX1X2 + Puntina centraggio H1 + puntina centraggio H2) ricalcolo facendo uno step in meno
|
|
||||||
if bOpen and ( nNumStep > 1) and ( ( dLen / 2) - ( dRealStep * (nNumStep - 1))) * 2 < ( 40 + 10 + 10) then
|
|
||||||
dRealStep = ceil( dDepth / (nNumStep - 1))
|
|
||||||
EgtSetMachiningParam( MCH_MP.STEP, dRealStep)
|
|
||||||
sMyWarn ='Warning in drill-double : step changed to ' .. tostring(dRealStep) .. 'mm'
|
|
||||||
end
|
|
||||||
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double)
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double)
|
||||||
if Proc.Double ~= Proc.PrevDouble then
|
if Proc.Double ~= Proc.PrevDouble then
|
||||||
sUserNotes = EgtSetValInNotes( sUserNotes, 'StartZmax', 2)
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'StartZmax', 2)
|
||||||
|
|||||||
@@ -51,6 +51,23 @@ function ProcessDtMortise.FrontIdentify( Proc)
|
|||||||
return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 56)
|
return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 56)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
-- Riconoscimento della feature profonda, non sulla faccia della trave
|
||||||
|
function ProcessDtMortise.IsDeeper( Proc, b3Raw)
|
||||||
|
-- recupero i dati della curva di contorno della faccia di fondo
|
||||||
|
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
|
||||||
|
if not AuxId then return false end
|
||||||
|
AuxId = AuxId + Proc.Id
|
||||||
|
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
||||||
|
if ( AreSameVectorApprox( vtExtr, -Y_AX()) and Proc.Box:getMin():getY() > b3Raw:getMin():getY() + 100 * GEO.EPS_SMALL) or
|
||||||
|
( AreSameVectorApprox( vtExtr, Y_AX()) and Proc.Box:getMax():getY() < b3Raw:getMax():getY() - 100 * GEO.EPS_SMALL) or
|
||||||
|
( AreSameVectorApprox( vtExtr, -Z_AX()) and Proc.Box:getMin():getZ() > b3Raw:getMin():getZ() + 100 * GEO.EPS_SMALL) or
|
||||||
|
( AreSameVectorApprox( vtExtr, Z_AX()) and Proc.Box:getMax():getZ() < b3Raw:getMax():getZ() - 100 * GEO.EPS_SMALL) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
-- Verifica se feature di coda
|
-- Verifica se feature di coda
|
||||||
function ProcessDtMortise.IsTailFeature( Proc, b3Raw)
|
function ProcessDtMortise.IsTailFeature( Proc, b3Raw)
|
||||||
|
|||||||
@@ -159,6 +159,105 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
return true, nil
|
return true, nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
-- smussi in testa
|
||||||
|
local function MakeHeadChamfer( idProc, nPartId)
|
||||||
|
local dDepthHeadChamfer = EgtGetInfo( idProc, 'Q08', 'd') or 0
|
||||||
|
-- se non attivo esco subito
|
||||||
|
if dDepthHeadChamfer < 100 * GEO.EPS_SMALL then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- recupero gruppo per geometria aggiuntiva
|
||||||
|
local AddGrpId = BL.GetAddGroup( nPartId)
|
||||||
|
if not AddGrpId then
|
||||||
|
local sErr = 'Error on process StartFace impossible to find AddGroup'
|
||||||
|
EgtOutLog( sErr)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
|
||||||
|
-- recupero la lavorazione
|
||||||
|
local sMilling = ML.FindMilling( 'Mark')
|
||||||
|
if not sMilling then
|
||||||
|
local sErr = 'Error : milling not found in library'
|
||||||
|
EgtOutLog( sErr)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
|
||||||
|
local nLoopId, nLoopCnt = EgtExtractSurfTmFacetLoops( idProc, 0, AddGrpId)
|
||||||
|
if not nLoopId or nLoopCnt > 1 then
|
||||||
|
local sErr = 'Error MakeHeadChamfer : too many loops'
|
||||||
|
EgtOutLog( sErr)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
|
||||||
|
-- setto direzione estrusione corretta
|
||||||
|
EgtModifyCurveExtrusion( nLoopId, X_AX())
|
||||||
|
EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.RIGHT))
|
||||||
|
|
||||||
|
local dQ09Value = EgtGetInfo( idProc, 'Q09', 'd')
|
||||||
|
local bChamferedEdge = dQ09Value > 0
|
||||||
|
|
||||||
|
local nIdFirstEntity, nEntityCnt = EgtExplodeCurveCompo( nLoopId)
|
||||||
|
local p3MidPoint = EgtMP( nIdFirstEntity, GDB_ID.GRID)
|
||||||
|
|
||||||
|
for i = 0, nEntityCnt - 1 do
|
||||||
|
if EgtCurveLength( nIdFirstEntity + i) - 10 < abs( dQ09Value) * 2 then
|
||||||
|
local sErr = 'Error MakeHeadChamfer : Q09 too high'
|
||||||
|
EgtOutLog( sErr)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- creo raccordo o fillet
|
||||||
|
for i = 0, nEntityCnt - 1 do
|
||||||
|
local idFirst = nIdFirstEntity + i
|
||||||
|
local idSecond = EgtIf( i == nEntityCnt - 1, nIdFirstEntity, idFirst + 1)
|
||||||
|
local ptEndPointFirst = EgtEP( idFirst, GDB_ID.GRID) - ( abs( dQ09Value) * EgtEV( idFirst, GDB_ID.GRID))
|
||||||
|
local ptStartPointSecond = EgtSP( idSecond, GDB_ID.GRID) + ( abs( dQ09Value) * EgtEV( idSecond, GDB_ID.GRID))
|
||||||
|
|
||||||
|
if bChamferedEdge then
|
||||||
|
EgtCurveChamfer( AddGrpId, idFirst, ptEndPointFirst, idSecond, ptStartPointSecond, abs( dQ09Value), true, GDB_RT.GRID)
|
||||||
|
else
|
||||||
|
EgtCurveFillet( AddGrpId, idFirst, ptEndPointFirst, idSecond, ptStartPointSecond, abs( dQ09Value), true, GDB_RT.GRID)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
EgtSelectPathObjs( nIdFirstEntity, true)
|
||||||
|
local idGeom, idGeomCnt = EgtCurveCompoByChain( AddGrpId, GDB_ID.SEL, {0,0,0}, true)
|
||||||
|
if not idGeom or idGeomCnt > 1 then
|
||||||
|
local sErr = 'Error MakeHeadChamfer : too many loops'
|
||||||
|
EgtOutLog( sErr)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
EgtChangeClosedCurveStartPoint( idGeom, p3MidPoint, GDB_RT.GRID)
|
||||||
|
|
||||||
|
-- Inserisco la lavorazione del lato standard
|
||||||
|
local dExtra = 2
|
||||||
|
local sName1 = 'HeadCham_' .. ( EgtGetName( idProc) or tostring( idProc))
|
||||||
|
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( {{ idGeom, -1}})
|
||||||
|
-- assegno affondamento e offset radiale
|
||||||
|
EgtSetMachiningParam( MCH_MP.DEPTH, dDepthHeadChamfer + dExtra)
|
||||||
|
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
|
||||||
|
-- assegno lato di lavoro
|
||||||
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
||||||
|
-- eseguo
|
||||||
|
if not ML.ApplyMachining( true, false) then
|
||||||
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
|
EgtSetOperationMode( nMch1Id, false)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
|
||||||
|
return true, nil
|
||||||
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
-- tagli verticali aggiuntivi
|
-- tagli verticali aggiuntivi
|
||||||
local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw, dOffsetBetweenCuts)
|
local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw, dOffsetBetweenCuts)
|
||||||
@@ -533,6 +632,16 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
|
|||||||
|
|
||||||
local bOk, sErr = MakeStandardCuts( Proc, b3Raw, nCuts, dOffsL, HeadCutType, Cutting1Data, Cutting2Data, nil, dOvmHead)
|
local bOk, sErr = MakeStandardCuts( Proc, b3Raw, nCuts, dOffsL, HeadCutType, Cutting1Data, Cutting2Data, nil, dOvmHead)
|
||||||
|
|
||||||
|
|
||||||
|
-- alla fine del taglio si aggiungono gli smussi in testa
|
||||||
|
local _, sErrHeadChamfer = MakeHeadChamfer( nOriId or Proc.Id, nPartId)
|
||||||
|
if sErr then
|
||||||
|
sErr = sErr..'\n'..sErrHeadChamfer
|
||||||
|
else
|
||||||
|
sErr = sErrHeadChamfer
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
return bOk, sErr
|
return bOk, sErr
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
+689
-2
@@ -129,6 +129,10 @@ EgtOutLog( ' ProcessLapJoint started', 1)
|
|||||||
-- Dati
|
-- Dati
|
||||||
local BD = require( 'BeamData')
|
local BD = require( 'BeamData')
|
||||||
local ML = require( 'MachiningLib')
|
local ML = require( 'MachiningLib')
|
||||||
|
local WHISK_OFFS = 0.1
|
||||||
|
local WHISK_SAFE = 5
|
||||||
|
local MIN_LEN_CUT = 30
|
||||||
|
|
||||||
|
|
||||||
-- variabili assegnazione parametri Q
|
-- variabili assegnazione parametri Q
|
||||||
local Q_FORCE_BLADE = '' -- i
|
local Q_FORCE_BLADE = '' -- i
|
||||||
@@ -146,7 +150,7 @@ local Q_MAX_ELEVATION = '' -- d
|
|||||||
local Q_SAW_PLUS_CHAIN = '' -- i
|
local Q_SAW_PLUS_CHAIN = '' -- i
|
||||||
local Q_FORCE_CHAINSAW = '' -- i
|
local Q_FORCE_CHAINSAW = '' -- i
|
||||||
local Q_CHAINSAW_FROM_SIDE = '' -- i
|
local Q_CHAINSAW_FROM_SIDE = '' -- i
|
||||||
|
local Q_MILL_AS_BLADE_CONVENTIONAL = '' -- i
|
||||||
|
|
||||||
-- variabile smussi
|
-- variabile smussi
|
||||||
local bMadeChamfer
|
local bMadeChamfer
|
||||||
@@ -195,11 +199,14 @@ local function AssignQIdent( Proc)
|
|||||||
Q_FORCE_CHAINSAW = 'Q12'
|
Q_FORCE_CHAINSAW = 'Q12'
|
||||||
-- TODO da riportare a Q13 quando è sistemata la gestione del movimento in macchina nell'attacco laterale
|
-- TODO da riportare a Q13 quando è sistemata la gestione del movimento in macchina nell'attacco laterale
|
||||||
Q_CHAINSAW_FROM_SIDE = 'Q999'
|
Q_CHAINSAW_FROM_SIDE = 'Q999'
|
||||||
|
Q_MILL_AS_BLADE_CONVENTIONAL = ''
|
||||||
|
Q_CLEAN_CORNER = ''
|
||||||
|
|
||||||
if ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 16 then
|
if ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 16 then
|
||||||
Q_FORCE_BLADE = 'Q01' -- i
|
Q_FORCE_BLADE = 'Q01' -- i
|
||||||
Q_DEPTH_CHAMFER = 'Q04' -- d
|
Q_DEPTH_CHAMFER = 'Q04' -- d
|
||||||
Q_ONLY_CHAMFER = 'Q05' -- i
|
Q_ONLY_CHAMFER = 'Q05' -- i
|
||||||
|
Q_MILL_AS_BLADE_CONVENTIONAL = 'Q14' -- i
|
||||||
elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 17 then
|
elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 17 then
|
||||||
Q_DEPTH_CHAMFER = 'Q01' -- d
|
Q_DEPTH_CHAMFER = 'Q01' -- d
|
||||||
Q_ONLY_CHAMFER = 'Q02' -- i
|
Q_ONLY_CHAMFER = 'Q02' -- i
|
||||||
@@ -220,6 +227,8 @@ local function AssignQIdent( Proc)
|
|||||||
Q_BLADE_ON_ALONG_FACE = 'Q04' -- i
|
Q_BLADE_ON_ALONG_FACE = 'Q04' -- i
|
||||||
Q_ANTISPLINT_TYPE = 'Q06' -- i
|
Q_ANTISPLINT_TYPE = 'Q06' -- i
|
||||||
Q_DEPTH_CHAMFER = 'Q07' -- d
|
Q_DEPTH_CHAMFER = 'Q07' -- d
|
||||||
|
Q_MILL_AS_BLADE_CONVENTIONAL = 'Q14' -- i
|
||||||
|
Q_CLEAN_CORNER = 'Q15' -- i
|
||||||
elseif ( Proc.Grp == 1 or Proc.Grp == 2) and Proc.Prc == 30 then
|
elseif ( Proc.Grp == 1 or Proc.Grp == 2) and Proc.Prc == 30 then
|
||||||
Q_BLADE_ON_ALONG_FACE = 'Q04' -- i
|
Q_BLADE_ON_ALONG_FACE = 'Q04' -- i
|
||||||
elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 32 then
|
elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 32 then
|
||||||
@@ -228,19 +237,23 @@ local function AssignQIdent( Proc)
|
|||||||
Q_ANTISPLINT_TYPE = 'Q06' -- i
|
Q_ANTISPLINT_TYPE = 'Q06' -- i
|
||||||
elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 33 then
|
elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 33 then
|
||||||
Q_ANTISPLINT_TYPE = 'Q06' -- i
|
Q_ANTISPLINT_TYPE = 'Q06' -- i
|
||||||
|
Q_MILL_AS_BLADE_CONVENTIONAL = 'Q14' -- i
|
||||||
elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 34 then
|
elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 34 then
|
||||||
Q_CONTOUR_SMALL_TOOL = 'Q01' -- i
|
Q_CONTOUR_SMALL_TOOL = 'Q01' -- i
|
||||||
Q_USE_MILL = 'Q02' -- i
|
Q_USE_MILL = 'Q02' -- i
|
||||||
Q_ANTISPLINT_TYPE = 'Q06' -- i
|
Q_ANTISPLINT_TYPE = 'Q06' -- i
|
||||||
elseif ( Proc.Grp == 4) and Proc.Prc == 37 then
|
elseif ( Proc.Grp == 4) and Proc.Prc == 37 then
|
||||||
Q_ANTISPLINT_TYPE = 'Q06' -- i
|
Q_ANTISPLINT_TYPE = 'Q06' -- i
|
||||||
|
Q_MILL_AS_BLADE_CONVENTIONAL = 'Q14' -- i
|
||||||
elseif ( Proc.Grp == 4) and Proc.Prc == 39 then
|
elseif ( Proc.Grp == 4) and Proc.Prc == 39 then
|
||||||
Q_CONTOUR_SMALL_TOOL = 'Q01' -- i
|
Q_CONTOUR_SMALL_TOOL = 'Q01' -- i
|
||||||
Q_USE_MILL = 'Q02' -- i
|
Q_USE_MILL = 'Q02' -- i
|
||||||
Q_ANTISPLINT_TYPE = 'Q06' -- i
|
Q_ANTISPLINT_TYPE = 'Q06' -- i
|
||||||
|
Q_MILL_AS_BLADE_CONVENTIONAL = 'Q14' -- i
|
||||||
elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 90 then
|
elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 90 then
|
||||||
Q_ANTISPLINT_TYPE = 'Q03' -- i
|
Q_ANTISPLINT_TYPE = 'Q03' -- i
|
||||||
Q_SIDE_ROUGH_TOOL = 'Q04' -- i
|
Q_SIDE_ROUGH_TOOL = 'Q04' -- i
|
||||||
|
Q_MILL_AS_BLADE_CONVENTIONAL = 'Q14' -- i
|
||||||
end
|
end
|
||||||
-- le altre features gestite non hanno parametri Q
|
-- le altre features gestite non hanno parametri Q
|
||||||
end
|
end
|
||||||
@@ -2856,7 +2869,13 @@ local function MakeByMillAsSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
|
|||||||
for i = 1, nStep do
|
for i = 1, nStep do
|
||||||
local dOffs = ( i - 1) * dStep
|
local dOffs = ( i - 1) * dStep
|
||||||
if vtN:getZ() < dVzLimDwnUp then dOffs = dOffs + dSawThick end
|
if vtN:getZ() < dVzLimDwnUp then dOffs = dOffs + dSawThick end
|
||||||
local bOk, sErr, nMchId = Fbs.MakeOne( Proc.Id, nFacAdj, sCutting, dSawDiam, nFaceUse, dVzLimDwnUp, 0, BD.CUT_SIC, dOffs, dStartDist, dEndDist, nil, b3Raw)
|
-- forzatura lavorazione discorde in base a parametro Q su feature
|
||||||
|
local nQ14Param = EgtGetInfo( Proc.Id, Q_MILL_AS_BLADE_CONVENTIONAL, 'd') or 0
|
||||||
|
local bForceInvert = nQ14Param == 1 or ( nQ14Param == 2 and vtN:getX() < 0.1 and Proc.AffectedFaces.Bottom)
|
||||||
|
if bForceInvert and i == 1 then
|
||||||
|
dStartDist, dEndDist = dEndDist, dStartDist
|
||||||
|
end
|
||||||
|
local bOk, sErr, nMchId = Fbs.MakeOne( Proc.Id, nFacAdj, sCutting, dSawDiam, nFaceUse, dVzLimDwnUp, 0, BD.CUT_SIC, dOffs, dStartDist, dEndDist, nil, b3Raw, bForceInvert)
|
||||||
if not bOk then return bOk, sErr end
|
if not bOk then return bOk, sErr end
|
||||||
-- setto l'elevazione
|
-- setto l'elevazione
|
||||||
local sNotes = 'MaxElev=' .. EgtNumToString( 0, 1) .. ';'
|
local sNotes = 'MaxElev=' .. EgtNumToString( 0, 1) .. ';'
|
||||||
@@ -3565,6 +3584,11 @@ local function MakePocket( Proc, nPartId, b3Solid, ptPs, tvtN, nFaceRef, sMchFin
|
|||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
-- provo ad allargare leggermente la tasca
|
-- provo ad allargare leggermente la tasca
|
||||||
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
|
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
|
||||||
|
-- se percorso a Zig-Zag, provo a cambiarlo in spirale
|
||||||
|
local nPocketSubType = EgtGetMachiningParam( MCH_MP.SUBTYPE)
|
||||||
|
if nPocketSubType == MCH_POCK_SUB.ZIGZAG then
|
||||||
|
EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN)
|
||||||
|
end
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
EgtSetOperationMode( nMchFId, false)
|
EgtSetOperationMode( nMchFId, false)
|
||||||
@@ -5882,6 +5906,656 @@ end
|
|||||||
|
|
||||||
--#endregion SawPlusChain
|
--#endregion SawPlusChain
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
local function ReorderFacesFromTab( nIdSurf, vFace)
|
||||||
|
|
||||||
|
local nFacCnt = EgtSurfTmFacetCount( nIdSurf)
|
||||||
|
for i = 1, #vFace do
|
||||||
|
for j = 1, nFacCnt do
|
||||||
|
-- ottengo punto iniziale e versore della faccia
|
||||||
|
local ptC, vtN = EgtSurfTmFacetCenter( nIdSurf, (j-1), GDB_ID.ROOT)
|
||||||
|
-- se versore e posizione coincidono e non corrispondono al numero faccia, faccio lo swap
|
||||||
|
if AreSameVectorExact( vFace[i].Norm, vtN) and AreSamePointEpsilon( vFace[i].Cen, ptC, 50*GEO.EPS_SMALL) then
|
||||||
|
if (j-1) ~= vFace[i].Fac then
|
||||||
|
EgtSurfTmSwapFacets( nIdSurf, vFace[i].Fac, (j-1))
|
||||||
|
end
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return nIdSurf
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
local function CalcInterference( nNewProc, vtExtr, ptCentr, dDiam1, dDiam2,
|
||||||
|
dTall1, dTall2, dDiam3, dTall3)
|
||||||
|
local ptCentrGrid1 = ptCentr + ( vtExtr * 0.01)
|
||||||
|
local frOriTool = Frame3d( ptCentrGrid1, vtExtr)
|
||||||
|
local bColl1 = EgtTestConeSurface( frOriTool, dDiam1/2, dDiam2/2, dTall1, nNewProc, 0, GDB_RT.GLOB)
|
||||||
|
if bColl1 then return true end
|
||||||
|
local ptCentrGrid2 = ptCentr + ( vtExtr * ( dTall1 + 0.01))
|
||||||
|
frOriTool = Frame3d( ptCentrGrid2, vtExtr)
|
||||||
|
local bColl2 = EgtTestCylSurface( frOriTool, dDiam2/2, dTall2, nNewProc, 0, GDB_RT.GLOB)
|
||||||
|
if bColl2 then return true end
|
||||||
|
local ptCentrGrid3 = ptCentr + ( vtExtr * ( dTall2 + 0.01))
|
||||||
|
frOriTool = Frame3d( ptCentrGrid3, vtExtr)
|
||||||
|
local bColl3 = EgtTestCylSurface( frOriTool, dDiam3/2, dTall3, nNewProc, 0, GDB_RT.GLOB)
|
||||||
|
if bColl3 then return true end
|
||||||
|
-- restituisco risultato controllo collisioni
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
local function MakeLocalSurf( ptP1, ptP2, ptP3, nAddGrpId)
|
||||||
|
-- verifico che i tre punti siano definiti
|
||||||
|
if not ptP1 or not ptP2 or not ptP3 then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
-- creo il contorno
|
||||||
|
local nLoopId = EgtCurveCompoFromPoints( nAddGrpId, { ptP1, ptP2, ptP3, ptP1}, GDB_RT.GLOB)
|
||||||
|
if not nLoopId then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
-- creo la superfice triangolare (quindi piana)
|
||||||
|
local nFaceId = EgtSurfTmByFlatContour( nAddGrpId, nLoopId, 0.01)
|
||||||
|
EgtErase( nLoopId)
|
||||||
|
if not nFaceId then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
-- se normale negativa inverto
|
||||||
|
local vtN1 = EgtSurfTmFacetNormVersor( nFaceId, 0, GDB_ID.ROOT)
|
||||||
|
if vtN1:getZ() < -0.01 then
|
||||||
|
EgtInvertSurf( nFaceId)
|
||||||
|
end
|
||||||
|
|
||||||
|
return nFaceId
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nAddGrpId,
|
||||||
|
dToolDiam, sMilling, dOffsAng,
|
||||||
|
dDiam1, dDiam2, dTall1,
|
||||||
|
dTall2, dDiam3, dTall3, bMakeLocSurf, vFace, vtN)
|
||||||
|
|
||||||
|
-- variabili costruzione geometria
|
||||||
|
local pAuxId = {}
|
||||||
|
local nAuxId
|
||||||
|
local ptApPoint
|
||||||
|
local AuxId
|
||||||
|
local nNewProcLoc
|
||||||
|
-- se devo creare superfice locale
|
||||||
|
if bMakeLocSurf then
|
||||||
|
-- creo superfice locale o esco
|
||||||
|
local nSurfToAdd = MakeLocalSurf( tFacAdj[7], tFacAdj[8], tFacAdj[9], nAddGrpId)
|
||||||
|
if nSurfToAdd then
|
||||||
|
local nFacCntPre = EgtSurfTmFacetCount( nNewProc.Id)
|
||||||
|
-- creo copia del percorso principale e gli aggiungo la nuova faccia
|
||||||
|
nNewProcLoc = EgtCopyGlob( nNewProc.Id, nAddGrpId)
|
||||||
|
nNewProcLoc = EgtSurfTmBySewing( nAddGrpId, {nNewProcLoc,nSurfToAdd} , true)
|
||||||
|
-- riordino le facce
|
||||||
|
nNewProcLoc = ReorderFacesFromTab( nNewProcLoc, vFace)
|
||||||
|
-- acquisisco il numero della faccia
|
||||||
|
local nFacCnt = EgtSurfTmFacetCount( nNewProcLoc)
|
||||||
|
nFacInd = nFacCnt - 1
|
||||||
|
else
|
||||||
|
local sErr = 'Cannot make local bottom surface'
|
||||||
|
EgtOutLog( sErr)
|
||||||
|
return true, ''
|
||||||
|
end
|
||||||
|
else
|
||||||
|
nNewProcLoc = nNewProc.Id
|
||||||
|
end
|
||||||
|
-- prendo il primo versore
|
||||||
|
local _, vtN1 = EgtSurfTmFacetCenter( nNewProcLoc, nFacInd, GDB_ID.ROOT)
|
||||||
|
local _, vtN2 = EgtSurfTmFacetCenter( nNewProcLoc, tFacAdj[1], GDB_ID.ROOT)
|
||||||
|
local _, vtN3 = EgtSurfTmFacetCenter( nNewProcLoc, tFacAdj[2], GDB_ID.ROOT)
|
||||||
|
-- trovo il punto sulla superfice di riferimento
|
||||||
|
local _, ptLocP1, ptLocP2, _ = EgtSurfTmFacetsContact( nNewProcLoc, nFacInd, tFacAdj[1], GDB_ID.ROOT)
|
||||||
|
local _, ptLocP3, ptLocP4, _ = EgtSurfTmFacetsContact( nNewProcLoc, nFacInd, tFacAdj[2], GDB_ID.ROOT)
|
||||||
|
-- se ho creato faccia locale su copia superficie, cancella la copia
|
||||||
|
if bMakeLocSurf then
|
||||||
|
EgtErase( nNewProcLoc)
|
||||||
|
end
|
||||||
|
local nIdIniPoint
|
||||||
|
local nIdEndPoint
|
||||||
|
if ptLocP1 and ptLocP2 then
|
||||||
|
if ( dist( ptLocP1, tFacAdj[4]) < GEO.EPS_SMALL) or ( dist( ptLocP2, tFacAdj[4]) < GEO.EPS_SMALL) then
|
||||||
|
nIdEndPoint = 4
|
||||||
|
nIdIniPoint = 5
|
||||||
|
elseif ( dist( ptLocP1, tFacAdj[5]) < GEO.EPS_SMALL) or ( dist( ptLocP2, tFacAdj[5]) < GEO.EPS_SMALL) then
|
||||||
|
nIdEndPoint = 5
|
||||||
|
nIdIniPoint = 4
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- versore direzione
|
||||||
|
local vtExtr = tFacAdj[nIdIniPoint] - tFacAdj[nIdEndPoint]
|
||||||
|
vtExtr:normalize()
|
||||||
|
-- versore direzione di uscita
|
||||||
|
local vtExtrExit
|
||||||
|
-- inserisco le prime tre linee
|
||||||
|
if nIdIniPoint and nIdEndPoint then
|
||||||
|
-- se fresatura da sotto salto la lavorazione
|
||||||
|
if vtExtr:getZ() < BD.DRILL_VZ_MIN then
|
||||||
|
local sErr = 'Error : Impossible insert clean corner from bottom'
|
||||||
|
EgtOutLog( sErr)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
-- sommo i tre versori per avere una direzione media
|
||||||
|
vtExtrExit = vtN2 + vtN3
|
||||||
|
vtExtrExit:normalize()
|
||||||
|
-- calcolo angolo tilt di 45°
|
||||||
|
vtExtr = vtExtrExit + vtN
|
||||||
|
vtExtr:normalize()
|
||||||
|
local vtCheck = Vector3d(vtExtr)
|
||||||
|
-- se ho un offset angolare ruoto il percorso
|
||||||
|
if abs(dOffsAng) > 100 * GEO.EPS_SMALL then
|
||||||
|
vtCheck:rotate( vtN, dOffsAng)
|
||||||
|
end
|
||||||
|
-- controllo se c'è collisione con le facce della superfice
|
||||||
|
if CalcInterference( nNewProc.Id, vtCheck, tFacAdj[nIdEndPoint], dDiam1, dDiam2,
|
||||||
|
dTall1, dTall2, dDiam3, dTall3) then
|
||||||
|
local sErr = 'Collision detect from clean corner tool and surface'
|
||||||
|
EgtOutLog( sErr)
|
||||||
|
return true, ''
|
||||||
|
end
|
||||||
|
nAuxId = EgtLine( nAddGrpId, tFacAdj[nIdIniPoint], tFacAdj[nIdEndPoint], GDB_RT.GLOB)
|
||||||
|
table.insert( pAuxId, nAuxId)
|
||||||
|
-- se offset angolare valido e/o negativo creo il baffo precedente
|
||||||
|
if dOffsAng < ( 100 * GEO.EPS_SMALL) then
|
||||||
|
-- se il punto finale corrisponde con il punto utilizzato in precedenza, uso l'altro
|
||||||
|
if dist( tFacAdj[nIdEndPoint], ptLocP1) < 10 * GEO.EPS_SMALL then
|
||||||
|
ptApPoint = ptLocP2
|
||||||
|
else
|
||||||
|
ptApPoint = ptLocP1
|
||||||
|
end
|
||||||
|
nAuxId = EgtLine( nAddGrpId, tFacAdj[nIdEndPoint], ptApPoint, GDB_RT.GLOB)
|
||||||
|
local dLenTrimExt = dist( tFacAdj[nIdEndPoint], ptApPoint) - (( dToolDiam/2) + 0.2)
|
||||||
|
-- se la distanza dei due punti della linea è maggiore dal raggio fresa + delta, trimmo al raggio fresa + delta
|
||||||
|
if dLenTrimExt > 10 * GEO.EPS_SMALL then
|
||||||
|
EgtTrimExtendCurveByLen( nAuxId , -dLenTrimExt, ptApPoint, GDB_RT.GLOB)
|
||||||
|
-- se ho l'offset angolare ruoto la linea per compensare la rotazione che verrà applicata
|
||||||
|
if abs(dOffsAng) > 100 * GEO.EPS_SMALL then
|
||||||
|
EgtRotate( nAuxId, tFacAdj[nIdEndPoint], vtN, -dOffsAng, GDB_RT.GLOB)
|
||||||
|
end
|
||||||
|
-- prendo il nuovo punto finale
|
||||||
|
ptApPoint = EgtEP( nAuxId, GDB_RT.GLOB)
|
||||||
|
else
|
||||||
|
-- se ho l'offset angolare ruoto la linea per compensare la rotazione che verrà applicata
|
||||||
|
if abs(dOffsAng) > 100 * GEO.EPS_SMALL then
|
||||||
|
EgtRotate( nAuxId, tFacAdj[nIdEndPoint], vtN, -dOffsAng, GDB_RT.GLOB)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
table.insert( pAuxId, nAuxId)
|
||||||
|
-- creo linea di ritorno
|
||||||
|
nAuxId = EgtLine( nAddGrpId, ptApPoint, tFacAdj[nIdEndPoint], GDB_RT.GLOB)
|
||||||
|
table.insert( pAuxId, nAuxId)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- inserisco le ultime tre linee
|
||||||
|
-- trovo il secondo punto sulla superfice di riferimento
|
||||||
|
ptLocP1, ptLocP2 = ptLocP3, ptLocP4
|
||||||
|
if ptLocP1 and ptLocP2 then
|
||||||
|
-- se il punto finale corrisponde con il punto utilizzato in precedenza, uso l'altro
|
||||||
|
if dist( tFacAdj[nIdEndPoint], ptLocP1) < 10 * GEO.EPS_SMALL then
|
||||||
|
ptApPoint = ptLocP2
|
||||||
|
else
|
||||||
|
ptApPoint = ptLocP1
|
||||||
|
end
|
||||||
|
-- se offset angolare valido e/o negativo creo il baffo precedente
|
||||||
|
if dOffsAng > -( 100 * GEO.EPS_SMALL) then
|
||||||
|
nAuxId = EgtLine( nAddGrpId, tFacAdj[nIdEndPoint], ptApPoint, GDB_RT.GLOB)
|
||||||
|
local dLenTrimExt = dist( tFacAdj[nIdEndPoint], ptApPoint) - (( dToolDiam/2) + 0.2)
|
||||||
|
-- se la distanza dei due punti della linea è maggiore dal raggio fresa + delta, trimmo al raggio fresa + delta
|
||||||
|
if dLenTrimExt > 10 * GEO.EPS_SMALL then
|
||||||
|
EgtTrimExtendCurveByLen( nAuxId , -dLenTrimExt, ptApPoint, GDB_RT.GLOB)
|
||||||
|
-- se ho l'offset angolare ruoto la linea per compensare la rotazione che verrà applicata
|
||||||
|
if abs(dOffsAng) > 100 * GEO.EPS_SMALL then
|
||||||
|
EgtRotate( nAuxId, tFacAdj[nIdEndPoint], vtN, -dOffsAng, GDB_RT.GLOB)
|
||||||
|
end
|
||||||
|
-- prendo il nuovo punto finale
|
||||||
|
ptApPoint = EgtEP( nAuxId, GDB_RT.GLOB)
|
||||||
|
else
|
||||||
|
-- se ho l'offset angolare ruoto la linea per compensare la rotazione che verrà applicata
|
||||||
|
if abs(dOffsAng) > 100 * GEO.EPS_SMALL then
|
||||||
|
EgtRotate( nAuxId, tFacAdj[nIdEndPoint], vtN, -dOffsAng, GDB_RT.GLOB)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
table.insert( pAuxId, nAuxId)
|
||||||
|
-- creo linea di ritorno
|
||||||
|
nAuxId = EgtLine( nAddGrpId, ptApPoint, tFacAdj[nIdEndPoint], GDB_RT.GLOB)
|
||||||
|
table.insert( pAuxId, nAuxId)
|
||||||
|
end
|
||||||
|
-- ultima linea di distacco (5mm in direzione utensile)
|
||||||
|
local pEnd = tFacAdj[nIdEndPoint] + ( 5 * vtExtr)
|
||||||
|
nAuxId = EgtLine( nAddGrpId, tFacAdj[nIdEndPoint], pEnd, GDB_RT.GLOB)
|
||||||
|
table.insert( pAuxId, nAuxId)
|
||||||
|
end
|
||||||
|
-- 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
|
||||||
|
local sErr = 'Error : impossible make clean corner path'
|
||||||
|
EgtOutLog( sErr)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
-- modifico versore direzione
|
||||||
|
EgtModifyCurveExtrusion( AuxId, vtExtr, GDB_RT.GLOB)
|
||||||
|
-- se ho un offset angolare ruoto il percorso
|
||||||
|
if abs(dOffsAng) > 100 * GEO.EPS_SMALL then
|
||||||
|
EgtRotate( AuxId, tFacAdj[nIdEndPoint], vtN, dOffsAng, GDB_RT.GLOB)
|
||||||
|
end
|
||||||
|
-- inserisco la lavorazione
|
||||||
|
local sName = 'Clean_' .. ( EgtGetName( nNewProc.Id) or tostring( nNewProc.Id))
|
||||||
|
local nMchId = EgtAddMachining( sName, sMilling)
|
||||||
|
if not nMchId then
|
||||||
|
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||||
|
EgtOutLog( sErr)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
EgtSetInfo( nMchId, 'Part', nPartId)
|
||||||
|
|
||||||
|
-- aggiungo geometria
|
||||||
|
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||||
|
-- imposto posizione braccio porta testa
|
||||||
|
local nSCC = MCH_SCC.ADIR_ZP
|
||||||
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||||
|
EgtSetMachiningParam( MCH_MP.LEADINTYPE, 0)
|
||||||
|
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, 4)
|
||||||
|
-- allungo inizio e fine di 10mm
|
||||||
|
EgtSetMachiningParam( MCH_MP.STARTADDLEN, 10)
|
||||||
|
EgtSetMachiningParam( MCH_MP.ENDADDLEN, 10)
|
||||||
|
-- setto affondamento 0
|
||||||
|
EgtSetMachiningParam( MCH_MP.DEPTH, 0)
|
||||||
|
-- forzo lato correzione a centrato
|
||||||
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.CENTER)
|
||||||
|
-- leggo eventuali note esistenti della lavorazione
|
||||||
|
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
|
||||||
|
-- Note utente con dichiarazione nessuna generazione sfridi per Vmill
|
||||||
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'VMRS', 0)
|
||||||
|
-- aggiungo alle note massima elevazione
|
||||||
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( 0.0, 1))
|
||||||
|
-- scrivo le note della lavorazione
|
||||||
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
||||||
|
if not EgtApplyMachining( true, false) then
|
||||||
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
|
EgtSetOperationMode( nMchId, false)
|
||||||
|
return false, sErr
|
||||||
|
else
|
||||||
|
local _, sWarn = EgtGetMachMgrWarning( 0)
|
||||||
|
if EgtIsMachiningEmpty() then
|
||||||
|
EgtSetOperationMode( nMchId, false)
|
||||||
|
return false, sWarn
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return true, ''
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
local function AddMillCorner( vFace, Proc, dToolDiam, nAddGrpId, nMasterNewProc, vtN)
|
||||||
|
local sMilling, dMaxDepth
|
||||||
|
-- se ripresa angolo con fresa cono 60° con ripresa
|
||||||
|
|
||||||
|
-- recupero la lavorazione di fresatura
|
||||||
|
sMilling, dMaxDepth = ML.FindMilling( 'CleanCorner60')
|
||||||
|
if not sMilling then
|
||||||
|
local sErr = 'Error : CleanCorner 60 not found in library'
|
||||||
|
EgtOutLog( sErr)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
|
||||||
|
-- recupero i dati dell'utensile
|
||||||
|
local dMillDiam = 20
|
||||||
|
local dMillTotDiam = 20
|
||||||
|
local dMillDiamTh = 20
|
||||||
|
local dToolLength = 20
|
||||||
|
local dThickTool = 20
|
||||||
|
local dSideAng = 0
|
||||||
|
if EgtMdbSetCurrMachining( sMilling) then
|
||||||
|
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||||
|
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||||
|
dMillDiamTh = EgtTdbGetCurrToolThDiam() or dMillDiamTh
|
||||||
|
dMillTotDiam = EgtTdbGetCurrToolParam( MCH_TP.TOTDIAM) or dMillTotDiam
|
||||||
|
dSideAng = EgtTdbGetCurrToolParam( MCH_TP.SIDEANG) or dSideAng
|
||||||
|
dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
|
||||||
|
dThickTool = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dThickTool
|
||||||
|
dToolLength = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dToolLength
|
||||||
|
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth -- qui è la distanza dal portautensile
|
||||||
|
-- calcolo il secondo diametro del cono
|
||||||
|
dMillTotDiam = dMillDiam + ( abs(dThickTool) * tan(dSideAng)) * 2
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- copio la feature nel layer di appoggio
|
||||||
|
local nNewProc = { CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||||
|
if nMasterNewProc then
|
||||||
|
nNewProc.Id = nMasterNewProc
|
||||||
|
else
|
||||||
|
nNewProc.Id = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
|
||||||
|
end
|
||||||
|
local nFacCnt = EgtSurfTmFacetCount( nNewProc.Id)
|
||||||
|
local nFacInd, dDimMin, dDimMax, dDepth, nSurfInt
|
||||||
|
local bMakeLocSurf = true
|
||||||
|
|
||||||
|
-- verifico se ciclo chiuso
|
||||||
|
local bClosed = ( abs( vFace[1].AngPrev) > 0.1)
|
||||||
|
-- ciclo di inserimento delle fresate sulle facce del contorno in esame
|
||||||
|
local i = 1
|
||||||
|
-- se faccia finale con fine non lavorato, forzo partenza da prima faccia non tutta saltata (tipo 4)
|
||||||
|
if bClosed and ( vFace[#vFace].Type == 4 or ( vFace[#vFace].Type & 2) ~= 0) then
|
||||||
|
while i <= #vFace and vFace[i].Type == 4 do
|
||||||
|
i = i + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- se facce tutte da saltare, parto dall'inizio
|
||||||
|
local bAllType4 = ( i > #vFace)
|
||||||
|
if bAllType4 or bClosed then i = 1 end
|
||||||
|
while i <= #vFace do
|
||||||
|
-- se tutta la faccia o la sua fine senza taglio, inserisco una fresatura
|
||||||
|
if ( vFace[i].Type & 2) ~= 0 or vFace[i].Type == 4 then
|
||||||
|
-- variabili costruzione geometria (nFace1, nFace2, tFacAdj)
|
||||||
|
local nFace1 = vFace[i].Fac
|
||||||
|
-- ricavo i tre punti per eventuale superficie locale
|
||||||
|
local ptLoc1, ptLoc2, ptLoc3
|
||||||
|
-- aggiungo geometria
|
||||||
|
local j = EgtIf( i < #vFace, i + 1, EgtIf( bClosed, 1, nil))
|
||||||
|
if not j then return true end
|
||||||
|
local nFace2 = vFace[j].Fac
|
||||||
|
-- punto in comune tra le due facce (punto precedente della faccia [j])
|
||||||
|
ptLoc1 = vFace[j].PPrev
|
||||||
|
-- punto precedente (punto precedente della faccia [i])
|
||||||
|
if vFace[i].PPrev then
|
||||||
|
ptLoc3 = vFace[i].PPrev
|
||||||
|
else
|
||||||
|
if abs( vtN:getZ()) > abs( vtN:getY()) then
|
||||||
|
ptLoc3 = Point3d( vFace[i].Cen:getX(), vFace[i].Cen:getY(), ptLoc1:getZ())
|
||||||
|
else
|
||||||
|
ptLoc3 = Point3d( vFace[i].Cen:getX(), ptLoc1:getY(), vFace[i].Cen:getZ())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- punto successivo ( precedente della faccia successiva)
|
||||||
|
local k = EgtIf( j < #vFace, j + 1, EgtIf( bClosed, 1, nil))
|
||||||
|
-- se è un percorso aperto prendo il punto medio della seconda faccia come punto locale 2
|
||||||
|
if not k then
|
||||||
|
if abs( vtN:getZ()) > abs( vtN:getY()) then
|
||||||
|
ptLoc2 = Point3d( vFace[j].Cen:getX(), vFace[j].Cen:getY(), ptLoc1:getZ())
|
||||||
|
else
|
||||||
|
ptLoc2 = Point3d( vFace[j].Cen:getX(), ptLoc1:getY(), vFace[j].Cen:getZ())
|
||||||
|
end
|
||||||
|
else
|
||||||
|
ptLoc2 = vFace[k].PPrev
|
||||||
|
end
|
||||||
|
-- ricavo i punti e l'angolo interno
|
||||||
|
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 > -( 90 + 10 * GEO.EPS_SMALL) then
|
||||||
|
local dLen = dist( ptP1, ptP2)
|
||||||
|
tFacAdj = { nFace1, nFace2, dLen, ptP1, ptP2, dAng, ptLoc1, ptLoc2, ptLoc3}
|
||||||
|
end
|
||||||
|
-- se ho un elemento creo percorso o percorsi in base al tipo di cono e all'apertura dall'angolo rispetto ai 90°
|
||||||
|
-- con una tolleranza di 2 gradi
|
||||||
|
if #tFacAdj > 0 then
|
||||||
|
if (dAng + 90) > 2 then
|
||||||
|
local dAngOffs = (dAng + 90) / 2
|
||||||
|
-- primo taglio
|
||||||
|
local bOk, sErr = AddMillCornerMachining( Proc.PartId, nNewProc, nFacInd, tFacAdj, nAddGrpId,
|
||||||
|
dToolDiam, sMilling, -dAngOffs,
|
||||||
|
dMillDiam, dMillTotDiam, abs( dThickTool),
|
||||||
|
dMaxDepth, dMillDiamTh, dToolLength, bMakeLocSurf, vFace, vtN)
|
||||||
|
if not bOk then return bOk, sErr end
|
||||||
|
-- secondo taglio
|
||||||
|
bOk, sErr = AddMillCornerMachining( Proc.PartId, nNewProc, nFacInd, tFacAdj, nAddGrpId,
|
||||||
|
dToolDiam, sMilling, dAngOffs,
|
||||||
|
dMillDiam, dMillTotDiam, abs( dThickTool),
|
||||||
|
dMaxDepth, dMillDiamTh, dToolLength, bMakeLocSurf, vFace, vtN)
|
||||||
|
if not bOk then return bOk, sErr end
|
||||||
|
-- altrimenti ho un solo percorso
|
||||||
|
else
|
||||||
|
local bOk, sErr = AddMillCornerMachining( Proc.PartId, nNewProc, nFacInd, tFacAdj, nAddGrpId,
|
||||||
|
dToolDiam, sMilling, 0,
|
||||||
|
dMillDiam, dMillTotDiam, abs( dThickTool),
|
||||||
|
dMaxDepth, dMillDiamTh, dToolLength, bMakeLocSurf, vFace, vtN)
|
||||||
|
if not bOk then return bOk, sErr end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- passo alla successiva
|
||||||
|
i = i + 1
|
||||||
|
end
|
||||||
|
-- cancello la copia della superfice
|
||||||
|
if nNewProc.Id then
|
||||||
|
EgtErase( nNewProc.Id)
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
local function GetOtherRegions( nPartId)
|
||||||
|
local vOthers = {}
|
||||||
|
local nOtherId = EgtGetFirstPartInRawPart( EgtGetFirstRawPart() or GDB_ID.NULL)
|
||||||
|
while nOtherId do
|
||||||
|
local nRegId = EgtGetFirstInGroup( EgtGetFirstNameInGroup( nOtherId, 'Outline') or GDB_ID.NULL)
|
||||||
|
while nRegId do
|
||||||
|
local vtN = EgtSurfFrNormVersor( nRegId, GDB_ID.ROOT)
|
||||||
|
if EgtExistsInfo( nRegId, 'REGION') and vtN and AreSameVectorApprox( vtN, Z_AX()) then
|
||||||
|
local b3Reg = EgtGetBBoxGlob( nRegId, GDB_BB.STANDARD)
|
||||||
|
if b3Reg then
|
||||||
|
table.insert( vOthers, { PartId = nOtherId, RegId = nRegId, Box = b3Reg})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
nRegId = EgtGetNext( nRegId)
|
||||||
|
end
|
||||||
|
nOtherId = EgtGetNextPartInRawPart( nOtherId)
|
||||||
|
end
|
||||||
|
return vOthers
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
local function GetFacesData( nNewProc, dToolDiam, dToolMaxDepth, dToolThick, nAddGrpId, nPartId, vtNBottom)
|
||||||
|
|
||||||
|
local nNumFacet = EgtSurfTmFacetCount( nNewProc)
|
||||||
|
local vFace = {}
|
||||||
|
-- recupero i dati di tutte le facce
|
||||||
|
for i = 1, nNumFacet do
|
||||||
|
-- indici faccia corrente e precedente
|
||||||
|
local nFac = i - 1
|
||||||
|
local nPrecFac
|
||||||
|
nPrecFac = EgtIf( i == 1, nNumFacet - 1, i - 2)
|
||||||
|
|
||||||
|
-- recupero centro e normale della faccia
|
||||||
|
local ptCen, vtN = EgtSurfTmFacetCenter( nNewProc, nFac, GDB_ID.ROOT)
|
||||||
|
-- recupero le dimensioni della faccia
|
||||||
|
local _, dLen, dWidth = BL.GetFaceHvRefDim( nNewProc, nFac)
|
||||||
|
-- recupero l'angolo con la faccia precedente
|
||||||
|
local bAdj, ptLocP1, ptLocP2, dAng = EgtSurfTmFacetsContact( nNewProc, nPrecFac, nFac, GDB_ID.ROOT)
|
||||||
|
-- verifico che l'adiacenza sia veramente con il precedente (percorro con normale a destra)
|
||||||
|
if bAdj then
|
||||||
|
if ( vtN ^ ( ptLocP1 - ptCen)) * vtNBottom > 0 then
|
||||||
|
bAdj = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- salvo i dati
|
||||||
|
vFace[i] = { Fac = nFac, Cen = ptCen, Norm = vtN, Len = dLen, Width = dWidth, AngPrev = EgtIf( bAdj, dAng, 0)}
|
||||||
|
if bAdj then
|
||||||
|
-- se rivolto verso Z
|
||||||
|
if abs( vtNBottom:getZ()) > abs( vtNBottom:getY()) then
|
||||||
|
if ptLocP1:getZ() < ptLocP2:getZ() then
|
||||||
|
vFace[i].PPrev = ptLocP1
|
||||||
|
else
|
||||||
|
vFace[i].PPrev = ptLocP2
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if vtNBottom:getY() > 0 then
|
||||||
|
vFace[i].PPrev = EgtIf( ptLocP1:getY() < ptLocP2:getY(), ptLocP1, ptLocP2)
|
||||||
|
else
|
||||||
|
vFace[i].PPrev = EgtIf( ptLocP1:getY() > ptLocP2:getY(), ptLocP1, ptLocP2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- analizzo le facce
|
||||||
|
local dMaxWidth = 0
|
||||||
|
for i = 1, #vFace do
|
||||||
|
-- aggiorno la massima larghezza
|
||||||
|
if vFace[i].Width > dMaxWidth then
|
||||||
|
dMaxWidth = vFace[i].Width
|
||||||
|
end
|
||||||
|
-- verifico l'affondamento
|
||||||
|
local dDepth = BD.CUT_EXTRA
|
||||||
|
if vFace[i].Width + BD.CUT_EXTRA > dToolMaxDepth then
|
||||||
|
dDepth = dToolMaxDepth - vFace[i].Width
|
||||||
|
end
|
||||||
|
-- lunghezza baffo
|
||||||
|
local dElev = vFace[i].Width + dDepth
|
||||||
|
local dWhisk = ( dToolDiam / 2) + WHISK_SAFE
|
||||||
|
-- determino la lunghezza del taglio passante e il tipo di attacco e uscita
|
||||||
|
local dLen = vFace[i].Len
|
||||||
|
local nType = 0
|
||||||
|
if vFace[i].AngPrev < -0.1 then
|
||||||
|
nType = nType + 1
|
||||||
|
end
|
||||||
|
if vFace[EgtIf( i < nNumFacet, i + 1, 1)].AngPrev < -0.1 then
|
||||||
|
nType = nType + 2
|
||||||
|
end
|
||||||
|
-- se lunghezza non significativa, non va inserito il taglio
|
||||||
|
if dLen < MIN_LEN_CUT then
|
||||||
|
nType = 4
|
||||||
|
end
|
||||||
|
vFace[i].Depth = dDepth
|
||||||
|
vFace[i].Whisk = dWhisk
|
||||||
|
vFace[i].Type = nType
|
||||||
|
end
|
||||||
|
-- recupero le regioni degli altri pezzi
|
||||||
|
local vOthers = GetOtherRegions( nPartId)
|
||||||
|
-- verifico i baffi sporgenti dei tagli rispetto alle altre regioni
|
||||||
|
for i = 1, #vFace do
|
||||||
|
-- verifico il baffo iniziale
|
||||||
|
if vFace[i].Type ~= 4 and ( vFace[i].Type & 1) == 0 then
|
||||||
|
-- creo il rettangolo del baffo
|
||||||
|
local vtOrt = Vector3d( vFace[i].Norm:getX(), vFace[i].Norm:getY(), 0) ; vtOrt:normalize()
|
||||||
|
local vtDir = Vector3d( vtOrt) ; vtDir:rotate( Z_AX(), -90)
|
||||||
|
local vtUp = Vector3d( vtDir) ; vtUp:rotate( vFace[i].Norm, -90)
|
||||||
|
local ptIni = vFace[i].Cen + vFace[i].Width / 2 * vtUp + ( vFace[i].Len / 2 + WHISK_OFFS) * vtDir + WHISK_OFFS * vtOrt
|
||||||
|
local ptDir = ptIni + ( vFace[i].Whisk - WHISK_OFFS) * vtDir
|
||||||
|
local ptCross = ptDir + ( dToolThick - WHISK_OFFS) * vtOrt
|
||||||
|
local WhId = EgtSurfFrRectangle3P( nAddGrpId, ptIni, ptCross, ptDir, GDB_RT.GLOB)
|
||||||
|
local b3Wh = EgtGetBBoxGlob( WhId or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||||
|
-- verifico se interferisce con gli altri pezzi
|
||||||
|
for j = 1, #vOthers do
|
||||||
|
if OverlapsXY( b3Wh, vOthers[j].Box) then
|
||||||
|
local nClass = EgtSurfFrChunkSimpleClassify( WhId, 0, vOthers[j].RegId, 0)
|
||||||
|
if nClass ~= GDB_RC.OUT then
|
||||||
|
local dLen = vFace[i].Len - vFace[i].Whisk + EgtIf( ( vFace[i].Type & 2) ~= 0, -vFace[i].Whisk, 0)
|
||||||
|
if dLen >= MIN_LEN_CUT then
|
||||||
|
vFace[i].Type = vFace[i].Type + 1
|
||||||
|
else
|
||||||
|
vFace[i].Type = 4
|
||||||
|
end
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
EgtErase( WhId)
|
||||||
|
end
|
||||||
|
-- verifico il baffo finale
|
||||||
|
if vFace[i].Type ~= 4 and ( vFace[i].Type & 2) == 0 then
|
||||||
|
-- creo il rettangolo del baffo
|
||||||
|
local vtOrt = Vector3d( vFace[i].Norm:getX(), vFace[i].Norm:getY(), 0) ; vtOrt:normalize()
|
||||||
|
local vtDir = Vector3d( vtOrt) ; vtDir:rotate( Z_AX(), 90)
|
||||||
|
local vtUp = Vector3d( vtDir) ; vtUp:rotate( vFace[i].Norm, 90)
|
||||||
|
local ptIni = vFace[i].Cen + vFace[i].Width / 2 * vtUp + ( vFace[i].Len / 2 + WHISK_OFFS) * vtDir + WHISK_OFFS * vtOrt
|
||||||
|
local ptDir = ptIni + ( vFace[i].Whisk - WHISK_OFFS) * vtDir
|
||||||
|
local ptCross = ptDir + ( dToolThick - WHISK_OFFS) * vtOrt
|
||||||
|
local WhId = EgtSurfFrRectangle3P( nAddGrpId, ptIni, ptCross, ptDir, GDB_RT.GLOB)
|
||||||
|
local b3Wh = EgtGetBBoxGlob( WhId or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||||
|
-- verifico se interferisce con gli altri pezzi
|
||||||
|
for j = 1, #vOthers do
|
||||||
|
if OverlapsXY( b3Wh, vOthers[j].Box) then
|
||||||
|
local nClass = EgtSurfFrChunkSimpleClassify( WhId, 0, vOthers[j].RegId, 0)
|
||||||
|
if nClass ~= GDB_RC.OUT then
|
||||||
|
local dLen = vFace[i].Len - vFace[i].Whisk + EgtIf( ( vFace[i].Type & 1) ~= 0, -vFace[i].Whisk, 0)
|
||||||
|
if dLen >= MIN_LEN_CUT then
|
||||||
|
vFace[i].Type = vFace[i].Type + 2
|
||||||
|
else
|
||||||
|
vFace[i].Type = 4
|
||||||
|
end
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
EgtErase( WhId)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- eventuali stampe
|
||||||
|
for i = 1, #vFace do
|
||||||
|
local Face = vFace[i]
|
||||||
|
local sOut = 'Face '..tostring( Face.Fac)..' C'..tostring( Face.Cen)..' N'..tostring( Face.Norm)..
|
||||||
|
' L='..EgtNumToString( Face.Len, 1)..' W='..EgtNumToString( Face.Width, 1)..' Ap='..EgtNumToString( Face.AngPrev, 1)..
|
||||||
|
' D='..EgtNumToString( Face.Depth, 1)..' B='..EgtNumToString( Face.Whisk, 1)..' T='..tostring( Face.Type)
|
||||||
|
EgtOutLog( sOut, 3)
|
||||||
|
end
|
||||||
|
|
||||||
|
return vFace, dMaxWidth, nNewProc
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
local function ReorderFaces( nIdSurf, nNumFacet, vtNBottom)
|
||||||
|
-- cerco una faccia senza precedenti
|
||||||
|
local nFirstFac
|
||||||
|
for i = 1, nNumFacet do
|
||||||
|
-- centro e normale della faccia
|
||||||
|
local ptCen, vtN = EgtSurfTmFacetCenter( nIdSurf, i - 1, GDB_ID.ROOT)
|
||||||
|
-- verifico con le altre facce
|
||||||
|
local bFoundPrec
|
||||||
|
for j = 1, nNumFacet do
|
||||||
|
if j ~= i then
|
||||||
|
-- verifico se è precedente
|
||||||
|
local bAdj, ptP1, _, _ = EgtSurfTmFacetsContact( nIdSurf, i - 1, j - 1, GDB_ID.ROOT)
|
||||||
|
if bAdj and ( vtN ^ ( ptCen - ptP1)) * vtNBottom > 0 then
|
||||||
|
bFoundPrec = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not bFoundPrec then
|
||||||
|
nFirstFac = i
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- se trovata, la metto al primo posto
|
||||||
|
if nFirstFac and nFirstFac ~= 1 then
|
||||||
|
EgtSurfTmSwapFacets( nIdSurf, nFirstFac - 1, 0)
|
||||||
|
end
|
||||||
|
-- ordino le facce in modo da avere una sequenza ordinata con le normali a destra
|
||||||
|
for i = 1, nNumFacet - 1 do
|
||||||
|
-- centro e normale della faccia
|
||||||
|
local ptCen, vtN = EgtSurfTmFacetCenter( nIdSurf, i - 1, GDB_ID.ROOT)
|
||||||
|
-- cerco la successiva
|
||||||
|
for j = i + 1, nNumFacet do
|
||||||
|
-- verifico se è successiva
|
||||||
|
local bAdj, ptP1, _, _ = EgtSurfTmFacetsContact( nIdSurf, i - 1, j - 1, GDB_ID.ROOT)
|
||||||
|
if bAdj and ( vtN ^ ( ptP1 - ptCen)) * vtNBottom > 0 then
|
||||||
|
EgtSurfTmSwapFacets( nIdSurf, i, j - 1)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
local function RemoveBottomFaceAndReorder( Proc, nAddGrpId, nFaceToDel, vtN)
|
||||||
|
-- copio la superfice nel gruppo ausiliario
|
||||||
|
local nNewProc = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
|
||||||
|
EgtSurfTmRemoveFacet( nNewProc, nFaceToDel)
|
||||||
|
local nNumFacet = EgtSurfTmFacetCount( nNewProc)
|
||||||
|
ReorderFaces( nNewProc, nNumFacet, vtN)
|
||||||
|
return nNewProc, nNumFacet
|
||||||
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePart, bPrevBhSideMill, bAllWithEndCap)
|
local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePart, bPrevBhSideMill, bAllWithEndCap)
|
||||||
if not BD.MAXDIAM_POCK_CORNER then
|
if not BD.MAXDIAM_POCK_CORNER then
|
||||||
@@ -7016,6 +7690,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
|||||||
end
|
end
|
||||||
local nBoreOnCorner = EgtGetInfo( Proc.Id, Q_BORE_ON_CORNER, 'i') or 0
|
local nBoreOnCorner = EgtGetInfo( Proc.Id, Q_BORE_ON_CORNER, 'i') or 0
|
||||||
local nContourSmallTool = EgtGetInfo( Proc.Id, Q_CONTOUR_SMALL_TOOL, 'i') or 0
|
local nContourSmallTool = EgtGetInfo( Proc.Id, Q_CONTOUR_SMALL_TOOL, 'i') or 0
|
||||||
|
local nCleanCorner = EgtGetInfo( Proc.Id, Q_CLEAN_CORNER, 'i') or 1
|
||||||
-- se abilitato dal parametro Q inserisco foro sullo spigolo
|
-- se abilitato dal parametro Q inserisco foro sullo spigolo
|
||||||
if nBoreOnCorner == 1 then
|
if nBoreOnCorner == 1 then
|
||||||
local bOk, sWarn2
|
local bOk, sWarn2
|
||||||
@@ -7045,6 +7720,18 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
|||||||
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2)
|
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
-- se richiesta pulizia spigoli con fresa a V
|
||||||
|
if nCleanCorner > 0 then
|
||||||
|
local dThElev = dToolThDiameter / 2 * sqrt( vtN:getX() * vtN:getX() + vtN:getY() * vtN:getY())
|
||||||
|
local nNewProc = RemoveBottomFaceAndReorder( Proc, nAddGrpId, nFacInd, vtN)
|
||||||
|
local vFace, dDepth = GetFacesData( nNewProc, dToolDiameter, dMaxToolMaterial, ( dToolDiameter/2), nAddGrpId, Proc.PartId, vtN)
|
||||||
|
local bCleanCornerOk, sCleanCornerWarn = AddMillCorner( vFace, Proc, dToolDiameter, nAddGrpId, nNewProc, vtN)
|
||||||
|
if not bCleanCornerOk then return false, sCleanCornerWarn end
|
||||||
|
if sCleanCornerWarn then
|
||||||
|
if not sWarn then sWarn = '' end
|
||||||
|
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sCleanCornerWarn, sCleanCornerWarn)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -506,7 +506,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
-- se il chamfer non è esclusivo continuo con le altre lavorazioni
|
-- se il chamfer non è esclusivo continuo con le altre lavorazioni
|
||||||
if nChamfer < 2 then
|
if nChamfer < 2 then
|
||||||
-- verifico se necessario lavorare in doppio
|
-- verifico se necessario lavorare in doppio
|
||||||
local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
|
local bDouble = ( dProfDepth + BD.CUT_EXTRA - 100 * GEO.EPS_SMALL > dToolMaxDepth)
|
||||||
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
|
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
|
||||||
-- se lavorazione da due parti, aggiungo la seconda
|
-- se lavorazione da due parti, aggiungo la seconda
|
||||||
local sMillingDown
|
local sMillingDown
|
||||||
|
|||||||
@@ -453,7 +453,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- verifico se necessario lavorare in doppio
|
-- verifico se necessario lavorare in doppio
|
||||||
local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
|
local bDouble = ( dProfDepth + BD.CUT_EXTRA - 100 * GEO.EPS_SMALL > dToolMaxDepth)
|
||||||
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
|
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
|
||||||
-- se lavorazione da due parti, aggiungo la seconda
|
-- se lavorazione da due parti, aggiungo la seconda
|
||||||
local sMillingDown
|
local sMillingDown
|
||||||
|
|||||||
@@ -453,7 +453,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- verifico se necessario lavorare in doppio
|
-- verifico se necessario lavorare in doppio
|
||||||
local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
|
local bDouble = ( dProfDepth + BD.CUT_EXTRA - 100 * GEO.EPS_SMALL > dToolMaxDepth)
|
||||||
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
|
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
|
||||||
-- se lavorazione da due parti, aggiungo la seconda
|
-- se lavorazione da due parti, aggiungo la seconda
|
||||||
local sMillingDown
|
local sMillingDown
|
||||||
|
|||||||
+131
-1
@@ -167,6 +167,99 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmTail)
|
|||||||
return true, nil
|
return true, nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
-- smussi in coda
|
||||||
|
local function MakeTailChamfer( idProc, nPartId, dDepthTailChamfer)
|
||||||
|
-- recupero gruppo per geometria aggiuntiva
|
||||||
|
local AddGrpId = BL.GetAddGroup( nPartId)
|
||||||
|
if not AddGrpId then
|
||||||
|
local sErr = 'Error on process StartFace impossible to find AddGroup'
|
||||||
|
EgtOutLog( sErr)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
|
||||||
|
-- recupero la lavorazione
|
||||||
|
local sMilling = ML.FindMilling( 'Mark')
|
||||||
|
if not sMilling then
|
||||||
|
local sErr = 'Error : milling not found in library'
|
||||||
|
EgtOutLog( sErr)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
|
||||||
|
local nLoopId, nLoopCnt = EgtExtractSurfTmFacetLoops( idProc, 0, AddGrpId)
|
||||||
|
if not nLoopId or nLoopCnt > 1 then
|
||||||
|
local sErr = 'Error MakeHeadChamfer : too many loops'
|
||||||
|
EgtOutLog( sErr)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
|
||||||
|
-- setto direzione estrusione corretta
|
||||||
|
EgtModifyCurveExtrusion( nLoopId, -X_AX())
|
||||||
|
EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.LEFT))
|
||||||
|
|
||||||
|
local dQ09Value = EgtGetInfo( idProc, 'Q09', 'd')
|
||||||
|
local bChamferedEdge = dQ09Value > 0
|
||||||
|
|
||||||
|
local nIdFirstEntity, nEntityCnt = EgtExplodeCurveCompo( nLoopId)
|
||||||
|
local p3MidPoint = EgtMP( nIdFirstEntity, GDB_ID.GRID)
|
||||||
|
|
||||||
|
for i = 0, nEntityCnt - 1 do
|
||||||
|
if EgtCurveLength( nIdFirstEntity + i) - 10 < abs( dQ09Value) * 2 then
|
||||||
|
local sErr = 'Error MakeTailChamfer : Q09 too high'
|
||||||
|
EgtOutLog( sErr)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- creo raccordo o fillet
|
||||||
|
for i = 0, nEntityCnt - 1 do
|
||||||
|
local idFirst = nIdFirstEntity + i
|
||||||
|
local idSecond = EgtIf( i == nEntityCnt - 1, nIdFirstEntity, idFirst + 1)
|
||||||
|
local ptEndPointFirst = EgtEP( idFirst, GDB_ID.GRID) - ( abs( dQ09Value) * EgtEV( idFirst, GDB_ID.GRID))
|
||||||
|
local ptStartPointSecond = EgtSP( idSecond, GDB_ID.GRID) + ( abs( dQ09Value) * EgtEV( idSecond, GDB_ID.GRID))
|
||||||
|
|
||||||
|
if bChamferedEdge then
|
||||||
|
EgtCurveChamfer( AddGrpId, idFirst, ptEndPointFirst, idSecond, ptStartPointSecond, abs( dQ09Value), true, GDB_RT.GRID)
|
||||||
|
else
|
||||||
|
EgtCurveFillet( AddGrpId, idFirst, ptEndPointFirst, idSecond, ptStartPointSecond, abs( dQ09Value), true, GDB_RT.GRID)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
EgtSelectPathObjs( nIdFirstEntity, true)
|
||||||
|
local idGeom, idGeomCnt = EgtCurveCompoByChain( AddGrpId, GDB_ID.SEL, {0,0,0}, true)
|
||||||
|
if not idGeom or idGeomCnt > 1 then
|
||||||
|
local sErr = 'Error MakeTailChamfer : too many loops'
|
||||||
|
EgtOutLog( sErr)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
EgtChangeClosedCurveStartPoint( idGeom, p3MidPoint, GDB_RT.GRID)
|
||||||
|
|
||||||
|
-- Inserisco la lavorazione del lato standard
|
||||||
|
local dExtra = 2
|
||||||
|
local sName1 = 'TailCham_' .. ( EgtGetName( idProc) or tostring( idProc))
|
||||||
|
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( {{ idGeom, -1}})
|
||||||
|
-- assegno affondamento e offset radiale
|
||||||
|
EgtSetMachiningParam( MCH_MP.DEPTH, dDepthTailChamfer + dExtra)
|
||||||
|
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
|
||||||
|
-- assegno lato di lavoro
|
||||||
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
||||||
|
-- eseguo
|
||||||
|
if not ML.ApplyMachining( true, false) then
|
||||||
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
|
EgtSetOperationMode( nMch1Id, false)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
|
||||||
|
return true, nil
|
||||||
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
-- lavorazione con sega a catena per sezioni alte e larghe
|
-- lavorazione con sega a catena per sezioni alte e larghe
|
||||||
local function MakeCutByChainSaw( nSurfId, sSawing, nFaceUse, dDepth, sNotes, dRadialOffset, bExtendStartEnd, bInvert)
|
local function MakeCutByChainSaw( nSurfId, sSawing, nFaceUse, dDepth, sNotes, dRadialOffset, bExtendStartEnd, bInvert)
|
||||||
@@ -662,7 +755,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
|
|||||||
local dMinTailScrapForAdditionalCuts = 10.123
|
local dMinTailScrapForAdditionalCuts = 10.123
|
||||||
local bNeedVerticalAddedCuts = not bSplit and ( Proc.Face[1].WidthTrimmed > BD.MAX_LEN_DICE) and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL)
|
local bNeedVerticalAddedCuts = not bSplit and ( Proc.Face[1].WidthTrimmed > BD.MAX_LEN_DICE) and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL)
|
||||||
local bNeedHorizontalAddedCuts = not bSplit and not bBigSectionCut and
|
local bNeedHorizontalAddedCuts = not bSplit and not bBigSectionCut and
|
||||||
( Proc.Face[1].HeightTrimmed > ( BD.MIN_HEIGHT_ADDED_CUTS or BD.MAX_LEN_DICE)) and
|
( Proc.Face[1].HeightTrimmed > ( BD.MIN_HEIGHT_ADDED_CUTS or BD.MAX_LEN_DICE) + 100 * GEO.EPS_SMALL) and
|
||||||
( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) and
|
( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) and
|
||||||
dOffsL < BD.MAX_DIM_DICE
|
dOffsL < BD.MAX_DIM_DICE
|
||||||
-- dati lavorazioni sopra e sotto
|
-- dati lavorazioni sopra e sotto
|
||||||
@@ -819,6 +912,43 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
|
|||||||
|
|
||||||
local bOk, sErr = MakeStandardCuts( Proc, b3Raw, nCuts, dOffsL, TailCutType, Cutting1Data, Cutting2Data, nil, dLenEndRaw)
|
local bOk, sErr = MakeStandardCuts( Proc, b3Raw, nCuts, dOffsL, TailCutType, Cutting1Data, Cutting2Data, nil, dLenEndRaw)
|
||||||
|
|
||||||
|
-- se smussi in coda da aggiungere
|
||||||
|
local dDepthTailChamfer = EgtGetInfo( nOriId or Proc.Id, 'Q08', 'd') or 0
|
||||||
|
if dDepthTailChamfer > 100 * GEO.EPS_SMALL then
|
||||||
|
-- creo subito nuova fase qui, a meno che non sia stata già creata
|
||||||
|
if nNewPhase == 0 then
|
||||||
|
BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET)
|
||||||
|
nNewPhase = EgtGetCurrPhase()
|
||||||
|
local nDispId = EgtGetPhaseDisposition( nNewPhase)
|
||||||
|
if sDownOrSideOrStd == 'down' then
|
||||||
|
EgtRotateRawPart( nRawId, X_AX(), 180)
|
||||||
|
EgtSetInfo( nDispId, 'TYPE', 'MID2')
|
||||||
|
EgtSetInfo( nDispId, 'ROT', -2)
|
||||||
|
elseif sDownOrSideOrStd == 'side' then
|
||||||
|
if bPreMove then EgtMoveRawPart( nRawId, vtMove) end
|
||||||
|
EgtRotateRawPart( nRawId, X_AX(), EgtIf( BD.RIGHT_LOAD, -90, 90))
|
||||||
|
if not bPreMove then EgtMoveRawPart( nRawId, vtMove) end
|
||||||
|
EgtSetInfo( nDispId, 'TYPE', 'MID2')
|
||||||
|
EgtSetInfo( nDispId, 'ROT', -1)
|
||||||
|
else
|
||||||
|
EgtSetInfo( nDispId, 'TYPE', 'END')
|
||||||
|
end
|
||||||
|
EgtSetInfo( nDispId, 'ORD', nOrd)
|
||||||
|
-- se grezzo successivo senza pezzi e finale, va tolto
|
||||||
|
local nNextRawId = EgtGetNextRawPart( nRawId)
|
||||||
|
if nNextRawId and EgtGetPartInRawPartCount( nNextRawId) == 0 and EgtGetRawPartBBox( nNextRawId):getDimX() < BD.MinRaw then
|
||||||
|
EgtRemoveRawPartFromCurrPhase( nNextRawId)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- alla fine del taglio si aggiungono gli smussi in testa
|
||||||
|
local _, sErrHeadChamfer = MakeTailChamfer( nOriId or Proc.Id, nPartId, dDepthTailChamfer)
|
||||||
|
if sErr then
|
||||||
|
sErr = sErr..'\n'..sErrHeadChamfer
|
||||||
|
else
|
||||||
|
sErr = sErrHeadChamfer
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return bOk, sErr, nNewPhase
|
return bOk, sErr, nNewPhase
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
-- Intestazioni
|
-- Intestazioni
|
||||||
require( 'EgtBase')
|
require( 'EgtBase')
|
||||||
_ENV = EgtProtectGlobal()
|
_ENV = EgtProtectGlobal()
|
||||||
EgtEnableDebug( false)
|
EgtEnableDebug( true)
|
||||||
|
|
||||||
-- Imposto direttorio libreria specializzata per Travi
|
-- Imposto direttorio libreria specializzata per Travi
|
||||||
EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua')
|
EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua')
|
||||||
|
|||||||
+1
-1
@@ -3,4 +3,4 @@
|
|||||||
|
|
||||||
NAME = 'Beam'
|
NAME = 'Beam'
|
||||||
VERSION = '2.7j2'
|
VERSION = '2.7j2'
|
||||||
MIN_EXE = '2.7f2'
|
MIN_EXE = '2.7k2'
|
||||||
|
|||||||
Reference in New Issue
Block a user