29 Commits

Author SHA1 Message Date
carlo.baronchelli 0464742a5e (Aggiornato messaggio versione) 2021-12-02 12:46:15 +01:00
carlo.baronchelli 8720604fb3 Modificato colore bordi e label angoli per frontalini (da verde a blu) 2021-12-02 12:45:33 +01:00
carlo.baronchelli 9527509c62 Aggiunta gestione (provvisoria?) spessore lastra 2021-12-01 17:11:04 +01:00
carlo.baronchelli 5149644550 Aggiunto caso b.r1r3, aggiornato b1.r1r2r3, aggiunte funzioni <Spostemento31> e <Spostamento 41> 2021-11-30 20:55:24 +01:00
Carlo Baronchelli f16baf745a Correzione in funct. SideSetInfoC 2021-11-29 18:05:28 +01:00
Carlo Baronchelli 336f52cf8e Introdotto funzioni <Spostamento30 > e <Spostamento40> 2021-11-29 16:32:50 +01:00
carlo.baronchelli 7782aaab76 Aggiunto casi, corretto un errore 2021-11-29 10:34:23 +01:00
carlo.baronchelli 60e91064ed Aggiunto casi [b1.r1r2], [b1.r2r3]; + Tarature parametri di offset vari; + funzioni per spostamenti 2021-11-23 21:31:04 +01:00
carlo.baronchelli 975d6acd19 taratura e sistemazione 'definitiva' delle etichettature dei lati con indicazione degli angoli di taglio 2021-11-17 17:40:32 +01:00
carlo.baronchelli 997df4745d Correzione errore spostamento retangolo 2 in [a.r1r2] ('<0' anziché '>0') 2021-11-16 23:10:19 +01:00
carlo.baronchelli 778eca1aaa da buttare via ? modiifcato alcune variabili, sembra non venga eseguito, no debug ... 2021-11-10 19:34:23 +01:00
carlo.baronchelli 2ae9613f2b Riorganizzato caso [a] degli 'spostamenti' 2021-11-09 19:57:00 +01:00
carlo.baronchelli ec6208f1a8 Correzione e paini vari con funzione di simmetria e ribaltamento aggiornate 2021-11-08 11:35:29 +01:00
carlo.baronchelli f77bd1fee3 Aggiunto etichettatura (prizzontale) lati compo con eventuali angoli di taglio 2021-11-07 20:38:56 +01:00
carlo.baronchelli 700137c6d1 Prove varie per dimensioni etichette 2021-11-05 22:23:22 +01:00
carlo.baronchelli 6c0bcb1173 Modifiche per inseimento dimensioni A/F 2021-11-04 23:16:26 +01:00
carlo.baronchelli e160ec0558 Introduzione in EgtCompo delle funzioni per Mirror del componente 2021-10-29 11:11:47 +02:00
carlo.baronchelli a796a64db4 Sistemazioni varie 2021-10-28 13:10:41 +02:00
carlo.baronchelli 6405bb0a45 Inserimento etichietta 'dimensioni dell'oggetto' su ciascun elemento A/F 2021-10-27 21:43:03 +02:00
carlo.baronchelli 1bc8c6c273 Modifiche per Indicazione dimensioni su ciascun pezzo A/F 2021-10-27 21:41:22 +02:00
Carlo Baronchelli e5a366ced1 Come precedente 2021-10-19 16:53:22 +02:00
Carlo Baronchelli c2a4e995f4 Correzioni per etichette e altro 2021-10-19 16:52:09 +02:00
Carlo Baronchelli ddda3debaa Aggiunti file .txt (VisualBasic) per consultazione 2021-10-18 17:10:48 +02:00
Carlo Baronchelli 4ef934c7d8 Corretto due commenti 2021-10-18 16:57:51 +02:00
Carlo Baronchelli 2bd6c22fbf Modificato file di configurazione per OmagCut 2021-10-18 16:54:38 +02:00
Carlo Baronchelli 2a885f9bff Corretto PcucinaC23.lua per riballtamento e simmetria 2021-10-18 16:53:03 +02:00
carlo.baronchelli 8b8fd31eba Predisposizione per modifica ribaltamento e simmetria 2021-10-16 07:51:24 +02:00
Carlo Baronchelli 190496769f Modificato commento '6/10/2021 .... ' 2021-10-06 14:39:16 +02:00
Carlo Baronchelli 58d2d9ce4d Ridenominazione file 2021-10-06 14:18:32 +02:00
32 changed files with 2182 additions and 1390 deletions
+10 -6
View File
@@ -39,6 +39,9 @@ if EgtGetLanguage() == 'ITA' then
EgtCompoMsg[53] = 'I lati L1 e L5 non si incontrano e L5 tende a intersecare L2 ' --non usato
EgtCompoMsg[101] = 'La differenza tra B e S deve essere maggiore o uguale a '
EgtCompoMsg[102] = 'La differenza tra A e D + E deve essere maggiore o uguale a '
-- Alzatine/Frontalini
EgtCompoMsg[150] = 'Un layer non è stato trovato' -- da tradurre
EgtCompoMsg[160] = 'caso non previsto' -- da tradurre
-- Piani cucina
EgtCompoMsg[201] = 'Differenza lunghezze A-D troppo piccola: deve essere maggiore o uguale a '
EgtCompoMsg[202] = 'Differenza LC-LB troppo piccola: deve essere maggiore o uguale a '
@@ -97,8 +100,6 @@ if EgtGetLanguage() == 'ITA' then
-- Ribasso
EgtCompoMsg[360] = 'Raggio R deve essere minore di '
EgtCompoMsg[360] = 'Raggio R deve essere maggiore di '
-- Alzatine/Frontalini
EgtCompoMsg[370] = 'non previsto'
elseif EgtGetLanguage() == 'DEU' then
EgtCompoMsg[1] = 'Box = '
@@ -134,6 +135,9 @@ elseif EgtGetLanguage() == 'DEU' then
EgtCompoMsg[53] = 'I lati L1 e L5 non si incontrano e L5 tende a intersecare L2 ' -- not used
EgtCompoMsg[101] = 'B - S must be greater than or equal to '
EgtCompoMsg[101] = 'A - D - E must be greater than or equal to '
-- Alzatine/Frontalini
EgtCompoMsg[150] = 'Un layer non è stato trovato' -- da tradurre
EgtCompoMsg[160] = 'caso non previsto' -- da tradurre
-- Piani cucina
EgtCompoMsg[201] = 'LA - LD must be greater than or equal to '
EgtCompoMsg[202] = 'LC - LB must be greater than or equal to '
@@ -192,8 +196,7 @@ elseif EgtGetLanguage() == 'DEU' then
-- Ribasso
EgtCompoMsg[360] = 'Raggio R deve essere minore di '
EgtCompoMsg[360] = 'Raggio R deve essere maggiore di '
-- Alzatine/Frontalini
EgtCompoMsg[370] = 'non previsto' -- da tradurre
else -- default 'ENG'
EgtCompoMsg[1] = 'Box = '
EgtCompoMsg[2] = 'Sides / Dimensions must be greater than or equal to '
@@ -227,6 +230,9 @@ else -- default 'ENG'
EgtCompoMsg[53] = 'I lati L1 e L5 non si incontrano e L5 tende a intersecare L2 ' -- not used
EgtCompoMsg[101] = 'B - S must be greater than or equal to '
EgtCompoMsg[101] = 'A - D - E must be greater than or equal to '
-- Alzatine/Frontalini
EgtCompoMsg[150] = 'Un layer non è stato trovato' -- da tradurre
EgtCompoMsg[160] = 'caso non previsto' -- da tradurre
-- Piani cucina
EgtCompoMsg[201] = 'LA - LD must be greater than or equal to '
EgtCompoMsg[202] = 'LC - LB must be greater than or equal to '
@@ -285,8 +291,6 @@ else -- default 'ENG'
-- Ribasso
EgtCompoMsg[360] = 'Radius R must be less than '
EgtCompoMsg[360] = 'Radius R must be bigger than '
-- Alzatine/Frontalini
EgtCompoMsg[370] = 'non previsto' -- da tradurre
end
return EgtCompoMsg
@@ -0,0 +1,209 @@
' permette di inserire più di un part
Private Function MakeMultipleInsert(ByVal nNbr As Integer, sName As String) As Boolean
Dim InsertColor As Color3d = New Color3d(89, 210, 210)
CompoColor(InsertColor, m_MainWindow.GetIniFile())
' Imposto il contesto corrente
EgtSetCurrentContext(DrawScene.GetCtx())
Dim Pz As Integer = -1
Dim NxtPz As Integer = -1
' Cancello layer regioni per selezione buchi
Pz = EgtGetFirstGroupInGroup(GDB_ID.ROOT)
While Pz <> -1
' imposto il contesto corrente
EgtSetCurrentContext(DrawScene.GetCtx())
' salvo il file temporaneo per studio delle alzatine
EgtSaveFile("c:\EgtData\OmagCUT\Temp\TempAlzatine.nge", NGE.CMPTEXT)
' cerco un altro pezzo nell'elenco
NxtPz = EgtGetNextPart(Pz)
Dim SelectRegion As Integer = EgtGetFirstNameInGroup(Pz, "SelectRegion")
EgtErase(SelectRegion)
' Cancello layer etichette, quotatura,ausiliario e box
EgtErase(EgtGetFirstNameInGroup(Pz, "LayAux"))
EgtErase(EgtGetFirstNameInGroup(Pz, "Etichette"))
EgtErase(EgtGetFirstNameInGroup(Pz, "Quotature"))
EgtErase(EgtGetFirstNameInGroup(Pz, "Box"))
' Cancello layer etichette dei componenti interni (buchi)
Dim nHLId As Integer = EgtGetFirstNameInGroup(Pz, "HoleLabels")
While nHLId <> GDB_ID.NULL
EgtErase(nHLId)
nHLId = EgtGetFirstNameInGroup(Pz, "HoleLabels")
End While
' Attivo visualizzazione misura
Dim nRegLayId As Integer = EgtGetFirstNameInGroup(Pz, NAME_REGION)
Dim nId As Integer = EgtGetFirstInGroup(nRegLayId)
While nId <> GDB_ID.NULL
If EgtGetType(nId) = GDB_TY.EXT_TEXT Then
EgtSetStatus(nId, GDB_ST.ON_)
End If
nId = EgtGetNext(nId)
End While
' Calcolo dimensione ingombro Pezzo tramite OutLoop
Dim nOutLoopLayer = EgtGetFirstNameInGroup(Pz, NAME_OUTLOOP)
Dim b3Part As New BBox3d
EgtGetBBoxGlob(nOutLoopLayer, GDB_BB.STANDARD, b3Part)
' Muovo la regione in Z per evitare problemi in visualizzazione
EgtMove(nRegLayId, New Vector3d(0, 0, DELTAZ_REG), GDB_RT.GLOB)
' Se pezzo con dati TRF
If m_bTrfData Then
' Nome da dati Trf
Dim nTextId = EgtGetFirstInGroup(nRegLayId)
While nTextId <> GDB_ID.NULL
If EgtGetType(nTextId) = GDB_TY.EXT_TEXT Then
Dim sText As String = m_TrfOrderCode & "-" & m_TrfOrderDesc
Dim sText2 As String = m_TrfMatCode & "-" & m_TrfSurfCode
Dim sText3 As String = LenToString(b3Part.DimX(), 0) & " x " & LenToString(b3Part.DimY(), 0) & " x " & LenToString(m_TrfThickness, 0)
Dim dRatio As Double = Math.Max(b3Part.DimX(), b3Part.DimY()) / Math.Min(b3Part.DimX(), b3Part.DimY())
If dRatio < 5 Then
sText = sText & "<br/>" & sText2 & "<br/>" & sText3
Else
sText = sText & " " & sText2 & " " & sText3
End If
EgtModifyText(nTextId, sText)
Dim ptCen As Point3d
EgtCenterPoint(nTextId, ptCen)
Dim b3Text As New BBox3d
EgtGetBBoxGlob(nTextId, GDB_BB.STANDARD, b3Text)
Dim dCoeff As Double = Math.Min(b3Part.DimX() / b3Text.DimX(), b3Part.DimY() / b3Text.DimY()) / 1.25
If dCoeff < 1 Then EgtScale(nTextId, New Frame3d(ptCen), dCoeff, dCoeff, dCoeff)
Exit While
End If
nTextId = EgtGetNext(nTextId)
End While
' Info di pezzo da dati Trf
EgtSetInfo(Pz, "OC", m_TrfOrderCode)
EgtSetInfo(Pz, "OD", m_TrfOrderDesc)
EgtSetInfo(Pz, "PC", m_TrfPartCode)
EgtSetInfo(Pz, "MT", m_TrfMatCode)
EgtSetInfo(Pz, "SRF", m_TrfSurfCode)
EgtSetInfo(Pz, "L", DoubleToString(b3Part.DimX(), 1))
EgtSetInfo(Pz, "W", DoubleToString(b3Part.DimY(), 1))
EgtSetInfo(Pz, "T", m_TrfThickness)
EgtSetInfo(Pz, "V1", DoubleToString(b3Part.DimX(), 1))
EgtSetInfo(Pz, "V2", DoubleToString(b3Part.DimY(), 1))
' Se altrimenti pezzo con dati Csv
ElseIf m_bCsvData Then
' Nome del pezzo
EgtSetName(Pz, m_sCsvName)
' Dati Csv
EgtSetInfo(Pz, INFO_CSV_PART, m_sCsvName)
EgtSetInfo(Pz, INFO_CSV_ORD, m_sCsvOrder)
EgtSetInfo(Pz, INFO_CSV_DIST, m_sCsvList)
EgtSetInfo(Pz, INFO_CSV_MAT, m_MainWindow.m_CurrentMachine.CurrMat.sName)
EgtSetInfo(Pz, INFO_CSV_V1, DoubleToString(b3Part.DimX(), 1))
EgtSetInfo(Pz, INFO_CSV_V2, DoubleToString(b3Part.DimY(), 1))
' Se definito nome lo inserisco nel testo
If Not String.IsNullOrWhiteSpace(m_sCsvName) Then
Dim nTextId = EgtGetFirstInGroup(nRegLayId)
While nTextId <> GDB_ID.NULL
If EgtGetType(nTextId) = GDB_TY.EXT_TEXT Then
Dim sText As String = String.Empty
EgtTextGetContent(nTextId, sText)
Dim sNewText = m_sCsvName & "<br/>" & sText
EgtModifyText(nTextId, sNewText)
Exit While
End If
nTextId = EgtGetNext(nTextId)
End While
End If
' Altrimenti pezzo con dati normali
Else
' Se definito nome lo inserisco nel testo
If Not String.IsNullOrWhiteSpace(sName) Then
Dim nTextId = EgtGetFirstInGroup(nRegLayId)
While nTextId <> GDB_ID.NULL
If EgtGetType(nTextId) = GDB_TY.EXT_TEXT Then
Dim sText As String = String.Empty
EgtTextGetContent(nTextId, sText)
Dim sNewText = sName & "<br/>" & sText
EgtModifyText(nTextId, sNewText)
Exit While
End If
nTextId = EgtGetNext(nTextId)
End While
End If
End If
' Eventuale testo per indicare il sopra (solo nel caso di rettangolo)
If TopChBx.IsVisible() And TopChBx.IsChecked() Then
Utility.AddTopToPartRegion(nRegLayId)
End If
' Scrivo testi per nesting
SideAngle.WriteSideAngleForNest(DrawScene.GetCtx())
' Imposto colore testi
Utility.SetTextColor(nRegLayId)
' Imposto il colore del pezzo inserito nel progetto
Dim nPartInRegion As Integer = EgtGetFirstInGroup(nRegLayId)
EgtSetColor(nPartInRegion, InsertColor)
' Esporto il pezzo in un file temporaneo
Dim sTmpFile As String = m_MainWindow.GetTempDir() & "\FlatPartCompo.Nge"
If Not EgtSaveObjToFile(Pz, sTmpFile, NGE.BIN) Then
Return False
End If
' Passo al contesto principale
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
' Recupero flag per inserimento diretto in grezzo (altrimenti in parcheggio)
Dim bDirect As Boolean = (GetPrivateProfileInt(S_NEST, K_DIRECT, 0, m_MainWindow.GetIniFile()) <> 0)
' Elimino eventuali precedenti pezzi vuoti
EgtEraseEmptyParts()
' Area dei nuovi pezzi
Dim dNewArea As Double = 0
' Se esiste il file del pezzo
If My.Computer.FileSystem.FileExists(sTmpFile) Then
' eseguo inserimento
For i As Integer = 1 To nNbr
' Inserisco il pezzo
EgtInsertFile(sTmpFile)
' Ne recupero l'Id
Dim nId2 As Integer = EgtGetLastPart()
' Aggiusto per lavorazioni
EgtAdjustFlatPart(nId2)
' Se dati Trf assegno nome univoco
If m_bTrfData Then EgtSetInfo(nId2, "CsvPart", m_TrfOrderCode & "-" & nId2.ToString())
' Aggiorno l'area dei nuovi pezzi
dNewArea += GeomCalc.GetPartArea(nId2)
' Inserisco in parcheggio
m_MainWindow.m_CadCutPageUC.m_NestPage.StoreOnePart(nId2, True)
' ------------------------ AGGIUNGO PEZZO NEL VEINMATCH ----------------------------------
' verifico che il pezzo sia un Piano Cucina o un Piano Bagno o un'Aletta
Dim sCMP As String = String.Empty
EgtGetInfo(nId2, "CMP", sCMP)
If sCMP.StartsWith("PCucina") Or sCMP.StartsWith("PBagno") Or sCMP.StartsWith("AlzFront") Then
' Aggiungo riferimento e lo inserisco in VeinMatching
VeinMatching.SetRefOnPart(nId2)
VeinMatching.AddPartFromDraw(nId2)
' Se richiesto posizionamento diretto, lo eseguo
If bDirect Then
If m_MainWindow.m_CadCutPageUC.m_NestPage.InsertOnePart(nId2) Then
' Eventuale notifica al VeinMatching
VeinMatching.OnInsertPartInRaw(nId2)
End If
End If
End If
' ------------------------ AGGIUNGO PEZZO NEL VEINMATCH ----------------------------------
Next
' Cancello il file
My.Computer.FileSystem.DeleteFile(sTmpFile)
End If
' Aggiorno Aree totale
m_MainWindow.m_CurrentProjectPageUC.UpdateTotalArea(dNewArea)
' passo al pezzo successivo
Pz = NxtPz
End While
' Aggiorno Aree da lavorare dei pezzi
m_MainWindow.m_CurrentProjectPageUC.UpdateToProduceArea()
m_MainWindow.m_CurrentProjectPageUC.ShowAreas()
' Aggiorno ambiente principale
EgtZoom(ZM.ALL)
Return True
End Function
+61 -22
View File
@@ -1,7 +1,7 @@
; Commento per evitare BOM con UTF-8
[General]
Debug=0
Licence=OmagCUT-Key335-InternaBaronchelli.lic
Licence=OmagCUT-Key149-InternaBaronchelli.lic
MessagesDir=c:\ProgramData\EgalTech\OmagCUT\Messages
Messages=Italiano
;WinPlace=0,1366,0,1280,1024
@@ -9,12 +9,12 @@ WinPlace=0,77,0,1304,768
;WinPlace=0,1366,0,1366,768
MmUnits=1
MaxProj=99
LastProj=8
LastProj=10
AutoLoadLastProj=1
SaveDir=C:\ProgramData\Egaltech\OmagCUT\Data
ImageDir=C:\ProgramData\Egaltech\OmagCUT\Images
SaveNameDir=C:\ProgramData\Egaltech\OmagCut\MyProjects
LastNameProj=
LastNameProj=P11_PcucinaC23
LastProjToView=0056
DateTimeToView=31.05.2018 00:08:40
CameraLink=1
@@ -24,7 +24,7 @@ ShowTipAxes=1
ContourFromCamera=0
Registration=1
SiemensPc=1
VirtualKeyboard=1
VirtualKeyboard=0
Support=support@egaltech.com
Theme=0
@@ -84,16 +84,27 @@ MajLnColor=160,160,160
[Compo]
TrfData=0
;CompoDir=C:\ProgramData\Egaltech\OmagCUT\Compo
;CompoDir=C:\ProgramData\Egaltech\OmagCUT\CompoAF
CompoDir=C:\EgtDev\frontalini\Frontalini_ecc\CompoAF
CompoDir=C:\Users\Utente\repos\frontalini-1\Frontalini_ecc\CompoAF\
Count=12
LastColor=5
Color1=255,0,0,60
Color2=0,255,0,60
Color3=0,0,255,60
Color4=0,190,255,60
Color5=190,255,0,60
Color6=190,0,255,60
Color7=255,190,0,60
Color8=255,0,190,60
Color9=0,255,190,60
[Compo1]
Name=1 ;Triangolo
Count=3
Count=5
Image=Triangolo.png
Compo1=10,Triangolo2L.lua,Triangolo2L.png
Compo2=11,Triangolo3L.lua,Triangolo3L.png
Compo3=12,TriangoloIs.lua,TriangoloIs.png
Compo4=10,Triangolo2LC2.lua,Triangolo2LC2.png
Compo5=10,Triangolo2LC1.lua,Triangolo2LC1.png
[Compo2]
Name=2 ;Rettangolo
Count=1
@@ -101,12 +112,13 @@ Image=Rettangolo.png
Compo1=2,Rettangolo.lua,Rettangolo.png
[Compo3]
Name=3 ;Trapezio
Count=4
Count=5
Image=Trapezio.png
Compo1=12,TrapezioIs.lua,TrapezioIs.png
Compo2=13,TrapezioRt.lua,TrapezioRt.png
Compo3=14,TrapezioScA.lua,TrapezioScA.png
Compo4=15,TrapezioScB.lua,TrapezioScB.png
Compo3=13,TrapezioRtA.lua,TrapezioRtA.png
Compo4=14,TrapezioScA.lua,TrapezioScA.png
Compo5=15,TrapezioScB.lua,TrapezioScB.png
[Compo4]
Name=4 ;Quadrilatero
Count=4
@@ -124,9 +136,10 @@ Compo2=21,PiedocaB1.lua,PiedocaB1.png
Compo3=22,PiedocaB2.lua,PiedocaB2.png
[Compo6]
Name=6 ;Soglia
Count=1
Count=2
Image=Soglia.png
Compo1=6,SogliaA.lua,Soglia.png
Compo2=6,SogliaL.lua,SogliaL.png
[Compo7]
Name=7 ;Piano Cucina
Count=9
@@ -172,13 +185,12 @@ Compo1=43,Poligono.lua
[InternalCompo]
;CompoDir=C:\ProgramData\Egaltech\OmagCUT\Compo
;CompoDir=C:\ProgramData\Egaltech\OmagCUT\CompoAF
CompoDir=C:\EgtDev\frontalini\Frontalini_ecc\CompoAF
Count=8
CompoDir=C:\Users\Utente\repos\frontalini-1\Frontalini_ecc\CompoAF\
Count=11
[InternalCompo1]
InternalCompo1=2,IntRectangle.lua,Rettangolo.png
[InternalCompo2]
InternalCompo2=2,Fr_Alz.lua
InternalCompo2=37,IntRectangleF.lua,RettangoloArrot.png
;[InternalCompo2]
;InternalCompo2=37,IntRectangleF.lua,RettangoloArrot.png
;[InternalCompo3]
@@ -200,12 +212,11 @@ InternalCompo2=2,Fr_Alz.lua
[Alz&Front]
;CompoDir=C:\ProgramData\Egaltech\OmagCUT\Compo
;CompoDir=C:\ProgramData\Egaltech\OmagCUT\CompoAF
CompoDir=C:\EgtDev\frontalini\Frontalini_ecc\CompoAF
CompoDir=C:\Users\Utente\repos\frontalini-1\Frontalini_ecc\CompoAF\
Alz&Front=72,Alz&Front.lua,Alz&Front.png
A_Height=45
A_Height=30
A_DeltaAng=1
F_Height=60
F_Height=35
F_DeltaAng=1
[FlatParts]
@@ -214,6 +225,7 @@ Tolerance=0.1
[Sides]
MaxSideAngle=75
SizeAlwaysOnTop=1
ParSideAsTrf=0
SideAngle=45
DripOffset=20
@@ -278,11 +290,11 @@ CurrSlab=1
[RawPart]
RawColor=128,192,255,40
KerfColor=255,0,0,100
Length=1500
Length=3137.76
Width=2035.82
Height=25
OffsX=100
OffsY=100
OffsX=217.97
OffsY=113.88
Kerf=100
[RawMove]
@@ -438,3 +450,30 @@ Tolerance=0
[Alz&Front]
A_Height=15
A_DeltaAng=1
[InternalCompo3]
InternalCompo3=31,IntEllipse.lua,IntEllisse.png
[InternalCompo4]
InternalCompo4=45,IntDxf.lua,IntDxf.png
[InternalCompo5]
InternalCompo5=39,Int1Hole.lua,Int1Hole.png
[InternalCompo6]
InternalCompo6=40,Int2Holes.lua,Int2Holes.png
[InternalCompo7]
InternalCompo7=41,Int3Holes.lua,Int3Holes.png
[InternalCompo8]
InternalCompo8=44,IntDownHole.lua,IntDownHole.png
[InternalCompo9]
InternalCompo9=46,Ribasso.lua,Ribasso.png
[InternalCompo10]
InternalCompo10=70,LineeRibasso.lua,LineeRibasso.png
[InternalCompo11]
InternalCompo11=71,LineeLibere.lua,LineeLibere.png
[MruFiles]
File1=C:\ProgramData\Egaltech\OmagCUT\Data\0010.nge
File2=C:\ProgramData\Egaltech\OmagCut\MyProjects\P11__PcucinaC23.nge
File3=C:\ProgramData\Egaltech\OmagCUT\Data\0009.nge
File4=
File5=
File6=
File7=
File8=
@@ -0,0 +1,454 @@
; Commento per evitare BOM con UTF-8
[General]
Debug=0
Licence=OmagCUT-Key335-InternaBaronchelli.lic
MessagesDir=c:\ProgramData\EgalTech\OmagCUT\Messages
Messages=Italiano
;WinPlace=0,1366,0,1280,1024
WinPlace=0,77,0,1304,768
;WinPlace=0,1366,0,1366,768
MmUnits=1
MaxProj=99
LastProj=8
AutoLoadLastProj=1
SaveDir=C:\ProgramData\Egaltech\OmagCUT\Data
ImageDir=C:\ProgramData\Egaltech\OmagCUT\Images
SaveNameDir=C:\ProgramData\Egaltech\OmagCut\MyProjects
LastNameProj=P11_PcucinaC23
LastProjToView=0056
DateTimeToView=31.05.2018 00:08:40
CameraLink=1
CNLink=0
TestingPage=1
ShowTipAxes=1
ContourFromCamera=0
Registration=1
SiemensPc=1
VirtualKeyboard=0
Support=support@egaltech.com
Theme=0
[Languages]
Count=7
Language1=Italiano,EgalTechIta.txt
Language2=English,EgalTechEng.txt
Language3=Francais,EgalTechFra.txt
Language4=Deutsch,EgalTechDeu.txt
Language5=Espagnol,EgalTechEsp.txt
Language6=Portugues,EgalTechPor.txt
Language7=Turk,EgalTechTur.txt
[Lua]
LibsDir=C:\ProgramData\Egaltech\OmagCUT\LuaLibs
BaseLib=EgtBase
[OpenGL]
DoubleBuffer=1
ColorBits=32
DepthBits=24
Driver=3
[GeomDB]
DefaultFont=ModernPropS.Nfe
NfeFontDir=C:\ProgramData\Egaltech\OmagCUT\Fonts
DefaultColor=128,64,0
SaveType=2
[Scene]
BackTop=192,192,192
BackBottom=192,192,192
ShowGFrame=1
Mark=255,255,0
SelSurf=255,255,192
ShowMode=2
CurveDir=0
ShowTriaAdv=1
ShowZmap=9 ; +1=surf, +2=lines, +4=normals, +8=più colori
TextureMaxLinPixels=2048
ZoomWin=0,255,255,255,30
DistLine=255,0,0
BackTop1=96,96,96
BackBottom1=160,160,160
[Grid]
ShowGrid=1
ShowFrame=1
SnapStep=10
SnapStepInch=12.7
MinLineSStep=1
MajLineSStep=10
ExtSStep=200
MinLnColor=160,160,160
MajLnColor=160,160,160
[Compo]
TrfData=0
;CompoDir=C:\ProgramData\Egaltech\OmagCUT\Compo
;CompoDir=C:\ProgramData\Egaltech\OmagCUT\CompoAF
CompoDir=C:\EgtDev\frontalini\Frontalini_ecc\CompoAF
Count=12
LastColor=9
Color1=255,0,0,60
Color2=0,255,0,60
Color3=0,0,255,60
Color4=0,190,255,60
Color5=190,255,0,60
Color6=190,0,255,60
Color7=255,190,0,60
Color8=255,0,190,60
Color9=0,255,190,60
[Compo1]
Name=1 ;Triangolo
Count=3
Image=Triangolo.png
Compo1=10,Triangolo2L.lua,Triangolo2L.png
Compo2=11,Triangolo3L.lua,Triangolo3L.png
Compo3=12,TriangoloIs.lua,TriangoloIs.png
[Compo2]
Name=2 ;Rettangolo
Count=1
Image=Rettangolo.png
Compo1=2,Rettangolo.lua,Rettangolo.png
[Compo3]
Name=3 ;Trapezio
Count=4
Image=Trapezio.png
Compo1=12,TrapezioIs.lua,TrapezioIs.png
Compo2=13,TrapezioRt.lua,TrapezioRt.png
Compo3=14,TrapezioScA.lua,TrapezioScA.png
Compo4=15,TrapezioScB.lua,TrapezioScB.png
[Compo4]
Name=4 ;Quadrilatero
Count=4
Image=Quadrilatero.png
Compo1=16,QuadrilateroA.lua,QuadrilateroA.png
Compo2=19,QuadrilateroD.lua,QuadrilateroD.png
Compo3=17,QuadrilateroB.lua,QuadrilateroB.png
Compo4=18,QuadrilateroC.lua,QuadrilateroC.png
[Compo5]
Name=5 ;Piedoca
Count=3
Image=Piedoca.png
Compo1=20,PiedocaA1.lua,PiedocaA1.png
Compo2=21,PiedocaB1.lua,PiedocaB1.png
Compo3=22,PiedocaB2.lua,PiedocaB2.png
[Compo6]
Name=6 ;Soglia
Count=1
Image=Soglia.png
Compo1=6,SogliaA.lua,Soglia.png
[Compo7]
Name=7 ;Piano Cucina
Count=9
Image=PianoCucina.png
Compo1=2,PCucinaRett.lua
Compo2=23,PCucinaA1.lua
Compo3=24,PCucinaA23.lua
Compo4=25,PCucinaC1.lua
Compo5=26,PCucinaC23.lua
Compo6=29,PCucinaD1.lua
Compo7=30,PCucinaD23.lua
Compo8=27,PCucinaB1.lua
Compo9=28,PCucinaB2.lua
[Compo8]
Name=8 ;Piano Bagno
Count=2
Image=PianoBagno.png
Compo1=2,PBagnoRett.lua
Compo2=38,PBagnoBomb.lua
[Compo9]
Name=31 ;Ellisse
Count=1
Image=Ellisse.png
Compo1=31,Ellisse.lua
[Compo10]
Name=32 ;Ovale
Count=1
Image=Ovale.png
Compo1=32,Ovale.lua
[Compo11]
Name=33 ;Arco
Count=4
Image=Arco.png
Compo1=42,CurvaA5.lua
Compo2=34,CurvaA1.lua
Compo3=35,CurvaA2.lua
Compo4=36,CurvaA3.lua
[Compo12]
Name=43 ;Poligono
Count=1
Image=Poligono.png
Compo1=43,Poligono.lua
[InternalCompo]
;CompoDir=C:\ProgramData\Egaltech\OmagCUT\Compo
;CompoDir=C:\ProgramData\Egaltech\OmagCUT\CompoAF
CompoDir=C:\EgtDev\frontalini\Frontalini_ecc\CompoAF
Count=8
[InternalCompo1]
InternalCompo1=2,IntRectangle.lua,Rettangolo.png
[InternalCompo2]
InternalCompo2=2,Fr_Alz.lua
;[InternalCompo2]
;InternalCompo2=37,IntRectangleF.lua,RettangoloArrot.png
;[InternalCompo3]
;InternalCompo3=31,IntEllipse.lua,IntEllisse.png
;[InternalCompo4]
;InternalCompo4=45,IntDxf.lua,IntDxf.png
;[InternalCompo5]
;InternalCompo5=39,Int1Hole.lua,Int1Hole.png
;[InternalCompo6]
;InternalCompo6=40,Int2Holes.lua,Int2Holes.png
;[InternalCompo7]
;InternalCompo7=41,Int3Holes.lua,Int3Holes.png
;[InternalCompo8]
;InternalCompo8=44,IntDownHole.lua,IntDownHole.png
;[InternalCompo9]
;InternalCompo9=46,Ribasso.lua,Ribasso.png
;[InternalCompo10]
;InternalCompo10=70,LineeRibasso.lua,LineeRibasso.png
[Alz&Front]
;CompoDir=C:\ProgramData\Egaltech\OmagCUT\Compo
;CompoDir=C:\ProgramData\Egaltech\OmagCUT\CompoAF
CompoDir=C:\EgtDev\frontalini\Frontalini_ecc\CompoAF
Alz&Front=72,Alz&Front.lua,Alz&Front.png
A_Height=30
A_DeltaAng=1
F_Height=35
F_DeltaAng=1
[FlatParts]
CurrDir=C:\ProgramData\Egaltech\OmagCUT\Examples
Tolerance=0.1
[Sides]
MaxSideAngle=75
SizeAlwaysOnTop=1
ParSideAsTrf=0
SideAngle=45
DripOffset=20
DripDepth=16
DripShort=0
UnderDrillDepth=12
DripOffset2=30
[Nest]
Direct=0
Step=100
AngStep=30
RestRadius=5
SnapDist=200
TrfThickTolerance=2
TextColor=0,0,0
[CSV]
Full=1
MaxDimOnX=0
Reader=CsvRead.lua
RuinedPartsDir=c:\ProgramData\EgalTech\OmagCUT\Ruined
ProducedPartsDir=c:\ProgramData\EgalTech\OmagCUT\Produced
CurrDir=C:\EgtData\Varie\CsvHenraux.new
LastFile=C:\EgtData\Varie\CsvHenraux.new\csv_fin.epl
[SlabDxf]
ImportSlabDxf=0
SlabLayer=SlabBoundary
PartsLayer=Counters
ScrapLayer=ReservedAreaBoundary
StdThick=25.4
[ColorToSideAng]
Enable=1
Tolerance=25
CTSA1=255,0,255,-45,0,1
CTSA2=153,102,204,-46,0,1
[Frame]
OffsZ=5
OffsXY=0
OffsYY=0
StartTrim=0
EndTrim=0.1
EnableArc=0
ArcRad=210
ArcAng=90
[FastGrid]
FgEnable=0
1=300,300,300 300
2=400,400,400 400
3=500,500,500 500
4=600,600,600 600
5=3000,600,3000 600
FGActive=1
PieceType=2
Order=Ord004
CurrSlab=1
[RawPart]
RawColor=128,192,255,40
KerfColor=255,0,0,100
Length=3137.76
Width=2035.82
Height=25
OffsX=217.97
OffsY=113.88
Kerf=100
[RawMove]
Step=100
Rotation=90
Perpendicular=0
[Reg]
Step=10
AngStep=2
[Camera]
Count=1
ExePath=C:\Program Files (x86)\Egaltech\CameraMng\CameraMng.exe
Image=C:\ProgramData\Egaltech\CameraMng\data\FinalImage.jpg
Info=C:\ProgramData\Egaltech\CameraMng\data\FinalImage.txt
Result=C:\ProgramData\Egaltech\CameraMng\data\click.txt
Contour=C:\ProgramData\Egaltech\CameraMng\data\FinalImage.dxf
ExePath2=C:\Program Files (x86)\Egaltech\CameraMng2\CameraMng2.exe
Image2=C:\ProgramData\Egaltech\CameraMng2\data\FinalImage.jpg
Info2=C:\ProgramData\Egaltech\CameraMng2\data\FinalImage.txt
Result2=C:\ProgramData\Egaltech\CameraMng2\data\click.txt
Contour2=C:\ProgramData\Egaltech\CameraMng2\data\FinalImage.dxf
Threshold=40
Timeout=30
Tolerance=5
[Mach]
MachinesDir=c:\EgtData\Machines
ToolMakersDir=C:\ProgramData\Egaltech\OmagCUT\ToolMakers
CurrMach=Omag-Area5
[Machines]
01.Mach=Omag-Area5
01.Proj=7
02.Mach=Omag-Area5_2Tsp-S
02.Proj=6
03.Mach=Omag-AreaCut
03.Proj=5
04.Mach=Omag-AreaCut-S
04.Proj=2
05.Mach=Omag-AreaCutUcd
05.Proj=2
06.Mach=Omag-AreaCutUcd-S
06.Proj=1
07.Mach=Omag-Blade5_2Tab-S
07.Proj=2
08.Mach=Omag-Blade5AR
08.Proj=7
09.Mach=Omag-Blade5ARnc
09.Proj=4
10.Mach=Omag-Blade5ARnc-S
10.Proj=2
11.Mach=Omag-Blade5AR-S
11.Proj=3
12.Mach=Omag-Blade5Ho4
12.Proj=10
13.Mach=Omag-Blade5-S
13.Proj=1
14.Mach=Omag-Digitale5
14.Proj=15
15.Mach=Omag-Digitale5Hsm
15.Proj=10
16.Mach=Omag-Digitale5HsmSV
16.Proj=3
17.Mach=Omag-Digitale5SV
17.Proj=3
18.Mach=Omag-MultiCut
18.Proj=0
19.Mach=Omag-MultiCutNC-S
19.Proj=0
20.Mach=Omag-MultiCutRT-S
20.Proj=2
21.Mach=Omag-Profiler
21.Proj=0
22.Mach=Omag-Water5&Saw
22.Proj=88
[Simul]
SliderX=0.5
SliderVal=61.4
[CopyTemplate]
CurrDir=C:\ProgramData\Egaltech\OmagCut\CopyTemplate
[VeinMatching]
Enable=1
WinPlace=0,378,35,682,747
[DirectCuts]
SingDepth=15
SingLength=1668.26
SingAngH=0
SingAngV=0
SingOffset=30
SingPosX=1143.74
SingPosY=1989.25
MultDepth=15
MultLength=100
MultAngH=0
MultAngV=0
MultNum1=2
MultDim1=20
MultNum2=3
MultDim2=40
MultNum3=3
MultDim3=50
MultNum4=0
MultDim4=0
MultNum5=0
MultDim5=0
MultNum6=0
MultDim6=0
MultNum7=0
MultDim7=0
MultNum8=0
MultDim8=0
MultNum9=0
MultDim9=0
MultNum10=0
MultDim10=0
MultHeadSide=0
MultPosX=1063.82
MultPosY=1739.07
GridDepth=25
GridAngH=270
GridAngV=0
GridNumX=2
GridDimX=100
GridNumY=2
GridDimY=100
GridHeadSide=0
GridPosX=1105.52
GridPosY=1885.01
FlattDepth=10
FlattAngH=0
FlattLength=1414.21
FlattWidth=500
FlattOverlap=1
FlattHeadSide=0
FlattMachType=1
FlattRotLock=0
FlattPosX=1000
FlattPosY=1000
TestDepth=5
TestLength=1078.98
TestAngH=259.45
TestOffset=0
[Cad2d]
Name=EgtCAM5R32
ExePath=C:\Program Files (x86)\Egaltech\EgtCAM5\EgtCAM5R32.exe
[ColorToEngrave]
Tolerance=0
[Alz&Front]
A_Height=15
A_DeltaAng=1
@@ -0,0 +1,27 @@
Friend Sub WriteSideAngleForNest(nCtx As Integer)
' Imposto contesto corrente
EgtSetCurrentContext(nCtx)
Dim PartId As Integer = EgtGetFirstPart()
While PartId <> GDB_ID.NULL
' Se richiesti lati paralleli con misura sul top come in TRF e non già misure sul top, verifico e aggiusto
If GetPrivateProfileInt( S_SIDES, K_PARSIDE_AS_TRF, 0, m_MainWindow.GetIniFile()) <> 0 AndAlso
GetPrivateProfileInt( S_SIDES, K_SIZEALWAYSONTOP, 0, m_MainWindow.GetIniFile()) = 0 Then
AdjustAsTrfParSides( PartId)
End If
' Elimino eventuale precedente layer per testi
EgtErase(EgtGetFirstNameInGroup(PartId, SIDE_ANGLE_LAYER))
' Creo layer per testi nesting
Dim TextLayId As Integer = EgtCreateGroup(PartId)
EgtSetName(TextLayId, SIDE_ANGLE_LAYER)
EgtSetColor(TextLayId, New Color3d(0, 0, 128))
' Opero su geometria esterna pezzo
WriteSideAngleOnLoop(EgtGetFirstNameInGroup(PartId, NAME_OUTLOOP), TextLayId)
' Ciclo su geometria interna pezzo
Dim LoopId As Integer = EgtGetFirstNameInGroup(PartId, NAME_INLOOP)
While LoopId <> GDB_ID.NULL
WriteSideAngleOnLoop(LoopId, TextLayId)
LoopId = EgtGetNextName(LoopId, NAME_INLOOP)
End While
PartId = EgtGetNextPart(PartId)
End While
End Sub
@@ -1,739 +0,0 @@
-- 2021/06/__
-- (exRettangolo interno dati base e altezza)
-- 21/06/2021 Nicola Pievani: creazione del file Alz&Front
-- 05/07/2021 Nicola Pievani: Inserisco commenti
-- 08/07/2021 CB: inizio disegno dei 'rettangoli esterni'
-- 00b 10/07/2020 CB: costruzione della tabella "MyTab"
-- 00c 13/07/2021 CB: introduzone record "SideREc" e tabella "SideTab"
-- 00d 15/07/2021 CB: introduzione funzione per disegno rettangoli
-- 00e 16/07/2021
-- 00f 20/07/2021
-- 21/07/2021 - aggiornato progetto in GIT
-- 26/07/2021 - 'chiuso' i rettangoli, noiminati i rispettivi lati
-- - studio casi per inserimento InfoAF per tagli inclinati
-- 28/07/2021 - semplificazione di SideTab e aggiunta angoli tra lati consecutivi
-- 29/07/2021 - inserimento InfoAF per tagli inclinati
-- 30/07/2021 - separazione dei casi tra frontalini e alzatine
-- 1/08/e segg - funzione SideAngSetInfo con anche prova etichette inclinazione
-- 3/08/2021 - inserimento info con riferimento al lato del
-- - inizio studio per 'spostamenti'
-- 9/08/2021 - aggiunto PzId in SideRec ('spostando' tutti gli altri campi !)
-- 20/08/2021 - prova calcolo intersezioni con 'pseudorette' dei lati dei rettangoli
-- 23/08/2021 - inizio calcolo spostamenti con trigonometria
-- 30/08/2021 - caso [b(r1r2r3
-- 06/10/2021 - da Sara 00a con modifiche by Nicola
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( true)
EgtAddToPackagePath(EgtGetSourceDir() .. 'LuaLibs\\?.lua')
require( 'EgtCompo')
-- Valori limite
local LgMin = 10
local RMin = 5
-- Parametri : dichiarazione e valori standard
--.T (tipo) : 0=null, 1=bool, 2=int, 3=len, 4=num, 5=string
local CMP = {}
-- elenco dei parametri visualizzati nell'interfaccia del programma OMAG-Cut
CMP.A_Height=30 -- altezza delle alzatine
CMP.F_Height=30 -- altezza dei frontalini
CMP.A_DeltaAng=0.5 -- angolo (semiangolo) di incremento per tagli inclinati
CMP.F_DeltaAng=0.5
CMP.ThicknessRaw=10 -- spessore del grezzo
-- parametri passati da OmagCut
CMP.BBoxRad = 1000
CMP.HeightText = 100
--
_G.CMP = CMP
-- 2021/08
-- Disegna i lati di un rattangolo dati layer, Punto, base, altezza;
-- 'allineato al sistema di riferimento' =: base parallela al sistema di riferimento dato
-- sarebbe superata dall'uso diretto della funzione di disegno Rettangolo
-- se non servissse distinguare i singoli lati
local function DrawRectangle (Pz, Lay, BaseL, HeightL, sName, sReference, Delta1, Delta2)
-- insrisco un commento nel pezzo per descriverlo
EgtSetInfo( Pz, "CMP", "AlzFront")
local Lr = EgtGroup( Pz, GDB_RT.LOC)
EgtSetName( Lr, "Region")
-- sul prim lato della figura copio l'identificatico univoco presente nel lato della cucina a cui è associato
local Pt = Point3d( -Delta1,0,0)
local l1 = EgtLinePDL( Lay, Pt, 0, BaseL)
EgtSetName( l1, sName.." l1")
EgtSetInfo( l1, "RefAF", sReference)
local l2 = EgtLinePDL( Lay, EgtEP( l1), 90, HeightL)
EgtSetName( l2, sName.." -l2")
local l3 = EgtLinePDL( Lay, EgtEP( l2), 180, BaseL)
EgtSetName( l3, sName.." -l3")
local l4 = EgtLine( Lay, EgtEP( l3), EgtSP( l1))
EgtSetName( l4,sName.." -l4")
local RectContour = EgtCurveCompo(Lay,{l1,l2,l3,l4},false)
local s1 = EgtSurfFlatRegion(Lr,RectContour)
if CMP.ERR == 0 then
EgtSetColor(s1,AQUA())
else
EgtSetColor(s1,ORANGE())
end
EgtSetAlpha(s1,25)
EgtErase( RectContour)
return l1, l2, l3, l4
end
--
-- Scrittura info e etichetta con inclinazione dei lati dei rettangoli
local function SideAngSetInfo(SideId, Lay, Gamma, dOffset, dHLbl)
EgtSetInfo( SideId, "SideAng", Gamma) -- -F_Delta?
EgtSetInfo( SideId, "OrigSideAng", Gamma) -- -F_Delta?
local Lbl = EgtNumToString(Gamma,1)..'°'
LblL1 = AddLabelAl( Lay, SideId, dOffset*0.02, Lbl, dHLbl, -90, BLACK())
end
--
-- rimuove l'informazione del taglio inclinato dal lato indicato del piano cucina
local function ResetSideAng( CurrSide) -- IsModify
if EgtGetInfo( CurrSide, "IsModify", 'i') == 0 then
return
end
if EgtExistsInfo( CurrSide, "SideAng") then
EgtRemoveInfo( CurrSide, "SideAng")
EgtRemoveInfo( CurrSide, "OrigSideAng")
end
end
--
-- costruisco la teballe che contiene le informazioni prese dal piano cucina
-- |LEGENDA 1: campi di SideTab|
-- |.IdSd = Side_Id; .IdPz = Pz_Id; .Frame = Ref_Id; .InfoSd = SideInfo(Alz/Front);|
-- |.l1---.l4 = Rectangle sides|; |.RContour = contorno del rettengolo|
-- |.RecPrv = Previous Record; RecNxt = Next Record|
-- |.VectS = Side Start Vector; .VectE = Side End Vector;|
-- |.zPrvAng = PrecSide-Side_Angle; .zNxtAng = Side-ProxSide_Angle.|
-- |.RefAF = GUID Reference.|
local function LoadData( SideTab, Lw, Le, dOffset, dHLbl)
-- contatore usato per conoscere il numero di lati inserito
local SideNum =1
-- ricerco nel layer OutLoop tutti i lati del piano cucina
local CurrSide = EgtGetFirstInGroup( Lw)
local PrecSide = nil
while CurrSide ~= nil do
local SideRec = {}
-- recupero informazione sul tipo di rettangolo da costruire (Alzatina o Frontalino)
local InfoAF = EgtGetInfo( CurrSide, "AF", 'i')
-- recupero informazione del riferimento univoco generato in OmagCUT (deve esistere)
local InfoRefGUID = EgtGetInfo( CurrSide, "RefAF", 's')
-- se non esite nessuna informazione allora inizializzo a 0
if InfoAF == nil then
InfoAF = 0
end
-- se primo lato
if SideNum == 1 then
SideRec = {IdSd = CurrSide, IdPz = nil, InfoSd = InfoAF, RecPrv = 0, RecNxt = SideNum+1,
VectS = EgtSV(CurrSide), VectE = EgtEV(CurrSide), RefAF = InfoRefGUID}
-- se lato successivo al primo
else
local v1 = SideTab[SideNum-1].VectE
local v2 = EgtSV(CurrSide)
local Angv1v2 = atan2( (v1^v2)*Z_AX(),v1*v2)
SideRec = { IdSd = CurrSide, IdPz = nil, InfoSd = InfoAF, RecPrv = SideNum-1, RecNxt = SideNum+1,
VectS = EgtSV(CurrSide), VectE = EgtEV(CurrSide), RefAF = InfoRefGUID,
zPrvAng = Angv1v2 }
-- Assegno la lato precedente (SideNum-1) l'informazione del lato corrente (SideNum)
SideTab[SideNum-1].zNxtAng = Angv1v2
end
-- (per visualizzazione in OmagCUT)
if InfoAF == 1 then
EgtSetColor(CurrSide, 'RED')
elseif InfoAF == 2 then
EgtSetColor(CurrSide, 'GREEN')
else
-- elimino eventuali angoli di taglio inseriti dovuti a precedenti frontalini
ResetSideAng( CurrSide)
EgtSetColor(CurrSide, 'BLACK')
end
-- Inserico nella tabella la tabella costruita temporaneamente per salvare i dati
table.insert(SideTab, SideRec)
-- passo al lato successivo
PrecSide = CurrSide
CurrSide = EgtGetNext( CurrSide)
SideNum = SideNum + 1
end --while
-- completo la tabella con i riferimenti tra ultimo lato e primo (in quanto successivo all'ultimo)
if #SideTab > 1 then
local v1 = SideTab[#SideTab].VectE
local v2 = SideTab[1].VectS
local Angv1v2 = atan2( (v1^v2)*Z_AX(),v1*v2)
SideTab[#SideTab].RecNxt = 1
SideTab[1].RecPrv = #SideTab
SideTab[#SideTab].zNxtAng = Angv1v2
SideTab[1].zPrvAng = Angv1v2
end
end
--
-- a partire dal primo pezzo (il piano cucina) elimino tutti i pezzi "Alz-Front"
local function ResetDraw( Pz)
local TabOfPart = {}
local CurrPz = EgtGetNextPart( Pz)
while CurrPz ~= nil do
if "Alz-Front" == EgtGetName( CurrPz) then
table.insert( TabOfPart, CurrPz)
end
CurrPz = EgtGetNextPart( CurrPz)
end
EgtErase( TabOfPart)
end
--
-- Funzione di disegno
local function CMP_Draw(bPreview)
-- Carico i messaggi
local Msg = require('EgtCompoMsg')
CMP.ERR = 0
CMP.MSG = ''
-- Assegno l'angolo di incremento per i tagli inclinati
local F_Delta = CMP.F_DeltaAng
local A_Delta = CMP.A_DeltaAng
-- Assegno l'altezza
local FH = CMP.F_Height
local AH = CMP.A_Height
-- Assegno la dimensione di riferimento (=1/10 del 'raggio' della figura)
local dDim = CMP.BBoxRad
local dHLbl = CMP.HeightText
local dStdOffs = dDim*.05 -- vedi etichettatura lati inclinati
local dOffsR = dDim*.2 -- distanziamento dei rettangoli dai lati del componente
local dOffsC = dDim*.25 -- 'costante' aggiuntiva per spostamenti
--
CMP.ERR = 0
CMP.MSG = ''
-- Pezzo e Layer già definiti
local Pz = EgtGetFirstGroupInGroup( GDB_ID.ROOT)
-- ripulisco il disegno
ResetDraw( Pz)
if not Pz then
CMP.ERR = 5
CMP.MSG = "Pezzo non trovato"
return
end
local La = EgtGetFirstNameInGroup( Pz, "LayAux")
local Le = EgtGetFirstNameInGroup( Pz, "Etichette")
local Lq = EgtGetFirstNameInGroup( Pz, "Quotature")
local Lo = EgtGetFirstNameInGroup( Pz, "Region")
local Lw = EgtGetFirstNameInGroup( Pz, "OutLoop")
local Ls = EgtGetFirstNameInGroup( Pz, "SelectRegion")
--local PzAF = EgtGroup(GDB_ID.ROOT,GDB_RT.LOC) -- ??? nuova part: alzatine e frontalini ???????
--local LyA = EgtGroup(PzAF,GDB_RT.LOC) -- layer alzatine
--EgtSetName(LyA,'Alzatine')
--local LyF = EgtGroup(PzAF,GDB_RT.LOC) -- layer frontalini
--EgtSetName(LyF,'Frontalini')
--local LyAe = EgtGroup(PzAF,GDB_RT.LOC) -- layer etichette alzatine
--EgtSetName(LyAe,'Etich_Alzatine')
--local LyFe = EgtGroup(PzAF,GDB_RT.LOC) -- layer etichette frontalini
--EgtSetName(LyFe,'Etich_Frontalini')
if not Ls then
Ls = EgtGroup( Pz, GDB_RT.LOC)
EgtSetName( Ls, "SelectRegion")
end
--[[ **COMMENTATO PER TEST**
if not La or not Lo or not Lw or not Le or not Lq then
CMP.ERR = 6
CMP.MSG = "Layer non trovato"
return
end
]]
local Lr = EgtGetFirstNameInGroup( Pz, "ErrorLay")
if Lr then
EgtEmptyGroup(Lr)
else
Lr = EgtGroup( Pz, GDB_RT.LOC)
EgtSetName( Lr, "ErrorLay")
end
--[[ **COMMENTATO PER TEST**
-- spengo i layer Aux e Quotature
EgtSetStatus( La, GDB_ST.OFF)
EgtSetStatus( Lq, GDB_ST.OFF)
]]
local sInd = nil
--[[ faccio scorrere tutti gli elementi del layer OutLoop e di ognuno leggo se contiente nelle Info "AF=x"
"AF=0" ( o nil) => al lato non deve essere associatu nulla
"AF=1" => al lato deve essere associto un'alzatina
"AF=2" => al lato deve essere associato un frontalino
nel ciclo while che segue carico una tabella contenente tutti i lati e i riferimenti ai lati successivi,
oltre a informazioni sulle direzioni iniziali/finali dei lati cghe seguono/precedono.
(In questa fase possono essere aggiunte altre informazioni...)
La variabile sMsg è usta dal programma per verificare che i lati letti dalla tabella siano gli stessi
passati dal programma
]]
local sMsg = " "
local SideNum =1
-- **COSTRUZIONE DELLA TABELLA DEI LATI DEL COMPONENTE** (es. piano cucina)
-- --------------------------------------------------------------------
local SideTab = {}
-- |LEGENDA 1: campi di SideTab|
-- |.IdSd = Side_Id; .IdPz = Pz_Id; .Frame = Ref_Id; .InfoSd = SideInfo(Alz/Front);|
-- |.l1---.l4 = Rectangle sides|; |.RContour = contorno del rettengolo|
-- |.RecPrv = Previous Record; RecNxt = Next Record|
-- |.VectS = Side Start; ; .VectE = Side End Vector;|
-- |.zPrvAng = PrecSide-Side_Angle; .zNxtAng = Side-ProxSide_Angle.|
-- |.RefAF = GUID Reference.|
LoadData( SideTab, Lw)
-- restituisco un messaggio al programma OmagCUT
CMP.MSG = sMsg
-- **COSTRUZIONE DELLE FIGURE** (rettangoli) rappresentative di alzatine o frontalini
-- -------------------------------------------------------------------------------
for SideNum = 1 , #SideTab do
-- se è richiesto un'alzatina o un frontalino (InfoSd=1 oppure InfoSd=2)
if SideTab[SideNum].InfoSd > 0 then
-- recupero le informazioni dalla tabella
local Side = SideTab[SideNum].IdSd
local SVect = SideTab[SideNum].VectS
local EVect = SideTab[SideNum].VectE
local RefToAF = SideTab[SideNum].RefAF
local BaseL; local HeightL
local sName
-- Costruisco il sistema di riferimento per il rettangolo
local Pt = EgtEP( Side) + VRotated( EVect*dOffsR, -90)
local Frame = Frame3d( Pt, -EVect, VRotated(EVect,-90), Vector3d(0,0,1))
-- nuova parte per alzatina o frontalino
local Pz = EgtGroup(GDB_ID.ROOT, Frame, GDB_RT.GLOB)
EgtSetName(Pz,"Alz-Front")
-- assegno alla tabella l'Id del pezzo appena creato
SideTab[SideNum].IdPz = Pz
-- creo Layer per il pezzo appena creato
local Lay = EgtGroup( Pz)
EgtSetName(Lay,"OutLoop")
local LayLbl = EgtGroup( Pz)
EgtSetName(LayLbl,"Etichette")
-- |ALZATINA|
if SideTab[SideNum].InfoSd == 1 then
EgtSetColor(Lay,RED(),100,true)
BaseL = EgtCurveLength( Side)
sName = "Side "..SideNum.." -A"
HeightL = AH
-- |FRONTALINO|
elseif SideTab[SideNum].InfoSd == 2 then
EgtSetColor(Lay,GREEN(),100,true)
BaseL = EgtCurveLength( Side)
sName = "Side "..SideNum.." -F"
HeightL = FH
SideTab[SideNum].Frame = Frame --**?????????????????***** anche QUI *??????????????<<<<<<
end
-- chiamo la funzione per il disegno (senso antiorario) dei lati del rettangolo 'allineato'
--local l1, l2, l3, l4 = DrawRectangle (Pz, Lay, BaseL, HeightL, sName, RefToAF)
-- inserisco gli Id dei lati del rettangolo nel Side_Record in SideTab
--SideTab[SideNum].l1 = l1; SideTab[SideNum].l2 = l2; SideTab[SideNum].l3 = l3; SideTab[SideNum].l4 = l4
-- **INFO PER TAGLI INCLINATI**
-- --------------------------
-- |ripeti LEGENDA 1: campi di SideTab)|
-- |.IdSd = Side_Id; .IdPz = Pz_Id; .Frame = Ref_Id; .InfoSd = SideInfo(Alz/Front);|
-- |.l1---.l4 = Rectangle sides|; |.RContour = contorno del rettengolo|
-- |.RecPrv = Previous Record; RecNxt = Next Record|
-- |.VectS = Side Start; ; .VectE = Side End Vector;|
-- |.zPrvAng = PrecSide-Side_Angle; .zNxtAng = Side-ProxSide_Angle|
-- |.RefAF = GUID Reference.|
local Tab = SideTab
local N = SideNum
local Alphap; local Alphas
local Betap; local Betas
-- angoli tra lato precedente e attuale
Alphap = Tab[N].zPrvAng;
if Alphap >= 0 then
Betap = 180-Alphap
else
Betap = (180+Alphap)
end
-- angoli tra lato attuale e successivo
Alphas = Tab[N].zNxtAng;
if Alphas >= 0 then
Betas = 180-Alphas
else
Betas = (180+Alphas)
end
local Gamma1 -- angolo di taglio su lato l2
local Gamma2 -- angolo di taglio su lato l4
local Delta1=0
local Delta2=0
-- **ALZATINE**
if Tab[N].InfoSd == 1 then
-- CASI RIFERITI AL LATO PRECEDENTE
-- **1) Ap0.sx** = non continua da lato precedente, angolo 'a sx'
if (Tab[N].InfoSd ~= Tab[Tab[N].RecPrv].InfoSd) and Alphap > 0 then
Gamma1 = 90 - Betap
--SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
-- (in caso **p0.sx.2** = Alphap <= 90, non si fa taglio inclinato)
-- **2) Ap0.dx** = non continua da lato precedente, angolo 'a dx'
elseif (Tab[N].InfoSd ~= Tab[Tab[N].RecPrv].InfoSd) and Alphap < 0 then
Gamma1 = Betap - 90 -- meno F_Delta ???????
--SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
-- **3) Ap1.sx** = continua da lato precedente, angolo 'a sx'
elseif (Tab[N].InfoSd == Tab[Tab[N].RecPrv].InfoSd) and Alphap > 0 then
Gamma1 = (90-Betap/2-A_Delta)
--SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
-- **4) Ap1.dx** = continua da lato precedente, angolo 'a dx'
elseif (Tab[N].InfoSd == Tab[Tab[N].RecPrv].InfoSd) and Alphap < 0 then
Gamma1 = -(90-Betap/2-A_Delta)
--SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
end
-- CASI RIFERITI AL LATO SUCCESSIVO
-- **1) As0.sx** = non continua al lato successivo, angolo 'a sx'
if (Tab[N].InfoSd ~= Tab[Tab[N].RecNxt].InfoSd) and Alphas > 0 then
Gamma2 = 90 - Betas -- meno F_Delta ???
--SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
-- **2) As0.dx** = non continua al lato successivo, angolo 'a dx'
elseif (Tab[N].InfoSd ~= Tab[Tab[N].RecNxt].InfoSd) and Alphas < 0 then
Gamma2 = Betas - 90 -- meno F_Delta ???
--SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
-- **3) As1.sx** = continua al lato successivo, angolo 'a sx'
elseif (Tab[N].InfoSd == Tab[Tab[N].RecNxt].InfoSd) and Alphas > 0 then
Gamma2 = (90-Betas/2-A_Delta)
--SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
-- **4) As1.dx** = continua al lato successivo, angolo 'a dx'
elseif (Tab[N].InfoSd == Tab[Tab[N].RecNxt].InfoSd) and Alphas < 0 then
Gamma2 = - (90-Betas/2-A_Delta)
--SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
end
Delta1 = -tan( Gamma1)*CMP.ThicknessRaw
Delta2 = -tan( Gamma2)*CMP.ThicknessRaw
-- chiamo la funzione per il disegno (senso antiorario) dei lati del rettangolo 'allineato'
local l1, l2, l3, l4 = DrawRectangle (Pz, Lay, BaseL + Delta1 + Delta2 , HeightL, sName, RefToAF, Delta1, Delta2)
-- inserisco gli Id dei lati del rettangolo nel Side_Record in SideTab
SideTab[SideNum].l1 = l1; SideTab[SideNum].l2 = l2; SideTab[SideNum].l3 = l3; SideTab[SideNum].l4 = l4
SideAngSetInfo ( l2, LayLbl, Gamma1, dStdOffs, dHLbl)
SideAngSetInfo ( l4, LayLbl, Gamma2, dStdOffs, dHLbl)
-- **FRONTALINI**
elseif Tab[N].InfoSd == 2 then
-- |ripeti LEGENDA 1: campi di SideTab)|
-- |.IdSd = Side_Id; .IdPz = Pz_Id; .Frame = Ref_Id; .InfoSd = SideInfo(Alz/Front);|
-- |.l1---.l4 = Rectangle sides|
-- |.RecPrv = Previous Record; RecNxt = Next Record|
-- |.VectS = Side Start; ; .VectE = Side End Vector;|
-- |.zPrvAng = PrecSide-Side_Angle; .zNxtAng = Side-ProxSide_Angle|
-- |.RefAF = GUID Reference.|
-- CASI RIFERITI AL LATO PRECEDENTE
-- **1) Fp0.sx** = non continua da lato precedente, angolo 'a sx'
if (Tab[N].InfoSd ~= Tab[Tab[N].RecPrv].InfoSd) and Alphap > 0 then
if Alphap > 90 then
Gamma1 = Betap - 90 -- meno F_Delta ????
--SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
-- (in caso Alphap <= 90, non si fa taglio inclinato)
else
Gamma1 = 0
--SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
end
-- **2) Fp0.dx** = non continua da lato precedente, angolo 'a dx'
elseif (Tab[N].InfoSd ~= Tab[Tab[N].RecPrv].InfoSd) and Alphap < 0 then
if -Alphap > 90 then
Gamma1 = 90 - Betap -- meno F_Delta ????
--SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
-- (in caso -Alphap <= 90, non si fa taglio inclinato)
else
Gamma1 = 0
--SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
end
-- **3) Fp1.sx** = continua da lato precedente, angolo 'a sx'
elseif (Tab[N].InfoSd == Tab[Tab[N].RecPrv].InfoSd) and Alphap > 0 then
Gamma1 = -(90-Betap/2+F_Delta)
--SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
-- **4) Fp1.dx** = continua da lato precedente, angolo 'a dx'
elseif (Tab[N].InfoSd == Tab[Tab[N].RecPrv].InfoSd) and Alphap < 0 then
Gamma1 = 90-Betap/2-F_Delta
--SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
end
-- CASI RIFERITI AL LATO SUCCESSIVO
-- |ripeti LEGENDA 1: campi di SideTab)|
-- |.IdSd = Side_Id; .IdPz = Pz_Id; .Frame = Ref_Id; .InfoSd = SideInfo(Alz/Front);|
-- |.l1---.l4 = Rectangle sides|; |.RContour = contorno del rettengolo|
-- |.RecPrv = Previous Record; RecNxt = Next Record|
-- |.VectS = Side Start; ; .VectE = Side End Vector;|
-- |.zPrvAng = PrecSide-Side_Angle; .zNxtAng = Side-ProxSide_Angle|
-- |.RefAF = GUID Reference.|
-- **1) Fs0.sx** = non continua al lato successivo, angolo 'a sx'
if (Tab[N].InfoSd ~= Tab[Tab[N].RecNxt].InfoSd) and Alphas > 0 then
if Alphas > 90 then
Gamma2 = Betas - 90 -- meno F_Delta ????
--SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
-- (in caso Alphap <= 90, non si fa taglio inclinato)
else
Gamma2 = 0
--SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
end
-- **2) Fs0.dx** = non continua al lato successivo, angolo 'a dx'
elseif (Tab[N].InfoSd ~= Tab[Tab[N].RecNxt].InfoSd) and Alphas < 0 then
-- **Fs0.dx.1**
if -Alphas > 90 then
Gamma2 = 90 - Betas -- meno F_Delta ????
--SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
-- (in caso -Alphap <= 90, non si fa taglio inclinato)
else
Gamma2 = 0
--SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
end
-- **3) Fs1.sx** = continua al lato successivo, angolo 'a sx'
elseif (Tab[N].InfoSd == Tab[Tab[N].RecNxt].InfoSd) and Alphas > 0 then
Gamma2 = - (90-Betas/2+F_Delta)
--SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
-- **4) Fs1.dx** = continua al lato successivo, angolo 'a dx'
elseif (Tab[N].InfoSd == Tab[Tab[N].RecNxt].InfoSd) and Alphas < 0 then
Gamma2 = 90-Betas/2-F_Delta
--SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
end
-- ******************** CHIAMARE QUI FUNZIONE RETTANGOLO ********************************
-- chiamo la funzione per il disegno (senso antiorario) dei lati del rettangolo 'allineato'
local l1, l2, l3, l4 = DrawRectangle (Pz, Lay, BaseL + Delta1 + Delta2 , HeightL, sName, RefToAF, Delta1, Delta2)
-- inserisco gli Id dei lati del rettangolo nel Side_Record in SideTab
SideTab[SideNum].l1 = l1; SideTab[SideNum].l2 = l2; SideTab[SideNum].l3 = l3; SideTab[SideNum].l4 = l4
SideAngSetInfo ( l2, LayLbl, Gamma1, dStdOffs, dHLbl)
SideAngSetInfo ( l4, LayLbl, Gamma2, dStdOffs, dHLbl)
-- taglio inclinato a -(45+delta) del lato superiore del frontalino
Gamma = -(45+F_Delta)
SideAngSetInfo ( l1, LayLbl, Gamma, dStdOffs, dHLbl)
SideAngSetInfo ( Tab[N].IdSd, LayLbl, Gamma, dStdOffs, dHLbl)
end --AlZATINE/FRONTALINI
-- ???? prevedere caso di errore (info ~= da 1 e da 2 e non nulla ??????
EgtDeselectAll()
-- inserisco info con riferimento al lato del componente
-- EgtSetInfo( l1, "RifSideId", Tab[N].IdSd) -- |<<<<<<<<<<<<<<<<<< bisogna mettere il nome del lato !!? NICOLA: ho creato un ideintificaticativo univoco <<<<<<<<<<<<<<<<<<<<<<<<<|
end -- richiesta alzatina o frontalini
end --for COSTRUZIONE DELLE FIGURE (rettangoli)
-- **CALCOLO DEGLI SPOSTAMENTI PER EVENTUALI INTERSEZIONI DEI RETTANGOLI RAPPRESENTATIVI DI A/F**
-- ------------------------------------------------------------------------------------
-- |Ipotesi 1|: Non più di due angoli 'a destra' consecutivi
-- |Ipotesi 2|: Nel caso di cui sopra, un solo angolo 'chiuso'
-- |ATTENZIONE| un rettangolo già mosso o che non si può muovere 'indietro' deve essere identificato ??!
SideNum = 1
-- for SideNum = 1 , #SideTab do --#SideTab do
while SideNum <= #SideTab do
-- |ripeti LEGENDA 1: campi di SideTab)|
-- |.IdSd = Side_Id; .IdPz = Pz_Id; .Frame = Ref_Id; .InfoSd = SideInfo(Alz/Front);|
-- |.l1---.l4 = Rectangle sides|; |.RContour = contorno del rettengolo|
-- |.RecPrv = Previous Record; RecNxt = Next Record|
-- |.VectS = Side Start; ; .VectE = Side End Vector;|
-- |.zPrvAng = PrecSide-Side_Angle; .zNxtAng = Side-ProxSide_Angle.|
-- |LEGENDA 2: INTERSEZIONI|
-- a) un solo angolo consecutivo a dx (alpha < 0+eps)
-- a.r) due rettangoli
-- a.r1) un solo rettangolo con il lato compo successivo
-- a.r2) un solo rettangolo con il alto compo precedente
-- b) due angoli successivi a dx (alpha1 e alpha 2 < 0°+eps);
-- (|alpha1 |+|alpha2 |>90°, <<180°)
-- solo rettangoli rN e rN+2
-- b.r1r3) si intersecano i due rettangoli
-- b.r1) rN interseca il lato N+2
-- b.r3) rN+2 nterseca il lato N
-- c) come (b) ma con anche il rettangolo rN+1
-- (rN+1 resta fermo a mano che |alpha1 | o |alpha2 |>90° <= | se si ammette questo caso ?????????|
-- bisogna verificare alpha1 e alpha2 se acuti => caso (a) per rN+1; quindi 'sfilare' rN da RN+1 e rN+2 da rN+1
local Tab = SideTab
local N = SideNum
local epsilon = 0.1 -- costante
--local dOffsR = CMP.BBoxRad*0.1 -- distanza dei rettangoli dal lato corrispondente
local dsp1x -- spostamento (nel verso x+ del proprio sist. di rif.) del rettangolo
local dH1, dH2, dH3 -- altezze dei rettangoli N, N+1, N+2 rispettivamente a seconda se alzatine o frontalini
if Tab[N].InfoSd == 1 then dH1 = AH else dH1 = FH end
if Tab[Tab[N].RecNxt].InfoSd == 1 then dH2 = AH else dH2 = FH end
if Tab[Tab[Tab[N].RecNxt].RecNxt].InfoSd == 1 then dH3 = AH else dH3 = FH end
local Alpha1 = Tab[N].zNxtAng
local Beta1 = 180 + Alpha1
local Alpha2 = Tab[Tab[N].RecNxt].zNxtAng
local Beta2 = 180 + Alpha2
-- **[a]: un solo angolo consecutivo a dx**
if Alpha1 < 0 and Alpha2 > 0 then
local dSp1xa, dSp1xb, dSP2xa, dSp2xb
local dSp1x, dSp2x
-- **[a.r1r2]**: entrambi i lati N e N+1 iunteressati da A/F
if Tab[N].InfoSd > 0 and Tab[Tab[N].RecNxt].InfoSd > 0 then
--calcolo degli spostamenti per rettangolo 1 (lato N)
dSp1xa = -(dOffsR+dH2)/sin(Alpha1)
if abs( Alpha1) >= 90 then
--dSP1xb = -(dOffsR+dH1)*tan(90+Alpha1) + dOffsC*tan(90+Alpha1)
dSP1xb = -(dOffsR+dH1)*tan(90+Alpha1) -- - dOffsC*tan(90+Alpha1)
else
dSP1xb = dOffsR*tan(90+Alpha1) -- + dOffsC*tan(90+Alpha1)
end
if abs( Alpha1) >= 90 then
dSp1x = dSp1xa + dSP1xb + dOffsC
else
dSp1x = dSp1xa - dSP1xb + dOffsC
end
-- calcolo degli spostamenti per rettangolo 2 (lato N+1)
dSp2xb = -(dOffsR+dH1)/sin(Beta1) -- - dOffsR/sin(Beta1)
if abs( Alpha1) >= 90 then
dSp2xa = (dOffsR+dH2)*tan(90+Alpha1) -- + dOffsC*tan(90+Alpha1)
else
dSp2xa = -dOffsR*tan(90+Alpha1) -- - dOffsC*tan(90+Alpha1)
end
local Opz = 1 -- <<<<<<<<<<<<<< OPZIONE PROVA <<<<<<<<<<<<<<<<<<<
-- opzione 1 (massima) per spostamento R2
if Opz == 1 then
if abs( Alpha1) >= 90 then
dSp2x = (dSp2xb + dSp2xa) - dOffsC
else
dSp2x = (dSp2xb - dSp2xa) - dOffsC
end
-- opzione 2 (minima) per spostamento R2
else
if abs( Alpha1) >= 90 then
dSp2x = dSp2xa + dOffsC
else
dSp2x = 0
end
end
if dSp1x ~= 0 then
EgtMoveGroup( Tab[N].IdPz, {dSp1x, 0, 0})
end
if dSP2x ~= 0 then
EgtMoveGroup( Tab[Tab[N].RecNxt].IdPz, {dSp2x, 0, 0})
end
-- **[a.r1]:** solo il lato N interessato da A/F, angolo tra i lati acuto
elseif Tab[N].InfoSd > 0 and Tab[Tab[N].RecNxt].InfoSd == 0
and abs( Alpha1) >= 90 then
dSp1x = -(dOffsR+dH1)*tan(90+Alpha1) + dOffsC
if dSp1x ~= 0 then
EgtMoveGroup( Tab[N].IdPz, {dSp1x, 0, 0})
end
-- **[a.r2]:** solo il lato N+1 interessato da A/F
elseif Tab[N].InfoSd == 0 and Tab[Tab[N].RecNxt].InfoSd > 0
and abs( Alpha1) >= 90 then
dSp2x = (dOffsR+dH2)*tan(90+Alpha1) - dOffsC
if dSP2x ~= 0 then
EgtMoveGroup( Tab[Tab[N].RecNxt].IdPz, {dSp2x, 0, 0})
end
end
SideNum = SideNum + 2
-- **[c]=[b.r1r2r3]:** due angoli consecutivi a dx; tre lati, N, N+1, N+2 interesssati da A/F
-- la somma dei due angoli interni deve essere >= 180°
elseif Alpha1 < 0 and Alpha2 < 0 and
(Tab[N].InfoSd > 0 and Tab[Tab[N].RecNxt].InfoSd > 0 and Tab[Tab[Tab[N].RecNxt].RecNxt].InfoSd > 0 ) then
local dSp1xa, dSp1xb, dSP3xa, dSp3xb
local dSp1x, dSp3x
--calcolo degli spostamenti per rettangolo 1 (lato N)
if abs( Alpha1) <= 90 and abs( Alpha2) <= 90 then
--<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< QUI <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
dSp1xa = -(dOffsR+dH2)/sin(Alpha1)
dSP1xb = dOffsR*tan(90+Alpha1)
dSp1x = dSp1xa - dSP1xb + dOffsC
dSp3xb = -(dOffsR+dH2)/sin(Beta2) -- - dOffsR/sin(Beta1)
dSp3xa = -dOffsR*tan(90+Alpha1) -- - dOffsC*tan(90+Alpha1)
dSp3x = (dSp3xb - dSp3xa) - dOffsC
if dSp1x ~= 0 then
EgtMoveGroup( Tab[N].IdPz, {dSp1x, 0, 0})
end
if dSP3x ~= 0 then
EgtMoveGroup( Tab[Tab[Tab[N].RecNxt].RecNxt].IdPz, {dSp3x, 0, 0})
end
elseif abs( Alpha1) >= 90 and abs( Alpha3) <= 90 then
CMP.ERR = 1
CMP.MSG = Msg[370].. "da prevedere?"
elseif abs( Alpha1) <= 90 and abs( Alpha3) >= 90 then
CMP.ERR = 2
CMP.MSG = Msg[370].. "da prevedere?"
else
CMP.ERR = 3
CMP.MSG = Msg[370].. "da prevedere?"
end
SideNum = SideNum + 3
else
SideNum = SideNum + 1
end -- [c] = due angoli consecutivi a dx
end -- while /verifica intersezioni)
--[==[ MOVIMENTI
-- calcolo degli spostamenti (lungo i propri lati di riferimento)
-- a) > if a & b & c
-- di r1 rispetto a r2 e a r3 > prendo il maggiore
-- di r3 rispetto a r1 e a r2 > prendo il maggiore
-- poi posso saltare due lati (?) sì se vale l'ipotesi di massimo due angoli a dx
-- b) elseif a & c & not b
-- di r1 rispetto a r3 e ... viceversa (?)
-- poi posso saltare due lati (?) sì se vale l'ipotesi di massimo due angoli a dx
-- c) else if a & not b & not c
-- di r1 rispetto a r2 e ... viceversa (?)
-- ma att.ne !!! potrei comprometere situazioni successive !!!!!!!!!!!!!!
-- else if : potrebbe esserci intersezione del singolo rettangolo con il lato successivo
-- o precedente !!
-- end ??
-- in caso di intersezione (a), devo verificare se R1 può muoversi 'indietro' o meno
-- in caso negativo, dovrà muoversi R2
Alphas = Tab[N].zNxtAng;
-- **[a)dx.ch.] = caso di interferenza con angolo succcessivo 'a dx', 'chiuso'**
if (Tab[N].InfoSd ~= nil and Tab[Tab[N].RecNxt].InfoSd ~= nil) then
-- if angolo precedente 'aperto' then
-- muovo il rettangolo 1
--and Alphas <= -90 then
EgtMove( Tab[N].IdPz, EgtEP(Tab[N].l3))
-- Point3d EgtIP( int nId1, int nId2, Point3d ptNear [, int RefId = nId])
-- bool EgtMove( int nId/s, Vector3d vtMove [, int nRefType = GDB_RT.LOC])
-- else ( angolo precedente 'chiuso
=> devo spostare il rettangolo 2
end
--else if veriifcare interferenza con i lati del compo principale, se c'è un solo rettangolo
]==]
end --function CMP_Draw(bPreview)
_G.CMP_Draw = CMP_Draw
CMP_Draw(true) -- solo per da egtCAM5
EgtZoom(SCE_ZM.ALL)
--EgtSaveFile( )
File diff suppressed because it is too large Load Diff
-5
View File
@@ -1,5 +0,0 @@
CMP.V1=1000.0
CMP.V2=200.0
CMP.V3=1600.0
CMP.V4=200.0
CMP.V5=0.0
+115 -49
View File
@@ -3,23 +3,7 @@
-- Tavola per definizione modulo (serve ma non usata)
local EgtCompo = {}
print( 'EgtCompo Carlo started')
--[[
-- 2021/07
-- Disegna i lati di un rattangolo 'allineato' dati layer, Punto, base, altezza e versore (direzione) della base
function DrawRectAll (Lay, Pt, BaseL, HeightL, Vect, sName)
local l1 = EgtLinePVL( Lay,Pt,VRotated( Vect,-90),HeightL)
EgtSetName( l1,sName.."l1")
local l2 = EgtLinePVL( Lay,EgtEP( l1),Vect,BaseL)
EgtSetName( l2,sName.."l2")
local l3 = EgtLinePVL( Lay,EgtEP( l2),VRotated( Vect,90),HeightL)
EgtSetName( l3,sName.."l3")
local l4 = EgtLine( Lay,EgtEP( l3),EgtSP( l1))
EgtSetName( l4,sName.."l4")
return l1, l2, l3, l4
end
]]
print( 'EgtCompo 2.3l0 started')
--[[ 2021/08
@@ -78,7 +62,7 @@ function AddLineDashes( Lq, LineId, dLen)
end
-- Aggiunge un simbolo circolare all'angolo dati due lati
function CircleIntPol (Layer,l1,l2,Ang,cnv) -- cnv = true se angolo dato acuto
function CircleIntPol ( Layer,l1,l2,Ang,cnv) -- cnv = true se angolo dato acuto
--ErrArc = EgtArcC2P(La,EgtSP(l2),Point3d(20,0,0),EgtSP(l1))
local vtBis, dLen, ptAngErr, crAngErr, sfAngErr
if cnv then
@@ -95,7 +79,7 @@ function CircleIntPol (Layer,l1,l2,Ang,cnv) -- cnv = true se angolo dato acuto
end
-- Restituisce la stringa del valore limite con le unità di misura UI
function GetLenLimit(Lim)
function GetLenLimit( Lim)
if EgtUiUnitsAreMM() then
return EgtNumToString(Lim,2)..' mm'
else
@@ -103,56 +87,82 @@ function GetLenLimit(Lim)
end
end
-- Inserisce una etichetta orizzontale centrata nel punto indicato
function AddLabelPnt(Lay,pt,sText,dH,Rot,col)
-- Inserisce una etichetta centrata nel punto indicato **in coord. globali**
function AddLabelPnt( Lay, pt, sText, dH, Rot, col)
local v = EgtTextAdv(Lay,pt,Rot,sText,'',100,'S',dH,1,0,GDB_TI.MC,GDB_RT.GLOB)
EgtSetColor(v,col)
return v
end
-- Inserisce una etichetta orizzontale vicino al punto medio di un elemento
function AddLabel(Lay,nEdge,offset,sText,dH,rot,col)
local vt = EgtMV(nEdge,GDB_ID.ROOT)
vt:rotate(Z_AX(),rot) -- rot=rotazione del versore di offset
local pt = EgtMP(nEdge,GDB_ID.ROOT) + vt * offset * dH + Vector3d(0,0,10)
local v = EgtTextAdv(Lay,pt,0,sText,'',100,'S',dH,1,0,GDB_TI.MC,GDB_RT.GLOB)
-- Inserisce una etichetta centrata nel punto indicato **in coord. locali**
function AddLabelPntLOC( Lay, pt, sText, dH, Rot, col)
local v = EgtTextAdv( Lay, pt, Rot, sText,'', 100, 'S', dH, 1, 0, GDB_TI.MC, GDB_RT.LOC)
EgtSetColor(v,col)
return v
end
-- Inserisce una **etichetta orizzontale** vicino al punto medio di un elemento
function AddLabel( Lay, nEdge, offset, sText, dH, rot, col)
local vt = EgtMV( nEdge, GDB_ID.ROOT)
vt:rotate(Z_AX(),rot) -- rotazione del versore di offset
local pt = EgtMP( nEdge,GDB_ID.ROOT) + vt * offset * dH + Vector3d(0,0,10)
local v = EgtTextAdv( Lay, pt, 0, sText, '', 100, 'S', dH, 1, 0, GDB_TI.MC, GDB_RT.GLOB)
EgtSetColor(v,col)
EgtSetStatus(v,GDB_ST.SEL)
return v
end
-- Inserisce una etichetta allineata vicino al punto medio di un elemento
function AddLabelAl(Lay,nEdge,offset,sText,dH,rot,col)
local vt = EgtMV(nEdge,GDB_ID.ROOT)
local vtAng = atan2(vt:getY(),vt:getX())
vt:rotate(Z_AX(),rot) -- rot=rotazione del versore di offset
local pt = EgtMP(nEdge,GDB_ID.ROOT) + vt * offset * dH + Vector3d(0,0,10)
local v = EgtTextAdv(Lay,pt,vtAng,sText,'',100,'S',dH,1,0,GDB_TI.MC,GDB_RT.GLOB)
EgtSetColor(v,col)
EgtSetStatus(v,GDB_ST.SEL)
-- Inserisce una **etichetta allineata** vicino al punto medio di un elemento
function AddLabelAl( Lay, nEdge, offset, sText, dH, rot, col)
local vt = EgtMV( nEdge, GDB_ID.ROOT)
local vtAng = atan2(vt:getY(), vt:getX())
vt:rotate( Z_AX(), rot) -- rotazione del versore di offset
local pt = EgtMP( nEdge, GDB_ID.ROOT) + vt * offset * dH + Vector3d(0,0,10)
local v = EgtTextAdv( Lay, pt, vtAng, sText,'', 100, 'S', dH, 1, 0, GDB_TI.MC, GDB_RT.GLOB)
EgtSetColor( v,col)
EgtSetStatus( v,GDB_ST.SEL)
return v
end
-- Inserisce una **etichetta allineata ed eventualmente ruotata** vicino al punto medio di un elemento
function AddLabelAl2( Lay, nEdge, offset, sText, dH, rot, col, bInv)
local vt = EgtMV( nEdge, GDB_ID.ROOT)
local vtAng = atan2( vt:getY(), vt:getX())
local vtAng2
if vtAng >= -75 and vtAng <= 115 then
vtAng2 = vtAng
else
vtAng2 = vtAng + 180
end
vt:rotate( Z_AX(),rot) -- rotazione del versore di offset
--local pt = EgtMP( nEdge, GDB_ID.ROOT) + vt * offset * dH + Vector3d(0,0,10)
local pt = EgtMP( nEdge, GDB_ID.ROOT) + vt * (offset + dH/2) + Vector3d(0,0,10)
local v = EgtTextAdv( Lay, pt, vtAng2, sText,'', 100, 'S', dH, 1, 0, GDB_TI.MC, GDB_RT.GLOB)
EgtSetColor( v, col)
EgtSetStatus( v, GDB_ST.SEL)
return v
end
-- Inserisce una etichetta orizzontale vicino alla posizione data (param. "U" da sx) di un elemento
function AddLabelU(Lay,nEdge,U,offset,sText,dH,rot,col)
function AddLabelU( Lay,nEdge,U,offset,sText,dH,rot,col)
--local vt = EgtMV(nEdge-1,GDB_ID.ROOT)
local vt = EgtMV(nEdge,GDB_ID.ROOT)
vt:rotate(Z_AX(),rot) -- rot=rotazione del versore di offset
local pt = EgtUP(nEdge,U,GDB_ID.ROOT) + vt * offset * dH + Vector3d(0,0,10)
local v = EgtTextAdv(Lay,pt,0,sText,'',100,'S',dH,1,0,GDB_TI.MC,GDB_RT.GLOB)
EgtSetColor(v,col)
EgtSetStatus(v,GDB_ST.SEL)
local vt = EgtMV( nEdge, GDB_ID.ROOT)
vt:rotate(Z_AX(), rot) -- rot=rotazione del versore di offset
local pt = EgtUP( nEdge, U, GDB_ID.ROOT) + vt * offset * dH + Vector3d(0,0,10)
local v = EgtTextAdv(Lay, pt, 0, sText, '', 100, 'S', dH, 1, 0, GDB_TI.MC, GDB_RT.GLOB)
EgtSetColor( v, col)
EgtSetStatus( v, GDB_ST.SEL)
return v
end
-- Inserisce una etichetta allineata vicino alla posizione data (para. "U" da sx) di un elemento
function AddLabelUAl(Lay,nEdge,U,offset,sText,dH,rot,col)
local vt = EgtMV(nEdge,GDB_ID.ROOT)
function AddLabelUAl( Lay, nEdge, U, offset, sText, dH, rot, col)
local vt = EgtMV( nEdge, GDB_ID.ROOT)
--local vt = EgtMV(nEdge,GDB_ID.ROOT)
local vtAng = atan2(vt:getY(),vt:getX())
vt:rotate(Z_AX(),rot) -- rot=rotazione del versore di offset
local pt = EgtUP(nEdge,U,GDB_ID.ROOT) + vt * offset * dH + Vector3d(0,0,10)
local v = EgtTextAdv(Lay,pt,vtAng,sText,'',100,'S',dH,1,0,GDB_TI.MC,GDB_RT.GLOB)
local vtAng = atan2( vt:getY(), vt:getX())
vt:rotate( Z_AX(),rot) -- rot=rotazione del versore di offset
local pt = EgtUP( nEdge, U, GDB_ID.ROOT) + vt * offset * dH + Vector3d(0,0,10)
local v = EgtTextAdv( Lay, pt, vtAng, sText, '', 100, 'S', dH, 1, 0, GDB_TI.MC, GDB_RT.GLOB)
EgtSetColor(v,col)
EgtSetStatus(v,GDB_ST.SEL)
return v
@@ -385,4 +395,60 @@ function CreateTopSurf( Lw, Lo, Ly, Ls)
return true
end -- di CreateTopSurf(Lw,Lo,Ly,Ls)
-- Mirror rispetto all'asse Y (SIMMETRIA)
function GetAllSimm( Lay1, Lay2, Lay3, Lay4, Lay5, Lay6, Lay7, Lay8)
if Lay1 then
EgtMirror( EgtGetAllInGroup( Lay1), ORIG(), X_AX(), GDB_RT.GLOB)
end
if Lay2 then
EgtMirror( EgtGetAllInGroup( Lay2), ORIG(), X_AX(), GDB_RT.GLOB)
end
if Lay3 then
EgtMirror( EgtGetAllInGroup( Lay3), ORIG(), X_AX(), GDB_RT.GLOB)
end
if Lay4 then
EgtMirror( EgtGetAllInGroup( Lay4), ORIG(), X_AX(), GDB_RT.GLOB)
end
if Lay5 then
EgtMirror( EgtGetAllInGroup( Lay5), ORIG(), X_AX(), GDB_RT.GLOB)
end
if Lay6 then
EgtMirror( EgtGetAllInGroup( Lay6), ORIG(), X_AX(), GDB_RT.GLOB)
end
if Lay7 then
EgtMirror( EgtGetAllInGroup( Lay7), ORIG(), X_AX(), GDB_RT.GLOB)
end
if Lay8 then
EgtMirror( EgtGetAllInGroup( Lay8), ORIG(), X_AX(), GDB_RT.GLOB)
end
end
-- Mirror rispetto all'asse X (RIBALTAMENTO)
function GetAllRib( Lay1, Lay2, Lay3, Lay4, Lay5, Lay6, Lay7, Lay8)
if Lay1 then
EgtMirror( EgtGetAllInGroup( Lay1), ORIG(), Y_AX(), GDB_RT.GLOB)
end
if Lay2 then
EgtMirror( EgtGetAllInGroup( Lay2), ORIG(), Y_AX(), GDB_RT.GLOB)
end
if Lay3 then
EgtMirror( EgtGetAllInGroup( Lay3), ORIG(), Y_AX(), GDB_RT.GLOB)
end
if Lay4 then
EgtMirror( EgtGetAllInGroup( Lay4), ORIG(), Y_AX(), GDB_RT.GLOB)
end
if Lay5 then
EgtMirror( EgtGetAllInGroup( Lay5), ORIG(), Y_AX(), GDB_RT.GLOB)
end
if Lay6 then
EgtMirror( EgtGetAllInGroup( Lay6), ORIG(), Y_AX(), GDB_RT.GLOB)
end
if Lay7 then
EgtMirror( EgtGetAllInGroup( Lay7), ORIG(), Y_AX(), GDB_RT.GLOB)
end
if Lay8 then
EgtMirror( EgtGetAllInGroup( Lay8), ORIG(), Y_AX(), GDB_RT.GLOB)
end
end
return EgtCompo
-6
View File
@@ -1,6 +0,0 @@
CMP.V1=1800
CMP.V2=2000
CMP.V3=600
CMP.V4=650
CMP.V5=false
CMP.V6=false
+8 -6
View File
@@ -168,16 +168,18 @@ function CMP_Draw(bPreview)
-- Simmetria
if Simm then
EgtMirror({Ly,Lr,La},ORIG(),X_AX(),GDB_RT.GLOB)
EgtInvertCurve({l1,l2,l4,l6,l5,l3,d1})
EgtSetInfo(La,"SIMM","1")
-- EgtMirror({Ly,Lr,La},ORIG(),X_AX(),GDB_RT.GLOB)
GetAllSimm( Ly, Lr, La)
EgtInvertCurve({l1,l2,l4,l6,l5,l3,d1})
EgtSetInfo(La,"SIMM","1")
end
-- Ribaltamento della figura
if Rib then
EgtMirror({Ly,Lr,La,Le},ORIG(),Y_AX(),GDB_RT.GLOB)
EgtInvertCurve({l1,l2,l4,l6,l5,l3})
EgtSetInfo(La,"RIB","1")
--EgtMirror({Ly,Lr,La,Le},ORIG(),Y_AX(),GDB_RT.GLOB)
GetAllRib( Ly, Lr, La, Le)
EgtInvertCurve({l1,l2,l4,l6,l5,l3})
EgtSetInfo(La,"RIB","1")
end
EgtReorderCurvesInGroup(Ly,ORIG())
-8
View File
@@ -1,8 +0,0 @@
CMP.V1=1800
CMP.V2=2000
CMP.V3=600
CMP.V4=500
CMP.V5=false
CMP.V6=100
CMP.V7=false
CMP.V8=false
+11 -9
View File
@@ -235,18 +235,20 @@ local function CMP_DrawA2(bPreview)
-- Simmetria orizzontale
if Simm then
EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),X_AX(),GDB_RT.GLOB)
EgtInvertCurve({l1,l2,l3,l4,l5,l6,l7,arcAlfa})
if CMP.ERR == 0 then
EgtInvertCurve(d1)
EgtSetInfo(La,"SIMM","1")
end
--EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),X_AX(),GDB_RT.GLOB)
GetAllSimm( Ly, Lr, La, Le, Lq)
EgtInvertCurve({l1,l2,l3,l4,l5,l6,l7,arcAlfa})
if CMP.ERR == 0 then
EgtInvertCurve(d1)
EgtSetInfo(La,"SIMM","1")
end
end
-- Simmetria verticale ('ribaltamento')
if Rib then
EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),Y_AX(),GDB_RT.GLOB)
EgtInvertCurve({l1,l2,l3,l4,l5,l6,l7,arcAlfa})
EgtSetInfo(La,"RIB","1")
--EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),Y_AX(),GDB_RT.GLOB)
GetAllRib( Ly, Lr, La, Le, Lq)
EgtInvertCurve({l1,l2,l3,l4,l5,l6,l7,arcAlfa})
EgtSetInfo(La,"RIB","1")
end
EgtReorderCurvesInGroup(Ly,ORIG())
-7
View File
@@ -1,7 +0,0 @@
CMP.V1=1000
CMP.V2=500
CMP.V3=500
CMP.V4=30
CMP.V5=50
CMP.V6=false
CMP.V7=false
+7 -3
View File
@@ -41,7 +41,7 @@ CMP.N6 = '←→' -- Simmetria dx/sx (true = svuotamento a dx)
CMP.V6 = false
CMP.N7 = '↑↓' -- Simmetria su/giù ('ribaltamento') (true = 'L' capovolta)
CMP.T7 = 1
CMP.V7 = false
CMP.V7 = true
CMP.Npar = 7
CMP.Nome = Nome
CMP.WithInt = true
@@ -227,14 +227,16 @@ function CMP_Draw(bPreview)
-- Simmetria orizzontale
if Simm then
EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),X_AX(),GDB_RT.GLOB)
--EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),X_AX(),GDB_RT.GLOB)
GetAllSimm( Ly, Lr, La, Le, Lq)
EgtInvertCurve({l1,l2,l3,l4,arc,l6,l7,d1})
EgtInvertCurve({DimLineL3,DimLineLC,DimLineLZ,DimLineL7,lnZ2,DimLineR1,DimLineR2,DimLineR3})
EgtSetInfo(La,"SIMM","1")
end
-- Simmetria verticale ('ribaltamento')
if Rib then
EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),Y_AX(),GDB_RT.GLOB)
--EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),Y_AX(),GDB_RT.GLOB)
GetAllRib( Ly,Lr,La,Le,Lq)
EgtInvertCurve({l1,l2,l3,l4,arc,l6,l7})
EgtInvertCurve({DimLineL3,DimLineLC,DimLineLZ,DimLineL7,lnZ2,DimLineR1,DimLineR2})
EgtSetInfo(La,"RIB","1")
@@ -331,3 +333,5 @@ function CMP_Draw(bPreview)
end
end
_G.CMP_Draw = CMP_Draw
CMP_Draw(true)
EgtZoom(SCE_ZM.ALL)
-6
View File
@@ -1,6 +0,0 @@
CMP.V1=800
CMP.V2=500
CMP.V3=30
CMP.V4=50
CMP.V5=false
CMP.V6=false
+6 -2
View File
@@ -193,14 +193,16 @@ function CMP_Draw(bPreview)
-- Simmetria orizzontale
if Simm then
EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),X_AX(),GDB_RT.GLOB)
--EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),X_AX(),GDB_RT.GLOB)
GetAllSimm( Ly, Lr, La, Le, Lq)
EgtInvertCurve({l1,l2,l3,l4,l5,l6,d1})
EgtInvertCurve({DimLineLZ,lnZ2,DimLineR3})
EgtSetInfo(La,"SIMM","1")
end
-- Simmetria verticale ('ribaltamento')
if Rib then
EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),Y_AX(),GDB_RT.GLOB)
--EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),Y_AX(),GDB_RT.GLOB)
GetAllRib( Ly,Lr,La,Le,Lq)
EgtInvertCurve({l1,l2,l3,l4,l5,l6})
EgtInvertCurve({DimLineLZ,lnZ2})
EgtSetInfo(La,"RIB","1")
@@ -288,3 +290,5 @@ function CMP_Draw(bPreview)
end
end
_G.CMP_Draw = CMP_Draw
CMP_Draw(true)
EgtZoom(SCE_ZM.ALL)
-7
View File
@@ -1,7 +0,0 @@
CMP.V1=1800
CMP.V2=2000
CMP.V3=600
CMP.V4=500
CMP.V5=110
CMP.V6=false
CMP.V7=false
+5 -3
View File
@@ -33,7 +33,7 @@ CMP.N4 = 'D' -- profondità lato 'orizzontale'
CMP.V4 = 500
CMP.N5 = 'a' -- angolo Alfa tra i muri (compreso tra AlfaMin e AlfaMax)
CMP.T5 = 4
CMP.V5 = 110
CMP.V5 = 85
CMP.N6 = '←→' -- Simmetria dx/sx (true = svuotamento a dx)
CMP.T6 = 1
@@ -207,7 +207,8 @@ function CMP_Draw(bPreview)
-- Simmetria orizzontale
if Simm then
EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),X_AX(),GDB_RT.GLOB)
--EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),X_AX(),GDB_RT.GLOB)
GetAllSimm( Ly, Lr, La, Le, Lq)
EgtInvertCurve({l1,l2,l3,l4,l5,l6,arcAlfa})
if CMP.ERR == 0 then
EgtInvertCurve(d1)
@@ -216,7 +217,8 @@ function CMP_Draw(bPreview)
end
-- Simmetria verticale ('ribaltamento')
if Rib then
EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),Y_AX(),GDB_RT.GLOB)
--EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),Y_AX(),GDB_RT.GLOB)
GetAllRib( Ly,Lr,La,Le,Lq)
EgtInvertCurve({l1,l2,l3,l4,l5,l6,arcAlfa})
EgtSetInfo(La,"RIB","1")
end
-9
View File
@@ -1,9 +0,0 @@
CMP.V1=1800.0
CMP.V2=2000.0
CMP.V3=600.0
CMP.V4=500.0
CMP.V5=75.0
CMP.V6=false
CMP.V7=100.0
CMP.V8=false
CMP.V9=false
+28 -19
View File
@@ -44,10 +44,10 @@ CMP.N7 = 'G/R' -- lunghezza 'smusso' interno a 45° o raggio di raccordo
CMP.V7 = 100
CMP.N8 = '←→' -- Simmetria dx/sx (true = svuotamento a dx)
CMP.T8 = 1
CMP.V8 = false
CMP.V8 = true
CMP.N9 = '↑↓' -- Simmetria su/giù ('ribaltamento') (true = 'L' capovolta)
CMP.T9 = 1
CMP.V9 = false
CMP.V9 = true
CMP.Npar = 9
CMP.Nome = Nome
CMP.WithInt = true
@@ -57,6 +57,7 @@ _G.CMP = CMP
CMP.DATA = EgtGetSourceDir() .. CMP.Nome ..'.dat'
LoadCompoData()
-- FIGURA CON RACCORDO
local function CMP_DrawC2(bPreview)
-- Carico i messaggi
local Msg = require('EgtCompoMsg')
@@ -238,17 +239,20 @@ local function CMP_DrawC2(bPreview)
end
-- Simmetria orizzontale
if Simm then
EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),X_AX(),GDB_RT.GLOB)
if Simm then
--EgtMirror( { Ly, Lr, La, Le, Lq}, ORIG(), X_AX(), GDB_RT.GLOB)
GetAllSimm( Ly, Lr, La, Le, Lq)
EgtInvertCurve({l1,l2,l3,l4,l5,l6,l7,arcAlfa})
if CMP.ERR == 0 then
EgtInvertCurve(d1)
EgtSetInfo(La,"SIMM","1")
end
end
EgtSetInfo(La,"SIMM","1")
end
end
-- Simmetria verticale ('ribaltamento')
if Rib then
EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),Y_AX(),GDB_RT.GLOB)
--EgtMirror( { Ly, Lr, La, Le, Lq}, ORIG(), Y_AX(), GDB_RT.GLOB)
GetAllRib( Ly, Lr, La, Le, Lq)
EgtInvertCurve({l1,l2,l3,l4,l5,l6,l7,arcAlfa})
EgtSetInfo(La,"RIB","1")
end
@@ -345,9 +349,10 @@ local function CMP_DrawC2(bPreview)
-- salvo i parametri come nuovo default
SaveCompoData(CMP.Npar)
end
end
end -- CMP_DrawC2 FIGURA CON RACCORDO
function CMP_DrawC3(bPreview)
-- FIGURA CON SMUSSO
local function CMP_DrawC3(bPreview)
-- Carico i messaggi
local Msg = require('EgtCompoMsg')
-- Assegnazioni
@@ -532,20 +537,24 @@ function CMP_DrawC3(bPreview)
end
-- Simmetria orizzontale
if Simm then
EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),X_AX(),GDB_RT.GLOB)
EgtInvertCurve({l1,l2,l3,l4,l5,l6arc,l7,arcAlfa})
if Simm then
--EgtMirror( { Ly, Lr, La, Le, Lq}, ORIG(), X_AX(), GDB_RT.GLOB)
GetAllSimm( Ly, Lr, La, Le, Lq)
EgtInvertCurve({l1,l2,l3,l4,l5,l6,l7,arcAlfa})
if CMP.ERR == 0 then
EgtInvertCurve(d1)
EgtSetInfo(La,"SIMM","1")
end
end
EgtSetInfo(La,"SIMM","1")
end
end
-- Simmetria verticale ('ribaltamento')
if Rib then
EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),Y_AX(),GDB_RT.GLOB)
EgtInvertCurve({l1,l2,l3,l4,l5,l6arc,l7,arcAlfa})
--EgtMirror( { Ly, Lr, La, Le, Lq}, ORIG(), Y_AX(), GDB_RT.GLOB)
GetAllRib( Ly, Lr, La, Le, Lq)
EgtInvertCurve({l1,l2,l3,l4,l5,l6,l7,arcAlfa})
EgtSetInfo(La,"RIB","1")
end
EgtReorderCurvesInGroup(Ly,ORIG())
-- Dimensioni dell'oggetto
@@ -640,7 +649,7 @@ function CMP_DrawC3(bPreview)
-- salvo i parametri come nuovo default
SaveCompoData(CMP.Npar)
end
end
end -- CMP_DrawC3 FIGURA CON SMUSSO
function CMP_Draw( bPreview)
-8
View File
@@ -1,8 +0,0 @@
CMP.V1=1800
CMP.V2=2000
CMP.V3=600
CMP.V4=500
CMP.V5=86
CMP.V6=2
CMP.V7=false
CMP.V8=false
+14 -12
View File
@@ -219,19 +219,21 @@ function CMP_Draw(bPreview)
-- Simmetria orizzontale
if Simm then
EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),X_AX(),GDB_RT.GLOB)
EgtInvertCurve({l1,l2,l3,l4,l5,l6,arcAlfa})
if CMP.ERR == 0 then
EgtInvertCurve(d1)
end
EgtSetInfo(La,"SIMM","1")
--EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),X_AX(),GDB_RT.GLOB)
GetAllSimm( Ly, Lr, La, Le, Lq)
EgtInvertCurve({l1,l2,l3,l4,l5,l6,arcAlfa})
if CMP.ERR == 0 then
EgtInvertCurve(d1)
end
EgtSetInfo(La,"SIMM","1")
end
-- Simmetria verticale ('ribaltamento')
if Rib then
--EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),Y_AX(),GDB_RT.GLOB)
GetAllRib( Ly, Lr, La, Le, Lq)
EgtInvertCurve({l1,l2,l3,l4,l5,l6,arcAlfa})
EgtSetInfo(La,"RIB","1")
end
-- Simmetria verticale ('ribaltamento')
if Rib then
EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),Y_AX(),GDB_RT.GLOB)
EgtInvertCurve({l1,l2,l3,l4,l5,l6,arcAlfa})
EgtSetInfo(La,"RIB","1")
end
EgtReorderCurvesInGroup(Ly,ORIG())
-10
View File
@@ -1,10 +0,0 @@
CMP.V1=1799.9989
CMP.V2=2000.0011
CMP.V3=600.0
CMP.V4=600.0
CMP.V5=87.0
CMP.V6=false
CMP.V7=150.0
CMP.V8=1
CMP.V9=false
CMP.V10=false
+15 -13
View File
@@ -5,7 +5,7 @@
-- Intestazioni
require('EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( true)
EgtEnableDebug( false)
EgtAddToPackagePath(EgtGetSourceDir() .. 'LuaLibs\\?.lua')
require( 'EgtCompo')
@@ -251,19 +251,21 @@ function CMP_DrawD2( bPreview)
-- Simmetria orizzontale
if Simm then
EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),X_AX(),GDB_RT.GLOB)
EgtInvertCurve({l1,l2,l3,l4,l5,l6,l7,arcAlfa})
if CMP.ERR == 0 then
EgtInvertCurve(d1)
end
EgtSetInfo(La,"SIMM","1")
--EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),X_AX(),GDB_RT.GLOB)
GetAllSimm( Ly, Lr, La, Le, Lq)
EgtInvertCurve({l1,l2,l3,l4,l5,l6,l7,arcAlfa})
if CMP.ERR == 0 then
EgtInvertCurve(d1)
end
EgtSetInfo(La,"SIMM","1")
end
-- Simmetria verticale ('ribaltamento')
if Rib then
EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),Y_AX(),GDB_RT.GLOB)
EgtInvertCurve({l1,l2,l3,l4,l5,l6,l7,arcAlfa})
EgtSetInfo(La,"RIB","1")
end
if Rib then
--EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),Y_AX(),GDB_RT.GLOB)
GetAllRib( Ly, Lr, La, Le, Lq)
EgtInvertCurve({l1,l2,l3,l4,l5,l6,l7,arcAlfa})
EgtSetInfo(La,"RIB","1")
end
EgtReorderCurvesInGroup(Ly,ORIG())
@@ -600,7 +602,7 @@ function CMP_DrawD3( bPreview)
-- Etichette sulla figura
local stdoffset = 1
local LblL1 = AddLabel(Le,l1,stdoffset,CMP.N1.."-"..l1.tostring,dim,-90,RED())
local LblL1 = AddLabel(Le,l1,stdoffset,CMP.N1,dim,-90,RED())
EgtSetInfo(LblL1,"Var",1)
local LblL2 = AddLabel(Le,l2,stdoffset,CMP.N2,dim,-90,RED())
EgtSetInfo(LblL2,"Var",2)
+334
View File
@@ -0,0 +1,334 @@
-- 2020/02/08
-- Piano cucina 'E' : quadrangolare, da uno a tre lati fuori squadra
-- rel.03e 13/07/2020 : riposizionamento del paragrafo "Dimesioni sull'oggetto"
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
EgtAddToPackagePath(EgtGetSourceDir() .. 'LuaLibs\\?.lua')
require( 'EgtCompo')
-- Valori limite
local LgMin = 10
local LgMinDeltaA = 5 -- ?
-- Parametri : dichiarazione e valori standard
local CMP = {}
-- 0=null, 1=bool, 2=int, 3=len, 4=num, 5=stringlocal CMP = {}
CMP.N1 = 'A' -- lato libero (frontale)
CMP.T1 = 3
CMP.V1 = 800
CMP.N2 = 'H1' -- perpendicolare a LA, a sx
CMP.T2 = 3
CMP.V2 = 600
CMP.N3 = 'H2' -- perpendicolare a LA, a dx
CMP.T3 = 3
CMP.V3 = 650
CMP.N4 = 'A1' -- 'prolungamento' fuori squadro ; se>0 angolo 'aperto', se <0 angolo 'chiuso'
CMP.T4 = 3
CMP.V4 = 10
CMP.N5 = 'A2' -- come A1
CMP.T5 = 3
CMP.V5 = 10
CMP.N6 = '↑↓' -- Ribaltamento su/giù
CMP.T6 = 1
CMP.V6 = true
--
CMP.Npar = 6
CMP.Nome = 'PCucinaRett'
CMP.INFO = nil
CMP.WithInt = true
--
_G.CMP = CMP
-- Aggiorno con ultimi valori salvati (se presenti)
CMP.DATA = EgtGetSourceDir() .. CMP.Nome ..'.dat'
LoadCompoData()
--
-- Funzione di disegno
local function CMP_Draw(bPreview)
-- Carico i messaggi
local Msg = require('EgtCompoMsg')
-- Assegno le dimensioni
local LA = CMP.V1
local H1 = CMP.V2
local H2 = CMP.V3
local A1 = CMP.V4
local A2 = CMP.V5
local Rib = CMP.V6
--
local sLBLabel = 'B' -- lato sx
local sLCLabel = 'C' -- lato dx
local sLDLabel = 'D' -- lato dx
local sLD1Label = 'd1' -- diagonale
local sLD2Label = 'd2' -- diagonale
--
CMP.ERR = 0
CMP.MSG = ''
-- Verifica della dimensioni
if LA < LgMin then
LA = 800 --LgMin
CMP.ERR = 1
CMP.MSG = Msg[2]..GetLenLimit( LgMin) -- La lunghezza dei lati deve essere maggiore di
elseif H1 < LgMin then
H1 = 600 --LgMin
CMP.ERR = 2
CMP.MSG = Msg[2]..GetLenLimit( LgMin) -- La lunghezza dei lati deve essere maggiore di
elseif H2 < LgMin then
H2 = 600 --LgMin
CMP.ERR = 2
CMP.MSG = Msg[2]..GetLenLimit( LgMin) -- La lunghezza dei lati deve essere maggiore di
elseif A1 > 0 and A1 < LgMinDeltaA then
A1 = LgMinDeltaA
CMP.ERR = 2
CMP.MSG = Msg[225]..GetLenLimit( LgMinDeltaA) -- | A1|, | A2| se diversi da zero devono essere maggiorni di
elseif A1 < 0 and abs( A1) < LgMinDeltaA then
A1 = -LgMinDeltaA
CMP.ERR = 2
CMP.MSG = Msg[225]..GetLenLimit( LgMinDeltaA) -- | A1|, | A2| se diversi da zero devono essere maggiorni di
elseif A2 > 0 and A2 < LgMinDeltaA then
A2 = LgMinDeltaA
CMP.ERR = 2
CMP.MSG = Msg[225]..GetLenLimit( LgMinDeltaA) -- | A1|, | A2| se diversi da zero devono essere maggiorni di
elseif A2 < 0 and abs( A2) < LgMinDeltaA then
A2 = -LgMinDeltaA
CMP.ERR = 2
CMP.MSG = Msg[225]..GetLenLimit( LgMinDeltaA) -- | A1|, | A2| se diversi da zero devono essere maggiorni di
end
if not bPreview and CMP.ERR ~= 0 then
return
end
--
-- Se Preview cancello tutto
if bPreview then
EgtNewFile()
EgtSetDefaultMaterial( BLACK())
end
--
-- Pezzo e Layer
local Pz = EgtGroup( GDB_ID.ROOT, GDB_RT.LOC) -- pezzo
local Ly = EgtGroup( Pz, GDB_RT.LOC) -- layer della figura principale
EgtSetName( Ly, 'OutLoop')
local Lr = EgtGroup( Pz, GDB_RT.LOC) -- layer regione
EgtSetName( Lr, 'Region')
local Lc = EgtGroup( Pz, GDB_RT.LOC) -- layer di costruzione
local La = EgtGroup( Pz, GDB_RT.LOC) -- layer ausiliario (diagonali ausiliarie e relative etichette, assi)
EgtSetName( La, "LayAux")
local Le = EgtGroup( Pz, GDB_RT.LOC) -- layer di quotatura e delle etichette pezzo
EgtSetName( Le, "Etichette")
local Lq = EgtGroup( Pz, GDB_RT.LOC) -- layer delle linee di quotatura
EgtSetName( Lq, "Quotature")
EgtSetCurrPartLayer(Pz, Ly)
--
-- Costruzione della figura: lati
local lA = EgtLine( Ly, Point3d( 0,0,0), Point3d( LA,0,0))
EgtSetName( lA, "A1")
local ptH1 = EgtSP( lA)
local ptH2 = EgtEP( lA)
if A1 > 0 then
ptH1 = ptH1 + Vector3d( A1, 0, 0)
end
if A2 > 0 then
ptH2 = ptH2 - Vector3d( A2, 0, 0)
end
-- altezze H1, H2
local lH1 = EgtLinePDL( Lq, ptH1, 90, H1)
local lH2 = EgtLinePDL( Lq, ptH2, 90, H2)
--
local lC = EgtLine( Ly, EgtEP( lH2), EgtEP( lH1))
EgtSetName( lC, "A3")
if A2 < 0 then
EgtExtendCurveStartByLen( lC, -A2)
end
if A1 < 0 then
EgtExtendCurveEndByLen( lC, -A1)
end
local lB = EgtLine( Ly, EgtEP( lA), EgtSP( lC))
EgtSetName( lB, "A2")
local lD = EgtLine( Ly, EgtEP( lC), EgtSP( lA))
EgtSetName( lD, "A4")
--
-- Riempimento della figura
local e1 = EgtCurveCompo( Ly, {lA,lB,lC,lD}, false)
local s1 = EgtSurfFlatRegion( Lr, e1)
if CMP.ERR == 0 then
EgtSetColor( s1, AQUA())
else
EgtSetColor( s1, ORANGE())
end
EgtSetAlpha( s1, 25)
EgtErase( e1)
--
-- **Linee di quotatura**
local dim = EgtGetBBoxGlob(Ly,GDB_BB.STANDARD):getRadius() * 0.1
local dim1 = dim * 1 ; local dim2 = dim * 2 ; local dim3 = dim * 3
local DimLineA1, DimLineA2
-- Linee di quotatura **lato 'esterno'**
local ptQ
if A1 > 0 or A2 > 0 then
ptQ = EgtSP( lA, Lq) - Vector3d( 0, dim * 3, 0)
else
ptQ = EgtSP( lA, Lq) - Vector3d( 0, dim * 2, 0)
end
local DimLineLA = EgtLinePDL( Lq, ptQ, 0, LA)
AddLineDashes( Lq, DimLineLA, dim/2)
--local DimLineA1
if A1 > 0 then
ptQ = EgtSP( lA, Lq) - Vector3d( 0, dim * 1.5, 0)
DimLineA1 = EgtLinePDL( Lq, ptQ, 0, A1)
AddLineDashes( Lq, DimLineA1, dim/2)
end
--local DimLineA2
if A2 > 0 then
ptQ = EgtEP( lA, Lq) - Vector3d( A2, dim * 1.5, 0)
DimLineA2 = EgtLinePDL( Lq, ptQ, 0, A2)
AddLineDashes( Lq, DimLineA2, dim/2)
end
-- Linee di quotatura **lato 'interno'**
if A1 < 0 or A2 < 0 then
ptQ = EgtSP( lC, Lq) + VRotated( EgtSV( lC) * dim * 3, -90)
else
ptQ = EgtSP( lC, Lq) + VRotated( EgtSV( lC) * dim * 2, -90)
end
local DimLineLC = EgtLinePVL( Lq, ptQ, EgtSV( lC), EgtCurveLength( lC))
AddLineDashes( Lq, DimLineLC, dim/2)
if A1 < 0 then
ptQ = EgtEP( lC, Lq) + VRotated( EgtSV( lC) * dim * 1.5, -90)
DimLineA1 = EgtLinePVL( Lq, ptQ, - EgtSV( lC), -A1)
AddLineDashes( Lq, DimLineA1, dim/2)
end
if A2 < 0 then
ptQ = EgtSP( lC, Lq) + VRotated( EgtSV( lC) * dim * 1.5, -90)
DimLineA2 = EgtLinePVL( Lq, ptQ, EgtSV( lC), -A2)
EgtInvertCurve( DimLineA2)
AddLineDashes( Lq, DimLineA2, dim/2)
end
--
-- Simmetria verticale ('ribaltamento')
if Rib then
--EgtMirror( { Ly, Lr, La, Le, Lq}, ORIG(), Y_AX(), GDB_RT.GLOB)
EgtMirror( EgtGetAllInGroup( Ly), ORIG(), Y_AX(), GDB_RT.GLOB)
EgtMirror( EgtGetAllInGroup( Lr), ORIG(), Y_AX(), GDB_RT.GLOB)
EgtMirror( EgtGetAllInGroup( La), ORIG(), Y_AX(), GDB_RT.GLOB)
EgtMirror( EgtGetAllInGroup( Le), ORIG(), Y_AX(), GDB_RT.GLOB)
EgtMirror( EgtGetAllInGroup( Lq), ORIG(), Y_AX(), GDB_RT.GLOB)
EgtInvertCurve( {lA,lB,lD,lC,lH1,lH2})
EgtInvertCurve({DimLineLA,DimLineA1 or GDB_ID.NULL,DimLineA2 or GDB_ID.NULL,DimLineLC,})
EgtSetInfo( La, "RIB", "1")
lB, lD = lD, lB
end
--
-- **Dimensioni dell'oggetto**
local bbox = EgtGetBBoxGlob( Ly, GDB_BB.STANDARD)
local dimX = EgtToUiUnits( bbox:getDimX())
local dimY = EgtToUiUnits( bbox:getDimY())
dim = bbox:getRadius() * 0.1
if CMP.ERR == 0 then
CMP.MSG = Msg[1] .. EgtNumToString( dimX,2) .. ' x ' .. EgtNumToString( dimY,2)
end
--
-- **Dimensioni sull'oggetto**
local ptP = 0.5 * ( bbox:getMin() + bbox:getMax())
local sDim = ''
if CMP.INFO then
sDim = sDim .. CMP.INFO
if ( min( dimX, dimY) / max( dimX, dimY)) > 0.3 then
sDim = sDim .. '<br/>'
else
sDim = sDim .. ' '
end
end
sDim = sDim .. EgtNumToString( dimX,2) .. ' x ' .. EgtNumToString( dimY,2)
local dDim = bbox:getRadius() * 0.1
local dRot = 0
if dimY > dimX then
dRot = 90
end
local LbOn = AddLabelPnt( Lr, ptP, sDim, dDim, dRot, BLACK())
EgtSetStatus( LbOn, GDB_ST.OFF)
-- **Etichette sulla figura**
local stdoffset = 1
local sA = CMP.N1
local vA = AddLabel( Le, DimLineLA, stdoffset*.8, sA, dim, 90, RED())
EgtSetInfo( vA, "Var", 1)
local sH1 = CMP.N2
local vH1 = AddLabel( Le, lH1, stdoffset*1.2, sH1, dim, -90, RED())
EgtSetInfo( vH1, "Var", 2)
local sH2 = CMP.N3
local vH2 = AddLabel( Le, lH2, stdoffset*1.2, sH2, dim, 90, RED())
EgtSetInfo( vH2, "Var", 3)
if A1 ~= 0 then
local sA1 = CMP.N4
local vA1 = AddLabel( Le, DimLineA1, stdoffset*.8, sA1, dim*.75, 90, RED())
EgtSetInfo( vA1, "Var", 4)
end
if A2 ~= 0 then
local sA2 = CMP.N5
local vA2 = AddLabel( Le, DimLineA2, stdoffset*.8, sA2, dim*.75, 90, RED())
EgtSetInfo( vA2, "Var", 5)
end
--
local LblLB, LblLC, LblLD
if CMP.ERR == 0 then
LblLB = AddLabel( Le, lB, stdoffset, sLBLabel, dim, -90, GREEN())
LblLC = AddLabel( Le, DimLineLC, stdoffset, sLCLabel, dim, -90, GREEN())
LblLD = AddLabel( Le, lD, stdoffset, sLDLabel, dim, -90, GREEN())
end
--
-- **Etichette sotto la figura**
if CMP.ERR == 0 then
bbox = EgtGetBBoxGlob( Lq,GDB_BB.STANDARD)
local pVal
if Rib then
pVal= bbox:getMin() - Vector3d( 0,dim*2,0)
else
pVal= bbox:getMin() - Vector3d( 0,dim*2,0)
end
local dLenLB = EgtToUiUnits( EgtCurveLength(lB))
local sLenLB = EgtNumToString( dLenLB,1)
local tValLB = EgtTextAdv( Le,pVal,0,sLBLabel..'='..sLenLB,'',100,'S',dim*.75,1,0,GDB_TI.BL,GDB_RT.GLOB)
EgtSetColor( tValLB,GREEN())
EgtSetStatus( tValLB,GDB_ST.SEL)
local dLengthValLB = ( EgtEP( tValLB,GDB_RT.GLOB)-EgtSP( tValLB,GDB_RT.GLOB)):getX() + dim*1
pVal = pVal + Vector3d( dLengthValLB,0,0)
local dLenLC = EgtToUiUnits( EgtCurveLength(lC))
local sLenLC = EgtNumToString( dLenLC,1)
local tValLC = EgtTextAdv( Le,pVal,0,sLCLabel..'='..sLenLC,'',100,'S',dim*.75,1,0,GDB_TI.BL,GDB_RT.GLOB)
EgtSetColor( tValLC,GREEN())
EgtSetStatus( tValLC,GDB_ST.SEL)
local dLengthValLC = ( EgtEP( tValLC,GDB_RT.GLOB)-EgtSP( tValLC,GDB_RT.GLOB)):getX() + dim*1
pVal = pVal + Vector3d( dLengthValLC,0,0)
local dLenLD = EgtToUiUnits( EgtCurveLength( lD))
local sLenLD = EgtNumToString( dLenLD,1)
local tValLD = EgtTextAdv( Le,pVal,0, sLDLabel..'='..sLenLD,'',100,'S',dim*.75,1,0,GDB_TI.BL,GDB_RT.GLOB)
EgtSetColor( tValLD,GREEN())
EgtSetStatus( tValLD,GDB_ST.SEL)
local dLengthValLD = ( EgtEP( tValLD,GDB_RT.GLOB)-EgtSP( tValLD,GDB_RT.GLOB)):getX() + dim*1
pVal = pVal + Vector3d( dLengthValLD,0,0)
end
-- Se non Preview
if not bPreview then
-- cancello le parti ausiliarie
EgtErase({La,Le,Lc,Lq})
-- rendo visibile label sul pezzo
EgtSetStatus(LbOn,GDB_ST.ON)
end
-- Se ok
if CMP.ERR == 0 then
-- scrivo i parametri nelle info del pezzo
WriteCompoDataToPart( Pz, CMP.Nome, CMP.Npar)
-- salvo i parametri come nuovo default
SaveCompoData( CMP.Npar)
end
return
end
_G.CMP_Draw = CMP_Draw
CMP_Draw(true)
EgtZoom(SCE_ZM.ALL)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+183
View File
@@ -0,0 +1,183 @@
-- 2015/07/__
-- Rettangolo dati base e altezza
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
EgtAddToPackagePath(EgtGetSourceDir() .. 'LuaLibs\\?.lua')
require( 'EgtCompo')
-- Valori limite
local LgMin = 10
-- Parametri : dichiarazione e valori standard
local CMP = {}
CMP.N1 = 'L'
CMP.T1 = 3 -- 0=null, 1=bool, 2=int, 3=len, 4=num, 5=string
CMP.V1 = 300.
CMP.N2 = 'H'
CMP.T2 = 3
CMP.V2 = 400.
CMP.Npar = 2
CMP.Nome = 'Rettangolo'
CMP.INFO = nil
CMP.WithTop = true
_G.CMP = CMP
-- Aggiorno con ultimi valori salvati (se presenti)
CMP.DATA = EgtGetSourceDir() .. CMP.Nome ..'.dat'
LoadCompoData()
-- Funzione di disegno
local function CMP_Draw(bPreview)
-- Carico i messaggi
local Msg = require('EgtCompoMsg')
-- Assegno le dimensioni
local L = CMP.V1
local H = CMP.V2
CMP.ERR = 0
CMP.MSG = ''
-- Verifica della dimensioni
if L < LgMin then
L = LgMin
CMP.ERR = 1
CMP.MSG = Msg[2]..GetLenLimit(LgMin) -- La lunghezza dei lati deve essere maggiore di
elseif H < LgMin then
H = LgMin
CMP.ERR = 2
CMP.MSG = Msg[2]..GetLenLimit(LgMin) -- La lunghezza dei lati deve essere maggiore di
end
if not bPreview and CMP.ERR ~= 0 then
return
end
-- Se Preview cancello tutto
if bPreview then
EgtNewFile()
EgtSetDefaultMaterial( BLACK())
end
-- Pezzo e Layer
local Pz = EgtGroup(GDB_ID.ROOT,GDB_RT.LOC) -- pezzo
local Ly = EgtGroup(Pz,GDB_RT.LOC) -- layer della figura principale
EgtSetName(Ly,'OutLoop')
local Lr = EgtGroup(Pz,GDB_RT.LOC) -- layer regione
EgtSetName(Lr,'Region')
local Lc = EgtGroup(Pz,GDB_RT.LOC) -- layer di costruzione
local La = EgtGroup(Pz,GDB_RT.LOC) -- layer ausiliario (diagonali ausiliarie e relative etichette, assi)
EgtSetName(La,"LayAux")
local Le = EgtGroup(Pz,GDB_RT.LOC) -- layer delle etichette pezzo
EgtSetName(Le,"Etichette")
local Lq = EgtGroup(Pz,GDB_RT.LOC) -- layer delle linee di quotatura
EgtSetName(Lq,"Quotature")
EgtSetCurrPartLayer(Pz,Ly)
-- Costruzione della figura: lati
local l1 = EgtLine(Ly,Point3d(0,0,0),Point3d(L,0,0))
EgtSetName(l1,"A1")
local l2 = EgtLine(Ly,EgtEP(l1),Point3d(L,H,0))
EgtSetName(l2,"A2")
local l3 = EgtLine(Ly,EgtEP(l2),Point3d(0,H,0))
EgtSetName(l3,"A3")
local l4 = EgtLine(Ly,EgtEP(l3),EgtSP(l1))
EgtSetName(l4,"A4")
-- assi
local a1 = EgtLinePDL(La,EgtMP(l2),180,L)
local a2 = EgtLinePDL(La,EgtMP(l3),-90,H)
local d1, D1
if CMP.ERR == 0 then
d1 = EgtLine(La,EgtSP(l1),EgtSP(l3))
D1 = (EgtCurveLength(d1))
end
-- Riempimento del rettangolo
local e1 = EgtCurveCompo(Ly,{l1,l2,l3,l4},false)
local s1 = EgtSurfFlatRegion(Lr,e1)
if CMP.ERR == 0 then
EgtSetColor(s1,AQUA())
else
EgtSetColor(s1,ORANGE())
end
EgtSetAlpha(s1,25)
EgtErase(e1)
-- Dimensioni dell'oggetto
local bbox = EgtGetBBoxGlob(Ly,GDB_BB.STANDARD)
local dimX = EgtToUiUnits(bbox:getDimX())
local dimY = EgtToUiUnits(bbox:getDimY())
local dim = bbox:getRadius() * 0.1
local pVal= bbox:getMin() - Vector3d(0,dim*2.8,0)
if CMP.ERR == 0 then
CMP.MSG = Msg[1] .. EgtNumToString(dimX,2) .. ' x ' .. EgtNumToString(dimY,2)
end
-- Dimensioni sull'oggetto
local ptP = 0.5 * ( bbox:getMin() + bbox:getMax())
local sDim = ''
if CMP.INFO then
sDim = sDim .. CMP.INFO
if ( min( dimX, dimY) / max( dimX, dimY)) > 0.3 then
sDim = sDim .. '<br/>'
else
sDim = sDim .. ' '
end
end
sDim = sDim .. EgtNumToString(dimX,2) .. ' x ' .. EgtNumToString(dimY,2)
local dDim = bbox:getRadius() * 0.1
local dRot = 0
if dimY > dimX then
dRot = 90
end
local LbOn = AddLabelPnt(Lr,ptP,sDim,dDim,dRot,BLACK())
EgtSetStatus(LbOn,GDB_ST.OFF)
-- Etichette sulla fgure
local stdoffset = 1.2
--local sL = CMP.N1 .. '=' .. EgtNumToString(EgtToUiUnits(L),2)
local sL = CMP.N1
local v1 = AddLabel(Le,l1,stdoffset,sL,dim,-90,RED())
EgtSetInfo(v1,"Var",1)
--local sH = CMP.N2 .. '=' .. EgtNumToString(EgtToUiUnits(H),2)
local sH = CMP.N2
local v2 = AddLabel(Le,l2,stdoffset,sH,dim,-90,RED())
EgtSetInfo(v2,"Var",2)
if CMP.ERR == 0 then
local LblD1 = AddLabelAl(La,d1,stdoffset*.75,'D',dim*.5,90,GREEN())
end
-- Etichette sotto la figura
if CMP.ERR == 0 then
local lLenD1 = EgtToUiUnits(D1)
local sLenD1 = EgtNumToString(lLenD1,1)
local ValD1 = EgtTextAdv(La,pVal,0,'D='..sLenD1,'',100,'S',dim*.5,1,0,GDB_TI.BL)
EgtSetColor(ValD1,GREEN())
EgtSetStatus(ValD1,GDB_ST.SEL)
local dD1Len = (EgtEP(ValD1)-EgtSP(ValD1)):getX() + dim/2
pVal = pVal + Vector3d(dD1Len,0,0)
end
-- Se non Preview
if not bPreview then
-- cancello le parti ausiliarie
EgtErase({La,Le,Lc,Lq})
-- rendo visibile label sul pezzo
EgtSetStatus(LbOn,GDB_ST.ON)
end
-- Se non ci sono errori
if CMP.ERR == 0 then
-- Scrivo i parametri nelle info del pezzo
WriteCompoDataToPart( Pz, CMP.Nome, CMP.Npar)
-- Salvo i parametri come nuovo default
SaveCompoData( CMP.Npar)
end
return
end
_G.CMP_Draw = CMP_Draw
CMP_Draw(true)
EgtZoom(SCE_ZM.ALL)