From 02c372d66d8f3fcdb1fed4902470124ce6b95ef4 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Thu, 24 Sep 2020 07:23:45 +0000 Subject: [PATCH] =?UTF-8?q?OmagOFFICE=20:=20-=20=C3=A8=20possibile=20impos?= =?UTF-8?q?tare=20la=20tolleranza=20di=20spessore=20in=20inserimento=20pez?= =?UTF-8?q?zi=20CSV=20(da=20Ini=20[CSV]=20ThickTolerance=3D3)=20-=20quando?= =?UTF-8?q?=20si=20importa=20da=20DXF=20ora=20=C3=A8=20possibile=20non=20r?= =?UTF-8?q?esettare=20il=20VeinMatch=20(da=20Ini=20[VeinMatching]=20ClearO?= =?UTF-8?q?nNewDxf=3D0)=20-=20esportazione=20DXF=20ora=20corretta=20anche?= =?UTF-8?q?=20per=20Autocad=20-=20modifica=20nome=20pezzo=20Csv=20ora=20ag?= =?UTF-8?q?giorna=20anche=20il=20nome=20dello=20stesso=20pezzo=20nel=20Vei?= =?UTF-8?q?nMatch.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Constants/ConstIni.vb | 2 ++ DxfImportWindow/DxfImportWindowVM.vb | 5 ++++- EgtStoneLib/CsvM.vb | 5 ++++- EgtStoneLib/VeinMatchingWindow.xaml.vb | 30 ++++++++++++++++++++++++++ OptionPanel/NestingTab/NestingTabVM.vb | 1 + 5 files changed, 41 insertions(+), 2 deletions(-) diff --git a/Constants/ConstIni.vb b/Constants/ConstIni.vb index 22085d1..d4842b1 100644 --- a/Constants/ConstIni.vb +++ b/Constants/ConstIni.vb @@ -122,6 +122,7 @@ Module ConstIni Public Const K_READER As String = "Reader" Public Const K_CSVCURRDIR As String = "CurrDir" Public Const K_CSVLASTFILE As String = "LastFile" + Public Const K_THICKTOLERANCE As String = "ThickTolerance" Public Const S_COLORTOSIDEANG As String = "ColorToSideAng" Public Const K_CTSA_ENABLE As String = "Enable" @@ -174,6 +175,7 @@ Module ConstIni Public Const K_VEINMA_PLACE As String = "WinPlace" Public Const K_VEINMA_IMGWIDTH As String = "ImgWidth" Public Const K_VEINMA_IMGHEIGHT As String = "ImgHeight" + Public Const K_VEINMA_CLEARONNEWDXF As String = "ClearOnNewDxf" Public Const S_DXFOUT As String = "DxfOut" Public Const K_DXFOUT_TYPE As String = "Type" diff --git a/DxfImportWindow/DxfImportWindowVM.vb b/DxfImportWindow/DxfImportWindowVM.vb index 1380f33..a90dd3f 100644 --- a/DxfImportWindow/DxfImportWindowVM.vb +++ b/DxfImportWindow/DxfImportWindowVM.vb @@ -622,7 +622,10 @@ Public Class DxfImportWindowVM ' Imposto riferimento sul centro geometrico di ogni pezzo VeinMatching.SetRefOnAllParts() ' Eventuale pulizia VeinMatching - VeinMatching.Clear() + Dim bVmClear As Boolean = ( GetMainPrivateProfileInt(S_VEINMATCHING, K_VEINMA_CLEARONNEWDXF, 1) <> 0) + If bVmClear Then + VeinMatching.Clear() + End If ' Salvo tutti i pezzi in un file temporaneo Dim sTmpFile As String = OmagOFFICEMap.refMainWindowVM.MainWindowM.sTempDir & "\FlatPart" & ".Nge" diff --git a/EgtStoneLib/CsvM.vb b/EgtStoneLib/CsvM.vb index b52ff7c..1835abc 100644 --- a/EgtStoneLib/CsvM.vb +++ b/EgtStoneLib/CsvM.vb @@ -86,12 +86,15 @@ Module CsvM If Not IsNothing(CurrentMachine.CurrMat) Then sCurrMat = CurrentMachine.CurrMat.sName End If + ' Recupero la tolleranza sullo spessore + Dim dToler As Double = GetMainPrivateProfileDouble(S_CSV, K_THICKTOLERANCE, 100 * EPS_SMALL) + dToler = Math.Max( dToler, 100 * EPS_SMALL) ' Creo la lista dei pezzi inseribili nella lastra corrente Dim InsPartList As New List(Of CsvPart) For i As Integer = 1 To m_CsvPartList.Count() Dim CurrPart As CsvPart = m_CsvPartList(i - 1) If CurrPart.m_bActive And - Math.Abs(CurrPart.m_dTh - dRawHeight) < 100 * EPS_SMALL And + Math.Abs(CurrPart.m_dTh - dRawHeight) < dToler And (String.IsNullOrWhiteSpace(CurrPart.m_sMaterial) Or String.IsNullOrWhiteSpace(sCurrMat) Or sCurrMat = "***" Or diff --git a/EgtStoneLib/VeinMatchingWindow.xaml.vb b/EgtStoneLib/VeinMatchingWindow.xaml.vb index b13f1c7..b5ae1e5 100644 --- a/EgtStoneLib/VeinMatchingWindow.xaml.vb +++ b/EgtStoneLib/VeinMatchingWindow.xaml.vb @@ -998,6 +998,36 @@ Friend Module VeinMatching Return (GetVeinPartId(nPartId) <> GDB_ID.NULL) End Function + Friend Function ModifyPartText( nPartId As Integer, sNewText As String, Optional bDraw As Boolean = True) 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 + EgtSetCurrentContext(m_nVeinCtx) + Dim nVeinPartId = GetVeinPartId(nOriId) + Dim bFound As Boolean = nVeinPartId <> GDB_ID.NULL + ' Recupero il primo testo della regione e lo modifico + If bFound Then + Dim nVeinRegId As Integer = EgtGetFirstNameInGroup(nVeinPartId, NAME_REGION) + Dim nCurrId As Integer = EgtGetFirstInGroup(nVeinRegId) + While nCurrId <> GDB_ID.NULL + If EgtGetType(nCurrId) = GDB_TY.EXT_TEXT Then + EgtModifyText( nCurrId, sNewText) + Exit While + End If + nCurrId = EgtGetNext(nCurrId) + End While + End If + If bDraw Then EgtDraw() + ' Ritorno al contesto originale + EgtSetCurrentContext(nMainCtx) + Return bFound + End Function + Friend Sub UpdateShowText(Optional bDraw As Boolean = True) ' Verifico esista il contesto del VeinMatching If m_nVeinCtx = 0 Then Return diff --git a/OptionPanel/NestingTab/NestingTabVM.vb b/OptionPanel/NestingTab/NestingTabVM.vb index edcd482..26f521c 100644 --- a/OptionPanel/NestingTab/NestingTabVM.vb +++ b/OptionPanel/NestingTab/NestingTabVM.vb @@ -1128,6 +1128,7 @@ Public Class NestingTabVM sNewText = sText.Remove( nPos, sCsvName.Length()).Insert( nPos, sNewName) End If EgtModifyText( nTextId, sNewText) + VeinMatching.ModifyPartText( nPartId, sNewText) Exit While End If nTextId = EgtGetNext(nTextId)