-- -- EEEEEEEEEE GGGGGG wwww wwww -- EEEEEEEEEE GGGGGGGGGG wwww wwww -- EEEE GGGG GGGG wwww wwww wwww -- EEEE GGGG wwww wwww wwww -- EEEEEEE GGGG GGGGGGG wwww wwwwww wwww -- EEEEEEE GGGG GGGGGGG wwww wwwwww wwww -- EEEE GGGG GGGG wwww wwwwwwww wwww -- EEEE GGGG GGGG wwww wwww wwww wwww -- EEEEEEEEEE GGGGGGGGGG wwwwwwww wwwwwwww -- EEEEEEEEEE GGGGGG wwwwwww wwwwwww -- -- FlushPull.lua by EgalWare s.r.l. 2016.07.05 -- Autore: Filippo Monchi -- FlushPull dati i valori 'L' e 'H' e con nome attributo -- 2016.09.21 V1.0a0 FM aggiunta messaggi di wanrning -- 2018.04.09 V1.0a1 FM Manage info (KeepBackSet) for adjust probe on Z -- 2018.10.22 V1.0a2 FM Manage better the big radius fillet parameter -- 2019.04.24 V1.0a3 FM Manage extra bores, extra rectangles, extra lines -- 2019.04.29 V1.0a4 FM Disable AddSurfTmByExtrusion -- 2019.05.22 V1.0a5 FM Manage anti-splint path on strike extra rectangle geometry -- 2019.09.30 V1.0a6 FM Manage anti-splint path on anti-splint path -- 2019.10.10 V1.0a7 FM Manage steel option -- 2019.10.18 V2.000 FM Manage use Materials -- 2019.10.28 V2.001 FM Add clean corner geometries -- 2020.01.07 V2.002 FM Manage start point on shortest side with steel material (also for extra rectangles) -- 2020.04.29 V2.003 FM Update for aluminum material -- 2021.01.22 V3.000 FM Manage better checking error on tools and dimension when produce flag is false -- 2021.03.12 V3.001 FM Check and adjust the angle parameter on ebtra rectangle and extra lines -- 2021.11.24 V3.002 FM Manage side probe option if variable DGC.Pms > 2 -- 2022.07.27 V3.003 FM Modification to use compiled code -- Tavola per definizione modulo (serve ma non usata) local FlushPull = {} -- Intestazioni require( 'EgtBase') EgtEnableDebug( false) -- per messaggi -- EgtAddToPackagePath( EgtGetSourceDir() .. '?.lua') EgtAddToPackagePath( DGD.BASEDIR .. '?.lua') -- Valori limite local DimMin = 4. -- valore minimo lato local dExtraH = 0.25 local function DrawAddLineDrawCircle( pInitial, pFinal, nGroup, idTable, bPrev, nGroupCirc, nRad, bDrawFirst, bDrawLast, cColor1, cColor2, sMVar, sReference) local nReference = GDB_RT.LOC if sReference and sReference == 'grid' then nReference = GDB_RT.GRID end local nLine = EgtLine(nGroup, pInitial, pFinal, nReference) local nNumLine if idTable then table.insert( idTable, nLine) -- se devo inserire una variazione nell'entità if sMVar then nNumLine = #idTable end end if bPrev then if bDrawFirst then local nCircle1 = EgtCircle( nGroupCirc, pInitial, nRad , nReference) EgtSetColor(nCircle1, cColor1) end if bDrawLast then local nCircle2 = EgtCircle( nGroupCirc, pFinal, nRad , nReference) EgtSetColor(nCircle2, cColor2) end end return nLine, nNumLine, sMVar end local function DrawAddCircleDrawCircle( pCenter, dRadius, dAngIni, dAngCen, nGroup, idTable, bPrev, nGroupCirc, nRad, bDrawFirst, bDrawLast, cColor1, cColor2, sMVar, sReference) local nReference = GDB_RT.LOC if sReference and sReference == 'grid' then nReference = GDB_RT.GRID end local nCircle = EgtArc( nGroup, pCenter, dRadius, dAngIni, dAngCen, 0, nReference) local nNumCircle if idTable then table.insert( idTable, nCircle) -- se devo inserire una variazione nell'entità if sMVar then nNumCircle = #idTable end end if bPrev then if bDrawFirst then local nCircle1 = EgtCircle( nGroupCirc, EgtSP( nCircle), nRad , nReference) EgtSetColor( nCircle1, cColor1) end if bDrawLast then local nCircle2 = EgtCircle( nGroupCirc, EgtEP( nCircle), nRad , nReference) EgtSetColor( nCircle2, cColor2) end end return nCircle, nNumCircle, sMVar end local function DrawRectangleWithFillet ( Lg, L, H, dThickD, rf) local tHint = {} local hint local pIni, pEnd, pCen -- Costruzione della geometria principale pIni = Point3d(((L/2)-rf),(H/2),dThickD) pCen = Point3d(((L/2)-rf),((H/2)-rf),dThickD) pEnd = Point3d((L/2),((H/2)-rf),dThickD) DrawAddCircleDrawCircle( pCen, rf, 90,-90, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED()) pIni = pEnd if abs(rf - (H/2)) > GEO.EPS_SMALL then -- se c'è stazio per una linea tra i due raccordi pEnd = Point3d((L/2),-(H/2)+rf,dThickD) DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED()) pIni = pEnd end pCen = Point3d(((L/2)-rf),(-(H/2)+rf),dThickD) pEnd = Point3d(((L/2)-rf),-(H/2),dThickD) DrawAddCircleDrawCircle( pCen, rf, 0,-90, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED()) pIni = pEnd if abs(rf - (L/2)) > GEO.EPS_SMALL then -- se c'è stazio per una linea tra i due raccordi pEnd = Point3d(-((L/2)-rf),-(H/2),dThickD) DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED()) pIni = pEnd end pCen = Point3d(-((L/2)-rf),(-(H/2)+rf),dThickD) pEnd = Point3d(-(L/2),(-(H/2)+rf),dThickD) DrawAddCircleDrawCircle( pCen, rf, -90,-90, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED()) pIni = pEnd if abs(rf - (H/2)) > GEO.EPS_SMALL then -- se c'è stazio per una linea tra i due raccordi pEnd = Point3d(-(L/2),((H/2)-rf),dThickD) DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED()) pIni = pEnd end pCen = Point3d(-((L/2)-rf),((H/2)-rf),dThickD) pEnd = Point3d(-((L/2)-rf),(H/2),dThickD) DrawAddCircleDrawCircle( pCen, rf, 180,-90, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED()) pIni = pEnd if abs(rf - (L/2)) > GEO.EPS_SMALL then -- se c'è stazio per una linea tra i due raccordi pEnd = Point3d(((L/2)-rf),(H/2),dThickD) DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED()) end -- trasformo in geometria composita i/il percorsi/o di contorno -- primo percorso if ( #tHint > 0) then hint = EgtCurveCompo( Lg, tHint, true) if hint then EgtInvertCurve( hint) end end return hint end local function MakeRectWithFillet( Lg, P1, P2, Rf, Ang, bBigLength, est) local hint_3 = EgtRectangle2P( Lg, P1, P2, GDB_RT.LOC) if hint_3 then -- with this way to makes rectangle, after explode the fisrt entity is the bottom one, -- the 2nd is the left one local nNewId, nNumEnt = EgtExplodeCurveCompo( hint_3) if nNewId and nNumEnt and nNumEnt > 0 then local pStartIni -- se devo inserire i raccordi if Rf > 0 then local tIdFil = {} local nLine for p = 1, (nNumEnt-1) do nLine = EgtCurveFillet( Lg, ( nNewId + p - 1), EgtEP( nNewId + p - 1), ( nNewId + p), EgtSP( nNewId + p), Rf, true) table.insert( tIdFil, nLine) end nLine = EgtCurveFillet( Lg, ( nNewId + nNumEnt - 1), EgtEP( nNewId + nNumEnt - 1), nNewId, EgtSP(nNewId), Rf, true) table.insert( tIdFil, nLine) if est then -- se materiale steel inizio sul lato più corto if bBigLength then -- se lunghezza maggiore (in X) di altezza (in Y) pStartIni = EgtMP( nNewId+1) else -- lunghezza (in X) minore o uguale a altezza (in Y) pStartIni = EgtMP( nNewId) end else -- altrimenti come fatto prima (sulla prima entità) pStartIni = EgtMP( nNewId) end -- creo curvecompo hint_3 = EgtCurveCompo( Lg, { nNewId, tIdFil[1], (nNewId+1), tIdFil[2], (nNewId+2), tIdFil[3], (nNewId+3), tIdFil[4]}, true) else if est then -- se materiale steel inizio sul lato più corto if bBigLength then -- se lunghezza maggiore (in X) di altezza (in Y) pStartIni = EgtMP( nNewId+1) else -- lunghezza (in X) minore o uguale a altezza (in Y) pStartIni = EgtMP( nNewId) end else -- altrimenti come fatto prima (sulla prima entità) pStartIni = EgtMP( nNewId) end -- creo curvecompo hint_3 = EgtCurveCompo( Lg, { nNewId, (nNewId+1), (nNewId+2), (nNewId+3)}, true) end if hint_3 then EgtChangeClosedCurveStartPoint( hint_3, pStartIni, GDB_RT.LOC) -- cambio punto di inizio if Ang ~= 0 then EgtRotate( hint_3, EgtGP( hint_3), Z_AX(), Ang, GDB_RT.LOC) -- ruoto end end end end return hint_3 end local function MakeAspOnStrikeRect( Lg, nHint, dX, dY, dThick, dDoorTh, dShiftX, dShiftY, bRefSide, dBack_set, dDiam, bOpposite, dZedPos, dDiam2, sSideLock, Fc) local nLine local ptIni, ptEnd, pInt1, pInt1, ptIni2, ptEnd2 local tPath = {} local nPath1, nPath2, nPath3, nPath4 local nInv = 1 if not dBack_set then dBack_set = 0 end -- creo la linea ptIni = Point3d( EgtIf( bRefSide, 0, -dBack_set), (dShiftY + max(dX, dY)), dZedPos) ptEnd = Point3d( EgtIf( bRefSide, 0, -dBack_set), (dShiftY - max(dX, dY)), dZedPos) nLine = DrawAddLineDrawCircle( ptIni, ptEnd, Lg, nil, false, nil, (dDiam/2), true, true, ORANGE(), ORANGE()) if nLine then -- verifico se ci sono intersezioni pInt1 = EgtIP( nLine, nHint, ptIni) pInt2 = EgtIP( nLine, nHint, ptEnd) -- se ci sono entrambe i punti e la loro distanza è maggiore del diametro fresa if pInt1 and pInt2 then local dDist = dist( pInt1, pInt2) if dDist>= dDiam then -- se larghezza maggiore dell'utensile -- imposto la griglia if bOpposite then EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.RIGHT)) nInv = 1 else EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.LEFT)) nInv = -1 end ptIni = Point3d( (pInt1:getY() - (dDiam/2) + dExtraH)*nInv, pInt1:getZ() + (dDiam*3/4), -pInt1:getX()) if dDiam2 then ptIni2 = Point3d( (pInt1:getY() - (dDiam2/2) + dExtraH)*nInv, pInt1:getZ() + (dDiam2*3/4), -pInt1:getX()) end if dDoorTh - dThick > GEO.EPS_SMALL then -- se spessore non passante -- creo percorso con 3 linee ptEnd = Point3d( ptIni:getX(), pInt1:getZ() - dThick + (dDiam/2) - dExtraH, ptIni:getZ()) DrawAddLineDrawCircle( ptIni, ptEnd, Lg, tPath, false, nil, (dDiam/2), true, true, ORANGE(), ORANGE(), nil, 'grid') ptIni = ptEnd ptEnd = Point3d( (pInt2:getY() + (dDiam/2) - dExtraH)*nInv, ptIni:getY(), -pInt2:getX()) DrawAddLineDrawCircle( ptIni, ptEnd, Lg, tPath, false, nil, (dDiam/2), true, true, ORANGE(), ORANGE(), nil, 'grid') ptIni = ptEnd ptEnd = Point3d( ptIni:getX(), pInt2:getZ() + (dDiam*3/4), ptIni:getZ()) DrawAddLineDrawCircle( ptIni, ptEnd, Lg, tPath, false, nil, (dDiam/2), true, true, ORANGE(), ORANGE(), nil, 'grid') -- se il percorso esiste if tPath then nPath2 = EgtCurveCompo( Lg, tPath, true) end if dDiam2 then -- creo il secondo percorso con 3 linee tPath = {} ptEnd2 = Point3d( ptIni2:getX(), pInt1:getZ() - dThick + (dDiam2/2) - dExtraH, ptIni2:getZ()) DrawAddLineDrawCircle( ptIni2, ptEnd2, Lg, tPath, false, nil, (dDiam2/2), true, true, ORANGE(), ORANGE(), nil, 'grid') ptIni2 = ptEnd2 ptEnd2 = Point3d( (pInt2:getY() + (dDiam2/2) - dExtraH)*nInv, ptIni2:getY(), -pInt2:getX()) DrawAddLineDrawCircle( ptIni2, ptEnd2, Lg, tPath, false, nil, (dDiam2/2), true, true, ORANGE(), ORANGE(), nil, 'grid') ptIni2 = ptEnd2 ptEnd2 = Point3d( ptIni2:getX(), pInt2:getZ() + (dDiam2*3/4), ptIni2:getZ()) DrawAddLineDrawCircle( ptIni2, ptEnd2, Lg, tPath, false, nil, (dDiam2/2), true, true, ORANGE(), ORANGE(), nil, 'grid') -- se il percorso esiste if tPath then nPath4 = EgtCurveCompo( Lg, tPath, true) end end else -- se spessore passante if (dDist - dDiam) < 2*dDiam then -- se larghezza minore del doppio diametro utensile -- creo percorso con 3 linee ptEnd = Point3d( ptIni:getX(), pInt1:getZ() - dThick - (dDiam*3/4), ptIni:getZ()) DrawAddLineDrawCircle( ptIni, ptEnd, Lg, tPath, false, nil, (dDiam/2), true, true, ORANGE(), ORANGE(), nil, 'grid') ptIni = ptEnd ptEnd = Point3d( (pInt2:getY() + (dDiam/2) - dExtraH)*nInv, ptIni:getY(), -pInt2:getX()) DrawAddLineDrawCircle( ptIni, ptEnd, Lg, tPath, false, nil, (dDiam/2), true, true, ORANGE(), ORANGE(), nil, 'grid') ptIni = ptEnd ptEnd = Point3d( ptIni:getX(), pInt2:getZ() + (dDiam*3/4), ptIni:getZ()) DrawAddLineDrawCircle( ptIni, ptEnd, Lg, tPath, false, nil, (dDiam/2), true, true, ORANGE(), ORANGE(), nil, 'grid') -- se il percorso esiste if tPath then nPath2 = EgtCurveCompo( Lg, tPath, true) end if dDiam2 then -- creo il secondo percorso con 3 linee tPath = {} ptEnd2 = Point3d( ptIni2:getX(), pInt1:getZ() - dThick - (dDiam2*3/4), ptIni2:getZ()) DrawAddLineDrawCircle( ptIni2, ptEnd2, Lg, tPath, false, nil, (dDiam2/2), true, true, ORANGE(), ORANGE(), nil, 'grid') ptIni2 = ptEnd2 ptEnd2 = Point3d( (pInt2:getY() + (dDiam2/2) - dExtraH)*nInv, ptIni2:getY(), -pInt2:getX()) DrawAddLineDrawCircle( ptIni2, ptEnd2, Lg, tPath, false, nil, (dDiam2/2), true, true, ORANGE(), ORANGE(), nil, 'grid') ptIni2 = ptEnd2 ptEnd2 = Point3d( ptIni2:getX(), pInt2:getZ() + (dDiam2*3/4), ptIni2:getZ()) DrawAddLineDrawCircle( ptIni2, ptEnd2, Lg, tPath, false, nil, (dDiam2/2), true, true, ORANGE(), ORANGE(), nil, 'grid') -- se il percorso esiste if tPath then nPath4 = EgtCurveCompo( Lg, tPath, true) end end else -- larghezza maggiore del doppio diametro, creo due linee distinte -- creo 2 persorsi composti da una linea ciascuno ptEnd = Point3d( ptIni:getX(), pInt1:getZ() - dThick - (dDiam*3/4), ptIni:getZ()) nPath1 = DrawAddLineDrawCircle( ptIni, ptEnd, Lg, nil, false, nil, (dDiam/2), true, true, ORANGE(), ORANGE(), nil, 'grid') ptIni = Point3d( (pInt2:getY() + (dDiam/2) - dExtraH)*nInv, ptEnd:getY(), -pInt2:getX()) ptEnd = Point3d( ptIni:getX(), pInt2:getZ() + (dDiam*3/4), ptIni:getZ()) nPath2 = DrawAddLineDrawCircle( ptIni, ptEnd, Lg, nil, false, nil, (dDiam/2), true, true, ORANGE(), ORANGE(), nil, 'grid') if dDiam2 then -- creo 2 persorsi composti da una linea ciascuno ptEnd2 = Point3d( ptIni2:getX(), pInt1:getZ() - dThick - (dDiam2*3/4), ptIni2:getZ()) nPath3 = DrawAddLineDrawCircle( ptIni2, ptEnd2, Lg, nil, false, nil, (dDiam2/2), true, true, ORANGE(), ORANGE(), nil, 'grid') ptIni2 = Point3d( (pInt2:getY() + (dDiam2/2) - dExtraH)*nInv, ptEnd2:getY(), -pInt2:getX()) ptEnd2 = Point3d( ptIni2:getX(), pInt2:getZ() + (dDiam2*3/4), ptIni2:getZ()) nPath4 = DrawAddLineDrawCircle( ptIni2, ptEnd2, Lg, nil, false, nil, (dDiam2/2), true, true, ORANGE(), ORANGE(), nil, 'grid') end end end end --debug -- EgtSaveFile( sNgeFile) -- EgtMove(DGD.PZ, Point3d(0,0,nil) - ORIG()) -- se esistono gli eventuali percorso setto spessore 0 if nPath1 then EgtModifyCurveThickness(nPath1, 0) if sSideLock == 'L' then -- inverto il percorso EgtInvertCurve(nPath1) end if string.lower(Fc) == 'keyway' then -- inverto il percorso EgtInvertCurve(nPath1) end end if nPath2 then EgtModifyCurveThickness(nPath2, 0) if sSideLock == 'L' then -- inverto il percorso EgtInvertCurve(nPath2) end if string.lower(Fc) == 'keyway' then -- inverto il percorso EgtInvertCurve(nPath2) end end if nPath3 then EgtModifyCurveThickness(nPath3, 0) if sSideLock == 'R' then -- inverto il percorso EgtInvertCurve(nPath3) end if string.lower(Fc) == 'keyway' then -- inverto il percorso EgtInvertCurve(nPath3) end end if nPath4 then EgtModifyCurveThickness(nPath4, 0) if sSideLock == 'R' then -- inverto il percorso EgtInvertCurve(nPath4) end if string.lower(Fc) == 'keyway' then -- inverto il percorso EgtInvertCurve(nPath4) end end -- re-imposto la griglia da sopra EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) end -- elimino la linea EgtErase(nLine) end return nPath1, nPath2, nPath3, nPath4 end local function GetMachToolErrorMessage( nErrorId, sGeomName, dIdMach, dOriDiamTool, nIdLogErr, sMchngName) local EgtDoorsMsg = require( 'EgtDoorsMsg') local sMessage = '' if dOriDiamTool then if nErrorId == -1 then -- lavorazione non presente in tabella sMessage = string.format(EgtDoorsMsg[466], nIdLogErr, dIdMach, sGeomName, EgtToUiUnits( dOriDiamTool)) elseif nErrorId == -2 then -- errore nel settare la lavorazione, lavorazione non presente in libreria sMessage = string.format(EgtDoorsMsg[467], nIdLogErr, sMchngName, dIdMach, sGeomName, EgtToUiUnits( dOriDiamTool)) elseif nErrorId == -3 then -- errore nell'acquisire parametri lavorazione sMessage = string.format(EgtDoorsMsg[468], nIdLogErr, sMchngName, dIdMach, sGeomName, EgtToUiUnits( dOriDiamTool)) elseif nErrorId == -4 then -- errore nell'acquisire parametri lavorazione sMessage = string.format(EgtDoorsMsg[469], nIdLogErr, sMchngName, dIdMach, sGeomName, EgtToUiUnits( dOriDiamTool)) elseif nErrorId == -5 then -- diametro utensile non trovato sMessage = string.format(EgtDoorsMsg[470], nIdLogErr, sMchngName, dIdMach, sGeomName, EgtToUiUnits( dOriDiamTool)) elseif nErrorId == -6 then -- nome geometria non presente in tabella sMessage = string.format(EgtDoorsMsg[471], nIdLogErr, sGeomName, EgtToUiUnits( dOriDiamTool)) elseif nErrorId == -7 then -- altezza massima utensile non trovata sMessage = string.format(EgtDoorsMsg[472], nIdLogErr, sMchngName, dIdMach, sGeomName, EgtToUiUnits( dOriDiamTool)) elseif nErrorId == -8 then -- tabella non presente nelle note sMessage = string.format(EgtDoorsMsg[509], nIdLogErr) end elseif nErrorId == -1 then -- lavorazione non presente in tabella sMessage = string.format(EgtDoorsMsg[504], nIdLogErr, dIdMach, sGeomName) elseif nErrorId == -2 then -- errore nel settare la lavorazione sMessage = string.format(EgtDoorsMsg[505], nIdLogErr, sMchngName, dIdMach, sGeomName) elseif nErrorId == -3 then -- errore nell'acquisire parametri lavorazione sMessage = string.format(EgtDoorsMsg[506], nIdLogErr, sMchngName, dIdMach, sGeomName) elseif nErrorId == -4 then -- errore nell'acquisire parametri lavorazione sMessage = string.format(EgtDoorsMsg[507], nIdLogErr, sMchngName, dIdMach, sGeomName) elseif nErrorId == -5 then -- diametro utensile non trovato sMessage = string.format(EgtDoorsMsg[508], nIdLogErr, sMchngName, dIdMach, sGeomName) elseif nErrorId == -6 then -- nome geometria non presente in tabella sMessage = string.format(EgtDoorsMsg[503], nIdLogErr, sGeomName) elseif nErrorId == -7 then -- altezza massima utensile non trovata sMessage = string.format(EgtDoorsMsg[473], nIdLogErr, sMchngName, dIdMach, sGeomName) elseif nErrorId == -8 then -- tabella non presente nelle note sMessage = string.format(EgtDoorsMsg[509], nIdLogErr) end return sMessage end -- Funzione di sistemazione parametri function FlushPull.AdjustParams( tMhPar) -- per antisplint su extra-rettangolo local dMaxMat0 local dMaxMat8 local dMaxMat9 local nTempT0 local nTempT8 local nTempT9 local sMchngName0 local sMchngName8 local sMchngName9 local dNumMessage local dNumLog = 0 local sMessToOut = '' -- se non ho il parametro chiseling lo setto disabilitato if not tMhPar.ech then tMhPar.ech = false end -- se chisel abilitato ma non c'è la variabile suffisso if tMhPar.ech and not tMhPar.CH then tMhPar.CH = '_Chisel' end -- se porta steel o aluminum if FindMaterial( DGD.Material, 'steel') or FindMaterial( DGD.Material, 'aluminum') then tMhPar.ech = false tMhPar.CH = nil tMhPar.est = true tMhPar.ASG = 0 tMhPar.EAR = nil tMhPar.das = nil else tMhPar.est = nil end -- setto parametri da ddf if DGD.DEPTH then tMhPar.T = EgtIf( DGD.DEPTH > DGD.dT, DGD.dT, DGD.DEPTH) end if DGD.FACE then tMhPar.Fc = DGD.FACE else if DGD.Push then -- se porta a spingere la geometria va dietro tMhPar.Fc = 'secure' else -- altrimenti tMhPar.Fc = 'keyway' end end if not tMhPar.rf then tMhPar.rf = 0 end if tMhPar.T == -0.5 then tMhPar.T = DGD.dT / 2 elseif tMhPar.T == -1 then tMhPar.T = DGD.dT end -- se ho il raggio valido disabilito il chiseling e il clean corner if tMhPar.rf and tMhPar.rf > 0 then tMhPar.ech = false tMhPar.clc = nil tMhPar.CL = nil else -- se non è definito o già nullo lo azzero tMhPar.rf = 0 end -- passo lo spessore porta tMhPar.DT = DGD.dT -- Assegno parametri da dati utensili in macchina local MB = require( 'MachiningBase') local sLG local nLGi = 1 local sASG -- anti-splint on extra rectangle local nASGi = 1 local sASGR -- anti-splint on antisplint local nASGRi = 1 -- disabilito perché nel flushpull non è gestito il diametro utensile .d perché non viene creato nessun percorso di lavorazione -- if tMhPar.est and tMhPar.LG then -- sLG = tMhPar.LG -- if DGD.MachEn > 0 and tMhPar.d then nTempT0, dMaxMat0, sMchngName0 = MB.GetToolDataFromAttrib( sLG, nLGi) end -- end if tMhPar.ech and tMhPar.LG then -- se chisel abilitato sLG = tMhPar.LG .. tMhPar.CH tMhPar.d0 = 0 if DGD.MachEn > 0 and tMhPar.d0 then nTempT0, dMaxMat0, sMchngName0 = MB.GetToolDataFromAttrib( sLG, nLGi) end end -- extra bores if tMhPar.T10 then if tMhPar.RTB10 and DGD.DEPTH then tMhPar.T10 = EgtIf( DGD.DEPTH > DGD.dT, DGD.dT, DGD.DEPTH) end if tMhPar.T10 == -0.5 then tMhPar.T10 = DGD.dT / 2 elseif tMhPar.T10 == -1 or tMhPar.T10 > DGD.dT then tMhPar.T10 = DGD.dT end end if tMhPar.T11 then if tMhPar.RTB11 and DGD.DEPTH then tMhPar.T11 = EgtIf( DGD.DEPTH > DGD.dT, DGD.dT, DGD.DEPTH) end if tMhPar.T11 == -0.5 then tMhPar.T11 = DGD.dT / 2 elseif tMhPar.T11 == -1 or tMhPar.T11 > DGD.dT then tMhPar.T11 = DGD.dT end end if tMhPar.T12 then if tMhPar.RTB12 and DGD.DEPTH then tMhPar.T12 = EgtIf( DGD.DEPTH > DGD.dT, DGD.dT, DGD.DEPTH) end if tMhPar.T12 == -0.5 then tMhPar.T12 = DGD.dT / 2 elseif tMhPar.T12 == -1 or tMhPar.T12 > DGD.dT then tMhPar.T12 = DGD.dT end end if tMhPar.T13 then if tMhPar.RTB13 and DGD.DEPTH then tMhPar.T13 = EgtIf( DGD.DEPTH > DGD.dT, DGD.dT, DGD.DEPTH) end if tMhPar.T13 == -0.5 then tMhPar.T13 = DGD.dT / 2 elseif tMhPar.T13 == -1 or tMhPar.T13 > DGD.dT then tMhPar.T13 = DGD.dT end end if tMhPar.T14 then if tMhPar.RTB14 and DGD.DEPTH then tMhPar.T14 = EgtIf( DGD.DEPTH > DGD.dT, DGD.dT, DGD.DEPTH) end if tMhPar.T14 == -0.5 then tMhPar.T14 = DGD.dT / 2 elseif tMhPar.T14 == -1 or tMhPar.T14 > DGD.dT then tMhPar.T14 = DGD.dT end end if tMhPar.T15 then if tMhPar.RTB15 and DGD.DEPTH then tMhPar.T15 = EgtIf( DGD.DEPTH > DGD.dT, DGD.dT, DGD.DEPTH) end if tMhPar.T15 == -0.5 then tMhPar.T15 = DGD.dT / 2 elseif tMhPar.T15 == -1 or tMhPar.T15 > DGD.dT then tMhPar.T15 = DGD.dT end end if tMhPar.T16 then if tMhPar.RTB16 and DGD.DEPTH then tMhPar.T16 = EgtIf( DGD.DEPTH > DGD.dT, DGD.dT, DGD.DEPTH) end if tMhPar.T16 == -0.5 then tMhPar.T16 = DGD.dT / 2 elseif tMhPar.T16 == -1 or tMhPar.T16 > DGD.dT then tMhPar.T16 = DGD.dT end end if tMhPar.T17 then if tMhPar.RTB17 and DGD.DEPTH then tMhPar.T17 = EgtIf( DGD.DEPTH > DGD.dT, DGD.dT, DGD.DEPTH) end if tMhPar.T17 == -0.5 then tMhPar.T17 = DGD.dT / 2 elseif tMhPar.T17 == -1 or tMhPar.T17 > DGD.dT then tMhPar.T17 = DGD.dT end end if tMhPar.T18 then if tMhPar.RTB18 and DGD.DEPTH then tMhPar.T18 = EgtIf( DGD.DEPTH > DGD.dT, DGD.dT, DGD.DEPTH) end if tMhPar.T18 == -0.5 then tMhPar.T18 = DGD.dT / 2 elseif tMhPar.T18 == -1 or tMhPar.T18 > DGD.dT then tMhPar.T18 = DGD.dT end end if tMhPar.T19 then if tMhPar.RTB19 and DGD.DEPTH then tMhPar.T19 = EgtIf( DGD.DEPTH > DGD.dT, DGD.dT, DGD.DEPTH) end if tMhPar.T19 == -0.5 then tMhPar.T19 = DGD.dT / 2 elseif tMhPar.T19 == -1 or tMhPar.T19 > DGD.dT then tMhPar.T19 = DGD.dT end end -- extra rectangles if tMhPar.TR10 then if tMhPar.RTR10 and DGD.DEPTH then tMhPar.TR10 = EgtIf( DGD.DEPTH > DGD.dT, DGD.dT, DGD.DEPTH) end if tMhPar.TR10 == -0.5 then tMhPar.TR10 = DGD.dT / 2 elseif tMhPar.TR10 == -1 or tMhPar.TR10 > DGD.dT then tMhPar.TR10 = DGD.dT end end if tMhPar.TR11 then if tMhPar.RTR11 and DGD.DEPTH then tMhPar.TR11 = EgtIf( DGD.DEPTH > DGD.dT, DGD.dT, DGD.DEPTH) end if tMhPar.TR11 == -0.5 then tMhPar.TR11 = DGD.dT / 2 elseif tMhPar.TR11 == -1 or tMhPar.TR11 > DGD.dT then tMhPar.TR11 = DGD.dT end end if tMhPar.TR12 then if tMhPar.RTR12 and DGD.DEPTH then tMhPar.TR12 = EgtIf( DGD.DEPTH > DGD.dT, DGD.dT, DGD.DEPTH) end if tMhPar.TR12 == -0.5 then tMhPar.TR12 = DGD.dT / 2 elseif tMhPar.TR12 == -1 or tMhPar.TR12 > DGD.dT then tMhPar.TR12 = DGD.dT end end if tMhPar.TR13 then if tMhPar.RTR13 and DGD.DEPTH then tMhPar.TR13 = EgtIf( DGD.DEPTH > DGD.dT, DGD.dT, DGD.DEPTH) end if tMhPar.TR13 == -0.5 then tMhPar.TR13 = DGD.dT / 2 elseif tMhPar.TR13 == -1 or tMhPar.TR13 > DGD.dT then tMhPar.TR13 = DGD.dT end end if tMhPar.TR14 then if tMhPar.RTR14 and DGD.DEPTH then tMhPar.TR14 = EgtIf( DGD.DEPTH > DGD.dT, DGD.dT, DGD.DEPTH) end if tMhPar.TR14 == -0.5 then tMhPar.TR14 = DGD.dT / 2 elseif tMhPar.TR14 == -1 or tMhPar.TR14 > DGD.dT then tMhPar.TR14 = DGD.dT end end -- Anti-splint su rettangoli if DGD.MachEn > 0 and tMhPar.ASG and tMhPar.EAR and ( ( tMhPar.TR10 and tMhPar.TR10 > GEO.EPS_SMALL) or ( tMhPar.TR11 and tMhPar.TR11 > GEO.EPS_SMALL) or ( tMhPar.TR12 and tMhPar.TR12 > GEO.EPS_SMALL) or ( tMhPar.TR13 and tMhPar.TR13 > GEO.EPS_SMALL) or ( tMhPar.TR14 and tMhPar.TR14 > GEO.EPS_SMALL)) then sASG = tMhPar.ASG nTempT8, dMaxMat8, sMchngName8 = MB.GetToolDataFromAttrib( sASG, nASGi) tMhPar.SL = DGD.Lock end -- Anti-splint su Anti-splint if DGD.MachEn > 0 and tMhPar.EAR and tMhPar.EAR == 2 and sASG then sASGR = tMhPar.ASG..'_R' tMhPar.ASGR = sASGR tMhPar.das2 = tMhPar.das nTempT9, dMaxMat9, sMchngName9 = MB.GetToolDataFromAttrib( sASGR, nASGRi) end -- extra lines if tMhPar.TL10 then if tMhPar.RTL10 and DGD.DEPTH then tMhPar.TL10 = EgtIf( DGD.DEPTH > DGD.dT, DGD.dT, DGD.DEPTH) end if tMhPar.TL10 == -0.5 then tMhPar.TL10 = DGD.dT / 2 elseif tMhPar.TL10 == -1 or tMhPar.TL10 > DGD.dT then tMhPar.TL10 = DGD.dT end end if tMhPar.TL11 then if tMhPar.RTL11 and DGD.DEPTH then tMhPar.TL11 = EgtIf( DGD.DEPTH > DGD.dT, DGD.dT, DGD.DEPTH) end if tMhPar.TL11 == -0.5 then tMhPar.TL11 = DGD.dT / 2 elseif tMhPar.TL11 == -1 or tMhPar.TL11 > DGD.dT then tMhPar.TL11 = DGD.dT end end if tMhPar.TL12 then if tMhPar.RTL12 and DGD.DEPTH then tMhPar.TL12 = EgtIf( DGD.DEPTH > DGD.dT, DGD.dT, DGD.DEPTH) end if tMhPar.TL12 == -0.5 then tMhPar.TL12 = DGD.dT / 2 elseif tMhPar.TL12 == -1 or tMhPar.TL12 > DGD.dT then tMhPar.TL12 = DGD.dT end end if tMhPar.TL13 then if tMhPar.RTL13 and DGD.DEPTH then tMhPar.TL13 = EgtIf( DGD.DEPTH > DGD.dT, DGD.dT, DGD.DEPTH) end if tMhPar.TL13 == -0.5 then tMhPar.TL13 = DGD.dT / 2 elseif tMhPar.TL13 == -1 or tMhPar.TL13 > DGD.dT then tMhPar.TL13 = DGD.dT end end if tMhPar.TL14 then if tMhPar.RTL14 and DGD.DEPTH then tMhPar.TL14 = EgtIf( DGD.DEPTH > DGD.dT, DGD.dT, DGD.DEPTH) end if tMhPar.TL14 == -0.5 then tMhPar.TL14 = DGD.dT / 2 elseif tMhPar.TL14 == -1 or tMhPar.TL14 > DGD.dT then tMhPar.TL14 = DGD.dT end end -- se devo disegnare le geometrie di lavorazione if DGD.MachEn > 0 then -- Raggio: se raggio presente e altro materiale e se raggio minore del diametro utensile + delta, lo annullo -- if tMhPar.rf and tMhPar.est and ( tMhPar.d and tMhPar.rf < ((tMhPar.d/2)+0.02)) then -- tMhPar.rf = 0 -- end -- gestisco il risultato della lettura utensili per antischeggia su extra rettangoli if DGD.bProoduce and not tMhPar.est and tMhPar.das and nTempT8 and nTempT8 <= 0 then dNumLog = -1594 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT8, sASG, nASGi, tMhPar.das, dNumLog, sMchngName8) elseif not tMhPar.est and nTempT8 then tMhPar.das = nTempT8 end -- gestisco il risultato della lettura utensili per antischeggia su antischeggia if DGD.bProoduce and not tMhPar.est and tMhPar.das2 and nTempT9 and nTempT9 <= 0 then dNumLog = -1594 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT9, sASGR, nASGRi, tMhPar.das2, dNumLog, sMchngName9) elseif not tMhPar.est and nTempT9 then tMhPar.das2 = nTempT9 end if tMhPar.CL and tMhPar.clc and tMhPar.clc > 0 and ( tMhPar.clc >= tMhPar.W or tMhPar.clc >= tMhPar.L) then tMhPar.clc = nil elseif not tMhPar.CL then tMhPar.clc = nil end end if dNumLog ~= 0 then return tMhPar, dNumLog, sMessToOut end return tMhPar, 0, '' end -- Funzione di disegno function FlushPull.Draw( tFlushPPar, bPreview, bRunByCompo, nDrawMach, dThickD) -- Assegno le dimensioni local L = tFlushPPar.L local W = tFlushPPar.W local T = tFlushPPar.T local R = tFlushPPar.R local rf = tFlushPPar.rf local clc = tFlushPPar.clc local ccr = tFlushPPar.ccr local ech = tFlushPPar.ech local est = tFlushPPar.est local kbs = tFlushPPar.kbs -- keep backset/thickness (0: none, 1: only face, 2: all) local pbs = tFlushPPar.pbs local DT = tFlushPPar.DT local SL = tFlushPPar.SL local Fc = tFlushPPar.Fc -- Assegno i nomi local LG = tFlushPPar.LG local LM = tFlushPPar.LM local CH = tFlushPPar.CH -- suffisso lavorazione chisel local CL = tFlushPPar.CL -- Anti-splint su extra rectangle geometry local EAR = tFlushPPar.EAR local das = tFlushPPar.das local ASG = tFlushPPar.ASG -- Second anti-splint on extra rectangle geometry local das2 = tFlushPPar.das2 local ASGR = tFlushPPar.ASGR -- tabelle per i fori, rettangoli e linee opzionali local tExtraBore = {} local tExtraRect = {} local tExtraLine = {} -- inserimento dati nella tabella fori table.insert( tExtraBore, { tFlushPPar.D10, tFlushPPar.T10, tFlushPPar.PX10, tFlushPPar.PY10, tFlushPPar.EB10, tFlushPPar.RBS10}) table.insert( tExtraBore, { tFlushPPar.D11, tFlushPPar.T11, tFlushPPar.PX11, tFlushPPar.PY11, tFlushPPar.EB11, tFlushPPar.RBS11}) table.insert( tExtraBore, { tFlushPPar.D12, tFlushPPar.T12, tFlushPPar.PX12, tFlushPPar.PY12, tFlushPPar.EB12, tFlushPPar.RBS12}) table.insert( tExtraBore, { tFlushPPar.D13, tFlushPPar.T13, tFlushPPar.PX13, tFlushPPar.PY13, tFlushPPar.EB13, tFlushPPar.RBS13}) table.insert( tExtraBore, { tFlushPPar.D14, tFlushPPar.T14, tFlushPPar.PX14, tFlushPPar.PY14, tFlushPPar.EB14, tFlushPPar.RBS14}) table.insert( tExtraBore, { tFlushPPar.D15, tFlushPPar.T15, tFlushPPar.PX15, tFlushPPar.PY15, tFlushPPar.EB15, tFlushPPar.RBS15}) table.insert( tExtraBore, { tFlushPPar.D16, tFlushPPar.T16, tFlushPPar.PX16, tFlushPPar.PY16, tFlushPPar.EB16, tFlushPPar.RBS16}) table.insert( tExtraBore, { tFlushPPar.D17, tFlushPPar.T17, tFlushPPar.PX17, tFlushPPar.PY17, tFlushPPar.EB17, tFlushPPar.RBS17}) table.insert( tExtraBore, { tFlushPPar.D18, tFlushPPar.T18, tFlushPPar.PX18, tFlushPPar.PY18, tFlushPPar.EB18, tFlushPPar.RBS18}) table.insert( tExtraBore, { tFlushPPar.D19, tFlushPPar.T19, tFlushPPar.PX19, tFlushPPar.PY19, tFlushPPar.EB19, tFlushPPar.RBS19}) -- inserimento dati nella tabella rettangoli; sono invertite lunghezza e larghezza perché nel flush_pull sono interpretate al contrario table.insert( tExtraRect, { tFlushPPar.WR10, tFlushPPar.LR10, tFlushPPar.RR10, tFlushPPar.CH10, tFlushPPar.TR10, tFlushPPar.PRX10, tFlushPPar.PRY10, tFlushPPar.AR10, tFlushPPar.ER10, tFlushPPar.RRS10}) table.insert( tExtraRect, { tFlushPPar.WR11, tFlushPPar.LR11, tFlushPPar.RR11, tFlushPPar.CH11, tFlushPPar.TR11, tFlushPPar.PRX11, tFlushPPar.PRY11, tFlushPPar.AR11, tFlushPPar.ER11, tFlushPPar.RRS11}) table.insert( tExtraRect, { tFlushPPar.WR12, tFlushPPar.LR12, tFlushPPar.RR12, tFlushPPar.CH12, tFlushPPar.TR12, tFlushPPar.PRX12, tFlushPPar.PRY12, tFlushPPar.AR12, tFlushPPar.ER12, tFlushPPar.RRS12}) table.insert( tExtraRect, { tFlushPPar.WR13, tFlushPPar.LR13, tFlushPPar.RR13, tFlushPPar.CH13, tFlushPPar.TR13, tFlushPPar.PRX13, tFlushPPar.PRY13, tFlushPPar.AR13, tFlushPPar.ER13, tFlushPPar.RRS13}) table.insert( tExtraRect, { tFlushPPar.WR14, tFlushPPar.LR14, tFlushPPar.RR14, tFlushPPar.CH14, tFlushPPar.TR14, tFlushPPar.PRX14, tFlushPPar.PRY14, tFlushPPar.AR14, tFlushPPar.ER14, tFlushPPar.RRS14}) -- inserimento dati nella tabella linee table.insert( tExtraLine, { tFlushPPar.LL10, tFlushPPar.TL10, tFlushPPar.PLX10, tFlushPPar.PLY10, tFlushPPar.AL10, tFlushPPar.EL10, tFlushPPar.RLS10}) table.insert( tExtraLine, { tFlushPPar.LL11, tFlushPPar.TL11, tFlushPPar.PLX11, tFlushPPar.PLY11, tFlushPPar.AL11, tFlushPPar.EL11, tFlushPPar.RLS11}) table.insert( tExtraLine, { tFlushPPar.LL12, tFlushPPar.TL12, tFlushPPar.PLX12, tFlushPPar.PLY12, tFlushPPar.AL12, tFlushPPar.EL12, tFlushPPar.RLS12}) table.insert( tExtraLine, { tFlushPPar.LL13, tFlushPPar.TL13, tFlushPPar.PLX13, tFlushPPar.PLY13, tFlushPPar.AL13, tFlushPPar.EL13, tFlushPPar.RLS13}) table.insert( tExtraLine, { tFlushPPar.LL14, tFlushPPar.TL14, tFlushPPar.PLX14, tFlushPPar.PLY14, tFlushPPar.AL14, tFlushPPar.EL14, tFlushPPar.RLS14}) -- variabili per messaggi e settaggi vari local sCompoName = tFlushPPar.Nome local nCompoNpar = tFlushPPar.Npar local sCompoPath = tFlushPPar.Path -- eventuale messaggio errore rilevato nell'adjust local nCodAdj = tFlushPPar.nCod local sCodAdj = tFlushPPar.sCod -- variabili per messaggi di errore local sNamePar1 = tFlushPPar.N1 or 'L' local sNamePar2 = tFlushPPar.N2 or 'W' local sNamePar3 = tFlushPPar.N3 or 'T' local sNamePar4 = tFlushPPar.N4 or 'Radius' local sNamePar5 = tFlushPPar.N5 or 'rf' local sNamePar6 = tFlushPPar.N6 or 'clc' local sNamePar7 = tFlushPPar.N7 or 'ccr' -- RunByComponentInterface local RC = true -- Messaggi codice errori local EM = ' ' local EC = 0 local ErrorBase = 1500 if not bRunByCompo then -- controllo se lanciato da componente RC = false end -- 0 solo geom esterna, 1 solo geom mach, 2 entrambe if not nDrawMach then -- se non definita la setto per non creare geometria di lavorazione nDrawMach = 0 end local nForceMakeFace = nDrawMach -- se le dimensioni del raccordo sono eccessive le riconduco a valori accettabili if L and W and rf then if 2*rf > min(L,W) then rf = min(L,W)/2 end end -- se ho abilitato il chiseling modifico il nome geometria if ech then LG = LG .. CH -- se ho abilitato solo le geometrie di lavorazione, abilito la generazione di entrambe per il contorno chisel if nDrawMach == 1 then nForceMakeFace = 2 end end if not ASGR then das2 = nil end local EgtDoorsMsg = require( 'EgtDoorsMsg') -- Verifica delle dimensioni, le condizioni vengono verificate in base a quale geometria deve essere creata if L and L < DimMin then EC = 1 EM = string.format(EgtDoorsMsg[407],sNamePar1,EgtToUiUnits(L),'',EgtToUiUnits(DimMin), sCompoPath) -- il parametro 'L' deve essere > DimMin L = DimMin elseif W and W < DimMin then EC = 2 EM = string.format(EgtDoorsMsg[407],sNamePar2,EgtToUiUnits(W),'',EgtToUiUnits(DimMin), sCompoPath) -- il parametro 'H' deve essere > DimMin W = DimMin elseif R and R < DimMin then EC = 3 EM = string.format(EgtDoorsMsg[407],sNamePar4,EgtToUiUnits(R),'',EgtToUiUnits(DimMin), sCompoPath) -- il parametro 'D' deve essere > DimMin R = DimMin elseif CL and clc and ccr and clc > 0 and ccr > 0 and (2*(ccr*sin(45))) >= clc then EC = 4 EM = string.format(EgtDoorsMsg[407],sNamePar6,EgtToUiUnits(clc),'',EgtToUiUnits(2*(ccr*sin(45))), sCompoPath) -- il parametro 'clc' deve essere > 'crc' clc = (2*(ccr*sin(45)))+0.2 end if not bPreview and EC ~= 0 then return (ErrorBase+EC), EM end -- Se Preview cancello tutto if bPreview then EgtNewFile() EgtSetDefaultMaterial( BLACK()) end -- Pezzo e Layer local Pz if bPreview then Pz = EgtGroup(GDB_ID.ROOT,GDB_RT.LOC) -- nuovo pezzo else if not RC then Pz = EgtGetCurrPart() -- pezzo corrente end if not Pz then Pz = EgtGroup(GDB_ID.ROOT,GDB_RT.LOC) -- nuovo pezzo end end local Lg Lg = EgtGroup(Pz,GDB_RT.LOC) -- layer della figura principale EgtSetName(Lg,sCompoName) local GId, MId local bSingleMode = true if nForceMakeFace ~= 1 then -- se abilitata geometria esterna -- Costruzione della geometria if L and W then if rf > 0 then GId = DrawRectangleWithFillet ( Lg, W, L, dThickD, rf) else GId = EgtRectangle2P( Lg, Point3d( -(W/2), -(L/2), dThickD), Point3d( (W/2), (L/2), dThickD), GDB_RT.GLOB) -- se ci sono i parametri per i percorsi cleancorner if CL and clc and clc > 0 and clc < W and clc < L then -- angolo x-y+ local CLC1 = MakeClcPath( clc, ccr, CL, Lg, -T) EgtMove( CLC1, Point3d(-(W/2),(L/2),dThickD) - ORIG()) -- se mantiene profondità e non è a spessore passante if kbs and kbs > 0 and T < DT then EgtSetInfo( CLC1, 'KeepBackSet', 'x') -- setto 'x' perché non si sa ancora da quale parte viene applicato end if pbs and pbs > 0 and T < DT and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( CLC1, 'ProbeSide', '1') end -- angolo x+y+ CLC2 = EgtCopyGlob( CLC1, Lg) EgtMove( CLC2, Point3d((W/2),-(L/2),0) - ORIG()) EgtRotate( CLC2, Point3d(0,0,0), Z_AX(), -90) EgtMove( CLC2, Point3d((W/2),(L/2),0) - ORIG()) -- angolo x+y- CLC3 = EgtCopyGlob( CLC1, Lg) EgtMove( CLC3, Point3d((W/2),-(L/2),0) - ORIG()) EgtRotate( CLC3, Point3d(0,0,0), Z_AX(), 180) EgtMove( CLC3, Point3d((W/2),-(L/2),0) - ORIG()) -- angolo x-y- CLC4 = EgtCopyGlob( CLC1, Lg) EgtMove( CLC4, Point3d((W/2),-(L/2),0) - ORIG()) EgtRotate( CLC4, Point3d(0,0,0), Z_AX(), 90) EgtMove( CLC4, Point3d(-(W/2),-(L/2),0) - ORIG()) end end elseif R then GId = EgtCircle( Lg, Point3d( 0, 0, dThickD), R , GDB_RT.GLOB) end if GId then EgtModifyCurveThickness( GId, -T) EgtInvertCurve( GId) EgtSetName( GId, LG) -- se mantiene profondità e non è a spessore passante if kbs and kbs > 0 and T < DT then EgtSetInfo( GId, 'KeepBackSet', 'x') -- setto 'x' perché non si sa ancora da quale parte viene applicato end if pbs and pbs > 0 and T < DT and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( GId, 'ProbeSide', '1') end end -- creo estrusi e superfici piane delle geometrie passanti -- AddSurfTmByExtrusion( Lg, GId, bSingleMode) local mis10 local AP10 local TA10 local ss10 local SLD10 local hint_3, hint_4, hint_5, hint_6, hint_7 -- Extra bores for k = 1, 10 do local D10 = tExtraBore[k][1] local T10 = tExtraBore[k][2] local PX10 = tExtraBore[k][3] or 0 local PY10 = tExtraBore[k][4] or 0 local EB10 = tExtraBore[k][5] local RBS10 = tExtraBore[k][6] -- se dimensioni foro serratura idonee if D10 and T10 and EB10 then if D10 > 0 and T10 ~= 0 and EB10 ~= '' then if not Lg then Lg = EgtGroup(Pz,GDB_RT.LOC) EgtSetName(Lg,sCompoName) end hint_3 = EgtCircle( Lg, Point3d(PX10,PY10,dThickD), D10/2, GDB_RT.LOC) EgtModifyCurveThickness(hint_3, -T10) EgtSetName(hint_3,EB10) EgtSetInfo(hint_3,'ReferHw',RBS10) -- setto la nota che indica a cosa è riferita, false: per backset true: per door side end end end -- Extra rectangles for k = 1, 5 do local LR10 = tExtraRect[k][1] local WR10 = tExtraRect[k][2] local RR10 = tExtraRect[k][3] local CH10 = tExtraRect[k][4] local TR10 = tExtraRect[k][5] local PRX10 = tExtraRect[k][6] or 0 local PRY10 = tExtraRect[k][7] or 0 local AR10 = tExtraRect[k][8] local ER10 = tExtraRect[k][9] local RRS10 = tExtraRect[k][10] -- se parametri esistenti e dimensioni rettangolo idonee if LR10 and WR10 and TR10 and ER10 then if LR10 > 0 and WR10 > 0 and TR10 ~= 0 and ER10 ~= '' and (2*RR10) < LR10 and (2*RR10) < WR10 then if not Lg then Lg = EgtGroup(Pz,GDB_RT.LOC) EgtSetName(Lg,sCompoName) end -- se ho il chisel abilitato ma il fillet è presente non lo applico if CH10 then if abs(RR10) < GEO.EPS_SMALL then -- se il raccordo non è presente applico il chisel ER10 = ER10 .. '_Chisel' end end if AR10 and abs(AR10) >= 360 then while abs(AR10) >= 360 do AR10 = AR10 + EgtIf( AR10 > 0, -360, 360) end end hint_3 = MakeRectWithFillet( Lg, Point3d((PRX10-(LR10/2)),(PRY10-(WR10/2)),dThickD), Point3d((PRX10+(LR10/2)),(PRY10+(WR10/2)),dThickD), RR10, AR10, (LR10 > WR10), est) EgtModifyCurveThickness(hint_3, -TR10) EgtSetName(hint_3,ER10) EgtSetInfo(hint_3,'ReferHw',RRS10) -- setto la nota che indica a cosa è riferita, false: per backset true: per door side -- se rettangolo sborda faccio antischeggia if nDrawMach > 0 and EAR and (( das and das > 0) or ( das2 and das2 > 0)) then -- creo percorso anti-scheggia se rettangolo sborda hint_4, hint_5, hint_6, hint_7 = MakeAspOnStrikeRect( Lg, hint_3, LR10, WR10, TR10, DGD.dT, PRX10, PRY10, RRS10, DGD.BACK_SET, das, nil, dThickD, das2, SL, Fc) if hint_4 then EgtSetName(hint_4, ASG) if string.lower(Fc) == 'secure' then EgtSetInfo(hint_4, 'SideDoor', 'Secure') -- setto una nota per indicare su che lato della porta deve essere spostato else EgtSetInfo(hint_4, 'SideDoor', 'Keyway') -- setto una nota per indicare su che lato della porta deve essere spostato end EgtSetInfo(hint_4, 'ReferHw', RRS10) -- setto la nota che indica a cosa è riferita, false: per backset true: per door side end if hint_5 then EgtSetName(hint_5, ASG) if string.lower(Fc) == 'secure' then EgtSetInfo(hint_5, 'SideDoor', 'Secure') -- setto una nota per indicare su che lato della porta deve essere spostato else EgtSetInfo(hint_5, 'SideDoor', 'Keyway') -- setto una nota per indicare su che lato della porta deve essere spostato end EgtSetInfo(hint_5, 'ReferHw', RRS10) -- setto la nota che indica a cosa è riferita, false: per backset true: per door side end if hint_6 then EgtSetName(hint_6, ASGR) if string.lower(Fc) == 'secure' then EgtSetInfo(hint_6, 'SideDoor', 'Secure') -- setto una nota per indicare su che lato della porta deve essere spostato else EgtSetInfo(hint_6, 'SideDoor', 'Keyway') -- setto una nota per indicare su che lato della porta deve essere spostato end EgtSetInfo(hint_6, 'ReferHw', RRS10) -- setto la nota che indica a cosa è riferita, false: per backset true: per door side end if hint_7 then EgtSetName(hint_7, ASGR) if string.lower(Fc) == 'secure' then EgtSetInfo(hint_7, 'SideDoor', 'Secure') -- setto una nota per indicare su che lato della porta deve essere spostato else EgtSetInfo(hint_7, 'SideDoor', 'Keyway') -- setto una nota per indicare su che lato della porta deve essere spostato end EgtSetInfo(hint_7, 'ReferHw', RRS10) -- setto la nota che indica a cosa è riferita, false: per backset true: per door side end end -- setto nota per correzione profondità con probe -- se mantiene profondità e non è a spessore passante if kbs and kbs > 0 and TR10 < DT then EgtSetInfo( hint_3, 'KeepBackSet', 'x') -- setto 'x' perché non si sa ancora da quale parte viene applicato end if pbs and pbs > 0 and TR10 < DT and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_3, 'ProbeSide', '1') end end end end -- Extra lines for k = 1, 5 do local LL10 = tExtraLine[k][1] local TL10 = tExtraLine[k][2] local PLX10 = tExtraLine[k][3] or 0 local PLY10 = tExtraLine[k][4] or 0 local AL10 = tExtraLine[k][5] local EL10 = tExtraLine[k][6] local RLS10 = tExtraLine[k][7] -- se parametri esistenti e dimensioni linea idonee if LL10 and TL10 and EL10 then if LL10 > 0 and TL10 ~= 0 and EL10 ~= '' and AL10 < 360 and AL10 > -360 then if not Lg then Lg = EgtGroup(Pz,GDB_RT.LOC) EgtSetName(Lg,sCompoName) end if AL10 and abs(AL10) >= 360 then while abs(AL10) >= 360 do AL10 = AL10 + EgtIf( AL10 > 0, -360, 360) end end hint_3 = EgtLinePDL( Lg, Point3d( PLX10,PLY10,dThickD), AL10, LL10, GDB_RT.LOC) EgtModifyCurveThickness(hint_3, -TL10) EgtSetName(hint_3,EL10) EgtSetInfo(hint_3,'ReferHw',RLS10) -- setto la nota che indica a cosa è riferita, false: per backset true: per door side -- setto nota per correzione profondità con probe -- se mantiene profondità e non è a spessore passante if kbs and kbs > 0 and TL10 < DT then EgtSetInfo( hint_3, 'KeepBackSet', 'x') -- setto 'x' perché non si sa ancora da quale parte viene applicato end if pbs and pbs > 0 and TL10 < DT and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_3, 'ProbeSide', '1') end end end end end -- Costruzione della geometria di lavorazione if nDrawMach > 0 then -- se abilitata geometria lavorazione -- Costruzione della geometria if L and W then if rf > 0 then MId = DrawRectangleWithFillet ( Lg, W, L, dThickD, rf) else MId = EgtRectangle2P( Lg, Point3d( -(W/2), -(L/2), dThickD), Point3d((W/2), (L/2), dThickD), GDB_RT.GLOB) end if est then -- se materiale steel inizio sempre sul lato corto if W > L then EgtChangeClosedCurveStartPoint( MId, Point3d( -(W/2), 0, dThickD), GDB_RT.GLOB) else EgtChangeClosedCurveStartPoint( MId, Point3d( 0, -(L/2), dThickD), GDB_RT.GLOB) end else EgtChangeClosedCurveStartPoint( MId, Point3d( -(W/2), 0, dThickD), GDB_RT.GLOB) end elseif R then MId = EgtCircle( Lg, Point3d( 0, 0, dThickD), R , GDB_RT.GLOB) end if MId then EgtModifyCurveThickness( MId, -T) EgtInvertCurve( MId) EgtSetName( MId, LM) -- se mantiene profondità e non è a spessore passante if kbs and kbs > 0 and T < DT then EgtSetInfo( MId, 'KeepBackSet', 'x') -- setto 'x' perché non si sa ancora da quale parte viene applicato end if pbs and pbs > 0 and T < DT and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( MId, 'ProbeSide', '1') end end end -- cambio colore alla geometria if bPreview then if EC == 0 then if GId then EgtSetColor( GId or GDB_ID.NULL, AQUA()) end if MId then EgtSetColor( MId or GDB_ID.NULL, AQUA()) end else if GId then EgtSetColor( GId or GDB_ID.NULL, ORANGE()) end if MId then EgtSetColor( MId or GDB_ID.NULL, ORANGE()) end end end -- Se non Preview -- (NOTA : se ci sono errori il componente non viene eseguito dal programma di gestione dei componenti) if not bPreview then if bRunByCompo then -- scrivo i parametri nelle info del pezzo WriteCompoDataToPart(Pz,sCompoName,nCompoNpar) end -- scrivo note nel layer della cerniera EgtSetInfo(Lg,'Type' ,'FlushPull') EgtSetInfo(Lg,'L' ,L) EgtSetInfo(Lg,'H' ,H) EgtSetInfo(Lg,'R' ,R) EgtSetInfo(Lg,'rf' ,rf) EgtSetInfo(Lg,'T' ,T) EgtSetInfo(Lg,'clc' ,clc) EgtSetInfo(Lg,'ccr' ,ccr) EgtSetInfo(Lg,'ech' ,ech) EgtSetInfo(Lg,'est' ,est) EgtSetInfo(Lg,'kbs' ,kbs) EgtSetInfo(Lg,'pbs' ,pbs) EgtSetInfo(Lg,'DT' ,DT) EgtSetInfo(Lg,'SL' ,SL) EgtSetInfo(Lg,'Fc' ,Fc) EgtSetInfo(Lg,'LG' ,LG) EgtSetInfo(Lg,'LM' ,LM) EgtSetInfo(Lg,'CH' ,CH) EgtSetInfo(Lg,'CL' ,CL) EgtSetInfo(Lg,'EAR' ,EAR) EgtSetInfo(Lg,'das' ,das) EgtSetInfo(Lg,'ASG' ,ASG) EgtSetInfo(Lg,'das2' ,das2) EgtSetInfo(Lg,'ASGR' ,ASGR) EgtSetInfo(Lg,'Path' ,sCompoPath) end if EC == 0 and nCodAdj and nCodAdj < 0 then EC = nCodAdj EM = sCodAdj end return EC, EM, Lg end return FlushPull