DataBeam :

- in LapJoint con due lati corretto riconoscimento feature di coda
- in ProfileCambered corretta direzione lavorazione e aggiunta possibilità di antischeggia con lama.
This commit is contained in:
Dario Sassi
2020-02-05 07:47:04 +00:00
parent 364b76cacc
commit 6027f9c0cb
2 changed files with 82 additions and 2 deletions
+73 -1
View File
@@ -1,4 +1,4 @@
-- ProcessProfCamb.lua by Egaltech s.r.l. 2019/04/10
-- ProcessProfCamb.lua by Egaltech s.r.l. 2020/02/04
-- Gestione calcolo profilo caudato per Travi
-- Tabella per definizione modulo
@@ -87,9 +87,11 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local dProfDepth = abs( EgtCurveThickness( AuxId))
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
local nLastFacet = EgtSurfTmFacetCount( Proc.Id) - 1 -- ultima faccia
local rfFac, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nLastFacet, GDB_ID.ROOT)
local nRefFacet = nLastFacet - 1 -- penultima faccia
local vtNF = EgtSurfTmFacetNormVersor( Proc.Id, nLastFacet, GDB_ID.ROOT)
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nRefFacet, GDB_ID.ROOT)
local bUseBladeOnLastFace -- serve per un eventuale gestione dell'inversione fresate se non c'è la lama
-- verifico se in testa o coda
local bHead = ( vtNF:getX() > 0)
EgtOutLog( 'vtN=' .. tostring( vtN), 3)
@@ -118,6 +120,31 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, 0)
if not bOk then return bOk, sErr end
end
-- se non da sotto e aggiungo taglio di lama se definito dal parametro Q02
if nSide ~= -1 and nLastFacet and EgtGetInfo( Proc.Id, 'Q02', 'i') == 1 then
-- recupero la lavorazione
local sCutting = ML.FindCutting( 'HeadSide')
if not sCutting then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' sawing not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati dell'utensile
local dToolDiam = 0
local dMaxDepth = 0
local dToolThick = 0
if EgtMdbSetCurrMachining( sCutting) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
dToolThick = EgtTdbGetCurrToolParam(MCH_TP.THICK) or dToolThick
end
end
local vtOrthoO = Vector3d(vtN)
local bOk, sNameOrErr = BL.MakeOneFaceBySaw( Proc.Id, nLastFacet, sCutting, dToolDiam, vtOrthoO, nil, -(dV*0.25), BD.CUT_SIC, 0, 0, nil, b3Raw)
if bOk then bUseBladeOnLastFace = true end
end
-- recupero la lavorazione
local sMilling = ML.FindMilling( 'Prof')
if not sMilling then
@@ -127,10 +154,12 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end
-- Recupero i dati dell'utensile
local dToolMaxDepth = 0
local dToolDiam = 0
if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dToolMaxDepth = EgtTdbGetCurrToolMaxDepth()
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
end
end
-- verifico se necessario lavorare in doppio
@@ -172,6 +201,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if bDouble then
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
end
local ptSP, ptEp
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo
@@ -179,6 +209,27 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- confronto il punto iniziale e finale della lavorazione con il box della feature
-- e se è vicino alla parte esterna della trave inverto la lavorazione
ptSP = EgtGetMachiningStartPoint()
ptEp = EgtGetMachiningEndPoint()
local nMachMode = EgtMdbGetCurrMachiningParam( MCH_MP.STEPTYPE)
if nMachMode == 1 and ptSP and ptEp then
if abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptSP:getX()) <
abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptEp:getX()) then
-- ottengo il lato lavoro e lo inverto
local nSideWork = EgtMdbGetCurrMachiningParam( MCH_MP.WORKSIDE)
if nSideWork > 0 then
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( nSideWork == MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT))
end
-- ottengo l'inversione e setto il contrario
local bInvertMode = EgtMdbGetCurrMachiningParam( MCH_MP.INVERT)
EgtSetMachiningParam( MCH_MP.INVERT, not bInvertMode)
-- riapplico la lavorazione
EgtApplyMachining()
end
end
end
-- se lavorazione da due parti, aggiungo la seconda
if bDouble then
@@ -208,6 +259,27 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- confronto il punto iniziale e finale della lavorazione con il box della feature
-- e se è vicino alla parte esterna della trave inverto la lavorazione
ptSP = EgtGetMachiningStartPoint()
ptEp = EgtGetMachiningEndPoint()
local nMachMode = EgtMdbGetCurrMachiningParam( MCH_MP.STEPTYPE)
if nMachMode == 1 and ptSP and ptEp then
if abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptSP:getX()) <
abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptEp:getX()) then
-- ottengo il lato lavoro e lo inverto
local nSideWork = EgtMdbGetCurrMachiningParam( MCH_MP.WORKSIDE)
if nSideWork > 0 then
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( nSideWork == MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT))
end
-- ottengo l'inversione e setto il contrario
local bInvertMode = EgtMdbGetCurrMachiningParam( MCH_MP.INVERT)
EgtSetMachiningParam( MCH_MP.INVERT, not bInvertMode)
-- riapplico la lavorazione
EgtApplyMachining()
end
end
end
end
-- se non da sotto, inserisco lavorazione finitura angolo