DataBeam :

- in contorni liberi gestite fresature parziali non fattibili da sotto
- aggiunti antischeggia in mortase a coda di rondine
- migliorie varie.
This commit is contained in:
Dario Sassi
2020-03-18 22:10:48 +00:00
parent b6cbab67ec
commit c14b77c9cd
8 changed files with 169 additions and 64 deletions
+106 -3
View File
@@ -1,4 +1,4 @@
-- ProcessMortise.lua by Egaltech s.r.l. 2020/02/06
-- ProcessMortise.lua by Egaltech s.r.l. 2020/03/18
-- Gestione calcolo mortase a coda di rondice per Travi
-- Tabella per definizione modulo
@@ -10,9 +10,13 @@ require( 'EgtBase')
EgtOutLog( ' ProcessDtMortise started', 1)
-- Dati
local BL = require( 'BeamLib')
local BD = require( 'BeamData')
local ML = require( 'MachiningLib')
-- settaggi interni ( poi andrà utilizzato parametro ACTIVE_AS proveniente da parametri utente di TechnoEssetre)
local bMakeAntiSplitPath = true
---------------------------------------------------------------------
-- Riconoscimento della feature
function ProcessDtMortise.Identify( Proc)
@@ -63,8 +67,107 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId)
EgtOutLog( sErr)
return false, sErr
end
-- recupero la lavorazione
local sMilling = ML.FindMilling( 'DtMortise')
local sMillingAs
-- se parametro interno abilitato e il percorso non è chiuso, aggiungo percorso e lavorazione antischeggia
if bMakeAntiSplitPath and not EgtCurveIsClosed( AuxId) then
-- recupero la lavorazione
sMillingAs = ML.FindMilling( 'DtMortise')
if not sMillingAs then
local sErr = 'Milling not found in library : Error on DtMortise ' .. tostring( Proc.Id)
EgtOutLog( sErr)
return false, sErr
end
-- recupero il diametro dell'utensile
local dToolDiam = 100
if EgtMdbSetCurrMachining( sMillingAs) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
end
end
-- recupero punto iniziale e finale del percorso
local pStartP = EgtSP( AuxId, GDB_RT.GLOB)
local pEndP = EgtEP( AuxId, GDB_RT.GLOB)
if pStartP and pEndP then
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
local pMid = ( pStartP + pEndP) / 2
local dDistMid = dist( pStartP, pMid)
local pMidArc
local bGoodArc
local nDiv = 2
local nId1
-- ciclo fino ad individuare arco compativile con l'utensile
while not bGoodArc do
-- linea dal punto medio alla fine
nId1 = EgtLine( nAddGrpId, pMid, pEndP, GDB_RT.GLOB)
-- se è stata creata setto il piano e l'accorcio
if nId1 then
-- EgtModifyCurveExtrusion( nId1, vtExtr, GDB_RT.GLOB)
-- accorcio la seconda linea al valore impostato, partendo dal divisore 2
EgtTrimExtendCurveByLen( nId1, -( dDistMid * ( 1 - ( 1 / nDiv))), pEndP, GDB_RT.GLOB)
-- ruoto di -90 gradi
EgtRotate( nId1, pMid, vtExtr, -90, GDB_RT.GLOB)
-- prendo il punto finale dell'entità ruotata
pMidArc = EgtEP( nId1, GDB_RT.GLOB)
-- cancello linea
EgtErase(nId1)
-- creo arco per 3 punti
nId1 = EgtArc3P( nAddGrpId, pStartP, pMidArc, pEndP, GDB_RT.GLOB)
if nId1 then
EgtModifyCurveExtrusion( nId1, vtExtr, GDB_RT.GLOB)
-- recupero il raggio e lo comparo con il raggio utensile,
-- se è maggiore del raggio utensile esco dal cliclo
local dRad = EgtArcRadius( nId1)
if dRad > 0 and dRad > dToolDiam then
bGoodArc = true
else
-- cancello l'arco e incremento il componente del divisore
EgtErase(nId1)
nDiv = nDiv + 1
end
else
bGoodArc = true
end
else
bGoodArc = true
end
end
if not nId1 then
local sErr = 'Wrong geometry : Error on DtMortise ' .. tostring( Proc.Id)
EgtOutLog( sErr)
return false, sErr
end
-- inserisco la lavorazione di contornatura anti splint
local sNameF = 'DtMtAS_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sNameF, sMillingAs)
if not nMchFId then
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sMillingAs
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nId1, -1}})
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
else
local sErr = 'Wrong geometry : Error on DtMortise ' .. tostring( Proc.Id)
EgtOutLog( sErr)
return false, sErr
end
end
-- recupero la lavorazione, se antischeggia già inserita prendo quella
local sMilling = EgtIf( sMillingAs, sMillingAs, ML.FindMilling( 'DtMortise'))
if not sMilling then
local sErr = 'Milling not found in library : Error on DtMortise ' .. tostring( Proc.Id)
EgtOutLog( sErr)