c608187245
- aggiunto nuovo tipo di ConeCleanCorner (DGC.Ccm -> dMode = -2).
1554 lines
62 KiB
Lua
1554 lines
62 KiB
Lua
-- VisionCutOut.lua by EgalWare s.r.l. 2025.05.14
|
|
-- VisionCutOut dati i valori 'L' e 'H' e con nome attributo
|
|
|
|
-- 2017.10.18 V1.0a1 FM Start point path near lock side
|
|
-- 2017.10.18 V1.0a2 FM Modify bevel arc path name according to swing
|
|
-- 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
|
|
-- 2018.12.11 V1.0a7 FM Manage fillet on corner of rectangle shape and calculate also for hatching (drop)
|
|
-- 2018.12.12 V1.0a8 FM Apply hatching on circle shape too
|
|
-- 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
|
|
-- 2021.06.08 V3.003 FM Manage diamond shape
|
|
-- 2022.01.17 V3.004 FM Manage Split door along door height
|
|
-- 2022.04.28 V3.005 FM Manage Split door along door width
|
|
-- 2022.07.06 V3.006 FM Fix error on split door along door height
|
|
-- 2022.07.27 V3.007 FM Modification to use compiled code
|
|
-- 2022.09.23 V3.008 FM Manage side groove for clips
|
|
-- 2023.02.03 V3.009 FM Fix error on disabled clean cone parameter ccn
|
|
-- 2024.10.19 V3.010 FM Manage drop path with back and forth
|
|
-- 2024.11.14 V3.011 FM Manage new ConeCleanCorner path by CurrDoorCustomData DGC.Ccm parameter
|
|
-- 2025.04.07 v2.7d2 DS Split trasversale divide in due la porta (Dutch Door).
|
|
-- 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.06 v2.7e2 DS Aggiunti antischeggia per Split.
|
|
-- 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 VisionCutOut = {}
|
|
|
|
-- 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 CalcIntersect( DRP1, hint_ofs, pIni, pEnd, dExtraLen)
|
|
|
|
if DRP1 and hint_ofs then
|
|
|
|
-- calcolo intersezioni tra percorso offsettato e punto iniziale percorso
|
|
local ptInt = EgtIP( DRP1, hint_ofs, pIni)
|
|
-- se esiste intersezione muovo il punto al punto intersezione
|
|
if ptInt then
|
|
-- calcolo la lunghezza tra i due punti
|
|
local dDistPoint = dist( pIni, ptInt)
|
|
if dDistPoint > 0 then
|
|
EgtTrimExtendCurveByLen( DRP1, -(dDistPoint + dExtraLen), pIni)
|
|
end
|
|
end
|
|
-- calcolo intersezioni tra percorso offsettato e punto finale percorso
|
|
ptInt = EgtIP( DRP1, hint_ofs, pEnd)
|
|
-- se esiste intersezione muovo il punto al punto intersezione
|
|
if ptInt then
|
|
-- calcolo la lunghezza tra i due punti
|
|
local dDistPoint = dist( pEnd, ptInt)
|
|
if dDistPoint > 0 then
|
|
EgtTrimExtendCurveByLen( DRP1, -(dDistPoint + dExtraLen), pEnd)
|
|
end
|
|
end
|
|
end
|
|
|
|
return DRP1
|
|
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 DrawAddCircleDrawCircle( pCenter, dRadius, dAngIni, dAngCen, nGroup, idTable, bPrev, nGroupCirc,
|
|
nRad, bDrawFirst, bDrawLast, cColor1, cColor2, sMVar)
|
|
|
|
local nCircle = EgtArc( nGroup, pCenter, dRadius, dAngIni, dAngCen, 0, GDB_RT.LOC)
|
|
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 , GDB_RT.LOC)
|
|
EgtSetColor( nCircle1, cColor1)
|
|
end
|
|
|
|
if bDrawLast then
|
|
local nCircle2 = EgtCircle( nGroupCirc, EgtEP( nCircle), nRad , GDB_RT.LOC)
|
|
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 DrawDiamondWithFillet ( Lg, L, H, dThickD, rf, dRad, sLockSide)
|
|
|
|
local tHint = {}
|
|
local hint
|
|
local pIni, pEnd, pCen
|
|
local nLin1, nLin2, nFill
|
|
local nLocKindGeom
|
|
local ptMid
|
|
|
|
-- Costruzione della geometria principale
|
|
if rf < dRad then
|
|
-- aggiungo le linee
|
|
pIni = Point3d(0,(H/2),dThickD)
|
|
pEnd = Point3d((L/2),0,dThickD)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
pEnd = Point3d(0,-(H/2),dThickD)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
pEnd = Point3d(-(L/2),0,dThickD)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
pEnd = Point3d(0,(H/2),dThickD)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
if rf > 0 then
|
|
-- aggiungo i raccordi
|
|
nLin1 = tHint[1]
|
|
nLin2 = tHint[2]
|
|
nFill = EgtCurveFillet( Lg, nLin1, EgtMP( nLin1), nLin2, EgtMP( nLin2), rf, true, GDB_RT.LOC)
|
|
table.insert( tHint, 2, nFill)
|
|
nLin1 = tHint[3]
|
|
nLin2 = tHint[4]
|
|
nFill = EgtCurveFillet( Lg, nLin1, EgtMP( nLin1), nLin2, EgtMP( nLin2), rf, true, GDB_RT.LOC)
|
|
table.insert( tHint, 4, nFill)
|
|
nLin1 = tHint[5]
|
|
nLin2 = tHint[6]
|
|
nFill = EgtCurveFillet( Lg, nLin1, EgtMP( nLin1), nLin2, EgtMP( nLin2), rf, true, GDB_RT.LOC)
|
|
table.insert( tHint, 6, nFill)
|
|
nLin1 = tHint[7]
|
|
nLin2 = tHint[1]
|
|
nFill = EgtCurveFillet( Lg, nLin1, EgtMP( nLin1), nLin2, EgtMP( nLin2), rf, true, GDB_RT.LOC)
|
|
table.insert( tHint, nFill)
|
|
end
|
|
if sLockSide then
|
|
if sLockSide == 'L' then
|
|
if rf > 0 then
|
|
ptMid = EgtMP( tHint[7])
|
|
else
|
|
ptMid = EgtMP( tHint[4])
|
|
end
|
|
else
|
|
ptMid = EgtMP( tHint[1])
|
|
end
|
|
end
|
|
nLocKindGeom = 1
|
|
else
|
|
pIni = Point3d(0,rf,dThickD)
|
|
pCen = Point3d(0,0,dThickD)
|
|
pEnd = Point3d(rf,0,dThickD)
|
|
DrawAddCircleDrawCircle( pCen, rf, 90,-90, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
pCen = Point3d(0,0,dThickD)
|
|
pEnd = Point3d(0,-rf,dThickD)
|
|
DrawAddCircleDrawCircle( pCen, rf, 0,-90, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
pCen = Point3d(0,0,dThickD)
|
|
pEnd = Point3d(-rf,0,dThickD)
|
|
DrawAddCircleDrawCircle( pCen, rf, -90,-90, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
pCen = Point3d(0,0,dThickD)
|
|
pEnd = Point3d(0,rf,dThickD)
|
|
DrawAddCircleDrawCircle( pCen, rf, 180,-90, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
if sLockSide then
|
|
if sLockSide == 'L' then
|
|
ptMid = Point3d(-rf,0,dThickD)
|
|
else
|
|
ptMid = Point3d(rf,0,dThickD)
|
|
end
|
|
end
|
|
nLocKindGeom = 2
|
|
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
|
|
if ptMid then
|
|
EgtChangeClosedCurveStartPoint( hint, ptMid, GDB_RT.GLOB)
|
|
end
|
|
end
|
|
|
|
return hint, nLocKindGeom
|
|
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
|
|
|
|
-------------------------------------- Sistemazione parametri -----------------------------------------------
|
|
function VisionCutOut.AdjustParams( tMhPar)
|
|
|
|
local EgtDoorsMsg = require( 'EgtDoorsMsg')
|
|
local dMaxMat0
|
|
local dMaxMat1
|
|
local dMaxMat2
|
|
local dMaxMat3
|
|
local dNumMessage
|
|
local dNumLog = 0
|
|
local sMessToOut = ''
|
|
local nTempT0
|
|
local nTempT1
|
|
local nTempT2
|
|
local nTempT3
|
|
local sMchngName0
|
|
local sMchngName1
|
|
local sMchngName2
|
|
local sMchngName3
|
|
local nThBl0
|
|
local nThBl1
|
|
local nThBl3
|
|
|
|
-- prendo parametro globale della direzione e se presente lo split porta
|
|
tMhPar.dir = DGD.DIR
|
|
tMhPar.split = DGD.SPLIT
|
|
|
|
-- Assegno parametri da ddf
|
|
if tMhPar.split then
|
|
-- se non definita direzione di default è lungo l'altezza porta
|
|
if not tMhPar.dir then
|
|
tMhPar.dir = '0'
|
|
end
|
|
if tMhPar.dir == '0' then
|
|
tMhPar.L = DGD.dH
|
|
tMhPar.W = DGD.WIDTH
|
|
elseif tMhPar.dir == '1' then
|
|
tMhPar.L = DGD.WIDTH
|
|
tMhPar.W = DGD.dW
|
|
end
|
|
elseif tMhPar.split == nil then
|
|
if DGD.LENGTH then
|
|
tMhPar.L = DGD.LENGTH
|
|
end
|
|
if DGD.WIDTH then
|
|
tMhPar.W = DGD.WIDTH
|
|
end
|
|
if DGD.RADIUS then
|
|
tMhPar.R = DGD.RADIUS
|
|
end
|
|
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.split or tMhPar.split == nil) and tMhPar.MaxBd and tMhPar.T and tMhPar.T > tMhPar.MaxBd then
|
|
tMhPar.bl = false
|
|
dNumLog = -1194
|
|
dNumMessage = 674
|
|
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T), EgtToUiUnits(tMhPar.MaxBd))
|
|
end
|
|
|
|
-- disattivo la lama se è presente un raccordo
|
|
if tMhPar.R and tMhPar.R > 0 then
|
|
tMhPar.bl = false
|
|
end
|
|
|
|
-- Assegno parametri da dati utensili in macchina
|
|
local MB = require( 'MachiningBase')
|
|
local sLBM
|
|
local nLBMi = 1
|
|
local sDM
|
|
local nDMi = 1
|
|
local dMaxCutBladeLen = 0
|
|
local sCLCN
|
|
local nCLCNi = 1
|
|
local sNotesMach = ''
|
|
local sCGM1
|
|
local nCGM1i = 1
|
|
|
|
-- 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
|
|
|
|
if tMhPar.GCM then
|
|
sCGM1 = tMhPar.GCM
|
|
end
|
|
|
|
-- se devo disegnare le geometrie di lavorazione
|
|
if DGD.MachEn > 0 then
|
|
|
|
-- parametri utensile per hatching
|
|
if ( tMhPar.split or tMhPar.split == nil) and 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 ( tMhPar.split or tMhPar.split == nil) and sDM and tMhPar.d and not( nTempT1 and sMchngName1) then
|
|
nDMi = 2
|
|
nTempT1, dMaxMat1, sMchngName1, nThBl1 = MB.GetToolDataFromAttrib( sDM, nDMi)
|
|
end
|
|
|
|
if ( tMhPar.split or tMhPar.split == nil) and sLBM and tMhPar.bl and tMhPar.d3 then
|
|
nTempT0, dMaxMat0, sMchngName0, nThBl0 = MB.GetToolDataFromAttrib( sLBM, nLBMi)
|
|
end
|
|
|
|
if tMhPar.split == nil and sCLCN then
|
|
nTempT2, dMaxMat2, sMchngName2, _, sNotesMach = MB.GetToolDataFromAttrib( sCLCN, nCLCNi, true)
|
|
end
|
|
|
|
-- se non c'è split e presente nome lavorazione su clip groove
|
|
if tMhPar.split == nil and sCGM1 then
|
|
nTempT3, dMaxMat3, sMchngName3, nThBl3 = MB.GetToolDataFromAttrib( sCGM1, nCGM1i, false, true)
|
|
end
|
|
|
|
if DGD.bProoduce and not est and nTempT2 and nTempT2 < 0 then
|
|
dNumLog = -1193
|
|
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.split or tMhPar.split == nil) and tMhPar.d and nTempT1 and nTempT1 <= 0 then
|
|
dNumLog = -1198
|
|
sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT1, sDM, nDMi, tMhPar.d, dNumLog, sMchngName1)
|
|
elseif not est and ( tMhPar.split or tMhPar.split == nil) and nTempT1 then
|
|
tMhPar.d = nTempT1
|
|
-- se divido porta setto la larghezza/lunghezza cava
|
|
if tMhPar.split then
|
|
if tMhPar.dir == '0' then
|
|
tMhPar.W = nTempT1
|
|
DGD.WIDTH = nTempT1
|
|
elseif tMhPar.dir == '1' then
|
|
tMhPar.L = nTempT1
|
|
DGD.LENGTH = nTempT1
|
|
end
|
|
end
|
|
end
|
|
|
|
if tMhPar.d3 and nTempT0 and nTempT0 <= 0 then -- lama
|
|
if DGD.bProoduce and tMhPar.bl then -- se utilizzo la lama
|
|
dNumLog = -1199
|
|
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
|
|
-- se divido porta setto la larghezza cava
|
|
if tMhPar.split then
|
|
if tMhPar.dir == '0' then
|
|
tMhPar.W = nThBl0
|
|
DGD.WIDTH = nThBl0
|
|
elseif tMhPar.dir == '1' then
|
|
tMhPar.L = nThBl0
|
|
DGD.LENGTH = nThBl0
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
if DGD.bProoduce and not est and sCGM1 and nTempT3 and nTempT3 <= 0 then -- fresa side groove
|
|
dNumLog = -1192
|
|
sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT3, sCGM1, nCGM1i, 0, dNumLog, sMchngName3)
|
|
end
|
|
|
|
-- se lo spessore porta è maggiore della capacità lama
|
|
if tMhPar.bl and tMhPar.T and dMaxMat0 and tMhPar.T >= dMaxMat0 then
|
|
-- se non split porta disabilito la lama ed emetto un warning
|
|
if not tMhPar.split then
|
|
tMhPar.bl = false
|
|
tMhPar.LBM = nil
|
|
dNumLog = -1197
|
|
dNumMessage = 672
|
|
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, sMchngName0, EgtToUiUnits(tMhPar.T), EgtToUiUnits(dMaxMat0))
|
|
-- altrimenti se split limito l'affondamento alla massima profondità lama
|
|
else
|
|
tMhPar.T = dMaxMat0
|
|
end
|
|
end
|
|
|
|
-- se lo spessore porta è maggiore della capacità utensile hatching
|
|
if tMhPar.T and dMaxMat1 and tMhPar.T >= dMaxMat1 then
|
|
-- se non split porta disabilito la lavorazione ed emetto un warning
|
|
if not tMhPar.split then
|
|
tMhPar.DM = nil
|
|
dNumLog = -1196
|
|
dNumMessage = 672
|
|
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, sMchngName0, EgtToUiUnits(tMhPar.T), EgtToUiUnits(dMaxMat0))
|
|
-- altrimenti se split limito l'affondamento alla massima profondità fresa
|
|
else
|
|
tMhPar.T = dMaxMat1
|
|
end
|
|
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 non split door e se l'impronta lama è maggiore della lunghezza o larghezza escludo la lama e do messaggio di warning
|
|
if ( not tMhPar.split and (2*dMaxCutBladeLen) >= tMhPar.L) or ( not tMhPar.split and (2*dMaxCutBladeLen) >= tMhPar.W) then
|
|
tMhPar.bl = false
|
|
tMhPar.LBM = nil
|
|
dNumLog = -1195
|
|
dNumMessage = 673
|
|
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, sMchngName0)
|
|
end
|
|
end
|
|
|
|
-- se lo spessore fresa clip groove è maggiore dello spessore porta
|
|
if nThBl3 and nThBl3 >= DGD.dT then
|
|
dNumLog = -1191
|
|
dNumMessage = 698
|
|
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, sMchngName3, nThBl3, DGD.dT)
|
|
tMhPar.GCM = nil
|
|
end
|
|
|
|
-- se non split door e se il blade è attivo e utensile lama e c'è il clean corner, lo ricalcolo in funzione del raggio lama
|
|
if not tMhPar.split and 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 tMhPar.split then
|
|
if tMhPar.dir == '0' then
|
|
tMhPar.hml = DGD.dH * 1.5
|
|
tMhPar.dml = 0.75 * tMhPar.L
|
|
tMhPar.dmw = 0.75 * tMhPar.W
|
|
elseif tMhPar.dir == '1' then
|
|
tMhPar.hml = DGD.dW * 1.5
|
|
tMhPar.dml = 0.75 * tMhPar.L
|
|
tMhPar.dmw = 0.75 * tMhPar.W
|
|
end
|
|
end
|
|
|
|
-- setto l'eventuale diametro fresa per clip groove
|
|
tMhPar.d4 = nTempT3
|
|
tMhPar.th4 = nThBl3
|
|
|
|
if dNumLog ~= 0 then
|
|
return tMhPar, dNumLog, sMessToOut
|
|
end
|
|
|
|
return tMhPar, 0, ''
|
|
end
|
|
|
|
------------------------------ Disegno ----------------------------------------------------------------------
|
|
function VisionCutOut.Draw( tVisPar, bPreview, bRunByCompo, nDrawMach)
|
|
|
|
-- Assegno le dimensioni
|
|
local L = tVisPar.L
|
|
local W = tVisPar.W
|
|
local T = tVisPar.T
|
|
local R = tVisPar.R
|
|
local clc = tVisPar.clc
|
|
local ccr = tVisPar.ccr
|
|
local ccn = tVisPar.ccn
|
|
local hml = tVisPar.hml
|
|
local dml = tVisPar.dml
|
|
local dmw = tVisPar.dmw
|
|
local bl = tVisPar.bl
|
|
local dbl = tVisPar.dbl
|
|
local d = tVisPar.d -- hatching tool diameter
|
|
local d3 = tVisPar.d3 -- blade diameter
|
|
local ds = tVisPar.ds or false
|
|
local dRadToClean = tVisPar.dCleanNote or 0
|
|
local dConeCleanMode = tVisPar.Ccm
|
|
local est = tVisPar.est
|
|
local dir = tVisPar.dir
|
|
local split = tVisPar.split
|
|
local spo = tVisPar.spo
|
|
local T2 = tVisPar.T2
|
|
-- tabelle gola laterale clip (clip side groove)
|
|
local tClipSideGroove = {}
|
|
-- inserimento dati nella tabella fori
|
|
table.insert( tClipSideGroove, { tVisPar.grl, tVisPar.grt, tVisPar.gsd, tVisPar.ctc, tVisPar.mci, tVisPar.sat, tVisPar.sab, tVisPar.sal, tVisPar.sah, tVisPar.GCM, tVisPar.d4, tVisPar.th4})
|
|
-- Assegno i nomi
|
|
local LG = tVisPar.LG
|
|
local LM = tVisPar.LM
|
|
local CL = tVisPar.CL
|
|
local CLCN = tVisPar.CLCN
|
|
local DM = tVisPar.DM -- nome lavorazione hatchind
|
|
local LBM = tVisPar.LBM -- nome lavorazione con lama
|
|
local LA = tVisPar.LA -- nome lavorazione AS
|
|
-- variabili per messaggi e settaggi vari
|
|
local sCompoName = tVisPar.Nome
|
|
local nCompoNpar = tVisPar.Npar
|
|
local sCompoPath = tVisPar.Path
|
|
-- eventuale messaggio errore rilevato nell'adjust
|
|
local nCodAdj = tVisPar.nCod
|
|
local sCodAdj = tVisPar.sCod
|
|
-- variabili per messaggi e settaggi vari
|
|
local sNamePar1 = tVisPar.N1 or 'L'
|
|
local sNamePar2 = tVisPar.N2 or 'W'
|
|
local sNamePar3 = tVisPar.N3 or 'T'
|
|
local sNamePar4 = tVisPar.N4 or 'Radius'
|
|
local sNamePar5 = tVisPar.N5 or 'clc'
|
|
local sNamePar6 = tVisPar.N5 or 'ccr'
|
|
local sNamePar7 = tVisPar.N5 or 'gt1'
|
|
local sNamePar8 = tVisPar.N5 or 'gt2'
|
|
local sNamePar9 = tVisPar.N5 or 'gt3'
|
|
local sNamePar10 = tVisPar.N5 or 'gt4'
|
|
|
|
-- RunByComponentInterface
|
|
local RC = true
|
|
-- Messaggi codice errori
|
|
local EM = ' '
|
|
local EC = 0
|
|
local ErrorBase = 1100
|
|
|
|
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
|
|
|
|
if split and DM and LBM then
|
|
DM = LBM
|
|
end
|
|
|
|
-- variabile spostamento rettangolo con cava split trasversale
|
|
local dPosX = 0
|
|
|
|
-- variabili calcolo diamond shape
|
|
local nIpo1, nIpo2, nIpo3, dTan, dAng, dRad
|
|
|
|
if L and W then
|
|
-- se diamond shape
|
|
if ds then
|
|
if L > 0 and W > 0 then
|
|
nIpo1 = L/2
|
|
nIpo2 = W/2
|
|
nIpo3 = sqrt((nIpo1*nIpo1)+(nIpo2*nIpo2))
|
|
dTan = nIpo2/nIpo1
|
|
dAng = atan(dTan)
|
|
dRad = nIpo1 * sin(dAng)
|
|
-- se con raccordo
|
|
if R and R > 0 then
|
|
if R > dRad then
|
|
R = dRad
|
|
end
|
|
-- disabilito il clean corner
|
|
clc = 0
|
|
ccr = 0
|
|
end
|
|
else
|
|
R = 0
|
|
end
|
|
else
|
|
if R and R > 0 then
|
|
-- se raccordo maggiore della metà del lato più corto lo ricalcolo
|
|
if 2*R > min(L,W) then
|
|
R = min(L,W)/2
|
|
end
|
|
-- disabilito il clean corner
|
|
clc = 0
|
|
ccr = 0
|
|
end
|
|
end
|
|
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(W),'',EgtToUiUnits(DimMin), sCompoPath) -- il parametro 'W' deve essere > DimMin
|
|
W = DimMin
|
|
elseif ( not L or not W) and R and R < DimMin then
|
|
EC = 3
|
|
EM = string.format(EgtDoorsMsg[407],sNamePar4,EgtToUiUnits(R),'',EgtToUiUnits(DimMin), sCompoPath) -- il parametro 'R' deve essere > DimMin
|
|
R = DimMin
|
|
--[[
|
|
elseif CL and clc and clc > 0 and ( 2*clc) >= W then
|
|
EC = 5
|
|
EM = string.format(EgtDoorsMsg[407],sNamePar5..'*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 = 6
|
|
EM = string.format(EgtDoorsMsg[407],sNamePar5..'*2',EgtToUiUnits(clc),sNamePar1,EgtToUiUnits(L), sCompoPath) -- il parametro 'clc*2' deve essere > L
|
|
clc = L/2-0.2
|
|
]]--
|
|
elseif not ds and CL and clc and ccr and clc > 0 and ccr > 0 and (2*(ccr*sin(45))) >= clc then
|
|
EC = 7
|
|
EM = string.format(EgtDoorsMsg[407],sNamePar5,EgtToUiUnits(clc),'',EgtToUiUnits(2*(ccr*sin(45))), sCompoPath) -- il parametro 'clc' deve essere > 'crc'
|
|
clc = (2*(ccr*sin(45)))+0.2
|
|
elseif tClipSideGroove[1][10] and tClipSideGroove[1][2] and tClipSideGroove[1][2] >= DGD.dT then
|
|
EC = 8
|
|
EM = string.format(EgtDoorsMsg[699], sNamePar7, EgtToUiUnits( tClipSideGroove[1][2]), EgtToUiUnits(DGD.dT), sCompoPath) -- il parametro 'grt' deve essere < spessore porta
|
|
tClipSideGroove[1][2] = DGD.dT - 0.1
|
|
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 tHint = {}
|
|
local hint1, hint2
|
|
local pIni, pEnd, pCen
|
|
local GId, MId, CLC1, CLC2, CLC3, CLC4, DRP1
|
|
local CLCN1, CLCN2, CLCN3, CLCN4
|
|
local nKindGeom
|
|
local bSingleMode = true
|
|
|
|
-- Costruzione della geometria
|
|
if L and W then
|
|
if R and R > 0 then -- se c'e anche il raccordo
|
|
if ds then
|
|
GId = DrawDiamondWithFillet( Lg, W, L, T, R, dRad)
|
|
else
|
|
GId = DrawRectangleWithFillet ( Lg, W, L, T, R)
|
|
end
|
|
if GId then
|
|
EgtMove( GId, Point3d(W/2,-(L/2),0) - ORIG())
|
|
end
|
|
else -- rettangolo o diamond senza raccordo
|
|
if ds then
|
|
GId = DrawDiamondWithFillet( Lg, W, L, T, 0, dRad)
|
|
if GId then
|
|
EgtMove( GId, Point3d(W/2,-(L/2),0) - ORIG())
|
|
-- se ci sono i parametri per i percorsi clean corner
|
|
if CL and clc and clc > 0 and clc < nIpo3 then
|
|
-- angolo x-y0
|
|
CLC1 = MakeClcPath( clc, 0, CL, Lg, -T, false, ds, nIpo1, nIpo2, nIpo3)
|
|
EgtMove( CLC1, Point3d(0,-(L/2),T) - ORIG())
|
|
-- angolo x0y+
|
|
CLC2 = MakeClcPath( clc, 0, CL, Lg, -T, false, ds, nIpo2, nIpo1, nIpo3)
|
|
EgtRotate( CLC2, Point3d(0,0,0), Z_AX(), -90)
|
|
EgtMove( CLC2, Point3d((W/2),0,T) - ORIG())
|
|
-- angolo x+y0
|
|
CLC3 = EgtCopyGlob( CLC1, Lg)
|
|
EgtRotate( CLC3, Point3d(0,-(L/2),0), Z_AX(), 180)
|
|
EgtMove( CLC3, Point3d(W,0,0) - ORIG())
|
|
-- angolo x-y-
|
|
CLC4 = EgtCopyGlob( CLC2, Lg)
|
|
EgtRotate( CLC4, Point3d((W/2),0,0), Z_AX(), 180)
|
|
EgtMove( CLC4, Point3d(0,-L,0) - ORIG())
|
|
end
|
|
end
|
|
else
|
|
GId = EgtRectangle2P( Lg, Point3d( dPosX, 0, T), Point3d( dPosX + 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,0,T) - ORIG())
|
|
-- angolo x+y+
|
|
CLC2 = EgtCopyGlob( CLC1, Lg)
|
|
EgtRotate( CLC2, Point3d(0,0,0), Z_AX(), -90)
|
|
EgtMove( CLC2, Point3d(W,0,0) - ORIG())
|
|
-- angolo x+y-
|
|
CLC3 = EgtCopyGlob( CLC1, Lg)
|
|
EgtRotate( CLC3, Point3d(0,0,0), Z_AX(), 180)
|
|
EgtMove( CLC3, Point3d(W,-L,0) - ORIG())
|
|
-- angolo x-y-
|
|
CLC4 = EgtCopyGlob( CLC1, Lg)
|
|
EgtRotate( CLC4, Point3d(0,0,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,0,T) - ORIG())
|
|
-- angolo x+y+
|
|
CLCN2 = EgtCopyGlob( CLCN1, Lg)
|
|
EgtRotate( CLCN2, Point3d(0,0,0), Z_AX(), -90)
|
|
EgtMove( CLCN2, Point3d(W,0,0) - ORIG())
|
|
-- angolo x+y-
|
|
CLCN3 = EgtCopyGlob( CLCN1, Lg)
|
|
EgtRotate( CLCN3, Point3d(0,0,0), Z_AX(), 180)
|
|
EgtMove( CLCN3, Point3d(W,-L,0) - ORIG())
|
|
-- angolo x-y-
|
|
CLCN4 = EgtCopyGlob( CLCN1, Lg)
|
|
EgtRotate( CLCN4, Point3d(0,0,0), Z_AX(), 90)
|
|
EgtMove( CLCN4, Point3d(0,-L,0) - ORIG())
|
|
end
|
|
end
|
|
end
|
|
end
|
|
-- se non è diamond shape e clip groove presente
|
|
if not ds and tClipSideGroove and #tClipSideGroove == 1 then
|
|
|
|
local GrLen = tClipSideGroove[1][1]
|
|
local GrTh = tClipSideGroove[1][2]
|
|
local GSDpth = tClipSideGroove[1][3]
|
|
local CenToCrn = tClipSideGroove[1][4]
|
|
local MaxClInt = tClipSideGroove[1][5]
|
|
local TopSide = tClipSideGroove[1][6]
|
|
local BotSide = tClipSideGroove[1][7]
|
|
local LckSide = tClipSideGroove[1][8]
|
|
local HngSide = tClipSideGroove[1][9]
|
|
local GeomName = tClipSideGroove[1][10]
|
|
local dDiamTool = tClipSideGroove[1][11]
|
|
local dThickTool = tClipSideGroove[1][12]
|
|
local sLenSide
|
|
local bLessDistance = false
|
|
local nDistMinToCorner
|
|
|
|
-- se ci sono tutti i parametri
|
|
if GrLen and GrTh and GSDpth and CenToCrn and MaxClInt and GeomName then
|
|
|
|
-- determino l'ordine delle facce da verificare
|
|
local pOrd = {}
|
|
|
|
if DGD.Lock == 'L' then
|
|
pOrd = { 7, 8, 6, 9}
|
|
else
|
|
pOrd = { 7, 9, 6, 8}
|
|
end
|
|
|
|
-- Clip side groove
|
|
for k = 1, 4 do
|
|
|
|
-- se lato abilitato
|
|
if tClipSideGroove[1][pOrd[k]] then
|
|
|
|
if pOrd[k] == 6 or pOrd[k] == 7 then
|
|
sLenSide = W
|
|
else
|
|
sLenSide = L
|
|
end
|
|
local nStartDist
|
|
local nCalcStep
|
|
local nClips = 0
|
|
tHint = {}
|
|
|
|
-- se ho almeno una linea
|
|
if ( sLenSide - CenToCrn) >= 0 then
|
|
|
|
-- se ho un solo clip
|
|
if ( sLenSide <= ( 2 * CenToCrn)) or ( sLenSide <= MaxClInt) then
|
|
nClips = 1
|
|
nStartDist = sLenSide / 2
|
|
nCalcStep = 0
|
|
-- se tolto il passo massimo rimane un valore <= della distanza da corner,
|
|
-- utilizzo la distanza da corner per calcolare il passo
|
|
elseif ( sLenSide - MaxClInt ) <= CenToCrn then
|
|
nClips = 2
|
|
nStartDist = sLenSide / 3
|
|
nCalcStep = nStartDist
|
|
-- se tolto il passo massimo rimane un valore <= del passo max,
|
|
-- utilippo
|
|
elseif ( sLenSide - ( 2 * CenToCrn)) <= MaxClInt then
|
|
nClips = 2
|
|
nStartDist = CenToCrn
|
|
nCalcStep = sLenSide - ( 2 * CenToCrn)
|
|
-- calcolo quante linee inserire
|
|
else
|
|
local nTempClip = floor( ( sLenSide - ( 2 * CenToCrn)) / MaxClInt)
|
|
-- se il numero clip temporaneo per l'interasse + le distanze dal borda è inferiore alla lunghezza lato allora
|
|
-- sono prima del valore massimo
|
|
if ( nTempClip * MaxClInt) + ( 2 * CenToCrn) < ( sLenSide - GEO.EPS_SMALL * 10) then
|
|
nClips = nTempClip + 2
|
|
else
|
|
nClips = nTempClip + 1
|
|
end
|
|
|
|
nStartDist = CenToCrn
|
|
nCalcStep = ( sLenSide - ( 2 * CenToCrn)) / ( nClips - 1)
|
|
end
|
|
|
|
-- se la distanza minima è inferiore al raggio fresa do errore
|
|
nDistMinToCorner = nStartDist - ( GrLen / 2)
|
|
if nDrawMach > 0 and nDistMinToCorner <= ( dDiamTool / 2) + 2 then
|
|
bLessDistance = true
|
|
break
|
|
end
|
|
|
|
-- disegno linee
|
|
for i = 1, nClips do
|
|
|
|
pIni = Point3d( nStartDist + ( nCalcStep * ( i - 1)) - ( GrLen / 2), GSDpth, T/2)
|
|
pEnd = Point3d( nStartDist + ( nCalcStep * ( i - 1)) + ( GrLen / 2), GSDpth, T/2)
|
|
hint1 = DrawAddLineDrawCircle( pIni, pEnd, Lg, tHint, bPreview, Dm, 0, false, false, RED(), RED())
|
|
|
|
if hint1 then
|
|
-- sposto il percorso sul lato definito
|
|
if pOrd[k] == 7 then -- se lato bottom
|
|
EgtRotate( hint1, Point3d(W/2,0,0), Z_AX(), 180)
|
|
EgtMove( hint1, Point3d(0,-L,0) - ORIG())
|
|
elseif pOrd[k] == 8 then -- se lato lock
|
|
-- se lock a sinistra
|
|
if DGD.Lock == 'L' then
|
|
EgtRotate( hint1, Point3d(0,0,0), Z_AX(), 90)
|
|
EgtMove( hint1, Point3d(0,-L,0) - ORIG())
|
|
else
|
|
EgtRotate( hint1, Point3d(0,0,0), Z_AX(), -90)
|
|
EgtMove( hint1, Point3d(W,0,0) - ORIG())
|
|
end
|
|
elseif pOrd[k] == 9 then -- se lato hinge
|
|
-- se lock a sinistra
|
|
if DGD.Lock == 'L' then
|
|
EgtRotate( hint1, Point3d(0,0,0), Z_AX(), -90)
|
|
EgtMove( hint1, Point3d(W,0,0) - ORIG())
|
|
else
|
|
EgtRotate( hint1, Point3d(0,0,0), Z_AX(), 90)
|
|
EgtMove( hint1, Point3d(0,-L,0) - ORIG())
|
|
end
|
|
end
|
|
EgtModifyCurveThickness( hint1, 0)
|
|
EgtSetName( hint1, GeomName)
|
|
|
|
-- se spessore groove maggiore altezza utensile creo due percorsi
|
|
if nDrawMach > 0 and GrTh > ( dThickTool + 0.2) then
|
|
EgtMove( hint1, Point3d(0,0,( GrTh - dThickTool)/2) - ORIG())
|
|
hint2 = EgtCopyGlob( hint1, Lg)
|
|
EgtMove( hint2, Point3d(0,0,-( GrTh - dThickTool)) - ORIG())
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- se distanza minima inferiore del raggio utensile do errore
|
|
if bLessDistance then
|
|
EC = (ErrorBase+6)
|
|
EM = string.format(EgtDoorsMsg[700], EgtToUiUnits(nDistMinToCorner),EgtToUiUnits( ( dDiamTool / 2) + 2))
|
|
end
|
|
end
|
|
end
|
|
elseif R then
|
|
GId = EgtCircle( Lg, Point3d( 0, 0, T), R , GDB_RT.GLOB)
|
|
elseif split == nil then
|
|
EC = (ErrorBase+4)
|
|
EM = EgtDoorsMsg[408] -- mancano i parametri delle dimensioni
|
|
end
|
|
if GId then
|
|
EgtModifyCurveThickness( GId, -T)
|
|
EgtInvertCurve( GId)
|
|
EgtSetName( GId, LG)
|
|
end
|
|
if GId and ( split == nil or ( split and dir == '1')) then
|
|
-- creo estrusi e superfici piane delle geometrie passanti
|
|
AddSurfTmByExtrusion( Lg, GId, bSingleMode)
|
|
end
|
|
-- stampo messaggio con il valore del lato
|
|
if ds then
|
|
EgtOutText( 'Diamond shape Side Length: '..EgtNumToString( EgtIf( EgtUiUnitsAreMM(), nIpo3, nIpo3 / GEO.ONE_INCH), 4))
|
|
end
|
|
|
|
-- Costruzione della geometria di lavorazione
|
|
if nDrawMach > 0 then -- se abilitata geometria lavorazione
|
|
if ( L and W) or R then -- se ci sono tutti i parametri necessari
|
|
if not split then
|
|
if L and W then -- se ci sono parametri minimi per il rettangolo
|
|
nKindGeom = 1 -- setto il tipo di geometria
|
|
if R and R > 0 then -- se c'e anche il parametro per il raccordo
|
|
if ds then
|
|
MId, nKindGeom = DrawDiamondWithFillet( Lg, W, L, T, R, dRad, DGD.Lock)
|
|
else
|
|
MId = DrawRectangleWithFillet( Lg, W, L, T, R)
|
|
end
|
|
if MId then
|
|
EgtMove( MId, Point3d(W/2,-(L/2),0) - ORIG())
|
|
end
|
|
if not ds then
|
|
-- se partenza su lato default ( che è il lato lock)
|
|
if not spo or spo == 0 or spo >= 4 then
|
|
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
|
|
-- saltrimenti e partenza su lato top
|
|
elseif spo == 1 then
|
|
EgtChangeClosedCurveStartPoint( MId, Point3d( W /2, 0, T), GDB_RT.GLOB)
|
|
-- saltrimenti e partenza su lato bottom
|
|
elseif spo == 2 then
|
|
EgtChangeClosedCurveStartPoint( MId, Point3d( W /2, - L, T), GDB_RT.GLOB)
|
|
-- saltrimenti e partenza su lato hinge
|
|
elseif spo == 3 then
|
|
if DGD.Lock == 'L' then
|
|
EgtChangeClosedCurveStartPoint( MId, Point3d( W, - L /2, T), GDB_RT.GLOB)
|
|
else
|
|
EgtChangeClosedCurveStartPoint( MId, Point3d( 0, - L /2, T), GDB_RT.GLOB)
|
|
end
|
|
end
|
|
end
|
|
else -- solo rettangolo o diamond senza raccordo
|
|
if ds then
|
|
MId, nKindGeom = DrawDiamondWithFillet( Lg, W, L, T, 0, dRad, DGD.Lock)
|
|
EgtMove( MId, Point3d(W/2,-(L/2),0) - ORIG())
|
|
else
|
|
MId = EgtRectangle2P( Lg, Point3d( 0, 0, T), Point3d( W, -L, T), GDB_RT.GLOB)
|
|
-- se partenza su lato default ( che è il lato lock)
|
|
if not spo or spo == 0 or spo >= 4 then
|
|
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
|
|
-- saltrimenti e partenza su lato top
|
|
elseif spo == 1 then
|
|
EgtChangeClosedCurveStartPoint( MId, Point3d( W /2, 0, T), GDB_RT.GLOB)
|
|
-- saltrimenti e partenza su lato bottom
|
|
elseif spo == 2 then
|
|
EgtChangeClosedCurveStartPoint( MId, Point3d( W /2, - L, T), GDB_RT.GLOB)
|
|
-- saltrimenti e partenza su lato hinge
|
|
elseif spo == 3 then
|
|
if DGD.Lock == 'L' then
|
|
EgtChangeClosedCurveStartPoint( MId, Point3d( W, - L /2, T), GDB_RT.GLOB)
|
|
else
|
|
EgtChangeClosedCurveStartPoint( MId, Point3d( 0, - L /2, T), GDB_RT.GLOB)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
elseif R then -- se c'è solo il parametro di raggio disegno la forma circolare
|
|
nKindGeom = 2 -- setto il tipo di geometria
|
|
MId = EgtCircle( Lg, Point3d( 0, 0, T), R , GDB_RT.GLOB)
|
|
-- se partenza su lato default ( che è il lato lock)
|
|
if not spo or spo == 0 or spo >= 4 then
|
|
if DGD.Lock == 'L' then
|
|
EgtChangeClosedCurveStartPoint( MId, Point3d( -R, 0, T), GDB_RT.GLOB)
|
|
else
|
|
EgtChangeClosedCurveStartPoint( MId, Point3d( R, 0, T), GDB_RT.GLOB)
|
|
end
|
|
-- saltrimenti e partenza su lato top
|
|
elseif spo == 1 then
|
|
EgtChangeClosedCurveStartPoint( MId, Point3d( 0, R, T), GDB_RT.GLOB)
|
|
-- saltrimenti e partenza su lato bottom
|
|
elseif spo == 2 then
|
|
EgtChangeClosedCurveStartPoint( MId, Point3d( 0, -R, T), GDB_RT.GLOB)
|
|
-- saltrimenti e partenza su lato hinge
|
|
elseif spo == 3 then
|
|
if DGD.Lock == 'L' then
|
|
EgtChangeClosedCurveStartPoint( MId, Point3d( R, 0, T), GDB_RT.GLOB)
|
|
else
|
|
EgtChangeClosedCurveStartPoint( MId, Point3d( -R, 0, T), GDB_RT.GLOB)
|
|
end
|
|
end
|
|
end
|
|
else
|
|
if L and W then -- se ci sono parametri minimi per il rettangolo
|
|
nKindGeom = 1 -- setto il tipo di geometria
|
|
end
|
|
end
|
|
|
|
-- se ci sono tutti i parametri per l'hatching
|
|
if DM and ( ( hml and dml) or dmw) then
|
|
|
|
local hint_ofs
|
|
local bMakeDrop
|
|
|
|
if not d then d = 0 end
|
|
|
|
-- se esiste un diametro faccio l'offset del percorso esterno per calcolare eventuale intersezioni
|
|
if d > 0 then
|
|
-- offset
|
|
if not split then
|
|
hint_ofs = EgtOffsetCurveAdv( GId, EgtIf( ds, (d*55/64),(d*35/64)), GDB_OT.FILLET)
|
|
else
|
|
hint_ofs = EgtOffsetCurveAdv( GId, 0, GDB_OT.FILLET)
|
|
end
|
|
if hint_ofs then
|
|
EgtModifyCurveThickness( hint_ofs, 0)
|
|
end
|
|
end
|
|
|
|
-- se l'utensile e i parametri per la lunghezza sono presenti
|
|
if d > 0 and hml and dml then
|
|
|
|
local nStep -- numero di passate
|
|
local dStep -- passo ricalcolato
|
|
local dDistI -- distanza iniziale
|
|
local dDistF -- distanza finale
|
|
local dPos -- Posizione di partenza Y
|
|
bMakeDrop = false
|
|
|
|
-- in base al tipo di geometria faccio i dovuti controlli
|
|
if nKindGeom == 1 then -- se e' un rettangolo
|
|
|
|
local dDimGeom = L
|
|
if dir == '1' then
|
|
dDimGeom = W
|
|
end
|
|
|
|
-- se lunghezza inferiore del limite inserisco le linee
|
|
if dDimGeom <= hml then
|
|
if not dir or dir == '1' then
|
|
if L > dml then -- se lunghezza e' maggiore del drop inserisco linee
|
|
-- determino quante linee inserire
|
|
nStep = ceil(L/dml) -- numero di passate
|
|
dStep = (L/nStep) -- passo ricalcolato
|
|
dDistI = dPosX
|
|
dDistF = dPosX + W
|
|
dPos = 0
|
|
bMakeDrop = true
|
|
end
|
|
end
|
|
end
|
|
elseif nKindGeom == 2 then -- se e' un cerchio
|
|
-- se diametro inferiore del limite inserisco le linee
|
|
if (2*R) <= hml then
|
|
if (2*R) > dml then -- se diametro e' maggiore del drop inserisco linee
|
|
-- determino quante linee inserire
|
|
nStep = ceil((2*R)/dml) -- numero di passate
|
|
dStep = ((2*R)/nStep) -- passo ricalcolato
|
|
dDistI = -R
|
|
dDistF = R
|
|
dPos = R
|
|
bMakeDrop = true
|
|
end
|
|
end
|
|
end
|
|
|
|
if bMakeDrop then
|
|
|
|
local nPass = 1
|
|
local nDir = 1
|
|
bExistsHatching = bMakeDrop
|
|
if split then d = 0 end
|
|
|
|
-- ciclo inserimento linee
|
|
while nPass < nStep do
|
|
|
|
pIni = Point3d( EgtIf( nDir > 0, (dDistI+(d*9/16)), (dDistF-(d*9/16))),(dPos-(dStep*nPass)),T)
|
|
pEnd = Point3d( EgtIf( nDir > 0, (dDistF-(d*9/16)), (dDistI+(d*9/16))),(dPos-(dStep*nPass)),T)
|
|
hint1 = DrawAddLineDrawCircle( pIni, pEnd, Lg, nil, bPreview, Dm, 0, false, false, RED(), RED())
|
|
-- calcolo intersezioni con il percorso di offset
|
|
hint1 = CalcIntersect( hint1, hint_ofs, pIni, pEnd, (d*1/64))
|
|
-- 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)
|
|
EgtSetInfo( DRP1, 'DirectionCut', 'W')
|
|
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
|
|
|
|
if d > 0 and dmw then
|
|
|
|
local nStep -- numero di passate
|
|
local dStep -- passo ricalcolato
|
|
local dDistI -- distanza iniziale
|
|
local dDistF -- distanza finale
|
|
local dPos -- Posizione di partenza X
|
|
bMakeDrop = false
|
|
|
|
-- in base al tipo di geometria faccio i dovuti controlli
|
|
if nKindGeom == 1 then -- se e' un rettangolo
|
|
-- se lunghezza inferiore del limite inserisco le linee
|
|
if L <= hml then
|
|
if not dir or dir == '0' then
|
|
if W > dmw then -- se larghezza e' maggiore del drop inserisco linee
|
|
-- determino quante linee inserire
|
|
nStep = ceil(W/dmw) -- numero di passate
|
|
dStep = (W/nStep) -- passo ricalcolato
|
|
dDistI = 0
|
|
dDistF = -L
|
|
dPos = 0
|
|
bMakeDrop = true
|
|
end
|
|
end
|
|
end
|
|
elseif nKindGeom == 2 then -- se e' un cerchio
|
|
-- se diametro inferiore del limite inserisco le linee
|
|
if (2*R) <= hml then
|
|
if (2*R) > dmw then -- se diametro e' maggiore del drop inserisco linee
|
|
-- determino quante linee inserire
|
|
nStep = ceil((2*R)/dmw) -- numero di passate
|
|
dStep = ((2*R)/nStep) -- passo ricalcolato
|
|
dDistI = R
|
|
dDistF = -R
|
|
dPos = -R
|
|
bMakeDrop = true
|
|
end
|
|
end
|
|
end
|
|
|
|
if bMakeDrop then
|
|
|
|
local nPass = 1
|
|
local nDir = 1
|
|
bExistsHatching = bMakeDrop
|
|
if split then d = 0 end
|
|
|
|
-- ciclo inserimento linee
|
|
while nPass < nStep do
|
|
|
|
pIni = Point3d( ((dStep*nPass)+dPos), EgtIf( nDir > 0, (dDistI-(d*9/16)), (dDistF+(d*9/16))),T)
|
|
pEnd = Point3d( ((dStep*nPass)+dPos), EgtIf( nDir > 0, (dDistF+(d*9/16)), (dDistI-(d*9/16))),T)
|
|
hint1 = DrawAddLineDrawCircle( pIni, pEnd, Lg, nil, bPreview, Dm, 0, false, false, RED(), RED())
|
|
-- calcolo intersezioni con il percorso di offset
|
|
hint1 = CalcIntersect( hint1, hint_ofs, pIni, pEnd, (d*1/64))
|
|
-- 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)
|
|
EgtSetInfo( DRP1, 'DirectionCut', 'H')
|
|
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
|
|
|
|
-- se esiste il percorso offsettato lo cancello
|
|
if hint_ofs then
|
|
EgtErase( hint_ofs)
|
|
end
|
|
end
|
|
|
|
if MId then
|
|
EgtModifyCurveThickness( MId, -T)
|
|
EgtInvertCurve( MId)
|
|
|
|
if bl then
|
|
EgtSetName( MId, LBM)
|
|
EgtSetInfo( MId, 'ByBlade', bl)
|
|
else
|
|
EgtSetName( MId, LM)
|
|
end
|
|
end
|
|
|
|
-- eventuale antischeggia per split (validi se rotazione utensile di split oraria)
|
|
if split and T2 and LA then
|
|
local bHoriz = ( dir ~= '0')
|
|
local bBvDw = ( DGD.sSecSide == 'UP')
|
|
local ptP1, ptP2, vtDir, vtExtr
|
|
if bHoriz then
|
|
ptP1 = EgtIf( bBvDw, Point3d( 0, 0, 0), Point3d( W, 0, DGD.dT))
|
|
ptP2 = EgtIf( bBvDw, Point3d( W, -L, 0), Point3d( 0, -L, DGD.dT))
|
|
vtDir = EgtIf( bBvDw, Z_AX(), -Z_AX())
|
|
vtExtr = EgtIf( bBvDw, -X_AX(), X_AX())
|
|
else
|
|
ptP1 = EgtIf( bBvDw, Point3d( W, 0, 0), Point3d( 0, 0, DGD.dT))
|
|
ptP2 = EgtIf( bBvDw, Point3d( 0, -L, 0), Point3d( W, -L, DGD.dT))
|
|
vtDir = EgtIf( bBvDw, Z_AX(), -Z_AX())
|
|
vtExtr = Y_AX()
|
|
end
|
|
-- prima linea
|
|
local As1Id = EgtLinePVL( Lg, ptP1, vtDir, DGD.dT, GDB_RT.LOC)
|
|
EgtModifyCurveExtrusion( As1Id, vtExtr)
|
|
EgtModifyCurveThickness( As1Id, -T2)
|
|
EgtSetName( As1Id, LA)
|
|
-- seconda linea
|
|
local As2Id = EgtLinePVL( Lg, ptP2, vtDir, DGD.dT, GDB_RT.LOC)
|
|
EgtModifyCurveExtrusion( As2Id, -vtExtr)
|
|
EgtModifyCurveThickness( As2Id, -T2)
|
|
EgtSetName( As2Id, LA)
|
|
end
|
|
|
|
elseif split == nil then
|
|
EC = (ErrorBase+5)
|
|
EM = EgtDoorsMsg[408] -- mancano i parametri delle dimensioni
|
|
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' , 'VisionCutOut')
|
|
EgtSetInfo( Lg, 'L' , L)
|
|
EgtSetInfo( Lg, 'H' , H)
|
|
EgtSetInfo( Lg, 'R' , R)
|
|
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, 'dir' , dir)
|
|
EgtSetInfo( Lg, 'split' , split)
|
|
EgtSetInfo( Lg, 'ds' , ds)
|
|
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 VisionCutOut
|