diff --git a/CompoWindow/CompoWindowVM.vb b/CompoWindow/CompoWindowVM.vb
index 920e9a6..f0a5642 100644
--- a/CompoWindow/CompoWindowVM.vb
+++ b/CompoWindow/CompoWindowVM.vb
@@ -228,6 +228,9 @@ Public Class CompoWindowVM
AdjustFlatPart(nId2)
' Inserisco in parcheggio
EstCalc.StoreOnePart(nId2, True)
+ ' Aggiungo riferimento e lo inserisco in VeinMatching
+ VeinMatching.SetRefOnPart(nId2)
+ VeinMatching.AddPart(nId2, True)
' Se richiesto posizionamento diretto, lo eseguo
If bDirect Then
If EstCalc.InsertOnePart(nId2, CurrentMachine.bAligned, CurrentMachine.bReducedCut) Then
@@ -277,25 +280,28 @@ Public Class CompoWindowVM
' Se presente lo svuoto
If TextLayer <> GDB_ID.NULL Then
EgtEmptyGroup(TextLayer)
- ' altrimenti lo creo
+ ' altrimenti lo creo
Else
TextLayer = EgtCreateGroup(Pz)
EgtSetName(TextLayer, SIDE_ANGLE_LAYER)
End If
- '' Modifico inclinazione lati
- 'For Each Entity In m_SideAngle.m_SideAngleEntityList
- ' Dim nCurrEntityName As Integer = EgtGetFirstNameInGroup(nOutLoopLayer, Entity.sEntityName)
- ' If Math.Abs(Entity.dSideAngle) > EPS_ANG_SMALL Then
- ' ' Scrivo nuovo angolo nelle info
- ' EgtSetInfo(nCurrEntityName, INFO_SIDE_ANGLE, Entity.dSideAngle)
- ' ' Creo testo con angolo di inclinazione per nesting
- ' Dim sText As String = DoubleToString(Entity.dSideAngle, 1) & "°"
- ' SideAngleUC.AddTextToLine(sText, TextLayer, nCurrEntityName, 10, dBBoxRad, False)
- ' Else
- ' ' Cancello inclinazione nell'apposito campo info
- ' EgtRemoveInfo(nCurrEntityName, INFO_SIDE_ANGLE)
- ' End If
- 'Next
+ ' Modifico inclinazione lati
+ If Not IsNothing(CompoWindowMap.refCompoParamPageVM.m_SideAngleEntityList) Then
+ For Each Entity In CompoWindowMap.refCompoParamPageVM.m_SideAngleEntityList
+ Dim CurrSideAngleEntity As SideAngleEntity = DirectCast(Entity, SideAngleEntity)
+ Dim nCurrEntityName As Integer = EgtGetFirstNameInGroup(nOutLoopLayer, Entity.sEntityName)
+ If Math.Abs(CurrSideAngleEntity.dSideAngle) > EPS_ANG_SMALL Then
+ ' Scrivo nuovo angolo nelle info
+ EgtSetInfo(nCurrEntityName, INFO_SIDE_ANGLE, CurrSideAngleEntity.dSideAngle)
+ ' Creo testo con angolo di inclinazione per nesting
+ Dim sText As String = DoubleToString(CurrSideAngleEntity.dSideAngle, 1) & "°"
+ SideEntityControlVM.AddTextToLine(sText, TextLayer, nCurrEntityName, 10, dBBoxRad, False)
+ Else
+ ' Cancello inclinazione nell'apposito campo info
+ EgtRemoveInfo(nCurrEntityName, INFO_SIDE_ANGLE)
+ End If
+ Next
+ End If
' Esporto il pezzo in un file temporaneo
Dim sTmpFile As String = OmagOFFICEMap.refMainWindowVM.MainWindowM.sTempDir & "\FlatPartCompo.Nge"
If Not EgtSaveObjToFile(1, sTmpFile, NGE.BIN) Then
@@ -335,6 +341,9 @@ Public Class CompoWindowVM
AdjustFlatPart(nId2)
' Inserisco in parcheggio
EstCalc.StoreOnePart(nId2, True)
+ ' Aggiungo riferimento e lo inserisco in VeinMatching
+ VeinMatching.SetRefOnPart(nId2)
+ VeinMatching.AddPart(nId2, True)
' Se richiesto posizionamento diretto, lo eseguo
If bDirect Then
If EstCalc.InsertOnePart(nId2, CurrentMachine.bAligned, CurrentMachine.bReducedCut) Then
diff --git a/Constants/ConstIni.vb b/Constants/ConstIni.vb
index 859f917..69de6e1 100644
--- a/Constants/ConstIni.vb
+++ b/Constants/ConstIni.vb
@@ -99,6 +99,7 @@ Module ConstIni
Public Const K_SNAPDIST As String = "SnapDist"
Public Const S_CSV As String = "Csv"
+ Public Const K_CSVDIRECT As String = "Direct"
Public Const K_MAXDIMONX As String = "MaxDimOnX"
Public Const K_CSVCURRDIR As String = "CurrDir"
Public Const K_CSVLASTFILE As String = "LastFile"
diff --git a/DxfImportWindow/DxfImportWindowVM.vb b/DxfImportWindow/DxfImportWindowVM.vb
index 0852285..7b756db 100644
--- a/DxfImportWindow/DxfImportWindowVM.vb
+++ b/DxfImportWindow/DxfImportWindowVM.vb
@@ -327,10 +327,9 @@ Public Class DxfImportWindowVM
End Function
Friend Sub LoadFlatParts()
- ' Scrivo testi per nesting
- 'm_SideAngleUC.WriteSideAngleForNest(ImportScene.GetCtx())
' Imposto riferimento sul centro geometrico di ogni pezzo
- VeinMatching.SetRefOnAllParts(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
+ EgtSetCurrentContext(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
+ VeinMatching.SetRefOnAllParts()
' Eventuale pulizia VeinMatching
VeinMatching.Clear()
' Vettore nomi file temporanei
diff --git a/EgtStoneLib/CsvM.vb b/EgtStoneLib/CsvM.vb
index c92425d..e85e0a2 100644
--- a/EgtStoneLib/CsvM.vb
+++ b/EgtStoneLib/CsvM.vb
@@ -186,10 +186,11 @@ Module CsvM
EgtLuaResetGlobVar("CMP")
EgtLuaResetGlobVar("CMP_Draw")
' Provo ad inserire i pezzi
+ Dim bDirect As Boolean = (GetMainPrivateProfileInt(S_CSV, K_CSVDIRECT, 1) <> 0)
For i As Integer = 1 To InsPartList.Count()
Dim CurrPart As CsvPart = InsPartList(i - 1)
While CurrPart.m_nToNest > 0
- If PackOnePart(CurrPart.m_nId) Then
+ If PackOnePart(CurrPart.m_nId, bDirect) Then
CurrPart.m_nToNest -= 1
Else
Exit While
@@ -199,47 +200,38 @@ Module CsvM
Return True
End Function
- Private Function PackOnePart(nId As Integer) As Boolean
- ' Dimensioni del pezzo
- Dim ptPartMin, ptPartMax As Point3d
- If Not EgtGetBBox(nId, GDB_BB.IGNORE_DIM + GDB_BB.IGNORE_TEXT, ptPartMin, ptPartMax) Then Return False
- Dim dPartLen As Double = ptPartMax.x - ptPartMin.x
- Dim dPartHeight As Double = ptPartMax.y - ptPartMin.y
- ' Centro del grezzo
- Dim nRawCenId = EgtGetFirstNameInGroup(EstCalc.GetRawId(), NAME_RAW_CENTER)
- Dim ptRawCenter As Point3d
- EgtStartPoint(nRawCenId, GDB_ID.ROOT, ptRawCenter)
- Dim dRawCenX = ptRawCenter.x - EstCalc.GetRawPtMin().x
- Dim dRawCenY = ptRawCenter.y - EstCalc.GetRawPtMin().y
- ' Inserisco il pezzo nel grezzo, in centro in XY e in alto in Z
- Dim ptP As New Point3d(dRawCenX - 0.5 * dPartLen, dRawCenY - 0.5 * dPartHeight, EstCalc.GetRawHeight())
- ' Ne creo una copia nella radice
+ Private Function PackOnePart(nId As Integer, bDirect As Boolean) As Boolean
+ ' Creo una copia del pezzo nella radice
Dim nId2 As Integer = EgtCopyGlob(nId, GDB_ID.ROOT)
- If EgtAddPartToRawPart(nId2, ptP, EstCalc.GetRawId()) Then
- ' Aggiungo le lavorazioni standard
- AddMachinings(nId2, True, False)
- ' Eseguo nesting
- Dim bFit As Boolean = False
- If EstCalc.UpdateNestRegions() Then
- Dim bAligned As Boolean = (GetMainPrivateProfileInt(S_MACH_NEST, K_MACH_NEST_ALIGNED, 0) <> 0)
- EstCalc.EnableReferenceRegion(bAligned)
- If Not EgtExistsInfo(EstCalc.GetRawId(), KEY_RAWBYPOINTS) Then
- bFit = EgtPackPartInRectangle(nId2, True, True)
- End If
- If Not bFit Then
- bFit = EgtPackPart(nId2, True, True)
- End If
- End If
- ' Gestione risultato nesting
- If bFit Then
+ If nId2 = GDB_ID.NULL Then Return False
+ ' Lo inserisco direttamente
+ If bDirect Then
+ ' Aggiungo riferimento e lo inserisco in VeinMatching
+ VeinMatching.SetRefOnPart(nId2)
+ VeinMatching.AddPart(nId2, True)
+ ' Provo inserimento in lastra
+ If EstCalc.InsertOnePart(nId2, CurrentMachine.bAligned, CurrentMachine.bReducedCut) Then
+ ' Eventuale notifica al VeinMatching
+ VeinMatching.OnInsertPartInRaw(nId2)
Return True
Else
+ ' Eventuale cancellazione per VM
+ VeinMatching.OnRemovePart(nId2)
+ ' Cancellazione del pezzo
EraseMachinings(nId2)
EgtRemovePartFromRawPart(nId2)
EgtErase(nId2)
+ Return False
End If
+ ' altrimenti lo metto in parcheggio
+ Else
+ ' Aggiungo riferimento e lo inserisco in VeinMatching
+ VeinMatching.SetRefOnPart(nId2)
+ VeinMatching.AddPart(nId2, True)
+ ' Inserisco in parcheggio
+ EstCalc.StoreOnePart(nId2, True)
+ Return True
End If
- Return False
End Function
Public Sub Remove(ByRef bOther As Boolean, ByRef sOtherCsv As String)
@@ -284,6 +276,8 @@ Module CsvM
' Rimuovo dal grezzo
EgtRemovePartFromRawPart(nId)
End If
+ ' Eventuale cancellazione per VM
+ VeinMatching.OnRemovePart(nId)
' Cancello il pezzo
EgtErase(nId)
' Aggiorno il contatore
diff --git a/EgtStoneLib/VeinMatchingWindow.xaml b/EgtStoneLib/VeinMatchingWindow.xaml
index 41775df..a314fa6 100644
--- a/EgtStoneLib/VeinMatchingWindow.xaml
+++ b/EgtStoneLib/VeinMatchingWindow.xaml
@@ -10,9 +10,12 @@
-
+
+
diff --git a/EgtStoneLib/VeinMatchingWindow.xaml.vb b/EgtStoneLib/VeinMatchingWindow.xaml.vb
index 00e8d33..dcdff6d 100644
--- a/EgtStoneLib/VeinMatchingWindow.xaml.vb
+++ b/EgtStoneLib/VeinMatchingWindow.xaml.vb
@@ -71,12 +71,13 @@ Public Class VeinMatchingWindow
' dimensione lineare max in pixel delle textures
Dim nTxrMaxLinPix As Integer = GetMainPrivateProfileInt(S_SCENE, K_TXRMAXLINPIX, 16384)
EgtSetTextureMaxLinPixels(nTxrMaxLinPix)
+ ' imposto stato bottone ShowText
+ ShowTextBtn.IsChecked = VeinMatching.bShowText
m_bFirst = False
End If
' inibisco selezione diretta da Scene
VeinMatchingScene.SetStatusNull()
-
End Sub
Private Sub Window_Closed(sender As Object, e As EventArgs) Handles Me.Closed
@@ -129,6 +130,10 @@ Public Class VeinMatchingWindow
VeinMatching.Export(SaveFileDialog.FileName)
End Sub
+ Private Sub ShowTextBtn_Click(sender As Object, e As RoutedEventArgs) Handles ShowTextBtn.Click
+ VeinMatching.SetShowText(If(ShowTextBtn.IsChecked, False))
+ End Sub
+
End Class
Friend Module VeinMatching
@@ -140,6 +145,13 @@ Friend Module VeinMatching
' Dimensioni immagine da esportare
Private m_nImgWidth As Integer = 1600
Private m_nImgHeight As Integer = 1200
+ ' Flag visualizzazione testi
+ Private m_bShowText As Boolean = True
+ Friend ReadOnly Property bShowText As Boolean
+ Get
+ Return m_bShowText
+ End Get
+ End Property
' Costanti
Const REF_NAME As String = "Ref"
@@ -151,9 +163,8 @@ Friend Module VeinMatching
Return True
End Function
- Friend Function SetRefOnAllParts(nCtx As Integer) As Boolean
- ' Si opera nel contesto indicato
- EgtSetCurrentContext(nCtx)
+ Friend Function SetRefOnAllParts() As Boolean
+ ' Si opera nel contesto corrente
Dim nId As Integer = EgtGetFirstPart()
While nId <> GDB_ID.NULL
' Gruppo regione
@@ -183,6 +194,34 @@ Friend Module VeinMatching
Return True
End Function
+ Friend Function SetRefOnPart(nId As Integer) As Boolean
+ ' Si opera nel contesto corrente
+ If nId <> GDB_ID.NULL Then
+ ' Gruppo regione
+ Dim nRegLayId As Integer = EgtGetFirstNameInGroup(nId, NAME_REGION)
+ ' Entità superficie regione piatta
+ Dim nRegId As Integer = EgtGetFirstInGroup(nRegLayId)
+ While nRegId <> GDB_ID.NULL
+ If EgtGetType(nRegId) = GDB_TY.SRF_FRGN Then
+ Exit While
+ End If
+ nRegId = EgtGetNext(nRegId)
+ End While
+ ' Ne recupero il centroide
+ Dim ptCen As Point3d
+ EgtCentroid(nRegId, GDB_ID.ROOT, ptCen)
+ ' Inserisco il riferimento
+ Dim frRef As New Frame3d(ptCen)
+ Dim nRefId As Integer = EgtCreateGeoFrame(nRegLayId, frRef, GDB_RT.GLOB)
+ EgtSetName(nRefId, REF_NAME)
+ ' salvo nelle info il riferimento originale
+ EgtSetInfo(nRefId, KEY_ORI_REF, frRef)
+ ' nascondo l'oggetto appena inserito
+ EgtSetMode(nRefId, GDB_MD.HIDDEN)
+ End If
+ Return True
+ End Function
+
Friend Function Clear() As Boolean
' Verifico esista il contesto del VeinMatching
If m_nVeinCtx = 0 Then Return True
@@ -199,7 +238,30 @@ Friend Module VeinMatching
Return True
End Function
- Friend Function AddPart(sPartFile As String, nPartId As Integer) As Boolean
+ Friend Function AddPart(nPartId As Integer, Optional bPack As Boolean = False) As Boolean
+ ' Verifico esista il contesto del VeinMatching
+ If m_nVeinCtx = 0 Then Return True
+ ' Verifico validità pezzo
+ If nPartId = GDB_ID.NULL Then Return False
+ ' Salvo il pezzo su file temporaneo
+ Dim sTmpDir As String = String.Empty
+ If Not EgtGetTempDir(sTmpDir) Then Return False
+ Dim sTmpFile As String = sTmpDir & "\FlatPartVme.Nge"
+ EgtSaveObjToFile(nPartId, sTmpFile, NGE.BIN)
+ ShowParkedParts()
+ ' Carico il file nel VM
+ Dim bOk As Boolean = My.Computer.FileSystem.FileExists(sTmpFile)
+ If bOk Then
+ bOk = AddPart(sTmpFile, nPartId, bPack)
+ ' Ne aggiorno la visualizzazione
+ ZoomAll()
+ ' Cancello il file
+ My.Computer.FileSystem.DeleteFile(sTmpFile)
+ End If
+ Return bOk
+ End Function
+
+ Friend Function AddPart(sPartFile As String, nPartId As Integer, Optional bPack As Boolean = False) As Boolean
' Verifico esista il contesto del VeinMatching
If m_nVeinCtx = 0 Then Return True
' Imposto VeinMatching context
@@ -211,16 +273,22 @@ Friend Module VeinMatching
Dim nVeinId2 As Integer = EgtGetLastPart()
' Assegno Id originale
EgtSetInfo(nVeinId2, KEY_ORI_ID, nPartId)
- ' Nascondo scritte, sono nel layer "Region"
- Dim nVeinRegId As Integer = EgtGetFirstNameInGroup(nVeinId2, NAME_REGION)
- Dim nCurrId As Integer = EgtGetFirstInGroup(nVeinRegId)
- While nCurrId <> GDB_ID.NULL
- If EgtGetType(nCurrId) = GDB_TY.EXT_TEXT Then EgtSetStatus(nCurrId, GDB_ST.OFF)
- nCurrId = EgtGetNext(nCurrId)
- End While
+ ' Se impostato, nascondo scritte, sono nel layer "Region"
+ If Not m_bShowText Then
+ Dim nVeinRegId As Integer = EgtGetFirstNameInGroup(nVeinId2, NAME_REGION)
+ Dim nCurrId As Integer = EgtGetFirstInGroup(nVeinRegId)
+ While nCurrId <> GDB_ID.NULL
+ If EgtGetType(nCurrId) = GDB_TY.EXT_TEXT Then EgtSetStatus(nCurrId, GDB_ST.OFF)
+ nCurrId = EgtGetNext(nCurrId)
+ End While
+ End If
' Nascondo layer con valori angoli dei lati
- nCurrId = EgtGetFirstNameInGroup(nVeinId2, SIDE_ANGLE_LAYER)
- EgtSetStatus(nCurrId, GDB_ST.OFF)
+ Dim nLayAngId As Integer = EgtGetFirstNameInGroup(nVeinId2, SIDE_ANGLE_LAYER)
+ EgtSetStatus(nLayAngId, GDB_ST.OFF)
+ ' Se richiesto, eseguo pack
+ If bPack Then
+ EgtPackBox(nVeinId2, 0, 0, 2000, INFINITO, 0, True)
+ End If
' Se necessario, ripristino il contesto originale
If nMainCtx > 0 Then EgtSetCurrentContext(nMainCtx)
Return True
@@ -300,8 +368,8 @@ Friend Module VeinMatching
Dim refTxr As New Frame3d
GetVeinRefPhoto(nMainCtx, nPartId, nId, refTxr)
EgtSetTextureFrame(nRegId, refTxr, GDB_RT.GLOB)
+ EgtDraw()
End If
- EgtDraw()
EgtSetCurrentContext(nMainCtx)
Return True
End Function
@@ -330,8 +398,27 @@ Friend Module VeinMatching
EgtSetColor(nRegId, colAqua)
' Se richiesto, eseguo deselezione
If bDeselect Then EgtDeselectObj(nId)
+ EgtDraw()
+ End If
+ EgtSetCurrentContext(nMainCtx)
+ Return True
+ End Function
+
+ Friend Function OnRemovePart(nPartId As Integer) As Boolean
+ ' Verifico esista il contesto del VeinMatching
+ If m_nVeinCtx = 0 Then Return True
+ ' Recupero il contesto corrente (principale)
+ Dim nMainCtx = EgtGetCurrentContext()
+ ' Recupero il nome originale del pezzo
+ Dim nOriId As Integer = nPartId
+ EgtGetInfo(nPartId, KEY_ORI_ID, nOriId)
+ ' Recupero il pezzo nel VeinMatching e lo cancello
+ EgtSetCurrentContext(m_nVeinCtx)
+ Dim nId = GetVeinPartId(nOriId)
+ If nId <> GDB_ID.NULL Then
+ EgtErase(nId)
+ EgtDraw()
End If
- EgtDraw()
EgtSetCurrentContext(nMainCtx)
Return True
End Function
@@ -434,6 +521,8 @@ Friend Module VeinMatching
If StringToInt(sName.Replace(PHOTO_NAME, ""), nVal) Then m_nPhoto = Math.Max(m_nPhoto, nVal)
nPhId = EgtGetNext(nPhId)
End While
+ ' Aggiorno visualizzazione testi
+ UpdateShowText()
' Eseguo zoom all
EgtZoom(ZM.ALL)
' Ripristino il contesto originale
@@ -539,6 +628,36 @@ Friend Module VeinMatching
Return True
End Function
+ Friend Function SetShowText(bShow As Boolean) As Boolean
+ If bShow <> m_bShowText Then
+ m_bShowText = bShow
+ UpdateShowText()
+ End If
+ Return True
+ End Function
+
+ Friend Sub UpdateShowText()
+ ' Verifico esista il contesto del VeinMatching
+ If m_nVeinCtx = 0 Then Return
+ ' Recupero il contesto corrente (principale)
+ Dim nMainCtx = EgtGetCurrentContext()
+ ' Ciclo sui pezzi
+ EgtSetCurrentContext(m_nVeinCtx)
+ Dim nPartId As Integer = EgtGetFirstPart()
+ While nPartId <> GDB_ID.NULL
+ Dim nVeinRegId As Integer = EgtGetFirstNameInGroup(nPartId, NAME_REGION)
+ Dim nCurrId As Integer = EgtGetFirstInGroup(nVeinRegId)
+ While nCurrId <> GDB_ID.NULL
+ If EgtGetType(nCurrId) = GDB_TY.EXT_TEXT Then EgtSetStatus(nCurrId, If(m_bShowText, GDB_ST.ON_, GDB_ST.OFF))
+ nCurrId = EgtGetNext(nCurrId)
+ End While
+ nPartId = EgtGetNextPart(nPartId)
+ End While
+ EgtDraw()
+ ' Ripristino il contesto originale
+ EgtSetCurrentContext(nMainCtx)
+ End Sub
+
Private Function CopyPhoto(nPhotoId As Integer) As Boolean
' Recupero il contesto corrente
Dim nCurrCtx = EgtGetCurrentContext()
@@ -616,11 +735,17 @@ Friend Module VeinMatching
' Riferimento della foto rispetto al riferimento del pezzo nel contesto principale
If Not EgtSetCurrentContext(nMainCtx) Then Return False
' riferimento della foto in globale
- If Not EstPhoto.GetPhotoTextureRef(refPhoto) Then Return False
+ If Not EstPhoto.GetPhotoTextureRef(refPhoto) Then
+ EgtSetCurrentContext(m_nVeinCtx)
+ Return False
+ End If
' riferimento del pezzo in globale
Dim nRefId As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(nPartId, NAME_REGION), REF_NAME)
Dim refPart As New Frame3d
- If Not EgtFrame(nRefId, GDB_ID.ROOT, refPart) Then Return False
+ If Not EgtFrame(nRefId, GDB_ID.ROOT, refPart) Then
+ EgtSetCurrentContext(m_nVeinCtx)
+ Return False
+ End If
' porto il riferimento della foto in quello del pezzo
refPhoto.ToLoc(refPart)
' Riferimento della foto rispetto al riferimento del pezzo in VeinMatching
diff --git a/MainWindow/MainWindowM.vb b/MainWindow/MainWindowM.vb
index 41899e3..f51854d 100644
--- a/MainWindow/MainWindowM.vb
+++ b/MainWindow/MainWindowM.vb
@@ -154,6 +154,8 @@ Public Class MainWindowM
(ChrW(97 - 1 + My.Application.Info.Version.Build)).ToString() &
My.Application.Info.Version.Revision.ToString()
EgtInit(m_nDebug, m_sLogFile, sLogMsg)
+ EgtSetTempDir(m_sTempDir)
+ EgtSetIniFile(IniFile.m_sIniFile)
' Leggo direttorio dei messaggi (se manca uso direttorio di configurazione)
Dim sMsgDir As String = String.Empty
If GetMainPrivateProfileString(S_GENERAL, K_MESSAGESDIR, "", sMsgDir) = 0 Then
@@ -196,8 +198,6 @@ Public Class MainWindowM
Dim sLuaBaseLib As String = String.Empty
GetMainPrivateProfileString(S_LUA, K_BASELIB, "EgtBase", sLuaBaseLib)
EgtLuaRequire(sLuaBaseLib)
- ' imposto IniFile a EgtInterface
- EgtSetIniFile(m_sIniFile)
' Info su opzioni chiave
EgtOutLog("KeyOptions : " & bKey.ToString() & " " & m_nKeyOptions.ToString() & " " & bProd.ToString())
End Sub
@@ -214,14 +214,14 @@ Public Class MainWindowM
' Prima istanza
m_nInstance = 1
' Aggiorno stato istanze attive
- WritePrivateProfileString(S_GENERAL, K_INSTANCES, m_nInstance, m_sIniFile)
+ WriteMainPrivateProfileString(S_GENERAL, K_INSTANCES, m_nInstance.ToString())
Else
' Leggo il massimo numero di istanze ammesse
Const MAX_INST As Integer = 32
- Dim nMaxInst As Integer = GetPrivateProfileInt(S_GENERAL, K_MAXINST, 1, m_sIniFile)
+ Dim nMaxInst As Integer = GetMainPrivateProfileInt(S_GENERAL, K_MAXINST, 1)
nMaxInst = Max(1, Min(nMaxInst, MAX_INST))
' Cerco il primo indice di istanza libero
- Dim nTmp As Integer = GetPrivateProfileInt(S_GENERAL, K_INSTANCES, 0, m_sIniFile)
+ Dim nTmp As Integer = GetMainPrivateProfileInt(S_GENERAL, K_INSTANCES, 0)
m_nInstance = 1
Dim nMask As Integer = 1
While (nTmp And nMask) <> 0 And m_nInstance < MAX_INST
@@ -257,7 +257,7 @@ Public Class MainWindowM
End If
' Aggiorno stato istanze attive
nTmp += (1 << (m_nInstance - 1))
- WritePrivateProfileString(S_GENERAL, K_INSTANCES, nTmp, m_sIniFile)
+ WriteMainPrivateProfileString(S_GENERAL, K_INSTANCES, nTmp.ToString())
End If
End Sub
@@ -271,9 +271,9 @@ Public Class MainWindowM
' Rilascio mutex
If Not IsNothing(m_objMutex) Then m_objMutex.Close()
' Aggiorno istanze usate
- Dim nTmp As Integer = GetPrivateProfileInt(S_GENERAL, K_INSTANCES, 0, m_sIniFile)
+ Dim nTmp As Integer = GetMainPrivateProfileInt(S_GENERAL, K_INSTANCES, 0)
nTmp -= (1 << (m_nInstance - 1))
- WritePrivateProfileString(S_GENERAL, K_INSTANCES, nTmp, m_sIniFile)
+ WriteMainPrivateProfileString(S_GENERAL, K_INSTANCES, nTmp.ToString())
End Sub
#End Region ' METHODS
diff --git a/MainWindow/MainWindowVM.vb b/MainWindow/MainWindowVM.vb
index 708cb97..3c46092 100644
--- a/MainWindow/MainWindowVM.vb
+++ b/MainWindow/MainWindowVM.vb
@@ -150,6 +150,8 @@ Public Class MainWindowVM
If OmagOFFICEMap.refOptionPanelVM.SelItem = OptionPanelVM.Tabs.SIMUL Then
OmagOFFICEMap.refSimulTabVM.ResetSimulation()
End If
+ ' Imposto contesto principale
+ EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
' Gestisco eventuale file corrente modificato
Dim bAllowClose As Boolean = OmagOFFICEMap.refSceneHostV.Controller.ManageModified()
' Se non confermata chiusura, esco
diff --git a/OptionPanel/NestingTab/NestingTabVM.vb b/OptionPanel/NestingTab/NestingTabVM.vb
index 1826a6a..215f864 100644
--- a/OptionPanel/NestingTab/NestingTabVM.vb
+++ b/OptionPanel/NestingTab/NestingTabVM.vb
@@ -607,9 +607,8 @@ Public Class NestingTabVM
' Se non ci sono pezzi selezionati, esco subito
If EgtGetFirstSelectedObj() = GDB_ID.NULL Then Return
' Chiedo conferma prima di procedere
- If MessageBox.Show(EgtMsg(MSG_EGTMSGBOX + 21), "", MessageBoxButton.OKCancel, MessageBoxImage.Question) = MessageBoxResult.Cancel Then
- Return
- End If
+ If MessageBox.Show(EgtMsg(MSG_EGTMSGBOX + 21), "", MessageBoxButton.OKCancel, MessageBoxImage.Question) = MessageBoxResult.Cancel Then Return
+ EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
' Verifico se ci sono pezzi provenienti da liste Csv
Dim bCsvParts As Boolean = False
Dim nId As Integer = EgtGetFirstSelectedObj()
@@ -632,6 +631,7 @@ Public Class NestingTabVM
Case MessageBoxResult.No
bEraseCsvParts = False
End Select
+ EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
End If
' Ciclo di cancellazione dei pezzi selezionati
nId = EgtGetFirstSelectedObj()
@@ -642,15 +642,17 @@ Public Class NestingTabVM
If bEraseCsvParts OrElse Not EgtExistsInfo(nId, INFO_CSV_PATH) Then
' Se pezzo in parcheggio cancello direttamente
If EgtIsPart(nId) Then
+ ' Eventuale notifica al VeinMatching
+ VeinMatching.OnRemovePart(nId)
' Rimuovo le lavorazioni
EraseMachinings(nId)
' Cancello
EgtErase(nId)
- ' Altrimenti pezzo nel grezzo
+ ' Altrimenti pezzo nel grezzo
ElseIf EgtGetParent(nId) = GetRawId() Then
If EgtRemovePartFromRawPart(nId) Then
' Eventuale notifica al VeinMatching
- VeinMatching.OnRemovePartFromRaw(nId)
+ VeinMatching.OnRemovePart(nId)
' Rimuovo le lavorazioni
EraseMachinings(nId)
'Cancello
diff --git a/OptionWindow/OptionWindowV.xaml b/OptionWindow/OptionWindowV.xaml
index af8d33a..c4c16d0 100644
--- a/OptionWindow/OptionWindowV.xaml
+++ b/OptionWindow/OptionWindowV.xaml
@@ -2,17 +2,21 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
+ IsMinimizable="False"
+ ShowInTaskbar="False"
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
- SizeToContent="WidthAndHeight" WindowStartupLocation="CenterOwner">
+ SizeToContent="WidthAndHeight"
+ WindowStartupLocation="CenterOwner">
-
-
+
+
+
+ Height="25" Width="60"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/OptionWindow/OptionWindowVM.vb b/OptionWindow/OptionWindowVM.vb
index 8c808ee..e831f4a 100644
--- a/OptionWindow/OptionWindowVM.vb
+++ b/OptionWindow/OptionWindowVM.vb
@@ -48,7 +48,7 @@ Public Class OptionWindowVM
Set(value As Integer)
If value <> m_SelSideModeIndex Then
m_SelSideModeIndex = value
- WriteMainPrivateProfileString(S_COMPO, K_SIDEMODE, m_SelSideModeIndex)
+ WriteMainPrivateProfileString(S_COMPO, K_SIDEMODE, m_SelSideModeIndex.ToString())
End If
End Set
End Property
@@ -74,6 +74,24 @@ Public Class OptionWindowVM
End Set
End Property
+ Public Property DIGeneral As Boolean
+ Get
+ Return (GetMainPrivateProfileInt(S_NEST, K_DIRECT, 0) <> 0)
+ End Get
+ Set(value As Boolean)
+ WriteMainPrivateProfileString(S_NEST, K_DIRECT, If(value, "1", "0"))
+ End Set
+ End Property
+
+ Public Property DICsv As Boolean
+ Get
+ Return GetMainPrivateProfileInt(S_CSV, K_CSVDIRECT, 1) <> 0
+ End Get
+ Set(value As Boolean)
+ WriteMainPrivateProfileString(S_CSV, K_CSVDIRECT, If(value, "1", "0"))
+ End Set
+ End Property
+
#Region "Messages"
Public ReadOnly Property Title As String
@@ -104,6 +122,24 @@ Public Class OptionWindowVM
End Get
End Property
+ Public ReadOnly Property DirectInsertHdr As String
+ Get
+ Return EgtMsg(MSG_OPTIONSPAGEUC + 8)
+ End Get
+ End Property
+
+ Public ReadOnly Property DIGeneralMsg As String
+ Get
+ Return EgtMsg(MSG_OPTIONSPAGEUC + 9)
+ End Get
+ End Property
+
+ Public ReadOnly Property DICsvMsg As String
+ Get
+ Return EgtMsg(MSG_OPTIONSPAGEUC + 10)
+ End Get
+ End Property
+
#End Region
#End Region ' FIELDS & PROPERTIES
diff --git a/SceneHost/SceneHostV.xaml.vb b/SceneHost/SceneHostV.xaml.vb
index 5d18bd2..b5e4aef 100644
--- a/SceneHost/SceneHostV.xaml.vb
+++ b/SceneHost/SceneHostV.xaml.vb
@@ -362,11 +362,16 @@ Public Class SceneHostV
End Sub
Private Sub OnOpenProject(sender As Object, sFile As String, bOk As Boolean) Handles m_Controller.OnOpenProject
- OmagOFFICEMap.refMainWindowVM.Title = sFile & " - OmagOFFICE"
- WriteMainPrivateProfileString(S_GENERAL, K_LASTPROJ, sFile)
+ ' Verifico la validità del file appena aperto (deve contenere almeno un gruppo di lavoro)
+ If EgtGetMachGroupCount() = 0 Then bOk = False
+ ' Procedo a seconda del risultato
If bOk Then
+ OmagOFFICEMap.refMainWindowVM.Title = sFile & " - OmagOFFICE"
+ WriteMainPrivateProfileString(S_GENERAL, K_LASTPROJ, sFile)
OmagOFFICEMap.refTopCommandBarVM.m_MruFiles.Add(sFile)
Else
+ EgtNewFile()
+ OmagOFFICEMap.refMainWindowVM.Title = " New - OmagOFFICE"
OmagOFFICEMap.refTopCommandBarVM.m_MruFiles.Remove(sFile)
Dim sMsg As String = EgtMsg(10003) & " '" & sFile & "'" 'Error opening file
MessageBox.Show(sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) 'Error
diff --git a/SideEntityControl/SideEntityControlVM.vb b/SideEntityControl/SideEntityControlVM.vb
index 8393f12..4aca37a 100644
--- a/SideEntityControl/SideEntityControlVM.vb
+++ b/SideEntityControl/SideEntityControlVM.vb
@@ -69,7 +69,7 @@ Public Class SideEntityControlVM
End Get
Set(value As String)
StringToDouble(value, m_Parameter1)
- SideAngleEntity.m_Parameter1 = value
+ SideAngleEntity.m_Parameter1 = m_Parameter1
If m_Mode = ModeOpt.SIDEANGLE Then
' ciclo sui checkbox calcolati sul numero di lati inclinabili presenti
For Index As Integer = 0 To m_SideEntityList.Count - 1
@@ -93,7 +93,6 @@ Public Class SideEntityControlVM
' Creo le geometrie dei gocciolatoi
RefreshSideAngleText()
End If
-
End Set
End Property
Private Sub SetParameter1(value As Double)
@@ -103,11 +102,11 @@ Public Class SideEntityControlVM
End Sub
Private m_Parameter2 As Double
- Public Property Parameter2 As Double
+ Public Property Parameter2 As String
Get
Return LenToString(m_Parameter2, -2)
End Get
- Set(value As Double)
+ Set(value As String)
StringToLen(value, m_Parameter2)
End Set
End Property
@@ -117,11 +116,11 @@ Public Class SideEntityControlVM
End Sub
Private m_Parameter3 As Double
- Public Property Parameter3 As Double
+ Public Property Parameter3 As String
Get
Return LenToString(m_Parameter3, -2)
End Get
- Set(value As Double)
+ Set(value As String)
StringToLen(value, m_Parameter3)
End Set
End Property
@@ -229,17 +228,16 @@ Public Class SideEntityControlVM
' Aggiorno valori
If m_Mode = ModeOpt.SIDEANGLE Then
Parameter1Msg = EgtMsg(MSG_IMPORTPAGEUC + 9) ' Angolo
- Dim sVal As String = String.Empty
- GetMainPrivateProfileString(S_SIDES, K_SIDEANGLE, "45", sVal)
- SetParameter1(sVal)
+ Dim dVal As Double = GetMainPrivateProfileDouble(S_SIDES, K_SIDEANGLE, "45")
+ SetParameter1(dVal)
Else
Parameter1Msg = EgtMsg(MSG_IMPORTPAGEUC + 10) ' Offset
m_dDripOffset = GetMainPrivateProfileDouble(S_SIDES, K_DRIPOFFSET, 20)
m_dDripDepth = GetMainPrivateProfileDouble(S_SIDES, K_DRIPDEPTH, 10)
m_dDripShort = GetMainPrivateProfileDouble(S_SIDES, K_DRIPSHORT, 0)
- SetParameter1(LenToString(m_dDripOffset, 3))
- SetParameter2(LenToString(m_dDripDepth, 3))
- SetParameter3(LenToString(m_dDripShort, 3))
+ SetParameter1(m_dDripOffset)
+ SetParameter2(m_dDripDepth)
+ SetParameter3(m_dDripShort)
End If
' Nascondo layer delle misure
@@ -654,7 +652,7 @@ Public Class SideEntityControlVM
' Scrivo nuovo angolo nelle info
If dSideAngle <> 0 Then
EgtSetInfo(CurrEntity.nGeomId, INFO_SIDE_ANGLE, dSideAngle)
- ' Cancello inclinazione nell'apposito campo info
+ ' Cancello inclinazione nell'apposito campo info
Else
EgtRemoveInfo(CurrEntity.nGeomId, INFO_SIDE_ANGLE)
End If
@@ -759,17 +757,16 @@ Public Class SideEntityControlVM
' Aggiorno valori
If m_Mode = ModeOpt.SIDEANGLE Then
Parameter1Msg = EgtMsg(MSG_IMPORTPAGEUC + 9) ' Angolo
- Dim sVal As String = String.Empty
- GetMainPrivateProfileString(S_SIDES, K_SIDEANGLE, "45", sVal)
- SetParameter1(sVal)
+ Dim dVal As Double = GetMainPrivateProfileDouble(S_SIDES, K_SIDEANGLE, "45")
+ SetParameter1(dVal)
Else
Parameter1Msg = EgtMsg(MSG_IMPORTPAGEUC + 10) ' Offset
m_dDripOffset = GetMainPrivateProfileDouble(S_SIDES, K_DRIPOFFSET, 20)
m_dDripDepth = GetMainPrivateProfileDouble(S_SIDES, K_DRIPDEPTH, 10)
m_dDripShort = GetMainPrivateProfileDouble(S_SIDES, K_DRIPSHORT, 0)
- SetParameter1(LenToString(m_dDripOffset, 3))
- SetParameter2(LenToString(m_dDripDepth, 3))
- SetParameter3(LenToString(m_dDripShort, 3))
+ SetParameter1(m_dDripOffset)
+ SetParameter2(m_dDripDepth)
+ SetParameter3(m_dDripShort)
End If
End Sub
@@ -793,7 +790,7 @@ Public Class SideEntityControlVM
End If
If m_Mode = ModeOpt.SIDEANGLE Then
- WriteMainPrivateProfileString(S_SIDES, K_SIDEANGLE, m_Parameter1)
+ WriteMainPrivateProfileString(S_SIDES, K_SIDEANGLE, DoubleToString(m_Parameter1, 3))
Else
WriteMainPrivateProfileString(S_SIDES, K_DRIPOFFSET, DoubleToString(m_dDripOffset, 3))
WriteMainPrivateProfileString(S_SIDES, K_DRIPDEPTH, DoubleToString(m_dDripDepth, 3))