From 869683c99a6aa0576849cff9de4868e230029a1c Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 23 Oct 2023 12:39:15 +0200 Subject: [PATCH 1/7] - a Topology aggiunta groove 2 facce (tipo birdsmouth passante) - prima aggiunta di MakeStaircaseStep --- LuaLibs/FeatureTopology.lua | 5 ++++- LuaLibs/ProcessLapJoint.lua | 25 ++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/LuaLibs/FeatureTopology.lua b/LuaLibs/FeatureTopology.lua index 03dbd55..5a3a09d 100644 --- a/LuaLibs/FeatureTopology.lua +++ b/LuaLibs/FeatureTopology.lua @@ -199,9 +199,12 @@ function FeatureTopology.Classify( Proc, b3Raw) elseif Proc.Fct == 2 and bAllAnglesConcave and #vTriangularFaces == 1 then sFamily = 'Bevel' bIsThrough = false - elseif Proc.Fct == 2 and bAllAnglesConcave then + elseif Proc.Fct == 2 and bAllAnglesConcave and ( Proc.AffectedFaces.Left or Proc.AffectedFaces.Right) and ( Proc.AffectedFaces.Front or Proc.AffectedFaces.Back) then sFamily = 'Rabbet' bIsThrough = true + elseif Proc.Fct == 2 and bAllAnglesConcave then + sFamily = 'Groove' + bIsThrough = true elseif Proc.Fct == 2 and not bAllAnglesConcave and bIsAnyDimensionLongAsPart then sFamily = 'DoubleBevel' bIsThrough = true diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index b1d4d58..4057728 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -151,6 +151,7 @@ local function AssignQIdent( Proc) Q_SIDE_ROUGH_TOOL = '' Q_ANTISPLINT_TYPE = '' Q_MAX_ELEVATION = 'Q10' + Q_STAIRCASE = '' if ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 16 then Q_FORCE_BLADE = 'Q01' -- i @@ -164,7 +165,8 @@ local function AssignQIdent( Proc) Q_USE_MILL = 'Q02' -- i Q_USE_ROUGH_TOOL = 'Q03' -- i Q_SIDE_ROUGH_TOOL = 'Q04' -- i - Q_BORE_ON_CORNER = 'Q06' -- i + Q_BORE_ON_CORNER = 'Q06' -- i + Q_STAIRCASE = 'Q09' -- i elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 25 then Q_BORE_ON_CORNER = 'Q01' -- i elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 30 then @@ -5665,6 +5667,23 @@ local function TestTwoFacesDownHead( Proc) return bDownHead end +--------------------------------------------------------------------- +local function MakeStaircaseStep( Proc) + -- angolo tra le facce + local _, _, _, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT) + -- se l'angolo tra le facce è maggiore di 90.5 o minore di 80 esco + if ( dAng > -80 + 10 * GEO.EPS_ANG_SMALL) or ( dAng < -90.5 - 10 * GEO.EPS_ANG_SMALL) then return false end + -- normali delle facce + local vtNRiser = EgtSurfTmFacetNormVersor( Proc.Id, 0, GDB_ID.ROOT) + local vtNTread = EgtSurfTmFacetNormVersor( Proc.Id, 1, GDB_ID.ROOT) + -- identifico quale faccia è l'alzata e quale la pedata + local nFaceRiser, nFaceTread = 0, 1 + if vtNRiser:getZ() > vtNTread:getZ() then + nFaceRiser, nFaceTread = 1, 0 + end + +end + --------------------------------------------------------------------- -- Applicazione della lavorazione --------------------------------------------------------------------- @@ -5821,6 +5840,10 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) end -- due facce elseif Proc.Fct == 2 then + -- se V passante e attiva Q per lavorazione speciale scala + if Q_STAIRCASE == 1 and Proc.Topology == 'Groove' and Proc.IsThrough == true then + return MakeStaircaseStep( Proc) + end -- se praticamente è lunga come la trave e sono due facce lunghe local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, 0, GDB_BB.STANDARD) local b3Fac2 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, 1, GDB_BB.STANDARD) From a7e0c5a33de22c4ee0798fa3fca565c634a82636 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Wed, 25 Oct 2023 15:56:53 +0200 Subject: [PATCH 2/7] - In LapJoint -> MakeStaircaseStep aggiunta la lavorazione con fresa --- LuaLibs/ProcessLapJoint.lua | 131 +++++++++++++++++++++++++++++++++--- 1 file changed, 122 insertions(+), 9 deletions(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 4057728..013c64e 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -5668,20 +5668,133 @@ local function TestTwoFacesDownHead( Proc) end --------------------------------------------------------------------- -local function MakeStaircaseStep( Proc) +local function MakeStaircaseStep( Proc, nRawId, b3Raw, b3Solid) -- angolo tra le facce local _, _, _, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT) - -- se l'angolo tra le facce è maggiore di 90.5 o minore di 80 esco - if ( dAng > -80 + 10 * GEO.EPS_ANG_SMALL) or ( dAng < -90.5 - 10 * GEO.EPS_ANG_SMALL) then return false end + local _, _, _, dAng2 = EgtSurfTmFacetsContact( Proc.Id, 1, 0, GDB_ID.ROOT) + -- l'angolo tra le facce deve essere compreso tra 80 e 90.5 deg + if ( dAng > -89.5 + 10 * GEO.EPS_ANG_SMALL) or ( dAng < -100 - 10 * GEO.EPS_ANG_SMALL) then return false end -- normali delle facce local vtNRiser = EgtSurfTmFacetNormVersor( Proc.Id, 0, GDB_ID.ROOT) local vtNTread = EgtSurfTmFacetNormVersor( Proc.Id, 1, GDB_ID.ROOT) - -- identifico quale faccia è l'alzata e quale la pedata - local nFaceRiser, nFaceTread = 0, 1 - if vtNRiser:getZ() > vtNTread:getZ() then - nFaceRiser, nFaceTread = 1, 0 + -- la faccia 0 è l'alzata (faccia più verticale), la 1 la pedata; se così non è le scambio + local nFacetRiser, nFacetTread = 0, 1 + if abs( vtNRiser:getZ()) > abs( vtNTread:getZ()) then + EgtSurfTmSwapFacets( Proc.Id, 0, 1) + vtNRiser, vtNTread = vtNTread, vtNRiser + end + -- riferimenti e dimensioni delle facce + local rfFacRiser, dHRiser, dVRiser = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacetRiser, GDB_ID.ROOT) + local rfFacTread, dHTread, dVTread = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacetTread, GDB_ID.ROOT) + + -- recupero la fresatura + -- verifico se fresatura da sopra + local bIsMillingUpward = ( vtNTread:getZ() >= BD.NZ_MINA) + -- fresatura + local sMilling = ML.FindMilling( 'BirdsMouth', nil, nil, nil, nil, bIsMillingUpward, not bIsMillingUpward) + if not sMilling then + local sErr = 'Error : BirdsMouth not found in library' + EgtOutLog( sErr) + return false, sErr + end + -- dati utensile + local dMillDiam = 50 + local dMillMaxMat = 0 + local dMillRotationSpeed = 0 + if EgtMdbSetCurrMachining( sMilling) then + local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then + dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam + dMillMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMillMaxMat + dMillRotationSpeed = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) or dMillRotationSpeed + end end + -- recupero la lavorazione con lama + -- verifico se uso lama da sotto + local bCutDown = ( BD.DOWN_HEAD and rfFacTread:getVersZ():getZ() < - 0.5) + -- lavorazione con lama + local sCutting = ML.FindCutting( 'HeadSide', not bCutDown, bCutDown) + -- dati utensile + local dSawMaxDepth = 0 + local dSawDiam = 400 + local dSawRotationSpeed = 0 + if sCutting then + if EgtMdbSetCurrMachining( sCutting) then + local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then + dSawMaxDepth = EgtTdbGetCurrToolMaxDepth() or dSawMaxDepth + dSawRotationSpeed = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED)or dSawRotationSpeed + end + end + end + + -- fresatura pedata per fare spazio alla lama + local dMillingDepth = dVTread - dSawMaxDepth + dMillDiam/2 - 10 + -- divido in passate orizzontali + local nHorizontalStepMilling = ceil( ( dMillingDepth - 100 * GEO.EPS_SMALL) / ( dMillDiam * 0.6)) + local dHorizontalStepMilling = 0 + if nHorizontalStepMilling > 1 then + dHorizontalStepMilling = ( dMillingDepth - dMillDiam * 0.6) / ( nHorizontalStepMilling - 1) + end + for i = nHorizontalStepMilling, 1, -1 do + -- inserisco la lavorazione + local sName = 'Mill_' .. ( 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, nFacetTread}}) + -- imposto uso faccia + local nFaceUse = BL.GetNearestOrthoOpposite( vtNTread) + EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) + -- imposto lato di lavoro e eventuale inversione + local bInvert = dMillRotationSpeed < 0 + local nWorkSide = MCH_MILL_WS.LEFT + if bInvert then + nWorkSide = MCH_MILL_WS.RIGHT + end + EgtSetMachiningParam( MCH_MP.WORKSIDE, nWorkSide) + EgtSetMachiningParam( MCH_MP.INVERT, bInvert) + -- imposto posizione braccio porta testa + if vtNTread:getY() < GEO.EPS_SMALL then + EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM) + else + EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) + end + -- imposto attacchi e allungamenti + if nFacetTread then + EgtSetMachiningParam( MCH_MP.STARTADDLEN, dMillDiam/2 + 10) + EgtSetMachiningParam( MCH_MP.ENDADDLEN, dMillDiam/2 + 10) + EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.LINEAR) + EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LI.LINEAR) + EgtSetMachiningParam( MCH_MP.LITANG, 0) + EgtSetMachiningParam( MCH_MP.LOTANG, 0) + EgtSetMachiningParam( MCH_MP.LIPERP, 0) + EgtSetMachiningParam( MCH_MP.LOPERP, 0) + end + -- imposto eventuale offset + EgtSetMachiningParam( MCH_MP.OFFSR, dVTread - dMillingDepth + i * dHorizontalStepMilling) + -- se step verticale non presente, lo setto + local dVerticalStepMilling = EgtGetMachiningParam( MCH_MP.STEP, 'd') + if not dVerticalStepMilling or dVerticalStepMilling <= 10 * GEO.EPS_SMALL then + dVerticalStepMilling = 0.25 * dMillDiam + end + EgtSetMachiningParam( MCH_MP.STEP, dVerticalStepMilling) + -- dichiaro non si generano sfridi per VMill + EgtSetMachiningParam( MCH_MP.USERNOTES, 'VMRS=0;') + -- eseguo + if not ML.ApplyMachining( true, false) then + local _, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nMchFId, false) + return false, sErr + end + -- eventuale segnalazione ingombro di testa o coda + UpdateEncumbrance( Proc, nRawId, b3Raw, b3Solid) + end end --------------------------------------------------------------------- @@ -5841,8 +5954,8 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- due facce elseif Proc.Fct == 2 then -- se V passante e attiva Q per lavorazione speciale scala - if Q_STAIRCASE == 1 and Proc.Topology == 'Groove' and Proc.IsThrough == true then - return MakeStaircaseStep( Proc) + if EgtGetInfo( Proc.Id, Q_STAIRCASE, 'i') == 1 and Proc.Topology == 'Groove' and Proc.IsThrough == true then + return MakeStaircaseStep( Proc, nRawId, b3Raw, b3Solid) end -- se praticamente è lunga come la trave e sono due facce lunghe local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, 0, GDB_BB.STANDARD) From 4e4a1eca4dd39ccca0df36a6c139dc5e25804208 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Thu, 26 Oct 2023 15:07:17 +0200 Subject: [PATCH 3/7] - In LapJoint -> MakeStaircaseStep correzioni al calcolo step orizzontali fresa --- LuaLibs/ProcessLapJoint.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 013c64e..fcecf32 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -5730,14 +5730,14 @@ local function MakeStaircaseStep( Proc, nRawId, b3Raw, b3Solid) end -- fresatura pedata per fare spazio alla lama - local dMillingDepth = dVTread - dSawMaxDepth + dMillDiam/2 - 10 + local dMillingDepth = dVTread - dSawMaxDepth + 10 -- divido in passate orizzontali - local nHorizontalStepMilling = ceil( ( dMillingDepth - 100 * GEO.EPS_SMALL) / ( dMillDiam * 0.6)) - local dHorizontalStepMilling = 0 - if nHorizontalStepMilling > 1 then - dHorizontalStepMilling = ( dMillingDepth - dMillDiam * 0.6) / ( nHorizontalStepMilling - 1) + local nMillHorizontalSteps = ceil( ( dMillingDepth - 100 * GEO.EPS_SMALL) / ( dMillDiam * 0.6)) + local dMillHorizontalStep = 0 + if nMillHorizontalSteps > 1 then + dMillHorizontalStep = ( dMillingDepth - dMillDiam * 0.6) / ( nMillHorizontalSteps - 1) end - for i = nHorizontalStepMilling, 1, -1 do + for i = nMillHorizontalSteps, 1, -1 do -- inserisco la lavorazione local sName = 'Mill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local nMchFId = EgtAddMachining( sName, sMilling) @@ -5777,7 +5777,7 @@ local function MakeStaircaseStep( Proc, nRawId, b3Raw, b3Solid) EgtSetMachiningParam( MCH_MP.LOPERP, 0) end -- imposto eventuale offset - EgtSetMachiningParam( MCH_MP.OFFSR, dVTread - dMillingDepth + i * dHorizontalStepMilling) + EgtSetMachiningParam( MCH_MP.OFFSR, dVTread - dMillingDepth + ( i - 1) * dMillHorizontalStep) -- se step verticale non presente, lo setto local dVerticalStepMilling = EgtGetMachiningParam( MCH_MP.STEP, 'd') if not dVerticalStepMilling or dVerticalStepMilling <= 10 * GEO.EPS_SMALL then From fdb897ec68e8475acd79d0a83f7146c4594242a7 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Fri, 27 Oct 2023 09:56:09 +0200 Subject: [PATCH 4/7] - In LapJoint -> MakeStaircaseStep aggiunti tagli di lama per pedata e alzata. Da verificare gli step --- LuaLibs/ProcessLapJoint.lua | 40 ++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index fcecf32..a66c61a 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -5729,7 +5729,7 @@ local function MakeStaircaseStep( Proc, nRawId, b3Raw, b3Solid) end end - -- fresatura pedata per fare spazio alla lama + -- fresatura della pedata per fare spazio alla lama local dMillingDepth = dVTread - dSawMaxDepth + 10 -- divido in passate orizzontali local nMillHorizontalSteps = ceil( ( dMillingDepth - 100 * GEO.EPS_SMALL) / ( dMillDiam * 0.6)) @@ -5779,11 +5779,11 @@ local function MakeStaircaseStep( Proc, nRawId, b3Raw, b3Solid) -- imposto eventuale offset EgtSetMachiningParam( MCH_MP.OFFSR, dVTread - dMillingDepth + ( i - 1) * dMillHorizontalStep) -- se step verticale non presente, lo setto - local dVerticalStepMilling = EgtGetMachiningParam( MCH_MP.STEP, 'd') - if not dVerticalStepMilling or dVerticalStepMilling <= 10 * GEO.EPS_SMALL then - dVerticalStepMilling = 0.25 * dMillDiam + local dMillVerticalStep = EgtGetMachiningParam( MCH_MP.STEP, 'd') + if not dMillVerticalStep or dMillVerticalStep <= 10 * GEO.EPS_SMALL then + dMillVerticalStep = 0.25 * dMillDiam end - EgtSetMachiningParam( MCH_MP.STEP, dVerticalStepMilling) + EgtSetMachiningParam( MCH_MP.STEP, dMillVerticalStep) -- dichiaro non si generano sfridi per VMill EgtSetMachiningParam( MCH_MP.USERNOTES, 'VMRS=0;') -- eseguo @@ -5795,6 +5795,36 @@ local function MakeStaircaseStep( Proc, nRawId, b3Raw, b3Solid) -- eventuale segnalazione ingombro di testa o coda UpdateEncumbrance( Proc, nRawId, b3Raw, b3Solid) end + + -- taglio di lama dell'alzata + -- calcolo direzione lavorazione per faceuse + local vtOrthoRiser = EgtIf( vtNRiser * Z_AX() > -GEO.EPS_SMALL, Z_AX(), -Z_AX()) + -- divido in passate orizzontali + local nSawStepsRiser = ceil( ( dVRiser - 100 * GEO.EPS_SMALL) / ( dSawMaxDepth * 0.6)) --VEDERE SE GLI STEP DI TAGLIO SONO CORRETTI!!! + local dSawStepRiser = 0 + if nSawStepsRiser > 1 then + dSawStepRiser = ( dVRiser - ( dSawMaxDepth * 0.6)) / ( nSawStepsRiser - 1) + end + for i = nSawStepsRiser, 1, -1 do + -- inserisco la lavorazione della faccia + local dCutRadialOffsetRiser = ( i - 1) * dSawStepRiser + local bOkSawRiser, sErr = Fbs.MakeOne( Proc.Id, nFacetRiser, sCutting, dSawDiam, vtOrthoRiser, nil, -dCutRadialOffsetRiser, 0, 0, 0, 0, nil, b3Raw) + end + + -- taglio di lama della pedata + -- calcolo direzione lavorazione per faceuse + local vtOrtho = EgtIf( vtNRiser * Z_AX() > -GEO.EPS_SMALL, Z_AX(), -Z_AX()) + -- divido in passate orizzontali + local nSawStepsTread = ceil( ( dVTread - 100 * GEO.EPS_SMALL) / ( dSawMaxDepth * 0.6)) + local dSawStepTread = 0 + if nSawStepsTread > 1 then + dSawStepTread = ( dVTread - ( dSawMaxDepth * 0.6)) / ( nSawStepsTread - 1) + end + for i = nSawStepsTread, 1, -1 do + -- inserisco la lavorazione della faccia + local dCutRadialOffsetTread = ( i - 1) * dSawStepTread + local bOkSawTread, sErr = Fbs.MakeOne( Proc.Id, nFacetTread, sCutting, dSawDiam, vtOrtho, nil, -dCutRadialOffsetTread, 0, 0, 0, 0, nil, b3Raw) + end end --------------------------------------------------------------------- From 3fe16f87b75ef9ae742469fc3dab1434eb5880b0 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Fri, 27 Oct 2023 17:01:07 +0200 Subject: [PATCH 5/7] =?UTF-8?q?In=20LapJoint=20->=20MakeStaircaseStep:=20-?= =?UTF-8?q?=20invertite=20taglio=20di=20lama=20alzata=20e=20pedata=20-=20s?= =?UTF-8?q?tep=20lama=20della=20pedata=20limitati=20a=202,=20uno=20a=20met?= =?UTF-8?q?=C3=A0=20e=20uno=20in=20fondo=20-=20corretto=20faceuse=20nel=20?= =?UTF-8?q?caso=20di=20lama=20da=20sotto=20(esclusi=20casi=20downup)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/ProcessLapJoint.lua | 43 +++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index a66c61a..7377c09 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -5796,11 +5796,28 @@ local function MakeStaircaseStep( Proc, nRawId, b3Raw, b3Solid) UpdateEncumbrance( Proc, nRawId, b3Raw, b3Solid) end - -- taglio di lama dell'alzata - -- calcolo direzione lavorazione per faceuse - local vtOrthoRiser = EgtIf( vtNRiser * Z_AX() > -GEO.EPS_SMALL, Z_AX(), -Z_AX()) + -- taglio di lama della pedata + -- calcolo faceuse + local nFaceUseTread = EgtIf( vtNRiser * Z_AX() > -GEO.EPS_SMALL, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_TOP) -- divido in passate orizzontali - local nSawStepsRiser = ceil( ( dVRiser - 100 * GEO.EPS_SMALL) / ( dSawMaxDepth * 0.6)) --VEDERE SE GLI STEP DI TAGLIO SONO CORRETTI!!! + local nSawStepsTread = ceil( ( dVTread - 100 * GEO.EPS_SMALL) / ( dSawMaxDepth * 0.6)) + local dSawStepTread = 0 + if nSawStepsTread > 1 then + dSawStepTread = ( dVTread - ( dSawMaxDepth * 0.6)) / ( nSawStepsTread - 1) + end + for i = 2, 1, -1 do + -- inserisco la lavorazione della faccia + local dCutRadialOffsetTread = ( i - 1) * dSawMaxDepth / 2 + -- componente limite del vettore Z per lama downUp; impostata a -2 per non farla mai rientrare in quel caso + local dVzLimDwnUp = -2 + local bOkSawTread, sErr = Fbs.MakeOne( Proc.Id, nFacetTread, sCutting, dSawDiam, nFaceUseTread, dVzLimDwnUp, -dCutRadialOffsetTread, 0, 0, 0, 0, nil, b3Raw) + end + + -- taglio di lama dell'alzata + -- calcolo faceuse + local nFaceUseRiser = EgtIf( vtNRiser * Z_AX() > -GEO.EPS_SMALL, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_TOP) + -- divido in passate orizzontali + local nSawStepsRiser = ceil( ( dVRiser - 100 * GEO.EPS_SMALL) / ( dSawMaxDepth * 0.6)) local dSawStepRiser = 0 if nSawStepsRiser > 1 then dSawStepRiser = ( dVRiser - ( dSawMaxDepth * 0.6)) / ( nSawStepsRiser - 1) @@ -5808,23 +5825,11 @@ local function MakeStaircaseStep( Proc, nRawId, b3Raw, b3Solid) for i = nSawStepsRiser, 1, -1 do -- inserisco la lavorazione della faccia local dCutRadialOffsetRiser = ( i - 1) * dSawStepRiser - local bOkSawRiser, sErr = Fbs.MakeOne( Proc.Id, nFacetRiser, sCutting, dSawDiam, vtOrthoRiser, nil, -dCutRadialOffsetRiser, 0, 0, 0, 0, nil, b3Raw) + -- componente limite del vettore Z per lama downUp; impostata a -2 per non farla mai rientrare in quel caso + local dVzLimDwnUp = -2 + local bOkSawRiser, sErr = Fbs.MakeOne( Proc.Id, nFacetRiser, sCutting, dSawDiam, nFaceUseRiser, dVzLimDwnUp, -dCutRadialOffsetRiser, 0, 0, 0, 0, nil, b3Raw) end - -- taglio di lama della pedata - -- calcolo direzione lavorazione per faceuse - local vtOrtho = EgtIf( vtNRiser * Z_AX() > -GEO.EPS_SMALL, Z_AX(), -Z_AX()) - -- divido in passate orizzontali - local nSawStepsTread = ceil( ( dVTread - 100 * GEO.EPS_SMALL) / ( dSawMaxDepth * 0.6)) - local dSawStepTread = 0 - if nSawStepsTread > 1 then - dSawStepTread = ( dVTread - ( dSawMaxDepth * 0.6)) / ( nSawStepsTread - 1) - end - for i = nSawStepsTread, 1, -1 do - -- inserisco la lavorazione della faccia - local dCutRadialOffsetTread = ( i - 1) * dSawStepTread - local bOkSawTread, sErr = Fbs.MakeOne( Proc.Id, nFacetTread, sCutting, dSawDiam, vtOrtho, nil, -dCutRadialOffsetTread, 0, 0, 0, 0, nil, b3Raw) - end end --------------------------------------------------------------------- From 54fcc27c496ba0aafae639ca255fbb7197f738b9 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Fri, 3 Nov 2023 09:42:12 +0100 Subject: [PATCH 6/7] =?UTF-8?q?-=20in=20LapJoint=20->=20MakeStaircaseStep?= =?UTF-8?q?=20aggiunta=20riduzione=20profondit=C3=A0=20lama=20in=20caso=20?= =?UTF-8?q?di=20angolo=20inferiore=20a=2090deg?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/ProcessLapJoint.lua | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index a649113..689bd1b 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -5673,7 +5673,6 @@ end local function MakeStaircaseStep( Proc, nRawId, b3Raw, b3Solid) -- angolo tra le facce local _, _, _, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT) - local _, _, _, dAng2 = EgtSurfTmFacetsContact( Proc.Id, 1, 0, GDB_ID.ROOT) -- l'angolo tra le facce deve essere compreso tra 80 e 90.5 deg if ( dAng > -89.5 + 10 * GEO.EPS_ANG_SMALL) or ( dAng < -100 - 10 * GEO.EPS_ANG_SMALL) then return false end -- normali delle facce @@ -5721,16 +5720,24 @@ local function MakeStaircaseStep( Proc, nRawId, b3Raw, b3Solid) local dSawMaxDepth = 0 local dSawDiam = 400 local dSawRotationSpeed = 0 + local dSawThick = 5 if sCutting then if EgtMdbSetCurrMachining( sCutting) then local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then dSawMaxDepth = EgtTdbGetCurrToolMaxDepth() or dSawMaxDepth - dSawRotationSpeed = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED)or dSawRotationSpeed + dSawRotationSpeed = EgtTdbGetCurrToolParam( MCH_MP.SPEED) or dSawRotationSpeed + dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick end end end + -- calcolo riduzione profondità lama in caso di angolo inferiore a 90deg + local dCutExtraSaw = 0 + if dAng < -91 and dAng > -179 then + dCutExtraSaw = - dSawThick / tan( 180 + dAng) + end + -- fresatura della pedata per fare spazio alla lama local dMillingDepth = dVTread - dSawMaxDepth + 10 -- divido in passate orizzontali @@ -5809,10 +5816,10 @@ local function MakeStaircaseStep( Proc, nRawId, b3Raw, b3Solid) end for i = 2, 1, -1 do -- inserisco la lavorazione della faccia - local dCutRadialOffsetTread = ( i - 1) * dSawMaxDepth / 2 + local dCutRadialOffsetTread = - dSawMaxDepth / 2 * ( i - 1) -- componente limite del vettore Z per lama downUp; impostata a -2 per non farla mai rientrare in quel caso local dVzLimDwnUp = -2 - local bOkSawTread, sErr = Fbs.MakeOne( Proc.Id, nFacetTread, sCutting, dSawDiam, nFaceUseTread, dVzLimDwnUp, -dCutRadialOffsetTread, 0, 0, 0, 0, nil, b3Raw) + local bOkSawTread, sErr = Fbs.MakeOne( Proc.Id, nFacetTread, sCutting, dSawDiam, nFaceUseTread, dVzLimDwnUp, dCutRadialOffsetTread + dCutExtraSaw, 0, 0, 0, 0, nil, b3Raw) end -- taglio di lama dell'alzata @@ -5826,10 +5833,10 @@ local function MakeStaircaseStep( Proc, nRawId, b3Raw, b3Solid) end for i = nSawStepsRiser, 1, -1 do -- inserisco la lavorazione della faccia - local dCutRadialOffsetRiser = ( i - 1) * dSawStepRiser + local dCutRadialOffsetRiser = - dSawStepRiser * ( i - 1) -- componente limite del vettore Z per lama downUp; impostata a -2 per non farla mai rientrare in quel caso local dVzLimDwnUp = -2 - local bOkSawRiser, sErr = Fbs.MakeOne( Proc.Id, nFacetRiser, sCutting, dSawDiam, nFaceUseRiser, dVzLimDwnUp, -dCutRadialOffsetRiser, 0, 0, 0, 0, nil, b3Raw) + local bOkSawRiser, sErr = Fbs.MakeOne( Proc.Id, nFacetRiser, sCutting, dSawDiam, nFaceUseRiser, dVzLimDwnUp, dCutRadialOffsetRiser + dCutExtraSaw, 0, 0, 0, 0, nil, b3Raw) end end From 7c7fa26b8d39e138c71e678f2ed4fa0726f3ed41 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Fri, 3 Nov 2023 18:32:54 +0100 Subject: [PATCH 7/7] =?UTF-8?q?-=20in=20Topology=20->=20Classify=20ora=20s?= =?UTF-8?q?i=20settano=20le=20AffectedFaces=20nella=20Proc,=20se=20non=20g?= =?UTF-8?q?i=C3=A0=20presenti=20-=20in=20LapJoint=20->=20MakeStaircaseStep?= =?UTF-8?q?=20aggiunta=20lavorazione=20smussi=20opzionale?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/FeatureTopology.lua | 2 ++ LuaLibs/ProcessLapJoint.lua | 42 +++++++++++++++++++++++++++---------- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/LuaLibs/FeatureTopology.lua b/LuaLibs/FeatureTopology.lua index 5a3a09d..4cc0573 100644 --- a/LuaLibs/FeatureTopology.lua +++ b/LuaLibs/FeatureTopology.lua @@ -3,6 +3,7 @@ -- 2023/09/26 Aggiunte topologie Strip e Cut. -- 2023/09/27 Modificata GetFacesParallelToPart per tunnel, pocket e groove 3 lati -- 2023/10/16 In GetFacesParallelToPart rimossa Pocket e aggiunto Rabbet al check solo direzione principale +-- 2023/11/03 In Classify ora si settano le AffectedFaces nella Proc, se non già presenti. -- Tabella per definizione modulo local FeatureTopology = {} @@ -163,6 +164,7 @@ end -- riconosce se Proc è una delle topologie standard e, in caso positivo, ne scrive le caratteristiche in campi specifici della Proc stessa restituendo true function FeatureTopology.Classify( Proc, b3Raw) + if not Proc.AffectedFaces then Proc.AffectedFaces = BL.GetProcessAffectedFaces( Proc) end if not Proc.Box or Proc.Box:isEmpty() then return false end diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 689bd1b..678372a 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -81,6 +81,7 @@ -- 2023/10/03 In MakePocket aggiunto messaggio in caso si rovini il pezzo successivo. -- 2023/10/25 In LapJoint 2 facce longitudinali faccio di lama solo se taglio completamente. Altrimenti fresa. -- 2023/10/27 In Lapjoint 2 facce con angolo > 90 deg, se forzata fresa, si svuota la faccia principale e si lavora poi la faccia inclinata. +-- 2023/11/03 In MakeStaircaseStep aggiunta lavorazione smussi opzionale. -- Tabella per definizione modulo local ProcessLapJoint = {} @@ -5642,7 +5643,6 @@ local function MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead) local nFct = EgtSurfTmFacetCount( vAddId[i]) local AddProc = { Id = vAddId[i], Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Box, TotBox = Proc.Box, Fct = nFct, Flg = Proc.Flg, PartId = Proc.PartId} Topology.Classify( AddProc, b3Raw) - AddProc.AffectedFaces = BL.GetProcessAffectedFaces( AddProc) -- lasciare il false nel sesto parametro (perchè internamente viene verificato se diverso da nil) local bOk, sMyWarn bOk, sMyWarn, bPrevBhSideMill = MakeMoreFaces( AddProc, nPhase, nRawId, nPartId, dOvmHead, bAllWithEndCap, bPrevBhSideMill, bAllWithEndCap) @@ -5670,7 +5670,14 @@ local function TestTwoFacesDownHead( Proc) end --------------------------------------------------------------------- -local function MakeStaircaseStep( Proc, nRawId, b3Raw, b3Solid) +local function MakeStaircaseStep( Proc, nRawId, b3Raw, nPartId) + -- box della trave + local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) + if not b3Solid then + local sErr = 'Error : part box not found' + EgtOutLog( sErr) + return false, sErr + end -- angolo tra le facce local _, _, _, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT) -- l'angolo tra le facce deve essere compreso tra 80 e 90.5 deg @@ -5738,6 +5745,23 @@ local function MakeStaircaseStep( Proc, nRawId, b3Raw, b3Solid) dCutExtraSaw = - dSawThick / tan( 180 + dAng) end + -- eventuali smussi + -- recupero gruppo per geometria addizionale + local nAddGrpId = BL.GetAddGroup( nPartId) + if not nAddGrpId then + local sErr = 'Error : missing AddGroup' + EgtOutLog( sErr) + return false, sErr + end + -- verifiche per smusso + local nChamfer, dDepthCham, sErrCham = EvaluateQParam( Proc) + -- lavorazione smussi + if nChamfer > 0 then + local _, _, _, vtOrtho, _, nSurfInt = BL.GetTunnelDimension( Proc, nPartId) + local nOk, sErr = MakeChamfer( Proc, true, nAddGrpId, vtOrtho, b3Solid, nSurfInt, dDepthCham) + if nOk < 0 then return false, sErr end + end + -- fresatura della pedata per fare spazio alla lama local dMillingDepth = dVTread - dSawMaxDepth + 10 -- divido in passate orizzontali @@ -5808,18 +5832,13 @@ local function MakeStaircaseStep( Proc, nRawId, b3Raw, b3Solid) -- taglio di lama della pedata -- calcolo faceuse local nFaceUseTread = EgtIf( vtNRiser * Z_AX() > -GEO.EPS_SMALL, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_TOP) - -- divido in passate orizzontali - local nSawStepsTread = ceil( ( dVTread - 100 * GEO.EPS_SMALL) / ( dSawMaxDepth * 0.6)) - local dSawStepTread = 0 - if nSawStepsTread > 1 then - dSawStepTread = ( dVTread - ( dSawMaxDepth * 0.6)) / ( nSawStepsTread - 1) - end + -- lavorazioni della faccia for i = 2, 1, -1 do - -- inserisco la lavorazione della faccia local dCutRadialOffsetTread = - dSawMaxDepth / 2 * ( i - 1) -- componente limite del vettore Z per lama downUp; impostata a -2 per non farla mai rientrare in quel caso local dVzLimDwnUp = -2 local bOkSawTread, sErr = Fbs.MakeOne( Proc.Id, nFacetTread, sCutting, dSawDiam, nFaceUseTread, dVzLimDwnUp, dCutRadialOffsetTread + dCutExtraSaw, 0, 0, 0, 0, nil, b3Raw) + if not bOkSawTread then return false, sErr end end -- taglio di lama dell'alzata @@ -5831,12 +5850,13 @@ local function MakeStaircaseStep( Proc, nRawId, b3Raw, b3Solid) if nSawStepsRiser > 1 then dSawStepRiser = ( dVRiser - ( dSawMaxDepth * 0.6)) / ( nSawStepsRiser - 1) end + -- lavorazioni della faccia for i = nSawStepsRiser, 1, -1 do - -- inserisco la lavorazione della faccia local dCutRadialOffsetRiser = - dSawStepRiser * ( i - 1) -- componente limite del vettore Z per lama downUp; impostata a -2 per non farla mai rientrare in quel caso local dVzLimDwnUp = -2 local bOkSawRiser, sErr = Fbs.MakeOne( Proc.Id, nFacetRiser, sCutting, dSawDiam, nFaceUseRiser, dVzLimDwnUp, dCutRadialOffsetRiser + dCutExtraSaw, 0, 0, 0, 0, nil, b3Raw) + if not bOkSawRiser then return false, sErr end end end @@ -6006,7 +6026,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) elseif Proc.Fct == 2 then -- se V passante e attiva Q per lavorazione speciale scala if EgtGetInfo( Proc.Id, Q_STAIRCASE, 'i') == 1 and Proc.Topology == 'Groove' and Proc.IsThrough == true then - return MakeStaircaseStep( Proc, nRawId, b3Raw, b3Solid) + return MakeStaircaseStep( Proc, nRawId, b3Raw, nPartId) end -- se praticamente è lunga come la trave e sono due facce lunghe local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, 0, GDB_BB.STANDARD)