DataWall :

- correzione in lavorazioni mortase passanti e aperte e in mortase con estrusione verso il basso.
This commit is contained in:
DarioS
2021-07-30 19:56:48 +02:00
parent 4205ae9c86
commit f31f18c7fc
+51 -35
View File
@@ -1,4 +1,4 @@
-- WProcessMortise.lua by Egaltech s.r.l. 2021/04/20
-- WProcessMortise.lua by Egaltech s.r.l. 2021/07/30
-- Gestione calcolo mortase per Pareti
-- Tabella per definizione modulo
@@ -67,34 +67,6 @@ function WPM.Make( Proc, nRawId, b3Raw)
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()
@@ -103,9 +75,50 @@ function WPM.Make( Proc, nRawId, b3Raw)
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
-- verifico se è presente il fondo (sempre faccia 0)
local bClosedBtm = AreSameVectorApprox( vtExtr, vtN)
-- Se curva di contorno aperta
local dLenOpenSide = 0
if not EgtCurveIsClosed( AuxId) then
-- se c'è il fondo
if bClosedBtm 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)
local dLen = dist( EgtUP( AuxId, i-1), EgtUP( AuxId, i))
dLenOpenSide = max( dLen, dLenOpenSide)
end
end
if #sOpen > 0 then
EgtSetInfo( AuxId, 'OPEN', sOpen)
end
end
end
-- altrimenti aperta
else
dLenOpenSide = dist( EgtSP( AuxId), EgtEP( AuxId))
local _, nCrvCnt = EgtCurveDomain( AuxId)
EgtCloseCurveCompo( AuxId)
EgtSetInfo( AuxId, 'OPEN', nCrvCnt)
end
end
-- Se mortasa passante
if not bClosedBtm then
-- creo superficie chiusa
local nFlat = EgtSurfTmByFlatContour( EgtGetParent( AuxId), AuxId, 0.05)
if nFlat then
@@ -134,7 +147,7 @@ function WPM.Make( Proc, nRawId, b3Raw)
-- scrivo info nel log
EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3)
-- Se mortasa chiusa
if not bOpenBtm then
if bClosedBtm 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'
@@ -161,6 +174,7 @@ function WPM.Make( Proc, nRawId, b3Raw)
dMorH = max( dMorH, dCenElev or 0)
-- determino larghezza della mortasa
if dL < dW then dL, dW = dW, dL end
dW = max( dW, min( 2 * dW, dLenOpenSide))
-- recupero la lavorazione
local sPocketing
if Proc.Prc ~= 53 then
@@ -224,7 +238,7 @@ function WPM.Make( Proc, nRawId, b3Raw)
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)
nDepthMin = dMaxDepth - EgtIf( not bClosedBtm and not bForceOneSide, dMorH * 2, dMorH)
else
nDepthMin = dMaxDepth
end
@@ -232,9 +246,11 @@ function WPM.Make( Proc, nRawId, b3Raw)
dMorH = dMaxDepth
EgtOutLog( sWarn .. ' (process ' .. tostring( Proc.Id) .. ')')
else
if bOpenBtm and not bForceOneSide then -- se mortasa passante setto metà profondità
if not bClosedBtm and not bForceOneSide then -- se mortasa passante setto metà profondità
nDepthMin = -dMorH
EgtSetMachiningParam( MCH_MP.DEPTH, nDepthMin)
elseif bRevertSide then
EgtSetMachiningParam( MCH_MP.DEPTH, dMorH)
end
end
-- imposto elevazione