DataWall :

- aggiunta gestione Mortise, DtMortise, Mark e Text.
This commit is contained in:
DarioS
2021-04-20 12:21:08 +02:00
parent 8d865b4deb
commit cb18e8cd0b
5 changed files with 713 additions and 4 deletions
+202
View File
@@ -0,0 +1,202 @@
-- WProcessDtMortise.lua by Egaltech s.r.l. 2021/04/20
-- Gestione calcolo mortase a coda di rondine per Pareti
-- Tabella per definizione modulo
local WPDM= {}
-- Include
require( 'EgtBase')
local WL = require( 'WallLib')
EgtOutLog( ' WProcessDtMortise started', 1)
-- Dati
local WD = require( 'WallData')
local WM = require( 'WMachiningLib')
-- settaggi interni ( poi andrà utilizzato parametro ACTIVE_AS proveniente da parametri utente di TechnoEssetre)
local bMakeAntiSplitPath = true
local bMakeAsByArc = true
---------------------------------------------------------------------
-- Riconoscimento della feature
function WPDM.Identify( Proc)
return ( (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 55))
end
---------------------------------------------------------------------
-- Classificazione della feature
function WPDM.Classify( 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)
-- verifico se la mortasa è lavorabile
return ( vtExtr:getZ() > WD.NZ_MINA)
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function WPDM.Make( Proc, nRawId, b3Raw)
-- recupero e verifico l'entità curva
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if AuxId then AuxId = AuxId + Proc.Id end
if not AuxId or ( EgtGetType( AuxId) & GDB_FY.GEO_CURVE) == 0 then
local sErr = 'Missing profile geometry : Error on DtMortise ' .. tostring( Proc.Id)
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati della curva
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
local ptBC = EgtGP( AuxId, GDB_RT.GLOB)
-- verifico che la mortasa non sia orientata verso il basso (-5 deg) o che ci sia una testa da sotto
local bFaceDown = ( vtExtr:getZ() < - 0.1)
if bFaceDown then
local sErr = 'Machining from bottom impossible : Error on DtMortise ' .. tostring( Proc.Id)
EgtOutLog( sErr)
return false, sErr
end
-- determino l'altezza della mortasa (0=faccia di fondo)
local rfDtMrt = Frame3d( ptBC, vtExtr)
local b3DtMrt = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, rfDtMrt)
local dAltMort = b3DtMrt:getDimZ()
-- verifico se di tipo pocket
local bPocket = ( EgtGetInfo( Proc.Id, 'P05', 'i') == 1)
if bPocket then bMakeAntiSplitPath = false end
-- recupero il raggio minimo della mortasa
local dMinRad = 1000
local nSt, nEnd = EgtCurveDomain( AuxId)
for i = nSt, nEnd - 1 do
local dRad = EgtCurveCompoRadius( AuxId, i)
if dRad > 0 and dRad < dMinRad then
dMinRad = dRad
end
end
-- recupero la lavorazione
local sMillType = 'DtMortise'
-- recupero la lavorazione : prima ricerca per sola tipologia
local sMilling = WM.FindMilling( sMillType)
if not sMilling then
local sErr = 'Milling not found in library : Error on DtMortise ' .. tostring( Proc.Id)
EgtOutLog( sErr)
return false, sErr
end
-- recupero la lavorazione : seconda ricerca con tipologia e diametro massimo
sMilling = WM.FindMilling( sMillType, nil, nil, 2 * dMinRad)
if not sMilling then
local sErr = 'Radius too small : Error on DtMortise ' .. tostring( Proc.Id)
EgtOutLog( sErr)
return false, sErr
end
-- recupero il diametro dell'utensile e l'angolo di spoglia
local dToolDiam = 100
local dMaxMat = 30
local dSideAng = 0
local bCW = true
if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
dToolDiam = max( dToolDiam, 10)
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
dSideAng = EgtTdbGetCurrToolParam( MCH_TP.SIDEANG) or dSideAng
local dSpeed = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) or 0
bCW = ( dSpeed >= 0)
end
end
-- verifico che la profondità non superi il massimo materiale dell'utensile
if dAltMort > dMaxMat + 10 * GEO.EPS_SMALL then
local sErr = 'Error : DtMortise Depth bigger than Tool Cutting edge'
EgtOutLog( sErr)
return false, sErr
end
-- se con tasca, la lavoro
if bPocket then
-- recupero il contorno della tasca (seconda curva ausiliaria)
local sVal = EgtGetInfo( Proc.Id, 'AUXID')
local vsAuxId = EgtSplitString( sVal)
local Aux2Id
if vsAuxId and #vsAuxId >=2 then
Aux2Id = tonumber( vsAuxId[2])
end
if Aux2Id then Aux2Id = Aux2Id + Proc.Id end
if not Aux2Id or ( EgtGetType( Aux2Id) & GDB_FY.GEO_CURVE) == 0 then
local sErr = 'Missing pocket geometry : Error on DtMortise ' .. tostring( Proc.Id)
EgtOutLog( sErr)
return false, sErr
end
-- recupero la lavorazione
local sPocketing
if Proc.Prc ~= 53 then
sPocketing = WM.FindPocketing( 'Mortise', dToolDiam)
end
if not sPocketing then
sPocketing = WM.FindPocketing( 'Pocket', dToolDiam)
end
if not sPocketing then
local sErr = 'Error : Mortise or Pocket not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- inserisco la lavorazione di svuotatura
local sName = 'DtMtPck_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sName, sPocketing)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Aux2Id, -1}})
-- dichiaro non si generano sfridi per VMill
local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end
-- verifico se necessarie più passate (distanza all'imbocco ortogonale all'asse)
local vtDiff = EgtEP( AuxId, GDB_RT.GLOB) - EgtSP( AuxId, GDB_RT.GLOB)
local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB)
vtAx:normalize()
local vtOrtDiff = vtDiff - vtDiff * vtAx * vtAx
local dDist = vtOrtDiff:len()
-- calcolo le passate
local nPass = ceil( dDist / ( 1.9 * dToolDiam))
local dStep = ( dDist - 0.95 * dToolDiam) / ( 2 * nPass)
for i = nPass, 1, -1 do
-- inserisco la lavorazione di contornatura
local sNameF = 'DtMt_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nPass)
local nMchFId = EgtAddMachining( sNameF, sMilling)
if not nMchFId then
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- imposto offset
local dOffs = ( i - 1) * dStep
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
-- sistemo il lato e la direzione di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT))
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, false, true))
-- dichiaro non si generano sfridi per VMill
local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end
return true
end
---------------------------------------------------------------------
return WPDM
+129
View File
@@ -0,0 +1,129 @@
-- WProcessMark.lua by Egaltech s.r.l. 2021/04/20
-- Gestione calcolo marcatura per Pareti
-- Tabella per definizione modulo
local WPMK = {}
-- Include
require( 'EgtBase')
EgtOutLog( ' WProcessMark started', 1)
-- Dati
local WD = require( 'WallData')
local WM = require( 'WMachiningLib')
---------------------------------------------------------------------
-- Riconoscimento della feature
function WPMK.Identify( Proc)
return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 60)
end
---------------------------------------------------------------------
-- Classificazione della feature
function WPMK.Classify( Proc, b3Raw)
-- recupero il versore estrusione o normale se testo
local vtN
if EgtGetType( Proc.Id) ~= GDB_TY.EXT_TEXT then
vtN = EgtCurveExtrusion( Proc.Id, GDB_ID.ROOT)
else
vtN = EgtTextNormVersor( Proc.Id, GDB_ID.ROOT)
end
-- verifico sia una curva/testo
if not vtN then
return false
end
-- verifico se la marcatura è lavorabile (solo da sopra)
return ( vtN:getZ() > WD.NZ_MINA)
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function WPMK.Make( Proc, nRawId, b3Raw)
-- recupero eventuale geometria ausiliaria
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if AuxId then AuxId = AuxId + Proc.Id end
-- recupero i dati della marcatura
local vtExtr
if EgtGetType( Proc.Id) ~= GDB_TY.EXT_TEXT then
vtExtr = EgtCurveExtrusion( Proc.Id, GDB_RT.GLOB)
else
vtExtr = EgtTextNormVersor( Proc.Id, GDB_ID.ROOT)
end
-- verifico sia una curva/testo
if not vtExtr then
local sErr = 'Error : Mark with geometry type not accepted'
EgtOutLog( sErr)
return false, sErr
end
-- verifico che la marcatura non sia orientata verso il basso
if vtExtr:getZ() < WD.NZ_MINA then
local sErr = 'Error : Mark from bottom impossible'
EgtOutLog( sErr)
return false, sErr
end
-- recupero la lavorazione
local sMilling = WM.FindMilling( 'Text')
if not sMilling then
local sErr = 'Error : milling not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- inserisco la lavorazione di fresatura
local sName = 'Decor_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sName, sMilling)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, -1}})
-- imposto posizione braccio porta testa
if vtExtr:getY() <= 0 then
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
else
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
-- eventuale lavorazione su seconda geometria
if AuxId then
-- inserisco la lavorazione di fresatura
local sName2 = 'Decor2_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchF2Id = EgtAddMachining( sName, sMilling)
if not nMchF2Id then
local sErr = 'Error adding machining ' .. sName2 .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- imposto posizione braccio porta testa
if vtExtr:getY() <= 0 then
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
else
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchF2Id, false)
return false, sErr
end
-- se geometria a X maggiore, la sposto prima
local ptS1 = EgtSP( Proc.Id, GDB_ID.ROOT)
local ptS2 = EgtSP( AuxId, GDB_ID.ROOT)
if ptS2:getX() > ptS1:getX() then
EgtRelocateGlob( nMchF2Id, nMchFId, GDB_IN.BEFORE)
end
end
return true
end
---------------------------------------------------------------------
return WPMK
+253
View File
@@ -0,0 +1,253 @@
-- WProcessMortise.lua by Egaltech s.r.l. 2021/04/20
-- Gestione calcolo mortase per Pareti
-- Tabella per definizione modulo
local WPM = {}
-- Include
require( 'EgtBase')
local WL = require( 'WallLib')
EgtOutLog( ' WProcessMortise started', 1)
-- Dati
local WD = require( 'WallData')
local WM = require( 'WMachiningLib')
---------------------------------------------------------------------
-- Riconoscimento della feature
function WPM.Identify( Proc)
return ( (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 50) or
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 53))
end
---------------------------------------------------------------------
-- Classificazione della feature: decide se la feature è in una posizione che per lavorala
-- deve essere ribaltata o no
function WPM.Classify( Proc, b3Raw)
-- recupero e verifico il percorso supplementare
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if AuxId then AuxId = AuxId + Proc.Id end
-- recupero versore estrusione della curva supplementare e non più della superficie
-- perché quest'ultima potrebbe non avere il fondo e dare quindi un risultato non corretto
local vtExtr = EgtCurveExtrusion( AuxId or GDB_ID.NULL, GDB_ID.ROOT)
-- recupero i dati della faccia di fondo
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
-- verifico sia una superficie
if not vtExtr then
return false
end
if not vtN then
return false
end
-- Confronto le direzioni Z dei 2 versori : se diverse la faccia 0 non è il fondo => mortasa passante
if abs( vtExtr:getZ() - vtN:getZ()) > 10 * GEO.EPS_SMALL then
return true
-- altrimenti è chiusa
else
-- verifico se la mortasa è lavorabile da sopra
return ( vtN:getZ() > WD.NZ_MINA)
end
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function WPM.Make( Proc, nRawId, b3Raw)
-- recupero e verifico l'entità curva
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
local bForceOneSide
local bRevertSide
if AuxId then
AuxId = AuxId + Proc.Id
end
if not AuxId or ( EgtGetType( AuxId) & GDB_FY.GEO_CURVE) == 0 then
local sErr = 'Error : missing profile geometry'
EgtOutLog( sErr)
return false, sErr
end
-- recupero versore estrusione della curva supplementare
local vtExtr = EgtCurveExtrusion( AuxId, GDB_ID.ROOT)
-- Se curva di contorno aperta
if not EgtCurveIsClosed( AuxId) then
local NewId, nCount = EgtExtractSurfTmFacetLoops( Proc.Id, 0, EgtGetParent( Proc.Id))
if NewId then
-- elimino eventuali loop interni (non dovrebbero comunque esserci)
for i = 1, nCount - 1 do
EgtErase( NewId + i)
end
-- sostituisco il loop esterno alla curva originale
EgtModifyCurveExtrusion( NewId, vtExtr, GDB_ID.ROOT)
EgtRelocate( NewId, AuxId, GDB_IN.AFTER)
EgtErase( AuxId)
EgtChangeId( NewId, AuxId)
-- sistemo i lati aperti
local vFacAdj = EgtSurfTmFacetAdjacencies( Proc.Id, 0)[1]
if vFacAdj then
local sOpen = ''
for i = 1, #vFacAdj do
if vFacAdj[i] < 0 then
sOpen = sOpen .. EgtIf( #sOpen > 0, ',', '') .. tostring( i - 1)
end
end
if #sOpen > 0 then
EgtSetInfo( AuxId, 'OPEN', sOpen)
end
end
end
end
-- recupero i dati della faccia di fondo
local frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0, GDB_ID.ROOT)
local ptC = ORIG()
local vtN = V_NULL()
if frMor then
ptC = frMor:getOrigin()
vtN = frMor:getVersZ()
end
-- Confronto le direzioni dei 2 versori : se diverse la faccia 0 non è il fondo => mortasa passante
local bOpenBtm = not AreSameVectorApprox( vtExtr, vtN)
if bOpenBtm then
-- creo superficie chiusa
local nFlat = EgtSurfTmByFlatContour( EgtGetParent( AuxId), AuxId, 0.05)
if nFlat then
frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( nFlat, 0, GDB_ID.ROOT)
ptC = frMor:getOrigin()
vtN = frMor:getVersZ()
-- verifico se copiare la geometria lungo l'asse Z
local b3Aux = EgtGetBBoxRef( AuxId, GDB_BB.STANDARD, frMor)
local bxMax = b3Aux:getMax()
local b3Mor = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frMor)
local bxMin = b3Mor:getMin()
local dMove = bxMin:getZ()-bxMax:getZ()
-- se il percorso ausiliario è esterno al grezzo, lo riavvicino
if abs( dMove) > GEO.EPS_SMALL then
AuxId = EgtCopyGlob( AuxId, WL.GetAddGroup(nPartId))
EgtMove( AuxId, Vector3d(0,0,-dMove))
EgtMove( nFlat, Vector3d(0,0,-dMove))
frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( nFlat, 0, GDB_ID.ROOT)
ptC = frMor:getOrigin()
vtN = frMor:getVersZ()
end
-- cancello le prove del misfatto (superficie piana)
EgtErase( nFlat)
end
end
-- scrivo info nel log
EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3)
-- Se mortasa chiusa
if not bOpenBtm then
-- verifico che la mortasa non sia orientata verso il basso (limite -5 deg)
if vtN:getZ() < WD.NZ_MINA then
local sErr = 'Error : Mortise from bottom impossible'
EgtOutLog( sErr)
return false, sErr
end
-- altrimenti passante
else
-- determino se la mortasa da lavorare sul lato opposto sia di angolo inferiore a quello consentito
if abs( vtN:getZ()) > 0.1 then
bForceOneSide = true
end
-- determino se è meglio lavorare la mortasa nel lato opposto
if vtN:getZ() < -GEO.EPS_SMALL then
bRevertSide = true
end
end
-- determino altezza della mortasa
local b3Mor = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frMor)
local dMorH = b3Mor:getDimZ()
-- elevazione del punto centro
local _, dCenElev = WL.GetPointDirDepth( nPartId, ptC, vtN)
dMorH = max( dMorH, dCenElev or 0)
-- determino larghezza della mortasa
if dL < dW then dL, dW = dW, dL end
-- recupero la lavorazione
local sPocketing
if Proc.Prc ~= 53 then
sPocketing = WM.FindPocketing( 'Mortise', dW)
end
if not sPocketing then
sPocketing = WM.FindPocketing( 'Pocket', dW)
end
if not sPocketing then
local sErr = 'Error : Mortise or Pocket not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati dell'utensile
local dMillDiam = 20
local dMaxDepth = 0
local bCW = true
if EgtMdbSetCurrMachining( sPocketing) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
dMaxDepth = ( EgtTdbGetCurrToolMaxDepth() or dMaxDepth)
local dSpeed = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) or 0
bCW = ( dSpeed >= 0)
end
end
-- inserisco la lavorazione di svuotatura
local sName = 'Mort_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sName, sPocketing)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
EgtOutLog( sErr)
return false, sErr
end
-- verifico se invertire versore estrusione geometria
if bRevertSide then
EgtModifyCurveExtrusion( AuxId, -vtExtr, GDB_ID.ROOT)
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- sistemo la direzione di lavoro
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, true, false))
-- imposto posizione braccio porta testa
if vtN:getY() < GEO.EPS_SMALL then
if bRevertSide then
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
else
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
end
else
if bRevertSide then
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
else
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end
end
local sWarn
local nDepthMin
-- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente
if dMorH > dMaxDepth + 10 * GEO.EPS_SMALL then
sWarn = 'Warning in mortise : elevation (' .. EgtNumToString( dMorH,1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth,1) .. ')'
-- se non ho invertito la direzione di estrusione
if not bRevertSide then
nDepthMin = dMaxDepth - EgtIf( bOpenBtm and not bForceOneSide, dMorH * 2, dMorH)
else
nDepthMin = dMaxDepth
end
EgtSetMachiningParam( MCH_MP.DEPTH, nDepthMin)
dMorH = dMaxDepth
EgtOutLog( sWarn .. ' (process ' .. tostring( Proc.Id) .. ')')
else
if bOpenBtm and not bForceOneSide then -- se mortasa passante setto metà profondità
nDepthMin = -dMorH
EgtSetMachiningParam( MCH_MP.DEPTH, nDepthMin)
end
end
-- imposto elevazione
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMorH, 1) .. ';')
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
return true, sWarn
end
---------------------------------------------------------------------
return WPM
+85
View File
@@ -0,0 +1,85 @@
-- WProcessText.lua by Egaltech s.r.l. 2021/04/20
-- Gestione calcolo testi per Travi
-- Tabella per definizione modulo
local WPT = {}
-- Include
require( 'EgtBase')
EgtOutLog( ' WProcessText started', 1)
-- Dati
local WD = require( 'WallData')
local WM = require( 'WMachiningLib')
---------------------------------------------------------------------
-- Riconoscimento della feature
function WPT.Identify( Proc)
return ( Proc.Grp == 4 and Proc.Prc == 61)
end
---------------------------------------------------------------------
-- Classificazione della feature
function WPT.Classify( Proc, b3Raw)
-- recupero i dati del testo
local vtN = EgtTextNormVersor( Proc.Id, GDB_ID.ROOT)
-- verifico sia un testo
if not vtN then
return false
end
-- verifico se il testo è lavorabile (solo da sopra)
return ( vtN:getZ() > WD.NZ_MINA)
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function WPT.Make( Proc, nRawId, b3Raw)
-- recupero i dati del testo
local vtN = EgtTextNormVersor( Proc.Id, GDB_ID.ROOT)
-- verifico sia un testo
if not vtN then
local sErr = 'Error : Text with geometry type not accepted'
EgtOutLog( sErr)
return false, sErr
end
-- verifico che il testo non sia orientato verso il basso
if vtN:getZ() < WD.NZ_MINA then
local sErr = 'Error : Text from bottom impossible'
EgtOutLog( sErr)
return false, sErr
end
-- recupero la lavorazione
local sMilling = WM.FindMilling( 'Text')
if not sMilling then
local sErr = 'Error : milling not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- inserisco la lavorazione di fresatura
local sName = 'Text_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sName, sMilling)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, -1}})
-- imposto posizione braccio porta testa
if vtN:getY() <= 0 then
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
else
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
return true
end
---------------------------------------------------------------------
return WPT
+44 -4
View File
@@ -1,4 +1,4 @@
-- WallExec.lua by Egaltech s.r.l. 2021/03/25
-- WallExec.lua by Egaltech s.r.l. 2021/04/20
-- Libreria esecuzione lavorazioni per Pareti
-- Tabella per definizione modulo
@@ -22,12 +22,20 @@ _G.package.loaded.WallLib = nil
_G.package.loaded.WProcessCut = nil
_G.package.loaded.WProcessLapJoint = nil
_G.package.loaded.WProcessDrill = nil
_G.package.loaded.WProcessMortise = nil
_G.package.loaded.WProcessDtMortise = nil
_G.package.loaded.WProcessMark = nil
_G.package.loaded.WProcessText = nil
_G.package.loaded.WProcessFreeContour = nil
local WM = require( 'WMachiningLib')
local WL = require( 'WallLib')
local Cut = require( 'WProcessCut')
local LapJoint = require( 'WProcessLapJoint')
local Drill = require( 'WProcessDrill')
local Mortise = require( 'WProcessMortise')
local DtMortise = require( 'WProcessDtMortise')
local Mark = require( 'WProcessMark')
local Text = require( 'WProcessText')
local FreeContour = require( 'WProcessFreeContour')
-------------------------------------------------------------------------------------------------------------
@@ -168,6 +176,22 @@ local function ClassifyFeatures( vProc, b3Raw)
elseif Drill.Identify( Proc) then
local bOk = Drill.Classify( Proc, b3Raw)
if not bOk then Proc.Flg = 0 end
-- se mortasatura
elseif Mortise.Identify( Proc) then
local bOk = Mortise.Classify( Proc, b3Raw)
if not bOk then Proc.Flg = 0 end
-- se mortasatura a coda di rondine
elseif DtMortise.Identify( Proc) then
local bOk = DtMortise.Classify( Proc, b3Raw)
if not bOk then Proc.Flg = 0 end
-- se marcatura
elseif Mark.Identify( Proc) then
local bOk = Mark.Classify( Proc, b3Raw)
if not bOk then Proc.Flg = 0 end
-- se testo
elseif Text.Identify( Proc) then
local bOk = Text.Classify( Proc, b3Raw)
if not bOk then Proc.Flg = 0 end
-- se contorno libero, outile o aperture
elseif FreeContour.Identify( Proc) then
local bOk = FreeContour.Classify( Proc, b3Raw)
@@ -197,7 +221,7 @@ local function AddFeatureMachining( Proc, nRawId, b3Raw)
if Cut.Identify( Proc) then
-- esecuzione taglio
bOk, sErr = Cut.Make( Proc, nRawId, b3Raw)
-- se tasca (3/4-030-X)
-- se tasca (3/4-030-X) o similari
elseif LapJoint.Identify( Proc) then
-- esecuzione tasca
bOk, sErr = LapJoint.Make( Proc, nRawId, b3Raw)
@@ -205,6 +229,22 @@ local function AddFeatureMachining( Proc, nRawId, b3Raw)
elseif Drill.Identify( Proc) then
-- esecuzione foratura
bOk, sErr = Drill.Make( Proc, nRawId, b3Raw)
-- se mortasatura (3/4-050-X) o similari
elseif Mortise.Identify( Proc) then
-- esecuzione mortasatura
bOk, sErr = Mortise.Make( Proc, nRawId, b3Raw)
-- se mortasatura a coda di rondine (3/4-055-X)
elseif DtMortise.Identify( Proc) then
-- esecuzione mortasatura a coda di rondine
bOk, sErr = DtMortise.Make( Proc, nRawId, b3Raw)
-- se marcatura (3/4-060-X)
elseif Mark.Identify( Proc) then
-- esecuzione marcatura
bOk, sErr = Mark.Make( Proc, nRawId, b3Raw)
-- se testo (4-061-X)
elseif Text.Identify( Proc) then
-- esecuzione incisione testo
bOk, sErr = Text.Make( Proc, nRawId, b3Raw)
-- se contorno libero, outline o apertura ( 0/3/4-250/251/252-X)
elseif FreeContour.Identify( Proc) then
-- esecuzione contorno
@@ -299,10 +339,10 @@ local function SortMachinings( nPhase, PrevMch, nPartId)
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, 'Nail_', true)
-- Tagli con sega a catena che sono rifiniture di spigoli
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MORTISING, 'Csaw_', false)
-- Fresature che sono rifiniture di spigoli
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, 'Clean_', false, 'MOVE_AFTER', false)
-- Svuotature
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.POCKETING)
-- Fresature che sono rifiniture di spigoli
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, 'Clean_', false, 'MOVE_AFTER', false)
-- Fresature che sono puliture di spigoli
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, 'Clean_', true, 'MOVE_AFTER', false)
-- Tagli con lama