diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 8700d53..677b922 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -5544,7 +5544,7 @@ local function MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead) -- ottengo la distanza tra la fine del pezzo e il pezzo successivo local dDistToNextPiece = BL.GetDistanceToNextPart( nRawId, nPhase) -- verifico se applicare gestione speciale delle giunzioni (U diretta come asse X) - local bAddEndCap = false + local bAddEndCapLeftSide, bAddEndCapRightSide = false, false local dAddLen = 0 local bIsOpenU = ( Proc.Fct == 3 and not TestElleShape3( Proc)) if bIsOpenU then @@ -5554,13 +5554,13 @@ local function MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead) if vtN0:getX() < 0.0175 and vtN1:getX() < 0.0175 and vtN2:getX() < 0.0175 then local dWidth = 0 if vtN0 * vtN1 < -0.9998 then - bAddEndCap = true + bAddEndCapLeftSide = true dWidth = ( ptC1 - ptC0) * vtN0 elseif vtN0 * vtN2 < -0.9998 then - bAddEndCap = true + bAddEndCapLeftSide = true dWidth = ( ptC2 - ptC0) * vtN0 elseif vtN1 * vtN2 < -0.9998 then - bAddEndCap = true + bAddEndCapLeftSide = true dWidth = ( ptC2 - ptC1) * vtN1 end dAddLen = min( dWidth, 100) / 2 @@ -5570,7 +5570,8 @@ local function MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead) -- per creare le superfici di cap nei tunnel serve aggiungere una faccia di fondo local nSurfBottomId if Proc.Topology == 'Tunnel' and Proc.AffectedFaces.Front then - bAddEndCap = true + bAddEndCapLeftSide = true + bAddEndCapRightSide = true dAddLen = 225 -- recupero centro e normale delle facce local ptC = {} @@ -5598,40 +5599,40 @@ local function MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead) end -- la divido in parti lungo X local vAddId = {} - local bAllWithEndCap = bAddEndCap + local bAllWithEndCap = bAddEndCapLeftSide or bAddEndCapRightSide local nPart = max( ceil( Proc.Box:getDimX() / BD.LONGCUT_MAXLEN), 2) local dPartLen = Proc.Box:getDimX() / nPart local Xmin = Proc.Box:getMin():getX() + local AddIdCopy = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL + if nSurfBottomId then EgtSurfTmAdd( AddIdCopy, nSurfBottomId) end + local nCapIdLeftSide, nCapIdRightSide for i = 1, nPart do -- eseguo divisione local AddId = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL - if i > 1 or bAddEndCap then + if i > 1 or bAddEndCapLeftSide then -- definizione del piano local dAdd = EgtIf( i > 1, dAddLen, 0) local ptOn = Point3d( Xmin - dAdd + ( i - 1) * dPartLen, 0, 0) local vtN = -X_AX() - -- se richiesto, creazione tappo - local CapId - if bAddEndCap then - local AddIdTemp = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL - if nSurfBottomId then EgtSurfTmAdd( AddIdTemp, nSurfBottomId) end - local nFirstId, nPnt, nCrv, nSrf = EgtPlaneSurfTmInters( ptOn, vtN, AddIdTemp, nAddGrpId, GDB_RT.GLOB) + -- se richiesto, creazione tappo sinistro + if bAddEndCapLeftSide then + local nFirstId, nPnt, nCrv, nSrf = EgtPlaneSurfTmInters( ptOn, vtN, AddIdCopy, nAddGrpId, GDB_RT.GLOB) if nPnt == 0 and nCrv == 1 and nSrf == 0 then EgtCloseCurveCompo( nFirstId) - CapId = EgtSurfTmByFlatContour( nAddGrpId, nFirstId) - if not CapId then bAllWithEndCap = false end + nCapIdLeftSide = EgtSurfTmByFlatContour( nAddGrpId, nFirstId) + if not nCapIdLeftSide then bAllWithEndCap = false end end --- if nFirstId then --- for nId = nFirstId, nFirstId + nPnt + nCrv + nSrf - 1 do --- EgtErase( nId) --- end --- end +-- if nFirstId then +-- for nId = nFirstId, nFirstId + nPnt + nCrv + nSrf - 1 do +-- EgtErase( nId) +-- end +-- end end - -- taglio della superficie + -- taglio della superficie lato sinistro EgtCutSurfTmPlane( AddId, ptOn, vtN, true, GDB_RT.GLOB) - -- se esiste, aggiunta del tappo - if CapId then - AddId = EgtSurfTmBySewing( nAddGrpId, { AddId, CapId}) + -- se esiste, aggiunta del tappo sinistro + if nCapIdLeftSide then + AddId = EgtSurfTmBySewing( nAddGrpId, { AddId, nCapIdLeftSide}) -- se prima spezzatura, allungamento per non lasciare archi if i == 1 then local b3Box = EgtGetBBoxGlob( AddId, GDB_BB.STANDARD) @@ -5643,7 +5644,26 @@ local function MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead) if i < nPart then local ptOn = Point3d( Xmin + i * dPartLen, 0, 0) local vtN = X_AX() + -- taglio della superficie lato destro EgtCutSurfTmPlane( AddId, ptOn, vtN, true, GDB_RT.GLOB) + -- se richiesto, creazione tappo destro + if bAddEndCapRightSide then + local nFirstId, nPnt, nCrv, nSrf = EgtPlaneSurfTmInters( ptOn, vtN, AddIdCopy, nAddGrpId, GDB_RT.GLOB) + if nPnt == 0 and nCrv == 1 and nSrf == 0 then + EgtCloseCurveCompo( nFirstId) + nCapIdRightSide = EgtSurfTmByFlatContour( nAddGrpId, nFirstId) + if not nCapIdRightSide then bAllWithEndCap = false end + end +-- if nFirstId then +-- for nId = nFirstId, nFirstId + nPnt + nCrv + nSrf - 1 do +-- EgtErase( nId) +-- end +-- end + end + end + -- se esiste, aggiunta del tappo destro + if nCapIdRightSide then + AddId = EgtSurfTmBySewing( nAddGrpId, { AddId, nCapIdRightSide}) end EgtSetName( AddId, 'AddPart_' .. tostring( Proc.Id) .. '_' .. tostring( i)) -- eseguo inserimento in modo da ordinare da X+ a X-