DataBeam :
- aggiunta possibilità di foro su spigolo di L20 da parametro Q - corretti profili per copia lavorazione di sgrossatura per finitura con nome originale e non effettivo.
This commit is contained in:
+47
-29
@@ -1,4 +1,4 @@
|
||||
-- ProcessMortise.lua by Egaltech s.r.l. 2020/01/29
|
||||
-- ProcessMortise.lua by Egaltech s.r.l. 2020/03/04
|
||||
-- Gestione calcolo mortase per Travi
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
@@ -42,12 +42,11 @@ function ProcessMortise.Classify( Proc)
|
||||
return false
|
||||
end
|
||||
local bDown
|
||||
-- Confronto le 2 direzioni Z dei versori
|
||||
-- se differiscono allora la faccetta 0 della superficie non è il fondo della mortasa+
|
||||
-- e quindi la mortasa è passante
|
||||
-- Confronto le direzioni Z dei 2 versori : se diverse la faccia 0 non è il fondo => mortasa passante
|
||||
if abs( vtExtr:getZ() - vtN:getZ()) > GEO.EPS_SMALL then
|
||||
bDown = false
|
||||
else -- se è chiusa
|
||||
-- altrimenti è chiusa
|
||||
else
|
||||
-- verifico se la mortasa è lavorabile solo da sotto
|
||||
bDown = ( vtN:getZ() < - 0.1)
|
||||
end
|
||||
@@ -69,26 +68,46 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId)
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- se curva aperta la allungo e chiudo
|
||||
if not EgtCurveIsClosed( AuxId) then
|
||||
local _, nCount = EgtCurveDomain( AuxId)
|
||||
EgtCloseCurveCompo( AuxId)
|
||||
EgtSetInfo( AuxId, 'OPEN', nCount)
|
||||
end
|
||||
-- recupero versore estrusione della curva supplementare e confronto la direzione Z
|
||||
-- del versore della componente Z della superficie
|
||||
-- recupero versore estrusione della curva supplementare
|
||||
local vtExtr = EgtCurveExtrusion( AuxId, GDB_ID.ROOT)
|
||||
-- recupero i dati del bottom
|
||||
-- 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 = frMor:getOrigin()
|
||||
local vtN = frMor:getVersZ()
|
||||
local bNotExistBtm
|
||||
-- Confronto le 2 direzioni Z dei versori
|
||||
-- se differiscono allora la faccetta 0 della superficie non è il fondo della mortasa+
|
||||
-- e quindi la mortasa è passante
|
||||
if abs( vtExtr:getZ() - vtN:getZ()) > GEO.EPS_SMALL then
|
||||
-- Confronto le direzioni Z dei 2 versori : se diverse la faccia 0 non è il fondo => mortasa passante
|
||||
local bOpenBtm = ( abs( vtExtr:getZ() - vtN:getZ()) > GEO.EPS_SMALL)
|
||||
if bOpenBtm then
|
||||
-- creo superficie chiusa
|
||||
local nFlat = EgtSurfTmByFlatContour( EgtGetParent(AuxId), AuxId, 0.02)
|
||||
local nFlat = EgtSurfTmByFlatContour( EgtGetParent( AuxId), AuxId, 0.02)
|
||||
if nFlat then
|
||||
frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( nFlat, 0, GDB_ID.ROOT)
|
||||
ptC = frMor:getOrigin()
|
||||
@@ -109,21 +128,20 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId)
|
||||
vtN = frMor:getVersZ()
|
||||
end
|
||||
-- cancello le prove del misfatto (superficie piana)
|
||||
EgtErase(nFlat)
|
||||
-- setto il flag che indica che non c'è il fondo
|
||||
bNotExistBtm = true
|
||||
EgtErase( nFlat)
|
||||
end
|
||||
end
|
||||
-- scrivo info nel log
|
||||
EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3)
|
||||
if not bNotExistBtm then
|
||||
if not bOpenBtm then
|
||||
-- verifico che la mortasa non sia orientata verso il basso (limite -5 deg)
|
||||
if vtN:getZ() < - 0.1 then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Mortise from bottom impossible'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
else -- se mortasa passante
|
||||
-- se mortasa 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
|
||||
@@ -190,7 +208,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId)
|
||||
local sWarn
|
||||
local nDepthMin
|
||||
-- se la mortasa è passante e non è forzata a un solo lato, riduco l'affondamento a metà profondità
|
||||
if bNotExistBtm and not bForceOneSide then
|
||||
if bOpenBtm and not bForceOneSide then
|
||||
dMorH = dMorH * 0.5
|
||||
end
|
||||
-- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente
|
||||
@@ -198,7 +216,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId)
|
||||
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( bNotExistBtm and not bForceOneSide, dMorH * 2, dMorH)
|
||||
nDepthMin = dMaxDepth - EgtIf( bOpenBtm and not bForceOneSide, dMorH * 2, dMorH)
|
||||
else
|
||||
nDepthMin = dMaxDepth
|
||||
end
|
||||
@@ -206,7 +224,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId)
|
||||
dMorH = dMaxDepth
|
||||
EgtOutLog( sWarn .. ' (process ' .. tostring( Proc.Id) .. ')')
|
||||
else
|
||||
if bNotExistBtm and not bForceOneSide then -- se mortasa passante setto metà profondità
|
||||
if bOpenBtm and not bForceOneSide then -- se mortasa passante setto metà profondità
|
||||
nDepthMin = -dMorH
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, nDepthMin)
|
||||
end
|
||||
@@ -222,7 +240,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId)
|
||||
-- ESPERIMENTO:
|
||||
-- se non c'è il fondo e la lavorazione non ha lavorato tutta la superficie per limite altezza utensile
|
||||
-- inserisco una ulteriore lavorazione contraria
|
||||
if bNotExistBtm and not bForceOneSide and nDepthMin and abs(nDepthMin) > 0 then
|
||||
if bOpenBtm and not bForceOneSide and nDepthMin and abs(nDepthMin) > 0 then
|
||||
-- inserisco la lavorazione di svuotatura opposta
|
||||
sName = 'Mort_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_Oppo'
|
||||
nMchFId = EgtAddMachining( sName, sPocketing)
|
||||
|
||||
Reference in New Issue
Block a user