-- LouverCutOut.lua by EgalWare s.r.l. 2025.05.14 -- Autore: Filippo Monchi -- LouverCutOut dati i valori 'L' e 'H' e con nome attributo -- 2017.10.18 V1.0a1 FM Start point path near lock side -- 2017.12.07 V1.0a3 FM Add Cleancorner path -- 2018.01.11 V1.0a4 FM Add Hatching -- 2018.08.24 V1.0a5 FM Add internal radius on clean-corner paths -- 2018.10.09 V1.0a6 FM check better the error condition with radius on clean corner path -- 2019.10.02 V1.019 FM Manage steel option (disable generation of some geometries) -- 2019.10.07 V1.01a FM Manage cut by saw -- 2019.10.18 V2.000 FM Manage use Materials -- 2019.12.06 V2.001 FM Fix error on not initialized variable d into hatching section -- 2020.04.29 V2.002 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.04.23 V3.001 FM Manage note to indicate if hatching is present -- 2021.04.27 V3.002 FM Manage special region on hatching paths to remove pods under those -- 2022.07.27 V3.003 FM Modification to use compiled code -- 2023.05.12 V3.004 FM Manage clean corner with cone tool -- 2023.05.12 V3.005 FM Fix error on disabled clean cone parameter ccn -- 2024.09.12 V3.006 FM Fix error on print error/warning message with wrongg variables -- 2024.10.19 V3.007 FM Manage drop path with back and forth -- 2024.11.14 V3.011 FM Manage new ConeCleanCorner path by CurrDoorCustomData DGC.Ccm parameter -- 2025.05.05 v2.7e1 DS DGC.Ccm con valori tra -1 e 0 per ConeCleanCorner che fa metà da sopra e metà da sotto senza baffi. -- 2025.05.14 v2.7e3 DS DGC.Ccm con valore -2 per ConeCleanCorner da sotto a sopra. -- Tavola per definizione modulo (serve ma non usata) local LouverCutOut = {} -- Intestazioni require( 'EgtBase') EgtEnableDebug( false) -- per messaggi -- EgtAddToPackagePath( EgtGetSourceDir() .. '?.lua') EgtAddToPackagePath( DGD.BASEDIR .. '?.lua') -- Valori limite local DimMin = 2. -- valore minimo lato 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 local function DrawAddLineDrawCircle( pInitial, pFinal, nGroup, idTable, bPrev, nGroupCirc, nRad, bDrawFirst, bDrawLast, cColor1, cColor2) local nLine = EgtLine(nGroup, pInitial, pFinal, GDB_RT.LOC) if idTable then table.insert( idTable, nLine) end if bPrev then if bDrawFirst then local nCircle1 = EgtCircle( nGroupCirc, pInitial, nRad , GDB_RT.LOC) EgtSetColor(nCircle1, cColor1) end if bDrawLast then local nCircle2 = EgtCircle( nGroupCirc, pFinal, nRad , GDB_RT.LOC) EgtSetColor(nCircle2, cColor2) end end return nLine end ----------------------------------------------------------------- local function DrawRectangleAndMakeItsRegion( Lg, bPreview, Dm, nIdPath, dTh) local nId, nId1, nId2, nId3, nId4 -- faccio gli offset in più e in meno e li unisco con le linee per creare il percorso nId1 = EgtCopyGlob( nIdPath, Lg) EgtOffsetCurve( nId1, 0.5) nId3 = EgtCopyGlob( nIdPath, Lg) EgtOffsetCurve( nId3, -0.5) -- inverto il percorso 2 EgtInvertCurve( nId3) -- prendo i punti da collegare local pIni = EgtEP( nId1) local pEnd = EgtSP( nId3) nId2 = DrawAddLineDrawCircle( pIni, pEnd, Lg, nil, bPreview, Dm, 0, false, false, RED(), RED()) pIni = EgtEP( nId3) pEnd = EgtSP( nId1) nId4 = DrawAddLineDrawCircle( pIni, pEnd, Lg, nil, bPreview, Dm, 0, false, false, RED(), RED()) -- creo percorso nId = EgtCurveCompo( Lg, {nId1,nId2,nId3,nId4}, true) EgtModifyCurveThickness( nId, dTh) -- creo estrusi e superfici piane delle geometrie passanti AddSurfTmByExtrusion( Lg, nId, true, 2) -- cancello il percorso utilizzato if nId then EgtErase( nId) end end -- Funzione di sistemazione parametri function LouverCutOut.AdjustParams( tMhPar) local EgtDoorsMsg = require( 'EgtDoorsMsg') local dMaxMat0 local dMaxMat1 local dMaxMat2 local dNumMessage local dNumLog = 0 local sMessToOut = '' local nTempT0 local nTempT1 local nTempT2 local sMchngName0 local sMchngName1 local sMchngName2 local nThBl0 local nThBl1 -- Assegno parametri da ddf if DGD.LENGTH then tMhPar.L = DGD.LENGTH end if DGD.WIDTH then tMhPar.W = DGD.WIDTH end tMhPar.T = DGD.dT -- verifico se presente il parametro DGC.Cmx ( massimo spessore per applicare la seconda modalità di ConeCleanCorner) e se ha i valori congruenti if not DGC.Cmx then tMhPar.Cmx = 0 else tMhPar.Cmx = abs(DGC.Cmx) end -- verifico se presente il parametro DGC.Ccm ( ConeCleanCorner mode) e se ha i valori congruenti (0 o 1) if not DGC.Ccm then tMhPar.Ccm = 0 else tMhPar.Ccm = DGC.Ccm if abs( tMhPar.Ccm) > 1 and tMhPar.Ccm ~= -2 then tMhPar.Ccm = 0 end -- verifico se spessore porta ammette la seconda modalità, nel caso torno alla prima modalità if tMhPar.T > tMhPar.Cmx then tMhPar.Ccm = 0 end end -- disattivo la lama se la cava è più profonda di una certa quota if tMhPar.MaxBd and tMhPar.T and tMhPar.T > tMhPar.MaxBd then tMhPar.bl = false dNumLog = -1294 dNumMessage = 674 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T), EgtToUiUnits(tMhPar.MaxBd)) end local MB = require( 'MachiningBase') local sLBM local nLBMi = 1 local sDM local nDMi = 1 local dMaxCutBladeLen = 0 local sCLCN local nCLCNi = 1 local sNotesMach = '' -- se porta steel o aluminum disabilito alcune geometrie non compatibili con il metallo if FindMaterial( DGD.Material, 'steel') or FindMaterial( DGD.Material, 'aluminum') then tMhPar.est = true tMhPar.DM = nil else tMhPar.est = nil end if tMhPar.DM then sDM = tMhPar.DM end if tMhPar.LBM then -- geometria con lama sLBM = tMhPar.LBM end if tMhPar.CLCN then -- pulitira spigolo con utensile conico sCLCN = tMhPar.CLCN end -- se devo disegnare le geometrie di lavorazione if DGD.MachEn > 0 then -- parametri utensile per hatching if sDM and tMhPar.d then nTempT1, dMaxMat1, sMchngName1, nThBl1 = MB.GetToolDataFromAttrib( sDM, nDMi) end -- se ha fallito con la prima colonna riprovo con la seconda -- (la lavorazione potrebbe essere messa sulla seconda colonna della MTAble) if sDM and tMhPar.d and not( nTempT1 and sMchngName1) then nDMi = 2 nTempT1, dMaxMat1, sMchngName1, nThBl1 = MB.GetToolDataFromAttrib( sDM, nDMi) end if sLBM and tMhPar.bl and tMhPar.d3 then nTempT0, dMaxMat0, sMchngName0, nThBl0 = MB.GetToolDataFromAttrib( sLBM, nLBMi) end if sCLCN then nTempT2, dMaxMat2, sMchngName2, _, sNotesMach = MB.GetToolDataFromAttrib( sCLCN, nCLCNi, true) end if DGD.bProoduce and not est and nTempT2 and nTempT2 < 0 then dNumLog = -1293 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT2, sCLCN, nCLCNi, 0, dNumLog, sMchngName2) else -- cerco la nota local nPosFound = string.find( sNotesMach, 'RadToClean') if nPosFound then local sParz = string.sub( sNotesMach, nPosFound) nPosFound = string.find( sParz, ';') local sTrimmed if nPosFound then sTrimmed = string.sub( sParz, 1, nPosFound-1) else sTrimmed = sParz end if sTrimmed and #sTrimmed > 0 then local sValue = string.sub( sTrimmed, 12) if sValue and #sTrimmed > 0 then local dVal = tonumber( sValue) if dVal and abs(dVal) > GEO.EPS_SMALL then tMhPar.dCleanNote = dVal else tMhPar.dCleanNote = 0 end else tMhPar.dCleanNote = 0 end else tMhPar.dCleanNote = 0 end else tMhPar.dCleanNote = 0 end end if DGD.bProoduce and not est and tMhPar.d and nTempT1 and nTempT1 <= 0 then dNumLog = -1298 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT1, sDM, nDMi, tMhPar.d, dNumLog, sMchngName1) elseif not est and nTempT1 then tMhPar.d = nTempT1 end if tMhPar.d3 and nTempT0 and nTempT0 <= 0 then -- lama if DGD.bProoduce and tMhPar.bl then -- se utilizzo la lama dNumLog = -1299 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT0, sLBM, nLBMi, tMhPar.d3, dNumLog, sMchngName0) end elseif nTempT0 then tMhPar.d3 = nTempT0 if nThBl0 and nThBl0 > 0 then tMhPar.thb = nThBl0 end end -- se lo spessore porta è maggiore della capacità lama disabilito la lama ed emetto un warning if tMhPar.bl and tMhPar.T and dMaxMat0 and tMhPar.T >= dMaxMat0 then tMhPar.bl = false tMhPar.LBM = nil dNumLog = -1297 dNumMessage = 672 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, sMchngName0, EgtToUiUnits(tMhPar.T), EgtToUiUnits(dMaxMat0)) end -- se lo spessore porta è maggiore della capacità utensile hatching disabilito la lavorazione ed emetto un warning if tMhPar.T and dMaxMat1 and tMhPar.T >= dMaxMat1 then tMhPar.DM = nil dNumLog = -1296 dNumMessage = 672 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, sMchngName1, EgtToUiUnits(tMhPar.T), EgtToUiUnits(dMaxMat1)) end -- se il blade è attivo calcolo se passa la lama nella sfinestratura if tMhPar.bl and tMhPar.d3 and tMhPar.L and tMhPar.W then -- calcolo la massima impronta lama local dBladeRadius = tMhPar.d3 / 2 dMaxCutBladeLen = sqrt( (dBladeRadius * dBladeRadius) - ( ( dBladeRadius - tMhPar.T) * ( dBladeRadius - tMhPar.T))) -- se l'impronta lama è maggiore della lunghezza o larghezza escludo la lama e do messaggio di warning if (2*dMaxCutBladeLen) >= tMhPar.L or (2*dMaxCutBladeLen) >= tMhPar.W then tMhPar.bl = false tMhPar.LBM = nil dNumLog = -1295 dNumMessage = 673 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, sMchngName0) end end -- se il blade è attivo e utensile lama e c'è il clean corner, lo ricalcolo in funzione del raggio lama if tMhPar.bl and tMhPar.thb and tMhPar.thb > 0 and tMhPar.clc and tMhPar.clc > 0 then if dMaxCutBladeLen > tMhPar.clc then tMhPar.clc = dMaxCutBladeLen end 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 LouverCutOut.Draw( tLvrPar, bPreview, bRunByCompo, nDrawMach) -- Assegno le dimensioni local L = tLvrPar.L local W = tLvrPar.W local T = tLvrPar.T local clc = tLvrPar.clc local ccr = tLvrPar.ccr local ccn = tLvrPar.ccn local hml = tLvrPar.hml local dml = tLvrPar.dml local dmw = tLvrPar.dmw local bl = tLvrPar.bl local dbl = tLvrPar.dbl local d = tLvrPar.d -- hatching tool diameter local d3 = tLvrPar.d3 -- blade diameter local dRadToClean = tLvrPar.dCleanNote or 0 local dConeCleanMode = tLvrPar.Ccm local est = tLvrPar.est -- Assegno i nomi local LG = tLvrPar.LG local LM = tLvrPar.LM local CL = tLvrPar.CL local CLCN = tLvrPar.CLCN local DM = tLvrPar.DM -- nome lavorazione hatchind local LBM = tLvrPar.LBM -- nome lavorazione con lama -- variabili per messaggi e settaggi vari local sCompoName = tLvrPar.Nome local nCompoNpar = tLvrPar.Npar local sCompoPath = tLvrPar.Path -- eventuale messaggio errore rilevato nell'adjust local nCodAdj = tLvrPar.nCod local sCodAdj = tLvrPar.sCod -- variabili per messaggi e settaggi vari local sNamePar1 = tLvrPar.N1 or 'L' local sNamePar2 = tLvrPar.N2 or 'H' local sNamePar3 = tLvrPar.N3 or 'T' local sNamePar4 = tLvrPar.N5 or 'clc' local sNamePar5 = tLvrPar.N5 or 'ccr' -- RunByComponentInterface local RC = true -- Messaggi codice errori local EM = ' ' local EC = 0 local ErrorBase = 1200 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 EgtDoorsMsg = require( 'EgtDoorsMsg') -- variabile per gestione presenza hatching local bExistsHatching = false -- 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 D = DimMin elseif W and W < DimMin then EC = 2 EM = string.format(EgtDoorsMsg[407],sNamePar2,EgtToUiUnits(H),'',EgtToUiUnits(DimMin), sCompoPath) -- il parametro 'H' deve essere > DimMin W = DimMin --[[ elseif CL and clc and clc > 0 and ( 2*clc) >= W then EC = 3 EM = string.format(EgtDoorsMsg[407],sNamePar4..'*2',EgtToUiUnits(clc),sNamePar2,EgtToUiUnits(W), sCompoPath) -- il parametro 'clc*2' deve essere > W clc = W/2-0.2 elseif CL and clc and clc > 0 and ( 2*clc) >= L then EC = 4 EM = string.format(EgtDoorsMsg[407],sNamePar4..'*2',EgtToUiUnits(clc),sNamePar1,EgtToUiUnits(L), sCompoPath) -- il parametro 'clc*2' deve essere > L clc = L/2-0.2 ]]-- elseif CL and clc and ccr and clc > 0 and ccr > 0 and (2*(ccr*sin(45))) >= clc then EC = 5 EM = string.format(EgtDoorsMsg[407],sNamePar4,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 pIni, pEnd local GId, MId, CLC1, CLC2, CLC3, CLC4 local CLCN1, CLCN2, CLCN3, CLCN4 local nKindGeom local bSingleMode = true -- Costruzione della geometria GId = EgtRectangle2P( Lg, Point3d( 0, 0, T), Point3d( W, L, T), GDB_RT.GLOB) -- Costruzione della geometria clean corner if nDrawMach >= 0 then -- se abilitata geometria -- se ci sono i parametri per i percorsi clean corner if CL and clc and clc > 0 and clc < W and clc < L then -- angolo x-y+ CLC1 = MakeClcPath( clc, ccr, CL, Lg, -T) EgtMove( CLC1, Point3d(0,L,T) - ORIG()) -- angolo x+y+ CLC2 = EgtCopyGlob( CLC1, Lg) EgtRotate( CLC2, Point3d(0,L,0), Z_AX(), -90) EgtMove( CLC2, Point3d(W,0,0) - ORIG()) -- angolo x+y- CLC3 = EgtCopyGlob( CLC1, Lg) EgtRotate( CLC3, Point3d(0,L,0), Z_AX(), 180) EgtMove( CLC3, Point3d(W,-L,0) - ORIG()) -- angolo x-y- CLC4 = EgtCopyGlob( CLC1, Lg) EgtRotate( CLC4, Point3d(0,L,0), Z_AX(), 90) EgtMove( CLC4, Point3d(0,-L,0) - ORIG()) end -- se ci sono i parametri per i percorsi di clean corner con utensile conico if CLCN and ccn and ccn > 0 and dRadToClean and dRadToClean > 0 then -- angolo x-y+ CLCN1 = MakeConeClcPath( CLCN, Lg, -T, dRadToClean, dConeCleanMode) EgtMove( CLCN1, Point3d(0,L,T) - ORIG()) -- angolo x+y+ CLCN2 = EgtCopyGlob( CLCN1, Lg) EgtRotate( CLCN2, Point3d(0,L,0), Z_AX(), -90) EgtMove( CLCN2, Point3d(W,0,0) - ORIG()) -- angolo x+y- CLCN3 = EgtCopyGlob( CLCN1, Lg) EgtRotate( CLCN3, Point3d(0,L,0), Z_AX(), 180) EgtMove( CLCN3, Point3d(W,-L,0) - ORIG()) -- angolo x-y- CLCN4 = EgtCopyGlob( CLCN1, Lg) EgtRotate( CLCN4, Point3d(0,L,0), Z_AX(), 90) EgtMove( CLCN4, Point3d(0,-L,0) - ORIG()) end if GId then EgtModifyCurveThickness( GId, -T) EgtInvertCurve( GId) EgtSetName( GId, LG) -- creo estrusi e superfici piane delle geometrie passanti AddSurfTmByExtrusion(Lg, GId, bSingleMode) end end -- Costruzione della geometria di lavorazione if nDrawMach > 0 then -- se abilitata geometria lavorazione -- Costruzione della geometria MId = EgtRectangle2P( Lg, Point3d( 0, 0, T), Point3d( W, L, T), GDB_RT.GLOB) if DGD.Lock == 'L' then EgtChangeClosedCurveStartPoint( MId, Point3d( 0, L /2, T), GDB_RT.GLOB) else EgtChangeClosedCurveStartPoint( MId, Point3d( W, L /2, T), GDB_RT.GLOB) end EgtModifyCurveThickness( MId, -T) EgtInvertCurve( MId) if bl then EgtSetName( MId, LBM) EgtSetInfo( MId, 'ByBlade', bl) else EgtSetName( MId, LM) end -- se ci sono tutti i parametri per l'hatching if DM and ( ( hml and dml) or dmw) then local bMakeDrop = false if not d then d = 0 end -- se l'utensile e i parametri per la lunghezza sono presenti if d > 0 and hml and dml then -- se lunghezza inferiore del limite inserisco le linee if L <= hml then if L > dml then -- se lunghezza e' maggiore del drop inserisco linee -- determino quante linee inserire local nStep = ceil(L/dml) -- numero di passate local dStep = (L/nStep) -- passo ricalcolato local nPass = 1 local nDir = 1 bMakeDrop = true bExistsHatching = bMakeDrop -- ciclo inserimento linee while nPass < nStep do pIni = Point3d( EgtIf( nDir > 0, (d*9/16), (W-(d*9/16))),(dStep*nPass),T) pEnd = Point3d( EgtIf( nDir > 0, (W-(d*9/16)), (d*9/16)),(dStep*nPass),T) hint1 = DrawAddLineDrawCircle( pIni, pEnd, Lg, nil, bPreview, Dm, 0, false, false, RED(), RED()) -- se ho doppia linea if dbl and dbl == 1 then EgtTrimExtendCurveByLen( hint1, -(d/2), pEnd) pIni = EgtSP( hint1) pEnd = EgtEP( hint1) -- seconda linea hint2 = DrawAddLineDrawCircle( pEnd, pIni, Lg, nil, bPreview, Dm, 0, false, false, RED(), RED()) DRP1 = EgtCurveCompo( Lg, {hint1,hint2}, true) else DRP1 = EgtCurveCompo( Lg, hint1, true) end EgtModifyCurveThickness( DRP1, -T) EgtSetName( DRP1, DM) if dbl and dbl == 1 then EgtSetInfo( DRP1, 'DoubleLine', 1) end -- creo estrusi e superfici attorno alla linea di drop DrawRectangleAndMakeItsRegion( Lg, bPreview, Dm, DRP1, -T) -- se non ho doppia linea creao linee di verso alternato if not dbl or dbl == 0 then nDir = -nDir end nPass = nPass + 1 end -- end while end end end if d > 0 and dmw then -- se lunghezza inferiore del limite inserisco le linee if L <= hml then if W > dmw then -- se larghezza e' maggiore del drop inserisco linee -- determino quante linee inserire local nStep = ceil(W/dmw) -- numero di passate local dStep = (W/nStep) -- passo ricalcolato local nPass = 1 local nDir = 1 bMakeDrop = true bExistsHatching = bMakeDrop -- ciclo inserimento linee while nPass < nStep do pIni = Point3d( (dStep*nPass), EgtIf( nDir > 0, (d*9/16), (L-(d*9/16))),T) pEnd = Point3d( (dStep*nPass), EgtIf( nDir > 0, (L-(d*9/16)), (d*9/16)),T) hint1 = DrawAddLineDrawCircle( pIni, pEnd, Lg, nil, bPreview, Dm, 0, false, false, RED(), RED()) -- se ho doppia linea if dbl and dbl == 1 then EgtTrimExtendCurveByLen( hint1, -(d/2), pEnd) pIni = EgtSP( hint1) pEnd = EgtEP( hint1) -- seconda linea hint2 = DrawAddLineDrawCircle( pEnd, pIni, Lg, nil, bPreview, Dm, 0, false, false, RED(), RED()) DRP1 = EgtCurveCompo( Lg, {hint1,hint2}, true) else DRP1 = EgtCurveCompo( Lg, hint1, true) end EgtModifyCurveThickness( DRP1, -T) EgtSetName( DRP1, DM) if dbl and dbl == 1 then EgtSetInfo( DRP1, 'DoubleLine', 1) end -- creo estrusi e superfici attorno alla linea di drop DrawRectangleAndMakeItsRegion( Lg, bPreview, Dm, DRP1, -T) -- se non ho doppia linea creao linee di verso alternato if not dbl or dbl == 0 then nDir = -nDir end nPass = nPass + 1 end -- end while end end 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 if CLC1 then EgtSetColor( CLC1 or GDB_ID.NULL, AQUA()) end if CLC2 then EgtSetColor( CLC2 or GDB_ID.NULL, AQUA()) end if CLC3 then EgtSetColor( CLC3 or GDB_ID.NULL, AQUA()) end if CLC4 then EgtSetColor( CLC4 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 if CLC1 then EgtSetColor( CLC1 or GDB_ID.NULL, ORANGE()) end if CLC2 then EgtSetColor( CLC2 or GDB_ID.NULL, ORANGE()) end if CLC3 then EgtSetColor( CLC3 or GDB_ID.NULL, ORANGE()) end if CLC4 then EgtSetColor( CLC4 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 and EC == 0 then if bRunByCompo then -- scrivo i parametri nelle info del pezzo WriteCompoDataToPart(Pz,sCompoName,nCompoNpar) end -- scrivo note nel layer EgtSetInfo( Lg, 'Type' , 'LouverCutOut') EgtSetInfo( Lg, 'L' , L) EgtSetInfo( Lg, 'H' , H) EgtSetInfo( Lg, 'T' , T) EgtSetInfo( Lg, 'clc' , clc) EgtSetInfo( Lg, 'ccr' , ccr) EgtSetInfo( Lg, 'ccn' , ccn) EgtSetInfo( Lg, 'hml' , hml) EgtSetInfo( Lg, 'dml' , dml) EgtSetInfo( Lg, 'dmw' , dmw) EgtSetInfo( Lg, 'bl' , bl) EgtSetInfo( Lg, 'dbl' , dbl) EgtSetInfo( Lg, 'd' , d) EgtSetInfo( Lg, 'd3' , d3) EgtSetInfo( Lg, 'est' , est) EgtSetInfo( Lg, 'hatch' , bExistsHatching) EgtSetInfo( Lg, 'LG' , LG) EgtSetInfo( Lg, 'LM' , LM) EgtSetInfo( Lg, 'CL' , CL) EgtSetInfo( Lg, 'CLCN' , CLCN) EgtSetInfo( Lg, 'DM' , DM) EgtSetInfo( Lg, 'LBM' , LBM) 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 LouverCutOut