Compare commits

...

11 Commits

Author SHA1 Message Date
NicolaP 2f24604fa8 Gestione multiselezione in parcheggio 2022-03-02 17:06:18 +01:00
NicolaP 2889e30386 Importazione di DXF contente più di 1 part 2022-03-02 15:34:58 +01:00
NicolaP a9458620c1 Gestione parcheggio (inserimento da CSV) 2022-02-28 19:28:47 +01:00
NicolaP 7fe03cbbb4 Gestione parcheggio (inserimento da Compo) 2022-02-28 18:46:05 +01:00
NicolaP d0646eb922 Migliorata gestione Text dei rettangoli 2022-02-28 16:29:48 +01:00
NicolaP 83f37dc628 Merge commit '601471482ad03d54149f8bcf5e938c47d63a0b70' 2022-02-28 16:07:13 +01:00
DarioS 568d7c109d OmagOFFICE 2.4b2 :
- corretta gestione angolo di rotazione pezzi con misure pollici (veniva moltiplicato per 25.4 come fosse una lunghezza) presente da ver 2.3b2
- uscendo da gestione grezzo senza alcun grezzo ora si nasconde la eventuale foto.
2022-02-22 10:50:20 +01:00
NicolaP 1c36907b47 Cambio versione 2022-02-17 11:13:09 +01:00
NicolaP d2e45a937e Merge commit '614756e1bb8cb0e583d961478d3c6860779b8d1d' 2022-02-17 11:10:55 +01:00
NicolaP 13f9fc9bd2 Migliorata visualizzazione lavorazioni WaterJet 2022-02-17 11:08:40 +01:00
NicolaP 614756e1bb Correzione gestione rotazione ventose. 2022-02-17 09:57:34 +01:00
17 changed files with 688 additions and 36 deletions
+14 -1
View File
@@ -364,6 +364,9 @@ Public Class CompoWindowVM
' Cancello layer regioni per selezione buchi
Pz = EgtGetFirstGroupInGroup(GDB_ID.ROOT)
' identificativo univoico del gruppo di pezzi, se più di un pezzo
Dim sGUICode As String = String.Empty
While Pz <> -1
' imposto il contesto corrente
EgtSetCurrentContext(CompoWindowMap.refCompoSceneHostV.CompoScene.GetCtx())
@@ -513,6 +516,9 @@ Public Class CompoWindowVM
EgtEraseEmptyParts()
' Area dei nuovi pezzi
Dim dNewArea As Double = 0
If nNbr > 1 Then
sGUICode = System.Guid.NewGuid.ToString
End If
' Se esiste il file del pezzo
If My.Computer.FileSystem.FileExists(sTmpFile) Then
' eseguo inserimento
@@ -527,8 +533,15 @@ Public Class CompoWindowVM
If m_bTrfData Then EgtSetInfo(nId2, "CsvPart", CompoWindowMap.refCompoManagerVM.sTrfOrderCode & "-" & nId2.ToString())
' Aggiorno l'area dei nuovi pezzi
dNewArea += GeomCalc.GetPartArea(nId2)
' Inserisco in parcheggio
' assegno l'identificatico del pezzo, se esiste
If Not String.IsNullOrEmpty(sGUICode) Then
Dim sPreGuid As String = EstCalc.CreatePreGuidCode(nId2)
EgtSetInfo(nId2, INFO_REFGROUP, sPreGuid & sGUICode)
End If
' muovo il pezzo nella prima posizione di parcheggio libera
EstCalc.StoreOnePart(nId2, True)
' Aggiungo riferimento e lo inserisco in VeinMatching
VeinMatching.SetRefOnPart(nId2)
VeinMatching.AddPart(nId2, True)
+1 -1
View File
@@ -121,7 +121,7 @@ Module ConstIni
Public Const K_TEXTCOLOR As String = "TextColor"
Public Const K_AUTOMATICOPTIMIZE As String = "AutomaticOptimize"
Public Const K_AUTOMATICMAXTIME As String = "AutomaticMaxTime"
Public Const K_DRAGRETTANGLE As String = "DragRettangle"
Public Const K_DRAGRETTANGLE As String = "DragRectangle"
Public Const S_SPLIT As String = "Split"
Public Const K_MOVE_LEV As String = "MoveLevel"
+1 -1
View File
@@ -71,7 +71,7 @@
<!--Quality-->
<ComboBox ItemsSource="{Binding CurrWaterjettingQualityList}"
SelectedItem="{Binding SelCurrWaterjettingQuality}"
Visibility="{Binding CurrWaterjettingQuality_Visibility}"
Visibility="{Binding CurrWaterjetting_Visibility}"
Margin="5,0,0,5"
Grid.Column="1">
</ComboBox>
+1 -1
View File
@@ -290,7 +290,7 @@ Public Class CurrMachWindowVM
End Set
End Property
Private m_CurrWaterjetting_Visibility As Visibility
Private m_CurrWaterjetting_Visibility As Visibility = Visibility.Collapsed
Public Property CurrWaterjetting_Visibility As Visibility
Get
Return m_CurrWaterjetting_Visibility
+25
View File
@@ -710,6 +710,8 @@ Public Class DxfImportWindowVM
EgtErase(EgtGetFirstNameInGroup(PartId, SELECT_REGION_LAYER))
PartId = EgtGetNextPart(PartId)
End While
' identificativo univoico del gruppo di pezzi, se più di un pezzo
Dim sGUICode As New List(Of String)
' Scrivo testi per nesting
SideEntityControlVM.WriteSideAngleForNest(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
' Imposto riferimento sul centro geometrico di ogni pezzo
@@ -732,10 +734,33 @@ Public Class DxfImportWindowVM
Dim bDirect As Boolean = (GetMainPrivateProfileInt(S_NEST, K_DIRECT, 0) <> 0)
' Elimino eventuali precedenti pezzi vuoti
EgtEraseEmptyParts()
' creo il riferimento
If m_PartNum > 1 Then
' per ogni pezze del file DXF creo un gruppo
Dim nIdTemp As Integer = EgtGetFirstPart()
While nIdTemp <> GDB_ID.NULL
Dim sPreGuid As String = CreatePreGuidCode(nIdTemp)
sGUICode.Add(sPreGuid & System.Guid.NewGuid.ToString)
nIdTemp = EgtGetNextPart(nIdTemp)
End While
End If
' Inserisco i pezzi nell'ambiente principale e recupero Id primo pezzo inserito
Dim nFirstId As Integer = EgtGetLastPart()
For nInd As Integer = 1 To m_PartNum
Dim nFirst2Id As Integer = EgtGetLastPart()
EgtInsertFile(sTmpFile)
Dim FirstOfImport As Integer = EgtGetNextPart(nFirst2Id)
Dim Index As Integer = 1
While FirstOfImport <> GDB_ID.NULL And Index <= sGUICode.Count
If Not String.IsNullOrEmpty(sGUICode(Index - 1)) Then
EgtSetInfo(FirstOfImport, INFO_REFGROUP, sGUICode(Index - 1))
Index += 1
Else
Exit While
End If
FirstOfImport = EgtGetNextPart(FirstOfImport)
End While
nFirst2Id = If(nFirst2Id <> GDB_ID.NULL, EgtGetNextPart(nFirst2Id), EgtGetFirstPart())
Next
nFirstId = If(nFirstId <> GDB_ID.NULL, EgtGetNextPart(nFirstId), EgtGetFirstPart())
' Cancello il file
+5
View File
@@ -33,6 +33,8 @@ Module ConstMach
Public Const KEY_VACLAY_SEL As String = "Sel"
' Info in gruppo layout per angolo di rotazione preferito
Public Const KEY_VACLAY_PREFROT As String = "PreferredRot"
Public Const KEY_VACLAY_PREFVROTXMINUS As String = "PrefVertRotXMinus"
Public Const KEY_VACLAY_PREFVROTXPLUS As String = "PrefVertRotXPlus"
' Info in gruppo layout per direzione di riferimento ventose per tagli da sotto
Public Const KEY_VACLAY_DRIPREFDIR As String = "DripRefDir"
' Info in asse rotante ventosa per step discreti
@@ -91,6 +93,9 @@ Module ConstMach
Public Const INFO_RAW_BLOCK = "Block"
' Info per numero lastra nel blocco
Public Const INFO_RAW_SLABNBR = "SlabNbr"
' Info per identificazione gruppo pezzi
Public Const INFO_REFGROUP As String = "RefGroup"
Public Const INFO_COUNTERLY As String = "CounterPz"
' Contrassegno di progetto OmagCut
Public Const NAME_PROJMARK As String = "OmagCut"
+36
View File
@@ -188,6 +188,25 @@ Module CsvM
EstCalc.SetTextColor( nRegId)
' Lo sposto nel gruppo speciale
EgtRelocate(nId, nIpGrp)
' assegno l'identificatico del pezzo, se esiste
If Not String.IsNullOrEmpty(CurrPart.m_sRefGuid) Then
' GuidCode dovrebbe contenere 36 caratteri, il precode 5: tot = 41
If CurrPart.m_sRefGuid.Count <= 36 Then
Dim sPreGuid As String = CreatePreGuidCode(CurrPart.m_nId)
CurrPart.m_sRefGuid = sPreGuid & CurrPart.m_sRefGuid
End If
EgtSetInfo(CurrPart.m_nId, INFO_REFGROUP, CurrPart.m_sRefGuid)
End If
Dim nRegLayId As Integer = EgtGetFirstNameInGroup(CurrPart.m_nId, NAME_REGION)
' Imposto il colore del pezzo inserito nel progetto
EgtSetColor(nRegLayId, CurrPart.m_cColor)
Dim EntId As Integer = EgtGetFirstInGroup(nRegLayId)
While EntId <> GDB_ID.NULL
If EgtGetType(EntId) = GDB_TY.SRF_FRGN Then EgtSetColor(EntId, CurrPart.m_cColor)
EntId = EgtGetNext(EntId)
End While
Next
EgtLuaResetGlobVar("CMP")
EgtLuaResetGlobVar("CMP_Draw")
@@ -282,12 +301,19 @@ Module CsvM
' Rimuovo dal grezzo
EgtRemovePartFromRawPart(nId)
End If
' recupero il Guid del pezzo corrente (potrebbe essere stato modificato a causa di rotazioni quando il pezzo è passato in parcheggio)
Dim sCurrRefGuid As String = String.Empty
EgtGetInfo(nId, INFO_REFGROUP, sCurrRefGuid)
' Eventuale cancellazione per VM
VeinMatching.OnRemovePart(nId)
' Cancello il pezzo
EgtErase(nId)
' aggiorno il layer che indica il numero di pezzi in parcheggio (se sRefGroup<>"")
EstCalc.CountPartInFamily(sCurrRefGuid)
' Aggiorno il contatore
CurrPart.m_nToNest += 1
' ricreo la lista delle famiglie di pezzi presenti in parcheggio
GetFamilyGroupInPark()
' Esco
Return True
End If
@@ -337,6 +363,9 @@ Module CsvM
EgtLuaGetGlobNumVar("CSV.DIMY" & sN, OnePart.m_dDimY)
EgtLuaGetGlobNumVar("CSV.TH" & sN, OnePart.m_dTh)
OnePart.m_nOriInd = i
If OnePart.m_nCount > 1 Then
OnePart.m_sRefGuid = System.Guid.NewGuid.ToString
End If
' inserisco in lista
m_CsvPartList.Add(OnePart)
Next
@@ -406,6 +435,7 @@ Module CsvM
Writer.WriteLine("DY=" & DoubleToString(CurrPart.m_dDimY, 4))
Writer.WriteLine("Th=" & DoubleToString(CurrPart.m_dTh, 4))
Writer.WriteLine("OIn=" & CurrPart.m_nOriInd.ToString())
Writer.WriteLine("Guid=" & CurrPart.m_sRefGuid)
Next
' Terminatore
Writer.WriteLine("[END]")
@@ -492,6 +522,8 @@ Module CsvM
StringToDouble(sItems(1), OnePart.m_dTh)
ElseIf sItems(0) = "OIn" Then
StringToInt(sItems(1), OnePart.m_nOriInd)
ElseIf sItems(0) = "Guid" Then
OnePart.m_sRefGuid = sItems(1).Trim
End If
End If
End If
@@ -528,4 +560,8 @@ Public Class CsvPart
Public m_dTh As Double = 0
Public m_nOriInd As Integer = 0
Public m_nId As Integer = GDB_ID.NULL
' definsco il riferimento al gruppo
Public m_sRefGuid As String = System.Guid.NewGuid.ToString
' definisco il colore del gruppo che sto inserendo
Public m_cColor As Color3d = CompoColor(IniFile.m_sIniFile)
End Class
+262 -2
View File
@@ -51,6 +51,68 @@ Module EstCalc
End If
End Function
#Region "PreGuidCode"
' recupero i primi 5 caratteri della stringa
Friend Function GetPreGuidCode(sGuidCode As String) As String
If sGuidCode.Count > 5 Then
Return sGuidCode(0) & sGuidCode(1) & sGuidCode(2) & sGuidCode(3) & sGuidCode(4)
End If
Return String.Empty
End Function
' sostituisce i primi 5 caratteri della stringa con qualle passata
Friend Function UppDateGuidCode(ByRef sGuidCode As String, sPreGuidCode As String) As Boolean
If sPreGuidCode.Count = 5 Then
sGuidCode = sGuidCode.Remove(0, 5)
sGuidCode = sPreGuidCode & sGuidCode
Return True
End If
Return False
End Function
' restituisce 5 caratteri
Friend Function CreatePreGuidCode(nId As Integer) As String
' recupero il frame dell'oggetto
Dim frGlobFrame As New Frame3d
If Not EgtGetGroupGlobFrame(nId, frGlobFrame) Then
Return String.Empty
End If
' recupero il suo versore
Dim vtX As Vector3d = frGlobFrame.VersX
Dim Len As Double
Dim AngV As Double
Dim AngH As Double
vtX.ToSpherical(Len, AngV, AngH)
' costruisco il codice (6 caratteri!) che identifica la posizione del pezzo in parcheggio
Dim sPreGuid As String = GetDirectionCode(AngH)
Return sPreGuid
End Function
Friend Function GetDirectionCode(dVal As Double) As String
Dim bIsNegative As Boolean = False
If dVal < 0 Then
dVal = dVal + (-1)
bIsNegative = True
End If
Dim sVal As String = DoubleToString(dVal * 1000, 0)
Dim nCount As Integer = sVal.Count
For Index As Integer = 1 To 4 - nCount
sVal = "0" & sVal
Next
Dim vVal As Char() = {"+"c, "1"c, "0"c, "0"c, "0"c}
If bIsNegative Then
vVal = {"-"c, sVal(0), sVal(1), sVal(2), sVal(3)}
Else
vVal = {"+"c, sVal(0), sVal(1), sVal(2), sVal(3)}
End If
' ricostruisco la stringa dotata di segno
sVal = vVal(0) & vVal(1) & vVal(2) & vVal(3) & vVal(4)
Return sVal
End Function
#End Region ' PreGiudCode
'--------------------------------------------------------------------------------------------------
Private m_nRawId As Integer = GDB_ID.NULL
Public Function GetRawId() As Integer
@@ -626,6 +688,16 @@ Module EstCalc
End If
' Gestione risultato nesting
If bFit Then
'---------------------- COUNTER PART ----------------------
Dim sRefGroup As String = String.Empty
If EgtGetInfo(nId, INFO_REFGROUP, sRefGroup) Then
' spengo il layer che contiene il contatore
Dim nCounterLayer As Integer = EgtGetFirstNameInGroup(nId, INFO_COUNTERLY)
EgtSetStatus(nCounterLayer, GDB_ST.OFF)
' aggiorno il layer che indica il numero di pezzi in parcheggio
CountPartInFamily(sRefGroup)
End If
'---------------------- COUNTER PART ----------------------
' Eventuale aggiunta solido per taglio da sotto
UpdateSolidForDrip(nId)
Return True
@@ -702,12 +774,198 @@ Module EstCalc
Return True
End Function
#Region "Manager Counter Part"
' lista delle famiglie di pezzi in parcheggio
Public m_ListOfGroupInPark As New List(Of FamilyPart)
' se seleniozato il layer CounterPz
Public m_bIsCounterLy As Boolean = False
Public m_nCurrNubrOfParts As Integer = 0
' creo la lista delle famiglie che popolano il parcheggio
Public Sub GetFamilyGroupInPark()
m_ListOfGroupInPark.Clear()
Dim nIdInPark As Integer = EgtGetFirstPart()
While nIdInPark <> GDB_ID.NULL
If IsInRaw(nIdInPark) Then
nIdInPark = EgtGetNextPart(nIdInPark)
Continue While
End If
Dim sRefGroup As String = String.Empty
If EgtGetInfo(nIdInPark, INFO_REFGROUP, sRefGroup) Then
Dim bExists As Boolean = False
For Each sItem As FamilyPart In m_ListOfGroupInPark
If sRefGroup = sItem.sRefGuid Then
bExists = True
Exit For
End If
Next
If Not bExists Then
m_ListOfGroupInPark.Add(New FamilyPart(sRefGroup, nIdInPark))
End If
End If
nIdInPark = EgtGetNextPart(nIdInPark)
End While
End Sub
Public Sub CountPartInFamily(sRefGuid As String)
If String.IsNullOrEmpty(sRefGuid) Then Return
Dim nCount As Integer = 0
Dim nIdInPark As Integer = EgtGetFirstPart()
' conto il nuero di pezzi del gruppo inidcato
While nIdInPark <> GDB_ID.NULL
If IsInRaw(nIdInPark) Then
nIdInPark = EgtGetNextPart(nIdInPark)
Continue While
End If
Dim sRefGroup As String = String.Empty
EgtGetInfo(nIdInPark, INFO_REFGROUP, sRefGroup)
If sRefGroup = sRefGuid Then
nCount += 1
End If
nIdInPark = EgtGetNextPart(nIdInPark)
End While
' aggiorno il contatore dei pezzi del gruppo
nIdInPark = EgtGetFirstPart()
While nIdInPark <> GDB_ID.NULL
If IsInRaw(nIdInPark) Then
nIdInPark = EgtGetNextPart(nIdInPark)
Continue While
End If
Dim sRefGroup As String = String.Empty
EgtGetInfo(nIdInPark, INFO_REFGROUP, sRefGroup)
If sRefGroup = sRefGuid Then
Dim nId As Integer = EgtGetFirstNameInGroup(nIdInPark, INFO_COUNTERLY)
If nId <> GDB_ID.NULL Then
Dim m_IdCounterTextas As Integer = EgtGetFirstInGroup(nId)
EgtModifyText(m_IdCounterTextas, "# " & nCount.ToString)
End If
End If
nIdInPark = EgtGetNextPart(nIdInPark)
End While
End Sub
Public Sub SelectPartInFaimily(sRefGuid As String, nNbrOfSelection As Integer)
' aggiorno il contatore dei pezzi del gruppo
Dim nIdInPark As Integer = EgtGetFirstPart()
Dim nCounter As Integer = 0
While nIdInPark <> GDB_ID.NULL And nCounter < nNbrOfSelection
If IsInRaw(nIdInPark) Then
nIdInPark = EgtGetNextPart(nIdInPark)
Continue While
End If
Dim sRefGroup As String = String.Empty
EgtGetInfo(nIdInPark, INFO_REFGROUP, sRefGroup)
If sRefGroup = sRefGuid Then
EgtSelectObj(nIdInPark)
nCounter += 1
End If
nIdInPark = EgtGetNextPart(nIdInPark)
End While
End Sub
Public Sub DeselectPartInFaimily(sRefGuid As String)
' aggiorno il contatore dei pezzi del gruppo
Dim nIdInPark As Integer = EgtGetFirstPart()
While nIdInPark <> GDB_ID.NULL
If IsInRaw(nIdInPark) Then
nIdInPark = EgtGetNextPart(nIdInPark)
Continue While
End If
Dim sRefGroup As String = String.Empty
EgtGetInfo(nIdInPark, INFO_REFGROUP, sRefGroup)
If sRefGroup = sRefGuid Then
EgtDeselectObj(nIdInPark)
End If
nIdInPark = EgtGetNextPart(nIdInPark)
End While
End Sub
Public Function ParkInGroupFamily(nId As Integer) As Boolean
' se pezzo appartenente ad un gruppo
Dim sRefGroup As String = String.Empty
Dim Element As FamilyPart
If EgtGetInfo(nId, INFO_REFGROUP, sRefGroup) Then
' verifico se esiste un pezzo dello stesso gruppo in parcheggio
Dim nNewLayer As Integer
Dim ptMin As Point3d
Dim ptMax As Point3d
For Each sItem As FamilyPart In m_ListOfGroupInPark
If sRefGroup = sItem.sRefGuid Then
' creo un nuovo layer per contenere l'informazione del numero di pezzi da inserire
If EgtGetFirstNameInGroup(nId, INFO_COUNTERLY) = GDB_ID.NULL Then
nNewLayer = EgtCreateGroup(nId)
EgtSetName(nNewLayer, INFO_COUNTERLY)
EgtSetColor(nNewLayer, New Color3d(0, 0, 0))
EgtGetBBox(nId, GDB_BB.STANDARD, ptMin, ptMax)
EgtCreateText(nNewLayer, New Point3d((ptMin.x + ptMax.x) / 2, ptMin.y - sItem.nHText - 20, ptMin.z), "# ???", sItem.nHText, GDB_RT.LOC)
Else
' Accendo il layer che contiene il contatore
Dim nCounterLayer As Integer = EgtGetFirstNameInGroup(nId, INFO_COUNTERLY)
EgtSetStatus(nCounterLayer, GDB_ST.ON_)
End If
' calcolo lo spostamento del pezzo
Dim PtMinInRaw As Point3d
Dim PtMaxInRaw As Point3d
EgtGetBBoxGlob(nId, GDB_BB.STANDARD, PtMinInRaw, PtMaxInRaw)
Dim vtMoveToStorage As New Vector3d
vtMoveToStorage = sItem.PtStorage() - PtMinInRaw
EgtMove(nId, vtMoveToStorage, GDB_RT.GLOB)
' aggiorno il layer che indica il numero di pezzi in parcheggio
CountPartInFamily(sRefGroup)
Return True
End If
Next
' inserisco il primo pezzo del gruppo nel parcheggio
Element = New FamilyPart(sRefGroup, nId)
m_ListOfGroupInPark.Add(Element)
' creo un nuovo layer per contenere l'informazione del numero di pezzi da inserire
If EgtGetFirstNameInGroup(nId, INFO_COUNTERLY) = GDB_ID.NULL Then
nNewLayer = EgtCreateGroup(nId)
EgtSetName(nNewLayer, INFO_COUNTERLY)
EgtSetColor(nNewLayer, New Color3d(0, 0, 0))
EgtGetBBox(nId, GDB_BB.STANDARD, ptMin, ptMax)
' posso migliorarei lposizioanamento in funzione della dimensione della scritta...
EgtCreateText(nNewLayer, New Point3d((ptMin.x + ptMax.x) / 2, ptMin.y - Element.nHText - 20, ptMin.z), "# 1", Element.nHText, GDB_RT.LOC)
Else
' Accendo il layer che contiene il contatore
Dim nCounterLayer As Integer = EgtGetFirstNameInGroup(nId, INFO_COUNTERLY)
EgtSetStatus(nCounterLayer, GDB_ST.ON_)
' aggiorno il layer che indica il numero di pezzi in parcheggio
CountPartInFamily(sRefGroup)
End If
End If
Return False
End Function
' verifico se il pezzo ha un gruppo che contiene le informazioni per il taglio
Public Function IsInRaw(nIdGroup As Integer) As Boolean
' verifico che il pezzo sia veramente uin parcheggio
Dim nPV As Integer = EgtGetFirstNameInGroup(nIdGroup, "PV")
If nPV <> GDB_ID.NULL Then
' verifico che non ci siano delle lavorazioni
If EgtGetFirstInGroup(nPV) <> GDB_ID.NULL Then
Return True
End If
End If
Return False
End Function
#End Region ' Manager Counter Part
Public Function StoreOnePart(ByVal nId As Integer, Optional ByVal bForced As Boolean = False) As Boolean
' Se pezzo in grezzo, metto in parcheggio (sempre possibile)
If bForced OrElse
(m_nRawId <> GDB_ID.NULL AndAlso EgtGetParent(nId) = m_nRawId) Then
' Ripristino lo stato originale
PreRemoveOnePart( nId)
PreRemoveOnePart(nId)
'---------------------- COUNTER PART ----------------------
' se esiste almento un pezzo del gruppo in parcheggio esco
If ParkInGroupFamily(nId) Then Return True
'---------------------- COUNTER PART ----------------------
' Parcheggio
PackPartInStore(nId)
' Aggiusto la posizione in Z
@@ -730,7 +988,8 @@ Module EstCalc
' Parcheggio
Const STORE_LARGH As Double = 6000
Const STORE_DIST As Double = 200
Const STORE_OFFS As Double = 20
' 40 il Font usato per indicare il numero di pezzi in parcheggio "# N"
Const STORE_OFFS As Double = 20 + 40 + 20
Dim dStXmin As Double = b3Tab.Min().x - 0.5 * (STORE_LARGH - b3Tab.DimX())
Return EgtPackBox(nId, dStXmin, -INFINITO, dStXmin + STORE_LARGH, b3Tab.Min().y - STORE_DIST, STORE_OFFS, False)
End Function
@@ -831,3 +1090,4 @@ Module EstCalc
End Function
End Module
+19 -5
View File
@@ -8,6 +8,8 @@ Module VacuumCups
Private m_nVacId As Integer = GDB_ID.NULL
Private m_nRefId As Integer = GDB_ID.NULL
Private m_dPreferredRot As Double = 0
Private m_dPrefVertRotXMinus As Double = 0
Private m_dPrefVertRotXPlus As Double = 0
Private m_dDripRefAng As Double = 0
' Nome del gruppo temporaneo per le ventose
@@ -73,7 +75,10 @@ Module VacuumCups
m_nVacId = EgtCopyGlob(nLayId, m_nTempId)
If m_nVacId = GDB_ID.NULL Then Return False
' Angolo di rotazione preferito
EgtGetInfo( m_nVacId, KEY_VACLAY_PREFROT, m_dPreferredRot)
EgtGetInfo(m_nVacId, KEY_VACLAY_PREFROT, m_dPreferredRot)
' Angoli di rotazione preferiti per ventosa in verticale (lungo Y) a sinistra e a destra del centro tavola
EgtGetInfo(m_nVacId, KEY_VACLAY_PREFVROTXMINUS, m_dPrefVertRotXMinus)
EgtGetInfo(m_nVacId, KEY_VACLAY_PREFVROTXPLUS, m_dPrefVertRotXPlus)
' Direzione di riferimento per tagli Drip
EgtGetInfo( m_nVacId, KEY_VACLAY_DRIPREFDIR, m_dDripRefAng)
' Nascondo il gruppo ma rendo visibili le curve di contorno delle ventose
@@ -363,6 +368,9 @@ Module VacuumCups
If b3Vac.IsEmpty() Then Return INFINITO
' Se box maggiore di quello del pezzo, scarto soluzione
If b3Vac.Radius() > b3Raw.Radius() Then Return INFINITO
' Recupero l'area della tavola
Dim b3Tab As New BBox3d
EgtGetTableArea(1, b3Tab)
' Determino il movimento
vtMove = ptRawCen - b3Vac.Center()
b3Vac.Move(vtMove)
@@ -374,11 +382,19 @@ Module VacuumCups
frMinRect.VersX().ToSpherical(dLen, dAngVertDeg, dAngOrizzDeg)
dRotAngDeg = dAngOrizzDeg
If b3Vac.DimY() > b3Vac.DimX() + EPS_SMALL Then dRotAngDeg -= 90
Dim dPreferredRot As Double = m_dPreferredRot
If Math.Abs(dRotAngDeg - 90) < 45 Or Math.Abs(dRotAngDeg - 270) < 45 Then
If frMinRect.Orig().x < b3Tab.Center().x Then
dPreferredRot = m_dPrefVertRotXMinus
Else
dPreferredRot = m_dPrefVertRotXPlus
End If
End If
Dim dAngDelta As Double = If( Math.Abs( b3Vac.DimY() - b3Vac.DimX()) < 10 * EPS_SMALL, 90, 180)
While dRotAngDeg - m_dPreferredRot >= dAngDelta / 2
While dRotAngDeg - dPreferredRot >= dAngDelta / 2
dRotAngDeg -= dAngDelta
End While
While dRotAngDeg - m_dPreferredRot <= -dAngDelta / 2
While dRotAngDeg - dPreferredRot <= -dAngDelta / 2
dRotAngDeg += dAngDelta
End While
Else
@@ -431,8 +447,6 @@ Module VacuumCups
ptRef.Move(vtMove)
ptRef.Rotate(ptRotCen, Vector3d.Z_AX(), dRotAngDeg)
' Ne calcolo la distanza dal centro della tavola
Dim b3Tab As New BBox3d
EgtGetTableArea(1, b3Tab)
Dim dDist As Double = Point3d.DistXY(ptRef, b3Tab.Center())
Return dDist
End Function
+2 -2
View File
@@ -195,8 +195,8 @@ Public Class MainWindowM
' Verifico abilitazione nesting automatico
m_bAutoNestOption = Not String.IsNullOrWhiteSpace( sNestKey)
' Recupero livello e opzioni della chiave
Dim bKey As Boolean = EgtGetKeyLevel(9423, 2401, 1, m_nKeyLevel) And
EgtGetKeyOptions(9423, 2401, 1, m_nKeyOptions)
Dim bKey As Boolean = EgtGetKeyLevel(9423, 2402, 1, m_nKeyLevel) And
EgtGetKeyOptions(9423, 2402, 1, m_nKeyOptions)
' Verifico abilitazione prodotto
Dim bProd As Boolean = GetKeyOption(KEY_OPT.OFFICE_BASE)
' Inizializzazione generale di EgtInterface
+2 -2
View File
@@ -69,6 +69,6 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.4.1.3")>
<Assembly: AssemblyFileVersion("2.4.1.3")>
<Assembly: AssemblyVersion("2.4.2.3")>
<Assembly: AssemblyFileVersion("2.4.2.3")>
+8
View File
@@ -255,6 +255,10 @@
<DependentUpon>SplitModeV.xaml</DependentUpon>
</Compile>
<Compile Include="OptionPanel\MachiningTab\SplitModeVM.vb" />
<Compile Include="OptionPanel\NestingTab\MultiSelectionV.xaml.vb">
<DependentUpon>MultiSelectionV.xaml</DependentUpon>
</Compile>
<Compile Include="OptionPanel\NestingTab\MultiSelectionVM.vb" />
<Compile Include="OptionPanel\NestingTab\NestingTabV.xaml.vb">
<DependentUpon>NestingTabV.xaml</DependentUpon>
</Compile>
@@ -437,6 +441,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="OptionPanel\NestingTab\MultiSelectionV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="OptionPanel\NestingTab\NestingTabV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -0,0 +1,41 @@
<EgtWPFLib5:EgtCustomWindow x:Class="MultiSelectionV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:OmagOFFICE="clr-namespace:OmagOFFICE"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
Title="{Binding TitleMsg}"
IsMinimizable="False"
IsClosable="False"
ShowInTaskbar="False"
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
WindowStartupLocation="CenterOwner"
Width="270" Height="150"
ResizeMode="NoResize">
<DockPanel Margin="5,5,5,0">
<UniformGrid Columns="2"
DockPanel.Dock="Top"
Margin="0,15,0,15">
<TextBlock Text="{Binding SelectionMsg}"/>
<TextBox Text="{Binding nNbrOfParts}"/>
</UniformGrid>
<UniformGrid Columns="4"
DockPanel.Dock="Bottom"
Margin="25,0,25,5">
<Button Command="{Binding OkCommand}"
Style="{StaticResource OptionPanel_TextButton}"
Content="{Binding OkMsg}">
</Button>
<ToggleButton Visibility="Hidden" />
<ToggleButton Visibility="Hidden" />
<Button Command="{Binding CancelCommand}"
Style="{StaticResource OptionPanel_TextButton}"
Content="{Binding CancelMsg}">
</Button>
</UniformGrid>
</DockPanel>
</EgtWPFLib5:EgtCustomWindow>
@@ -0,0 +1,15 @@
Public Class MultiSelectionV
Private WithEvents m_MultiSelectionVM As MultiSelectionVM
Sub New(Owner As Window, MultiSelVM As MultiSelectionVM)
MyBase.New(Owner)
' This call is required by the designer.
InitializeComponent()
Me.DataContext = MultiSelVM
' Assegno al riferimento locale al VM il VM preso dal DataContext
m_MultiSelectionVM = MultiSelVM
Me.Show()
End Sub
End Class
@@ -0,0 +1,97 @@
Imports EgtUILib
Imports EgtWPFLib5
Public Class MultiSelectionVM
Inherits VMBase
Private m_sRefGuidOfPart As String = String.Empty
Public ReadOnly Property TitleMsg As String
Get
Return "Multiple selection"
End Get
End Property
Public ReadOnly Property SelectionMsg As String
Get
Return "Number of Parts"
End Get
End Property
Public ReadOnly Property OkMsg As String
Get
Return "Ok"
End Get
End Property
Public ReadOnly Property CancelMsg As String
Get
Return "Cancel"
End Get
End Property
Private m_MultiSelectionV As MultiSelectionV
Public Sub SetMultiSelectionV(MultiSel As MultiSelectionV)
m_MultiSelectionV = MultiSel
End Sub
Private m_nNbrOfParts As Integer
Public Property nNbrOfParts As String
Get
Return m_nNbrOfParts.ToString
End Get
Set(value As String)
Dim nVal As Integer = 0
StringToInt(value, nVal)
m_nNbrOfParts = nVal
NotifyPropertyChanged("nNbrOfParts")
End Set
End Property
Private m_cmdOk As ICommand
Private m_cmdCancel As ICommand
Public ReadOnly Property OkCommand As ICommand
Get
If m_cmdOk Is Nothing Then
m_cmdOk = New Command(AddressOf OkCmd)
End If
Return m_cmdOk
End Get
End Property
Public Sub OkCmd(ByVal param As Object)
' il numero di elementi indicato è corretto
' deseleziono il pezzo corrente
DeselectPartInFaimily(m_sRefGuidOfPart)
Select Case m_nNbrOfParts
Case 0 ' Annulla
' continuo senza eseguire niente
Case Else
' seleziono il numero di pezzi indicati
SelectPartInFaimily(m_sRefGuidOfPart, m_nNbrOfParts)
End Select
' chiudo la finestra
m_MultiSelectionV.Close()
EgtDraw()
End Sub
Public ReadOnly Property CancelCommand As ICommand
Get
If m_cmdCancel Is Nothing Then
m_cmdCancel = New Command(AddressOf CancelCmd)
End If
Return m_cmdCancel
End Get
End Property
Public Sub CancelCmd(ByVal param As Object)
' chiudo la fiestra senza eseguire niente
m_MultiSelectionV.Close()
EgtDraw()
End Sub
Sub New(CurrNumberOfParts As Integer, sRefGuid As String)
m_nNbrOfParts = CurrNumberOfParts
m_sRefGuidOfPart = sRefGuid
End Sub
End Class
+154 -19
View File
@@ -115,8 +115,7 @@ Public Class NestingTabVM
End Get
Set(value As String)
Dim dValue As Double
'StringToDouble(value, m_dRotationAngle)
If StringToLen(value, dValue) Then
If StringToDouble(value, dValue) Then
If dValue < 0 Then
dValue = 0
ElseIf dValue > 180 Then
@@ -175,7 +174,7 @@ Public Class NestingTabVM
Public ReadOnly Property DragRettangleMsg As String
Get
Return "Drag Rettangle"
Return "Drag Rectangle"
End Get
End Property
@@ -414,8 +413,29 @@ Public Class NestingTabVM
If Not EgtGetPartPartClusterCenterGlob(nId, ptCen) Then Return False
' Rotazione del pezzo attorno al suo centro
EgtRotate(nId, ptCen, Vector3d.Z_AX(), dAngRotDeg, GDB_RT.GLOB)
' Sistemazione nel parcheggio
PackPartInStore(nId)
'---------------------- COUNTER PART ----------------------
' Aggiorno il Guid assegnando la nuova rotazione
Dim sRefGroup As String = String.Empty
If EgtGetInfo(nId, INFO_REFGROUP, sRefGroup) Then
Dim sCurrRefGroup As String = sRefGroup
If UppDateGuidCode(sRefGroup, CreatePreGuidCode(nId)) Then
EgtSetInfo(nId, INFO_REFGROUP, sRefGroup)
End If
' aggiorno il layer che indica il numero di pezzi in parcheggio
CountPartInFamily(sCurrRefGroup)
End If
' se esiste almento un pezzo del gruppo in parcheggio esco
If Not ParkInGroupFamily(nId) Then
PackPartInStore(nId)
End If
' ricarico l'lelenco dei pezzi in parcheggio
GetFamilyGroupInPark()
'---------------------- COUNTER PART ----------------------
'' Sistemazione nel parcheggio
'PackPartInStore(nId)
End If
' Passo al successivo selezionato
nId = EgtGetNextSelectedObj()
@@ -759,25 +779,29 @@ Public Class NestingTabVM
Dim ptCen As Point3d
EgtCenterPoint(m_nIdSelectedTextRettangle, ptCen)
EgtModifyText(m_nIdSelectedTextRettangle, m_sTextContent & LenToString(MaxLen + dProjection, 2) & " x " & LenToString(MinLen, 2))
EgtMove(m_nIdSelectedTextRettangle, vtMove * 0.5)
EgtMove(m_nIdSelectedTextRettangle, vtMove * 0.5, GDB_ID.ROOT)
If m_nIdSelectedTextTopRettangle <> GDB_ID.NULL Then
EgtMove(m_nIdSelectedTextTopRettangle, vtMove * 0.5)
EgtMove(m_nIdSelectedTextTopRettangle, vtMove * 0.5, GDB_ID.ROOT)
End If
End If
' verifico che il il lato maggiore rimanga semore il lato maggiore
Dim bRettangleCorrect As Boolean = False
If (MaxLen + dProjection - MinLen) > EPS_SMALL Then bRettangleCorrect = True
Dim nWarn As Integer = 0
ResetAllMachinings(nWarn)
EnableReferenceRegion(False)
' se la modifica genera un errore allora ripristino la figura prima della defomrazione
If Not EgtVerifyPart(EgtGetParent(m_nIdSelectedOutLoopRettangle), True) Then
If Not EgtVerifyPart(EgtGetParent(m_nIdSelectedOutLoopRettangle), True) Or Not bRettangleCorrect Then
EgtScale(m_nIdSelectedOutLoopRettangle, frFixed, 1 / dScalefactor, 1, 1, GDB_ID.ROOT)
EgtScale(m_nIdSelectedFlatSurfRettangle, frFixed, 1 / dScalefactor, 1, 1, GDB_ID.ROOT)
Dim ptCen As Point3d
EgtCenterPoint(m_nIdSelectedTextRettangle, ptCen)
EgtModifyText(m_nIdSelectedTextRettangle, m_sTextContent & LenToString(MaxLen, 2) & " x " & LenToString(MinLen, 2))
EgtMove(m_nIdSelectedTextRettangle, -vtMove * 0.5)
EgtMove(m_nIdSelectedTextRettangle, -vtMove * 0.5, GDB_ID.ROOT)
If m_nIdSelectedTextTopRettangle <> GDB_ID.NULL Then
EgtMove(m_nIdSelectedTextTopRettangle, -vtMove * 0.5)
EgtMove(m_nIdSelectedTextTopRettangle, -vtMove * 0.5, GDB_ID.ROOT)
End If
End If
@@ -1236,6 +1260,8 @@ Public Class NestingTabVM
End Property
Public Sub StorePart(ByVal param As Object)
' creo la lista delle famiglie di pezzi presenti in parcheggio
GetFamilyGroupInPark()
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
' Ciclo di parcheggio dei pezzi selezionati
Dim nId As Integer = EgtGetFirstSelectedObj()
@@ -1308,13 +1334,20 @@ Public Class NestingTabVM
If bEraseCsvParts OrElse Not EgtExistsInfo(nId, INFO_CSV_PATH) Then
' Se pezzo in parcheggio cancello direttamente
If EgtIsPart(nId) Then
'---------------------- COUNTER PART ----------------------
Dim sRefGroup As String = String.Empty
' recupero l'GUID del gruppo
EgtGetInfo(nId, INFO_REFGROUP, sRefGroup)
'---------------------- COUNTER PART ----------------------
' Eventuale notifica al VeinMatching
VeinMatching.OnRemovePart(nId, False)
' Rimuovo le lavorazioni
EraseMachinings(nId)
' Cancello
EgtErase(nId)
' Altrimenti pezzo nel grezzo
' aggiorno il layer che indica il numero di pezzi in parcheggio (se sRefGroup<>"")
CountPartInFamily(sRefGroup)
' Altrimenti pezzo nel grezzo
ElseIf EgtGetParent(nId) = EstCalc.GetRawId() Then
If EgtRemovePartFromRawPart(nId) Then
' Eventuale notifica al VeinMatching
@@ -1529,13 +1562,35 @@ Public Class NestingTabVM
If EgtIsPart(nPartId) Or bPartInTable Then
Dim nStat As Integer = GDB_ST.ON_
EgtGetStatus(nPartId, nStat)
' Se già selezionato
If nStat = GDB_ST.SEL Then
' Memorizzo Id da deselezionare
m_nIdToDesel = nPartId
Else
' Memorizzo Id da selezionare
m_nIdToSel = nPartId
' verifico se l'lemento selezionato è il numero di pezzi
If EgtGetType(nId) = GDB_TY.EXT_TEXT Then
Dim NameLayer As String = String.Empty
EgtGetName(EgtGetParent(nId), NameLayer)
If NameLayer = INFO_COUNTERLY Then
Dim sText As String = String.Empty
If EgtTextGetContent(nId, sText) Then
Dim sItems() As String = sText.Split("#")
If sItems.Count > 1 Then
m_nCurrNubrOfParts = 0
If StringToInt(sItems(1), m_nCurrNubrOfParts) Then
m_bIsCounterLy = True
m_nIdToSel = nPartId
End If
End If
End If
End If
End If
If Not m_bIsCounterLy Then
' Se già selezionato o posizione oggetto incompatibile con flag posizione selezionati
If nStat = GDB_ST.SEL Then
' Memorizzo Id da deselezionare
m_nIdToDesel = nPartId
Else
' Memorizzo Id da selezionare
m_nIdToSel = nPartId
End If
End If
' Drag possibile
m_bDrag = True
@@ -1588,7 +1643,20 @@ Public Class NestingTabVM
Dim b3Ins As new BBox3d
EgtGetBBoxGlob( EgtGetFirstNameInGroup( nTestId, NAME_REGION), BBFLAG, b3Ins)
Dim vtDiff As new Vector3d( b3Curr.Min().x - b3Ins.Min().x, b3Curr.Min().y - b3Ins.Min().y, 0)
EgtMove( nMoveId, vtDiff)
EgtMove(nMoveId, vtDiff)
'---------------------- COUNTER PART ----------------------
' aggiorno contatore pezzi
Dim sRefGroup As String = String.Empty
If EgtGetInfo(nMoveId, INFO_REFGROUP, sRefGroup) Then
' spengo il layer che contiene il contatore
Dim nCounterLayer As Integer = EgtGetFirstNameInGroup(nMoveId, INFO_COUNTERLY)
EgtSetStatus(nCounterLayer, GDB_ST.OFF)
' aggiorno il layer che indica il numero di pezzi in parcheggio
CountPartInFamily(sRefGroup)
End If
'---------------------- COUNTER PART ----------------------
' Gestione VeinMatching
VeinMatching.OnInsertPartInRaw( nMoveId)
' Imposto stato
@@ -1693,12 +1761,34 @@ Public Class NestingTabVM
VeinMatching.OnMovePartInRaw(nMoveId)
End If
End If
'---------------------- COUNTER PART ----------------------
Dim sRefGroup As String = String.Empty
If EgtGetInfo(nMoveId, INFO_REFGROUP, sRefGroup) Then
' accendo il layer che contiene il contatore (spento in fase di Drag)
Dim nCounterLayer As Integer = EgtGetFirstNameInGroup(nMoveId, INFO_COUNTERLY)
EgtSetStatus(nCounterLayer, GDB_ST.ON_)
' aggiorno il layer che indica il numero di pezzi in parcheggio
CountPartInFamily(sRefGroup)
End If
'---------------------- COUNTER PART ----------------------
End If
m_bFromParking = False
' altrimenti caso con verifica durante il movimento
Else
' Basta reset alla fine
End If
' se è stato selezionato il layer del contatore mostro la finsetra
ElseIf m_bIsCounterLy Then
' devo csotruire la finestra per la selezione del numero di pezzi da muovere
' apro una finestra di dialogo per chiedere se inserire tutti i pezzi della famiglia
Dim sRefGroup As String = String.Empty
EgtGetInfo(m_nIdToSel, INFO_REFGROUP, sRefGroup)
Dim DataContextSlectWD As New MultiSelectionVM(m_nCurrNubrOfParts, sRefGroup)
Dim SelectWD As MultiSelectionV = New MultiSelectionV(Application.Current.MainWindow, DataContextSlectWD)
DataContextSlectWD.SetMultiSelectionV(SelectWD)
m_bIsCounterLy = False
' Se selezione da eseguire
ElseIf m_nIdToSel <> GDB_ID.NULL Then
' Determino se pezzo in tavola o in parcheggio
@@ -1772,3 +1862,48 @@ Public Class NestingTabVM
#End Region ' EVENTS
End Class
Class FamilyPart
Private PtMinStoraged As Point3d
Private PtMaxStoraged As Point3d
Private m_nHText As Integer = 40
Public ReadOnly Property nHText As Double
Get
Return m_nHText
End Get
End Property
Private m_sRefGuid As String = String.Empty
Public ReadOnly Property sRefGuid As String
Get
Return m_sRefGuid
End Get
End Property
Private m_nIdPart As Integer = -1
Public ReadOnly Property nIdPart As Integer
Get
Return m_nIdPart
End Get
End Property
Private m_IdCounterText As Integer
Public ReadOnly Property IdCounterText As Integer
Get
Return m_IdCounterText
End Get
End Property
Public Function PtStorage() As Point3d
EgtGetBBoxGlob(m_nIdPart, GDB_BB.STANDARD, PtMinStoraged, PtMaxStoraged)
Return PtMinStoraged
End Function
Sub New(Guid As String, IdPart As Integer)
m_sRefGuid = Guid
m_nIdPart = IdPart
End Sub
End Class
+5 -2
View File
@@ -1678,8 +1678,11 @@ Public Class RawPartTabVM
End Sub
Private Sub AdjustRawPartOnExit()
' Se non c'è il grezzo, esco
If EstCalc.GetRawId() = GDB_ID.NULL Then Return
' Se non c'è il grezzo, esco dopo aver nascosto eventuale foto
If EstCalc.GetRawId() = GDB_ID.NULL Then
ShowPhoto(False)
Return
End If
' Disabilito impostazione modificato
Dim bOldEnMod = EgtGetEnableModified()
If bOldEnMod Then EgtDisableModified()