Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8944a8d191 | |||
| 5cdfc79aca | |||
| 2f24604fa8 | |||
| 2889e30386 | |||
| a9458620c1 | |||
| 7fe03cbbb4 | |||
| d0646eb922 | |||
| 83f37dc628 | |||
| 568d7c109d | |||
| 1c36907b47 | |||
| d2e45a937e | |||
| 13f9fc9bd2 | |||
| 614756e1bb | |||
| 601471482a | |||
| 8e112dc210 | |||
| 007ad8439c | |||
| 1ffca8b52c | |||
| c96251ba99 | |||
| 19e347412c | |||
| 8ff06da714 | |||
| a18408724c | |||
| 701f1f2b87 | |||
| 2bb53b0b06 | |||
| f456c16827 | |||
| 334bfa68f7 | |||
| 51bbaf0bfe | |||
| 57cf143306 | |||
| a804043d2e | |||
| 59865b140e | |||
| 08cd099947 | |||
| 7dfb843b36 | |||
| 108b075e4f |
@@ -67,8 +67,8 @@ Public Class CompoParamPageVM
|
|||||||
Private m_AlzAndFront_Visibility As Visibility
|
Private m_AlzAndFront_Visibility As Visibility
|
||||||
Public Property AlzAndFront_Visibility As Visibility
|
Public Property AlzAndFront_Visibility As Visibility
|
||||||
Get
|
Get
|
||||||
' !!!! Temporaneamente in attesa di completamento Frontalini e alzatine !!!!
|
'' !!!! Temporaneamente in attesa di completamento Frontalini e alzatine !!!!
|
||||||
Return Visibility.Collapsed
|
'Return Visibility.Collapsed
|
||||||
Return m_AlzAndFront_Visibility
|
Return m_AlzAndFront_Visibility
|
||||||
End Get
|
End Get
|
||||||
Set(value As Visibility)
|
Set(value As Visibility)
|
||||||
@@ -411,8 +411,13 @@ Public Class CompoParamPageVM
|
|||||||
CompoWindowMap.refCompoSceneHostV.CompoScene,
|
CompoWindowMap.refCompoSceneHostV.CompoScene,
|
||||||
SideEntityControlVM.ModeOpt.ENGRAVE)
|
SideEntityControlVM.ModeOpt.ENGRAVE)
|
||||||
SideEntityControl = New SideEntityControlV(m_SideEntityControlVM)
|
SideEntityControl = New SideEntityControlV(m_SideEntityControlVM)
|
||||||
|
If m_SideEntityControlVM.SideEntityList.Count < 1 Then
|
||||||
|
' eventulmente stamnpare messaggio!
|
||||||
|
' OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
|
||||||
|
' OmagOFFICEMap.refStatusBarVM.SetOutputMessage("Lavorazioni non disponibile", MSG_TYPE.WARNING)
|
||||||
|
End If
|
||||||
Else
|
Else
|
||||||
SideAngle_IsEnabled = True
|
SideAngle_IsEnabled = True
|
||||||
Drip_IsEnabled = OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.UNDER_CUT) And
|
Drip_IsEnabled = OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.UNDER_CUT) And
|
||||||
Not String.IsNullOrWhiteSpace(CurrentMachine.sCurrDripSaw)
|
Not String.IsNullOrWhiteSpace(CurrentMachine.sCurrDripSaw)
|
||||||
FiloTop_IsEnabled = True
|
FiloTop_IsEnabled = True
|
||||||
@@ -582,10 +587,13 @@ Public Class CompoParamPageVM
|
|||||||
EgtLuaGetGlobBoolVar(LUA_CMP_WITHINT, bHasInternalCompo)
|
EgtLuaGetGlobBoolVar(LUA_CMP_WITHINT, bHasInternalCompo)
|
||||||
Internal_Visibility = If(bHasInternalCompo, Visibility.Visible, Visibility.Collapsed)
|
Internal_Visibility = If(bHasInternalCompo, Visibility.Visible, Visibility.Collapsed)
|
||||||
SideEntity_Visibility = Visibility.Visible
|
SideEntity_Visibility = Visibility.Visible
|
||||||
|
' verifico che esista la configurazione per le alzatine e i frontalini
|
||||||
|
Dim sVariable As String = String.Empty
|
||||||
|
Dim bEnableAlzAndFront As Boolean = GetMainPrivateProfileString("Alz&Front", "Alz&Front", "", sVariable) <> 0
|
||||||
' verifio se abilitare il bottone per inserire le Alz&Front
|
' verifio se abilitare il bottone per inserire le Alz&Front
|
||||||
Dim sCMPName As String = String.Empty
|
Dim sCMPName As String = String.Empty
|
||||||
If EgtLuaGetGlobStringVar("CMP.Nome", sCMPName) Then
|
If EgtLuaGetGlobStringVar("CMP.Nome", sCMPName) Then
|
||||||
If sCMPName.StartsWith("PCucina") Or sCMPName.StartsWith("PBagno") Then
|
If bEnableAlzAndFront And sCMPName.StartsWith("PCucina") Or sCMPName.StartsWith("PBagno") Then
|
||||||
AlzAndFront_Visibility = Visibility.Visible
|
AlzAndFront_Visibility = Visibility.Visible
|
||||||
Else
|
Else
|
||||||
AlzAndFront_Visibility = Visibility.Collapsed
|
AlzAndFront_Visibility = Visibility.Collapsed
|
||||||
@@ -616,12 +624,15 @@ Public Class CompoParamPageVM
|
|||||||
AddRemove_Visibility = Visibility.Collapsed
|
AddRemove_Visibility = Visibility.Collapsed
|
||||||
Back_Visibility = Visibility.Visible
|
Back_Visibility = Visibility.Visible
|
||||||
Internal_Visibility = Visibility.Visible
|
Internal_Visibility = Visibility.Visible
|
||||||
AlzAndFront_Visibility = Visibility.Visible
|
' verifico che esista la configurazione per le alzatine e i frontalini
|
||||||
|
Dim sVariable As String = String.Empty
|
||||||
|
Dim bEnableAlzAndFront As Boolean = GetMainPrivateProfileString("Alz&Front", "Alz&Front", "", sVariable) <> 0
|
||||||
|
AlzAndFront_Visibility = If(bEnableAlzAndFront, Visibility.Visible, Visibility.Collapsed)
|
||||||
SideEntity_Visibility = Visibility.Visible
|
SideEntity_Visibility = Visibility.Visible
|
||||||
' verifio se abilitare il bottone per inserire le Alz&Front
|
' verifio se abilitare il bottone per inserire le Alz&Front
|
||||||
Dim sCMPName As String = String.Empty
|
Dim sCMPName As String = String.Empty
|
||||||
If EgtLuaGetGlobStringVar("CMP.Nome", sCMPName) Then
|
If EgtLuaGetGlobStringVar("CMP.Nome", sCMPName) Then
|
||||||
If sCMPName.StartsWith("PCucina") Or sCMPName.StartsWith("PBagno") Then
|
If bEnableAlzAndFront And sCMPName.StartsWith("PCucina") Or sCMPName.StartsWith("PBagno") Then
|
||||||
AlzAndFront_Visibility = Visibility.Visible
|
AlzAndFront_Visibility = Visibility.Visible
|
||||||
Else
|
Else
|
||||||
AlzAndFront_Visibility = Visibility.Collapsed
|
AlzAndFront_Visibility = Visibility.Collapsed
|
||||||
|
|||||||
@@ -354,7 +354,7 @@ Public Class CompoWindowVM
|
|||||||
|
|
||||||
Friend Function MakeMultipleInsert(ByVal nNbr As Integer, sName As String) As Boolean
|
Friend Function MakeMultipleInsert(ByVal nNbr As Integer, sName As String) As Boolean
|
||||||
|
|
||||||
'Dim InsertColor As Color3d = CompoColor(m_MainWindow.GetIniFile())
|
Dim InsertColor As Color3d = CompoColor(IniFile.m_sIniFile)
|
||||||
|
|
||||||
' Imposto il contesto corrente
|
' Imposto il contesto corrente
|
||||||
EgtSetCurrentContext(CompoWindowMap.refCompoSceneHostV.CompoScene.GetCtx())
|
EgtSetCurrentContext(CompoWindowMap.refCompoSceneHostV.CompoScene.GetCtx())
|
||||||
@@ -364,6 +364,9 @@ Public Class CompoWindowVM
|
|||||||
' Cancello layer regioni per selezione buchi
|
' Cancello layer regioni per selezione buchi
|
||||||
Pz = EgtGetFirstGroupInGroup(GDB_ID.ROOT)
|
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
|
While Pz <> -1
|
||||||
' imposto il contesto corrente
|
' imposto il contesto corrente
|
||||||
EgtSetCurrentContext(CompoWindowMap.refCompoSceneHostV.CompoScene.GetCtx())
|
EgtSetCurrentContext(CompoWindowMap.refCompoSceneHostV.CompoScene.GetCtx())
|
||||||
@@ -492,12 +495,12 @@ Public Class CompoWindowVM
|
|||||||
EstCalc.SetTextColor(nRegLayId)
|
EstCalc.SetTextColor(nRegLayId)
|
||||||
|
|
||||||
' Imposto il colore del pezzo inserito nel progetto
|
' Imposto il colore del pezzo inserito nel progetto
|
||||||
'EgtSetColor(nRegLayId, InsertColor)
|
EgtSetColor(nRegLayId, InsertColor)
|
||||||
'Dim EntId As Integer = EgtGetFirstInGroup(nRegLayId)
|
Dim EntId As Integer = EgtGetFirstInGroup(nRegLayId)
|
||||||
'While EntId <> GDB_ID.NULL
|
While EntId <> GDB_ID.NULL
|
||||||
' If EgtGetType(EntId) = GDB_TY.SRF_FRGN Then EgtSetColor(EntId, InsertColor)
|
If EgtGetType(EntId) = GDB_TY.SRF_FRGN Then EgtSetColor(EntId, InsertColor)
|
||||||
' EntId = EgtGetNext(EntId)
|
EntId = EgtGetNext(EntId)
|
||||||
'End While
|
End While
|
||||||
|
|
||||||
' Esporto il pezzo in un file temporaneo
|
' Esporto il pezzo in un file temporaneo
|
||||||
Dim sTmpFile As String = OmagOFFICEMap.refMainWindowVM.MainWindowM.sTempDir & "\FlatPartCompo.Nge"
|
Dim sTmpFile As String = OmagOFFICEMap.refMainWindowVM.MainWindowM.sTempDir & "\FlatPartCompo.Nge"
|
||||||
@@ -513,6 +516,9 @@ Public Class CompoWindowVM
|
|||||||
EgtEraseEmptyParts()
|
EgtEraseEmptyParts()
|
||||||
' Area dei nuovi pezzi
|
' Area dei nuovi pezzi
|
||||||
Dim dNewArea As Double = 0
|
Dim dNewArea As Double = 0
|
||||||
|
If nNbr > 1 Then
|
||||||
|
sGUICode = System.Guid.NewGuid.ToString
|
||||||
|
End If
|
||||||
' Se esiste il file del pezzo
|
' Se esiste il file del pezzo
|
||||||
If My.Computer.FileSystem.FileExists(sTmpFile) Then
|
If My.Computer.FileSystem.FileExists(sTmpFile) Then
|
||||||
' eseguo inserimento
|
' eseguo inserimento
|
||||||
@@ -527,8 +533,15 @@ Public Class CompoWindowVM
|
|||||||
If m_bTrfData Then EgtSetInfo(nId2, "CsvPart", CompoWindowMap.refCompoManagerVM.sTrfOrderCode & "-" & nId2.ToString())
|
If m_bTrfData Then EgtSetInfo(nId2, "CsvPart", CompoWindowMap.refCompoManagerVM.sTrfOrderCode & "-" & nId2.ToString())
|
||||||
' Aggiorno l'area dei nuovi pezzi
|
' Aggiorno l'area dei nuovi pezzi
|
||||||
dNewArea += GeomCalc.GetPartArea(nId2)
|
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)
|
EstCalc.StoreOnePart(nId2, True)
|
||||||
|
|
||||||
' Aggiungo riferimento e lo inserisco in VeinMatching
|
' Aggiungo riferimento e lo inserisco in VeinMatching
|
||||||
VeinMatching.SetRefOnPart(nId2)
|
VeinMatching.SetRefOnPart(nId2)
|
||||||
VeinMatching.AddPart(nId2, True)
|
VeinMatching.AddPart(nId2, True)
|
||||||
|
|||||||
@@ -86,6 +86,8 @@ Module ConstIni
|
|||||||
Public Const K_SIDEMODE As String = "SideMode"
|
Public Const K_SIDEMODE As String = "SideMode"
|
||||||
Public Const K_TRFDATA As String = "TrfData"
|
Public Const K_TRFDATA As String = "TrfData"
|
||||||
Public Const K_CSVDATA As String = "CsvData"
|
Public Const K_CSVDATA As String = "CsvData"
|
||||||
|
Public Const K_LASTCOLOR As String = "LastColor"
|
||||||
|
Public Const K_COLOR As String = "Color"
|
||||||
|
|
||||||
Public Const S_FLATPARTS As String = "FlatParts"
|
Public Const S_FLATPARTS As String = "FlatParts"
|
||||||
Public Const K_FLPCURRDIR As String = "CurrDir"
|
Public Const K_FLPCURRDIR As String = "CurrDir"
|
||||||
@@ -119,6 +121,10 @@ Module ConstIni
|
|||||||
Public Const K_TEXTCOLOR As String = "TextColor"
|
Public Const K_TEXTCOLOR As String = "TextColor"
|
||||||
Public Const K_AUTOMATICOPTIMIZE As String = "AutomaticOptimize"
|
Public Const K_AUTOMATICOPTIMIZE As String = "AutomaticOptimize"
|
||||||
Public Const K_AUTOMATICMAXTIME As String = "AutomaticMaxTime"
|
Public Const K_AUTOMATICMAXTIME As String = "AutomaticMaxTime"
|
||||||
|
Public Const K_DRAGRETTANGLE As String = "DragRectangle"
|
||||||
|
|
||||||
|
Public Const S_SPLIT As String = "Split"
|
||||||
|
Public Const K_MOVE_LEV As String = "MoveLevel"
|
||||||
|
|
||||||
Public Const S_CSV As String = "Csv"
|
Public Const S_CSV As String = "Csv"
|
||||||
Public Const K_CSVDIRECT As String = "Direct"
|
Public Const K_CSVDIRECT As String = "Direct"
|
||||||
@@ -127,6 +133,7 @@ Module ConstIni
|
|||||||
Public Const K_CSVCURRDIR As String = "CurrDir"
|
Public Const K_CSVCURRDIR As String = "CurrDir"
|
||||||
Public Const K_CSVLASTFILE As String = "LastFile"
|
Public Const K_CSVLASTFILE As String = "LastFile"
|
||||||
Public Const K_THICKTOLERANCE As String = "ThickTolerance"
|
Public Const K_THICKTOLERANCE As String = "ThickTolerance"
|
||||||
|
Public Const K_FULL As String = "Full"
|
||||||
|
|
||||||
Public Const S_COLORTOSIDEANG As String = "ColorToSideAng"
|
Public Const S_COLORTOSIDEANG As String = "ColorToSideAng"
|
||||||
Public Const K_CTSA_ENABLE As String = "Enable"
|
Public Const K_CTSA_ENABLE As String = "Enable"
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
|
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
|
||||||
WindowStartupLocation="CenterOwner"
|
WindowStartupLocation="CenterOwner"
|
||||||
MinWidth="270" MinHeight="250"
|
MinWidth="270" MinHeight="250"
|
||||||
|
MaxWidth="500"
|
||||||
ResizeMode="NoResize">
|
ResizeMode="NoResize">
|
||||||
|
|
||||||
<DockPanel Margin="5,5,5,0">
|
<DockPanel Margin="5,5,5,0">
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
Imports System.Collections.ObjectModel
|
Imports System.Collections.ObjectModel
|
||||||
|
Imports System.IO
|
||||||
Imports EgtUILib
|
Imports EgtUILib
|
||||||
Imports EgtWPFLib5
|
Imports EgtWPFLib5
|
||||||
|
|
||||||
@@ -110,6 +111,8 @@ Public Class CsvWindowVM
|
|||||||
#Region "METHODS"
|
#Region "METHODS"
|
||||||
|
|
||||||
Private Sub ShowTreeView()
|
Private Sub ShowTreeView()
|
||||||
|
Dim bFull = OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.CSV_AUTO) And
|
||||||
|
(GetMainPrivateProfileInt(S_CSV, K_FULL, 1) <> 0)
|
||||||
' Path del file Csv
|
' Path del file Csv
|
||||||
Dim TempPath As New Text.StringBuilder(260)
|
Dim TempPath As New Text.StringBuilder(260)
|
||||||
PathCompactPathEx(TempPath, CsvM.CsvPath, 56, 0)
|
PathCompactPathEx(TempPath, CsvM.CsvPath, 56, 0)
|
||||||
@@ -118,6 +121,7 @@ Public Class CsvWindowVM
|
|||||||
m_CsvTypeList.Clear()
|
m_CsvTypeList.Clear()
|
||||||
Dim sCurrMat As String = String.Empty
|
Dim sCurrMat As String = String.Empty
|
||||||
Dim dCurrTh As Double = 0
|
Dim dCurrTh As Double = 0
|
||||||
|
Dim sCurrPath As String = String.Empty
|
||||||
Dim nCatToNest As Integer = 0
|
Dim nCatToNest As Integer = 0
|
||||||
Dim nCatCount As Integer = 0
|
Dim nCatCount As Integer = 0
|
||||||
Dim PartCathegory As New CsvPartType("", 0)
|
Dim PartCathegory As New CsvPartType("", 0)
|
||||||
@@ -128,15 +132,29 @@ Public Class CsvWindowVM
|
|||||||
If i = 1 Then
|
If i = 1 Then
|
||||||
sCurrMat = CurrPart.m_sMaterial
|
sCurrMat = CurrPart.m_sMaterial
|
||||||
dCurrTh = CurrPart.m_dTh
|
dCurrTh = CurrPart.m_dTh
|
||||||
|
sCurrPath = CurrPart.m_sPath
|
||||||
ElseIf String.Compare(sCurrMat, CurrPart.m_sMaterial, True) <> 0 Or
|
ElseIf String.Compare(sCurrMat, CurrPart.m_sMaterial, True) <> 0 Or
|
||||||
|
String.Compare(sCurrPath, CurrPart.m_sPath, True) <> 0 Or
|
||||||
Math.Abs(dCurrTh - CurrPart.m_dTh) > 10 * EPS_SMALL Then
|
Math.Abs(dCurrTh - CurrPart.m_dTh) > 10 * EPS_SMALL Then
|
||||||
PartCathegory.Name = If(String.IsNullOrWhiteSpace(sCurrMat), "***", sCurrMat) &
|
|
||||||
" - " & LenToString(dCurrTh, 2) &
|
If bFull Then
|
||||||
" - " & nCatToNest.ToString() & "/" & nCatCount.ToString()
|
PartCathegory.Name = If(String.IsNullOrWhiteSpace(sCurrMat), "***", sCurrMat) &
|
||||||
|
" - " & LenToString(dCurrTh, 2) &
|
||||||
|
" - " & nCatToNest.ToString() & "/" & nCatCount.ToString()
|
||||||
|
If Not String.IsNullOrWhiteSpace(sCurrPath) Then
|
||||||
|
PartCathegory.Name &= vbCrLf & Path.GetFileNameWithoutExtension(sCurrPath)
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
PartCathegory.Name = nCatToNest.ToString() & "/" & nCatCount.ToString()
|
||||||
|
If Not String.IsNullOrWhiteSpace(sCurrPath) Then
|
||||||
|
PartCathegory.Name &= vbCrLf & Path.GetFileNameWithoutExtension(sCurrPath)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
PartCathegory.IsExpanded = True
|
PartCathegory.IsExpanded = True
|
||||||
CsvTypeList.Add(PartCathegory)
|
CsvTypeList.Add(PartCathegory)
|
||||||
sCurrMat = CurrPart.m_sMaterial
|
sCurrMat = CurrPart.m_sMaterial
|
||||||
dCurrTh = CurrPart.m_dTh
|
dCurrTh = CurrPart.m_dTh
|
||||||
|
sCurrPath = CurrPart.m_sPath
|
||||||
PartCathegory = New CsvPartType("", 0)
|
PartCathegory = New CsvPartType("", 0)
|
||||||
nCatToNest = 0
|
nCatToNest = 0
|
||||||
nCatCount = 0
|
nCatCount = 0
|
||||||
@@ -150,18 +168,31 @@ Public Class CsvWindowVM
|
|||||||
PartCathegory.CsvPartList.Add(New CsvPartItem(CurrPart.m_sName, i, sCount, sDim, CurrPart.m_bActive))
|
PartCathegory.CsvPartList.Add(New CsvPartItem(CurrPart.m_sName, i, sCount, sDim, CurrPart.m_bActive))
|
||||||
Next
|
Next
|
||||||
' Inserisco ultima categoria
|
' Inserisco ultima categoria
|
||||||
PartCathegory.Name = If(String.IsNullOrWhiteSpace(sCurrMat), "***", sCurrMat) &
|
If bFull Then
|
||||||
" - " & LenToString(dCurrTh, 2) &
|
PartCathegory.Name = If(String.IsNullOrWhiteSpace(sCurrMat), "***", sCurrMat) &
|
||||||
" - " & nCatToNest.ToString() & "/" & nCatCount.ToString()
|
" - " & LenToString(dCurrTh, 2) &
|
||||||
|
" - " & nCatToNest.ToString() & "/" & nCatCount.ToString()
|
||||||
|
If Not String.IsNullOrWhiteSpace(sCurrPath) Then
|
||||||
|
PartCathegory.Name &= vbCrLf & Path.GetFileNameWithoutExtension(sCurrPath)
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
PartCathegory.Name = nCatToNest.ToString() & "/" & nCatCount.ToString()
|
||||||
|
If Not String.IsNullOrWhiteSpace(sCurrPath) Then
|
||||||
|
PartCathegory.Name &= vbCrLf & Path.GetFileNameWithoutExtension(sCurrPath)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
PartCathegory.IsExpanded = True
|
PartCathegory.IsExpanded = True
|
||||||
CsvTypeList.Add(PartCathegory)
|
CsvTypeList.Add(PartCathegory)
|
||||||
NotifyPropertyChanged("CsvTypeList")
|
NotifyPropertyChanged("CsvTypeList")
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub UpdateTreeView()
|
Private Sub UpdateTreeView()
|
||||||
|
Dim bFull = OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.CSV_AUTO) And
|
||||||
|
(GetMainPrivateProfileInt(S_CSV, K_FULL, 1) <> 0)
|
||||||
For Each CatItem As CsvPartType In m_CsvTypeList
|
For Each CatItem As CsvPartType In m_CsvTypeList
|
||||||
Dim sCurrMat As String = String.Empty
|
Dim sCurrMat As String = String.Empty
|
||||||
Dim dCurrTh As Double = 0
|
Dim dCurrTh As Double = 0
|
||||||
|
Dim sCurrPath As String = String.Empty
|
||||||
Dim nCatToNest As Integer = 0
|
Dim nCatToNest As Integer = 0
|
||||||
Dim nCatCount As Integer = 0
|
Dim nCatCount As Integer = 0
|
||||||
For Each PrtItem As CsvPartItem In CatItem.CsvPartList
|
For Each PrtItem As CsvPartItem In CatItem.CsvPartList
|
||||||
@@ -171,12 +202,23 @@ Public Class CsvWindowVM
|
|||||||
PrtItem.sText1 = sCount
|
PrtItem.sText1 = sCount
|
||||||
sCurrMat = PartData.m_sMaterial
|
sCurrMat = PartData.m_sMaterial
|
||||||
dCurrTh = PartData.m_dTh
|
dCurrTh = PartData.m_dTh
|
||||||
|
sCurrPath = PartData.m_sPath
|
||||||
nCatToNest += PartData.m_nToNest
|
nCatToNest += PartData.m_nToNest
|
||||||
nCatCount += PartData.m_nCount + PartData.m_nAdd
|
nCatCount += PartData.m_nCount + PartData.m_nAdd
|
||||||
Next
|
Next
|
||||||
CatItem.Name = If(String.IsNullOrWhiteSpace(sCurrMat), "***", sCurrMat) &
|
If bFull Then
|
||||||
" - " & LenToString(dCurrTh, 2) &
|
CatItem.Name = If(String.IsNullOrWhiteSpace(sCurrMat), "***", sCurrMat) &
|
||||||
" - " & nCatToNest.ToString() & "/" & nCatCount.ToString()
|
" - " & LenToString(dCurrTh, 2) &
|
||||||
|
" - " & nCatToNest.ToString() & "/" & nCatCount.ToString()
|
||||||
|
If Not String.IsNullOrWhiteSpace(sCurrPath) Then
|
||||||
|
CatItem.Name &= vbCrLf & Path.GetFileNameWithoutExtension(sCurrPath)
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
CatItem.Name = nCatToNest.ToString() & "/" & nCatCount.ToString()
|
||||||
|
If Not String.IsNullOrWhiteSpace(sCurrPath) Then
|
||||||
|
CatItem.Name &= vbCrLf & Path.GetFileNameWithoutExtension(sCurrPath)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
Next
|
Next
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@
|
|||||||
<!--Quality-->
|
<!--Quality-->
|
||||||
<ComboBox ItemsSource="{Binding CurrWaterjettingQualityList}"
|
<ComboBox ItemsSource="{Binding CurrWaterjettingQualityList}"
|
||||||
SelectedItem="{Binding SelCurrWaterjettingQuality}"
|
SelectedItem="{Binding SelCurrWaterjettingQuality}"
|
||||||
Visibility="{Binding CurrWaterjettingQuality_Visibility}"
|
Visibility="{Binding CurrWaterjetting_Visibility}"
|
||||||
Margin="5,0,0,5"
|
Margin="5,0,0,5"
|
||||||
Grid.Column="1">
|
Grid.Column="1">
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ Public Class CurrMachWindowVM
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
Private m_CurrWaterjetting_Visibility As Visibility
|
Private m_CurrWaterjetting_Visibility As Visibility = Visibility.Collapsed
|
||||||
Public Property CurrWaterjetting_Visibility As Visibility
|
Public Property CurrWaterjetting_Visibility As Visibility
|
||||||
Get
|
Get
|
||||||
Return m_CurrWaterjetting_Visibility
|
Return m_CurrWaterjetting_Visibility
|
||||||
@@ -659,7 +659,7 @@ Public Class CurrMachWindowVM
|
|||||||
Dim MachiningMaterials() = SysNotes.Split(";".ToCharArray)
|
Dim MachiningMaterials() = SysNotes.Split(";".ToCharArray)
|
||||||
|
|
||||||
If CurrentMachine.bWaterJet And CurrentMachine.bFromDBWaterJet Then
|
If CurrentMachine.bWaterJet And CurrentMachine.bFromDBWaterJet Then
|
||||||
For Each Material As Object In MachiningMaterials
|
For Each Material As String In MachiningMaterials
|
||||||
Dim Param() As String = Material.Split(",".ToCharArray)
|
Dim Param() As String = Material.Split(",".ToCharArray)
|
||||||
If Param.Count() < 2 Then Continue For
|
If Param.Count() < 2 Then Continue For
|
||||||
Dim CurrMatId As String = String.Empty
|
Dim CurrMatId As String = String.Empty
|
||||||
@@ -672,7 +672,8 @@ Public Class CurrMachWindowVM
|
|||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
Dim SubParam() As String = Param(0).Split(".".ToCharArray)
|
Dim SubParam() As String = Param(0).Split(".".ToCharArray)
|
||||||
If SubParam(0) = CurrentMachine.CurrMat.nId.ToString() AndAlso SubParam.Count > 1 AndAlso SubParam(1) = CurrentMachine.CurrMat.SubId.ToString() Then
|
If Not IsNothing( CurrentMachine.CurrMat) AndAlso SubParam(0) = CurrentMachine.CurrMat.nId.ToString() AndAlso
|
||||||
|
SubParam.Count > 1 AndAlso SubParam(1) = CurrentMachine.CurrMat.SubId.ToString() Then
|
||||||
Dim MatMinH As Double = 0
|
Dim MatMinH As Double = 0
|
||||||
StringToDouble(Param(1), MatMinH)
|
StringToDouble(Param(1), MatMinH)
|
||||||
Dim MatMaxH As Double = 0
|
Dim MatMaxH As Double = 0
|
||||||
|
|||||||
@@ -710,6 +710,8 @@ Public Class DxfImportWindowVM
|
|||||||
EgtErase(EgtGetFirstNameInGroup(PartId, SELECT_REGION_LAYER))
|
EgtErase(EgtGetFirstNameInGroup(PartId, SELECT_REGION_LAYER))
|
||||||
PartId = EgtGetNextPart(PartId)
|
PartId = EgtGetNextPart(PartId)
|
||||||
End While
|
End While
|
||||||
|
' identificativo univoico del gruppo di pezzi, se più di un pezzo
|
||||||
|
Dim sGUICode As New List(Of String)
|
||||||
' Scrivo testi per nesting
|
' Scrivo testi per nesting
|
||||||
SideEntityControlVM.WriteSideAngleForNest(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
|
SideEntityControlVM.WriteSideAngleForNest(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
|
||||||
' Imposto riferimento sul centro geometrico di ogni pezzo
|
' 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)
|
Dim bDirect As Boolean = (GetMainPrivateProfileInt(S_NEST, K_DIRECT, 0) <> 0)
|
||||||
' Elimino eventuali precedenti pezzi vuoti
|
' Elimino eventuali precedenti pezzi vuoti
|
||||||
EgtEraseEmptyParts()
|
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
|
' Inserisco i pezzi nell'ambiente principale e recupero Id primo pezzo inserito
|
||||||
Dim nFirstId As Integer = EgtGetLastPart()
|
Dim nFirstId As Integer = EgtGetLastPart()
|
||||||
For nInd As Integer = 1 To m_PartNum
|
For nInd As Integer = 1 To m_PartNum
|
||||||
|
Dim nFirst2Id As Integer = EgtGetLastPart()
|
||||||
EgtInsertFile(sTmpFile)
|
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
|
Next
|
||||||
nFirstId = If(nFirstId <> GDB_ID.NULL, EgtGetNextPart(nFirstId), EgtGetFirstPart())
|
nFirstId = If(nFirstId <> GDB_ID.NULL, EgtGetNextPart(nFirstId), EgtGetFirstPart())
|
||||||
' Cancello il file
|
' Cancello il file
|
||||||
@@ -909,6 +934,36 @@ Public Class DxfImportWindowVM
|
|||||||
NotifyPropertyChanged("MsgColor")
|
NotifyPropertyChanged("MsgColor")
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
' metodo utilizzato per definire il colore dei pezzi DXF importati
|
||||||
|
Private Sub ColorRegion(nCtx As Integer)
|
||||||
|
|
||||||
|
' Leggo dati corrispondenza colore
|
||||||
|
Dim InsertColor As Color3d = CompoColor(IniFile.m_sIniFile)
|
||||||
|
|
||||||
|
' Imposto contesto corrente
|
||||||
|
EgtSetCurrentContext(nCtx)
|
||||||
|
' Ciclo sui pezzi
|
||||||
|
Dim PartId As Integer = EgtGetFirstPart()
|
||||||
|
While PartId <> GDB_ID.NULL
|
||||||
|
' Ciclo sui layer delle regioni
|
||||||
|
Dim RegionId As Integer = EgtGetFirstNameInGroup(PartId, NAME_REGION)
|
||||||
|
While RegionId <> GDB_ID.NULL
|
||||||
|
EgtSetColor(RegionId, InsertColor)
|
||||||
|
' Ciclo sulle regioni
|
||||||
|
Dim EntId As Integer = EgtGetFirstInGroup(RegionId)
|
||||||
|
While EntId <> GDB_ID.NULL
|
||||||
|
If EgtGetType(EntId) = GDB_TY.SRF_FRGN Then EgtSetColor(EntId, InsertColor)
|
||||||
|
EntId = EgtGetNext(EntId)
|
||||||
|
End While
|
||||||
|
RegionId = EgtGetNextName(PartId, NAME_REGION)
|
||||||
|
End While
|
||||||
|
' passo al pezzo successico
|
||||||
|
PartId = EgtGetNextPart(PartId)
|
||||||
|
End While
|
||||||
|
' Aggiorno scritte per angoli sui lati
|
||||||
|
'WriteSideAngleForNest(nCtx)
|
||||||
|
End Sub
|
||||||
|
|
||||||
#End Region ' METHODS
|
#End Region ' METHODS
|
||||||
|
|
||||||
#Region "COMMANDS"
|
#Region "COMMANDS"
|
||||||
@@ -973,6 +1028,7 @@ Public Class DxfImportWindowVM
|
|||||||
If GetPrivateProfileInt(S_COLORTOENGRAVE, K_CTE_ENABLE, 0, IniFile.m_sIniFile) <> 0 Then
|
If GetPrivateProfileInt(S_COLORTOENGRAVE, K_CTE_ENABLE, 0, IniFile.m_sIniFile) <> 0 Then
|
||||||
SideEntityControlVM.ColorToEngrave(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
|
SideEntityControlVM.ColorToEngrave(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
|
||||||
End If
|
End If
|
||||||
|
ColorRegion(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
|
||||||
' Eseguo zoom
|
' Eseguo zoom
|
||||||
EgtZoom(ZM.ALL)
|
EgtZoom(ZM.ALL)
|
||||||
' disabilito bottoni UseLayer e UseRegion, abilito bottoni Reset e Insert
|
' disabilito bottoni UseLayer e UseRegion, abilito bottoni Reset e Insert
|
||||||
@@ -1013,6 +1069,7 @@ Public Class DxfImportWindowVM
|
|||||||
If GetPrivateProfileInt(S_COLORTOENGRAVE, K_CTE_ENABLE, 0, IniFile.m_sIniFile) <> 0 Then
|
If GetPrivateProfileInt(S_COLORTOENGRAVE, K_CTE_ENABLE, 0, IniFile.m_sIniFile) <> 0 Then
|
||||||
SideEntityControlVM.ColorToEngrave(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
|
SideEntityControlVM.ColorToEngrave(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
|
||||||
End If
|
End If
|
||||||
|
ColorRegion(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
|
||||||
' Eseguo zoom
|
' Eseguo zoom
|
||||||
EgtZoom(ZM.ALL)
|
EgtZoom(ZM.ALL)
|
||||||
' disabilito bottoni UseLayer. UseRegion e UseClosedCurve, abilito bottoni Reset e Insert
|
' disabilito bottoni UseLayer. UseRegion e UseClosedCurve, abilito bottoni Reset e Insert
|
||||||
@@ -1053,6 +1110,7 @@ Public Class DxfImportWindowVM
|
|||||||
If GetPrivateProfileInt(S_COLORTOENGRAVE, K_CTE_ENABLE, 0, IniFile.m_sIniFile) <> 0 Then
|
If GetPrivateProfileInt(S_COLORTOENGRAVE, K_CTE_ENABLE, 0, IniFile.m_sIniFile) <> 0 Then
|
||||||
SideEntityControlVM.ColorToEngrave(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
|
SideEntityControlVM.ColorToEngrave(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
|
||||||
End If
|
End If
|
||||||
|
ColorRegion(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
|
||||||
' Eseguo zoom
|
' Eseguo zoom
|
||||||
EgtZoom(ZM.ALL)
|
EgtZoom(ZM.ALL)
|
||||||
' disabilito bottoni UseLayer e UseRegion, abilito bottoni Reset e Insert
|
' disabilito bottoni UseLayer e UseRegion, abilito bottoni Reset e Insert
|
||||||
|
|||||||
@@ -717,10 +717,12 @@ Friend Module CamAuto
|
|||||||
|
|
||||||
|
|
||||||
Private Function SetLuaStandardCamParams(Optional bDripOk As Boolean = True) As Boolean
|
Private Function SetLuaStandardCamParams(Optional bDripOk As Boolean = True) As Boolean
|
||||||
|
Dim sMaterial As String = CurrentMachine.CurrMat.sName
|
||||||
Dim sSawMch As String = CurrentMachine.sCurrSawing
|
Dim sSawMch As String = CurrentMachine.sCurrSawing
|
||||||
Dim sMillMch As String = CurrentMachine.sCurrMilling
|
Dim sMillMch As String = CurrentMachine.sCurrMilling
|
||||||
Dim sDrillMch As String = CurrentMachine.sCurrDrilling
|
Dim sDrillMch As String = CurrentMachine.sCurrDrilling
|
||||||
Dim sWaterJetMch As String = CurrentMachine.sCurrWaterJetting
|
Dim sWaterJetMch As String = CurrentMachine.sCurrWaterJetting
|
||||||
|
Dim sWaterJetQual As String = CurrentMachine.sCurrWaterJettingQuality
|
||||||
Dim sDripSawMch As String = If(bDripOk, CurrentMachine.sCurrDripSawing, "")
|
Dim sDripSawMch As String = If(bDripOk, CurrentMachine.sCurrDripSawing, "")
|
||||||
Dim sDripDrillMch As String = If(bDripOk, CurrentMachine.sCurrDripDrilling, "")
|
Dim sDripDrillMch As String = If(bDripOk, CurrentMachine.sCurrDripDrilling, "")
|
||||||
Dim dReducedDepth As Double = GetPrivateProfileDouble(S_MACH_NEST, K_MACH_REDUCEDDEPTH, 1, CurrentMachine.sMachIniFile)
|
Dim dReducedDepth As Double = GetPrivateProfileDouble(S_MACH_NEST, K_MACH_REDUCEDDEPTH, 1, CurrentMachine.sMachIniFile)
|
||||||
@@ -732,10 +734,12 @@ Friend Module CamAuto
|
|||||||
Dim bMillingOnCorners As Boolean = (GetPrivateProfileInt(S_MACH_NEST, K_MACH_MILLING_ON_CORNERS, 1, CurrentMachine.sMachIniFile) <> 0)
|
Dim bMillingOnCorners As Boolean = (GetPrivateProfileInt(S_MACH_NEST, K_MACH_MILLING_ON_CORNERS, 1, CurrentMachine.sMachIniFile) <> 0)
|
||||||
Dim bMillingOnSinks As Boolean = (GetPrivateProfileInt(S_MACH_NEST, K_MACH_MILLING_ON_SINKS, 0, CurrentMachine.sMachIniFile) <> 0)
|
Dim bMillingOnSinks As Boolean = (GetPrivateProfileInt(S_MACH_NEST, K_MACH_MILLING_ON_SINKS, 0, CurrentMachine.sMachIniFile) <> 0)
|
||||||
Dim dMillingShort As Double = GetPrivateProfileDouble(S_MACH_NEST, K_MACH_MILLING_SHORTENING, 0, CurrentMachine.sMachIniFile)
|
Dim dMillingShort As Double = GetPrivateProfileDouble(S_MACH_NEST, K_MACH_MILLING_SHORTENING, 0, CurrentMachine.sMachIniFile)
|
||||||
|
EgtLuaSetGlobStringVar("CAM.MATERIAL", sMaterial)
|
||||||
EgtLuaSetGlobStringVar("CAM.SAWMCH", sSawMch)
|
EgtLuaSetGlobStringVar("CAM.SAWMCH", sSawMch)
|
||||||
EgtLuaSetGlobStringVar("CAM.MILLMCH", sMillMch)
|
EgtLuaSetGlobStringVar("CAM.MILLMCH", sMillMch)
|
||||||
EgtLuaSetGlobStringVar("CAM.DRILLMCH", sDrillMch)
|
EgtLuaSetGlobStringVar("CAM.DRILLMCH", sDrillMch)
|
||||||
EgtLuaSetGlobStringVar("CAM.WATERJETMCH", sWaterJetMch)
|
EgtLuaSetGlobStringVar("CAM.WATERJETMCH", sWaterJetMch)
|
||||||
|
EgtLuaSetGlobStringVar("CAM.WATERJETQLTY", sWaterJetQual)
|
||||||
EgtLuaSetGlobStringVar("CAM.DRIPSAWMCH", sDripSawMch)
|
EgtLuaSetGlobStringVar("CAM.DRIPSAWMCH", sDripSawMch)
|
||||||
EgtLuaSetGlobStringVar("CAM.DRIPDRILLMCH", sDripDrillMch)
|
EgtLuaSetGlobStringVar("CAM.DRIPDRILLMCH", sDripDrillMch)
|
||||||
EgtLuaSetGlobNumVar("CAM.REDUCEDDEPTH", dReducedDepth)
|
EgtLuaSetGlobNumVar("CAM.REDUCEDDEPTH", dReducedDepth)
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ Module ConstMach
|
|||||||
Public Const KEY_VACLAY_SEL As String = "Sel"
|
Public Const KEY_VACLAY_SEL As String = "Sel"
|
||||||
' Info in gruppo layout per angolo di rotazione preferito
|
' Info in gruppo layout per angolo di rotazione preferito
|
||||||
Public Const KEY_VACLAY_PREFROT As String = "PreferredRot"
|
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
|
' Info in gruppo layout per direzione di riferimento ventose per tagli da sotto
|
||||||
Public Const KEY_VACLAY_DRIPREFDIR As String = "DripRefDir"
|
Public Const KEY_VACLAY_DRIPREFDIR As String = "DripRefDir"
|
||||||
' Info in asse rotante ventosa per step discreti
|
' Info in asse rotante ventosa per step discreti
|
||||||
@@ -91,6 +93,9 @@ Module ConstMach
|
|||||||
Public Const INFO_RAW_BLOCK = "Block"
|
Public Const INFO_RAW_BLOCK = "Block"
|
||||||
' Info per numero lastra nel blocco
|
' Info per numero lastra nel blocco
|
||||||
Public Const INFO_RAW_SLABNBR = "SlabNbr"
|
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
|
' Contrassegno di progetto OmagCut
|
||||||
Public Const NAME_PROJMARK As String = "OmagCut"
|
Public Const NAME_PROJMARK As String = "OmagCut"
|
||||||
@@ -280,6 +285,8 @@ Module ConstMach
|
|||||||
' Nome di pezzo temporaneo che serve per copia dime
|
' Nome di pezzo temporaneo che serve per copia dime
|
||||||
Public Const NAME_COPYTEMPLATE As String = "CopyTemplate"
|
Public Const NAME_COPYTEMPLATE As String = "CopyTemplate"
|
||||||
|
|
||||||
|
' Nome layer solidi per VM
|
||||||
|
Public Const NAME_VM_SOLID As String = "Solid"
|
||||||
' Chiave per Id originale del pezzo per VeinMatch
|
' Chiave per Id originale del pezzo per VeinMatch
|
||||||
Public Const KEY_ORI_ID As String = "OriId"
|
Public Const KEY_ORI_ID As String = "OriId"
|
||||||
|
|
||||||
|
|||||||
+321
-74
@@ -12,12 +12,19 @@ Module CsvM
|
|||||||
Return m_sCsvPath
|
Return m_sCsvPath
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
Private m_sFilePath As String = String.Empty
|
||||||
|
Public ReadOnly Property FilePath As String
|
||||||
|
Get
|
||||||
|
Return m_sFilePath
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
Private m_CsvPartList As New List(Of CsvPart)
|
Private m_CsvPartList As New List(Of CsvPart)
|
||||||
Public ReadOnly Property CsvPartList As List(Of CsvPart)
|
Public ReadOnly Property CsvPartList As List(Of CsvPart)
|
||||||
Get
|
Get
|
||||||
Return m_CsvPartList
|
Return m_CsvPartList
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
Private m_bCsvPartListModified As Boolean = False
|
Private m_bCsvPartListModified As Boolean = False
|
||||||
Private m_sCompoDir As String = String.Empty
|
Private m_sCompoDir As String = String.Empty
|
||||||
|
|
||||||
@@ -36,12 +43,7 @@ Module CsvM
|
|||||||
|
|
||||||
Public Sub NewCmd()
|
Public Sub NewCmd()
|
||||||
' Salvo lista dei pezzi attuale (se modificata)
|
' Salvo lista dei pezzi attuale (se modificata)
|
||||||
If Not SaveCsvPartList() Then
|
SaveCsvPartList()
|
||||||
' Errore nel salvataggio del file CSV, vuoi continuare lo stesso ? - Errore
|
|
||||||
If MessageBox.Show(EgtMsg(MSG_CSVPAGEUC + 5), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.YesNo, MessageBoxImage.Error) <> MessageBoxResult.Yes Then
|
|
||||||
Return
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
' Pulisco path e lista dei pezzi Csv
|
' Pulisco path e lista dei pezzi Csv
|
||||||
m_sCsvPath = String.Empty
|
m_sCsvPath = String.Empty
|
||||||
m_CsvPartList.Clear()
|
m_CsvPartList.Clear()
|
||||||
@@ -51,25 +53,33 @@ Module CsvM
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Sub Open()
|
Public Sub Open()
|
||||||
' Salvo lista dei pezzi attuale (se modificata)
|
|
||||||
If Not SaveCsvPartList() Then
|
|
||||||
' Errore nel salvataggio del file CSV, vuoi continuare lo stesso ? - Errore
|
|
||||||
If MessageBox.Show(EgtMsg(MSG_CSVPAGEUC + 5), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.YesNo, MessageBoxImage.Error) <> MessageBoxResult.Yes Then
|
|
||||||
Return
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
' Leggo direttorio corrente dei file CSV
|
' Leggo direttorio corrente dei file CSV
|
||||||
Dim sCurrDir As String = ""
|
Dim sCurrDir As String = ""
|
||||||
GetMainPrivateProfileString(S_CSV, K_CSVCURRDIR, "C:\", sCurrDir)
|
GetMainPrivateProfileString(S_CSV, K_CSVCURRDIR, "C:\", sCurrDir)
|
||||||
' Apro dialogo scelta file
|
' Apro dialogo scelta file
|
||||||
Dim CsvFileDlg As New Microsoft.Win32.OpenFileDialog()
|
Dim CsvFileDlg As New Microsoft.Win32.OpenFileDialog()
|
||||||
If Directory.Exists(sCurrDir) Then CsvFileDlg.InitialDirectory = sCurrDir
|
If Directory.Exists(sCurrDir) Then CsvFileDlg.InitialDirectory = sCurrDir
|
||||||
CsvFileDlg.Filter = "Csv file (*.csv;*.epl)|*.csv;*.epl"
|
Dim bFull = OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.CSV_AUTO) And
|
||||||
|
(GetMainPrivateProfileInt(S_CSV, K_FULL, 1) <> 0)
|
||||||
|
Dim sFilterDialog As String = String.Empty
|
||||||
|
Dim sDeniedFiles As List(Of String) = CreateListOfDeniedFiles()
|
||||||
|
If bFull Then
|
||||||
|
sFilterDialog = "Csv file (*.csv;*.epl)|*.csv;*.epl;Merge.epl"
|
||||||
|
Else
|
||||||
|
sFilterDialog = "Csv file (*.csv)|*.csv"
|
||||||
|
End If
|
||||||
|
CsvFileDlg.Filter = sFilterDialog
|
||||||
|
|
||||||
If Not CsvFileDlg.ShowDialog() Then Return
|
If Not CsvFileDlg.ShowDialog() Then Return
|
||||||
|
|
||||||
|
' Salvo lista dei pezzi attuale
|
||||||
|
SaveCsvPartList()
|
||||||
|
|
||||||
' Salvo direttorio corrente
|
' Salvo direttorio corrente
|
||||||
WriteMainPrivateProfileString(S_CSV, K_CSVCURRDIR, Path.GetDirectoryName(CsvFileDlg.FileName))
|
WriteMainPrivateProfileString(S_CSV, K_CSVCURRDIR, Path.GetDirectoryName(CsvFileDlg.FileName))
|
||||||
' Apertura file
|
' Apertura file
|
||||||
Dim sPath = CsvFileDlg.FileName
|
Dim sPath = CsvFileDlg.FileName
|
||||||
|
' se necessario cambio estensione del file
|
||||||
If String.Compare(Path.GetExtension(sPath), ".CSV", True) = 0 Then
|
If String.Compare(Path.GetExtension(sPath), ".CSV", True) = 0 Then
|
||||||
LoadCsvFile(sPath)
|
LoadCsvFile(sPath)
|
||||||
Else
|
Else
|
||||||
@@ -77,6 +87,93 @@ Module CsvM
|
|||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Function CreateListOfDeniedFiles() As List(Of String)
|
||||||
|
Dim LocalList As New List(Of String)
|
||||||
|
LocalList.Add("MERGE")
|
||||||
|
Dim Index1 As Integer = 0
|
||||||
|
Dim Index2 As Integer = 0
|
||||||
|
For Index1 = 0 To m_CsvPartList.Count - 1
|
||||||
|
Dim sFileName As String = m_CsvPartList(Index1).m_sPath
|
||||||
|
sFileName = Path.GetFileNameWithoutExtension(sFileName).ToUpper.Trim()
|
||||||
|
Dim bNewFile As Boolean = True
|
||||||
|
For Index2 = 0 To LocalList.Count - 1
|
||||||
|
If sFileName = LocalList(Index2) Then
|
||||||
|
bNewFile = False
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
If bNewFile Then
|
||||||
|
LocalList.Add(Path.GetFileNameWithoutExtension(sFileName).ToUpper.Trim)
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Return LocalList
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Function LoadCsvFile(sCsvPath As String) As Boolean
|
||||||
|
Dim bFull = OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.CSV_AUTO) And
|
||||||
|
(GetMainPrivateProfileInt(S_CSV, K_FULL, 1) <> 0)
|
||||||
|
' aggiungo i pezzi su una lista temporanea
|
||||||
|
Dim LocalPartList As New List(Of CsvPart)
|
||||||
|
' Eseguo la lettura del file Csv
|
||||||
|
If Not ReadCsvFile(sCsvPath, LocalPartList) Then
|
||||||
|
'Errore nella lettura del file CSV
|
||||||
|
MessageBox.Show(EgtMsg(91206), "Error", MessageBoxButton.OK, MessageBoxImage.Error)
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Creo un nuovo file che ospitarà il merge de
|
||||||
|
Dim sNewMergeFile As String = Path.GetDirectoryName(m_sCsvPath) & "\Merge.csv"
|
||||||
|
m_sCsvPath = sNewMergeFile
|
||||||
|
m_sFilePath = m_sCsvPath
|
||||||
|
|
||||||
|
' Elimino pezzi nulli
|
||||||
|
RemoveWrongParts(LocalPartList)
|
||||||
|
' Aggiorno
|
||||||
|
If bFull Then
|
||||||
|
MySaveCsvPartList(LocalPartList)
|
||||||
|
' Salvo come epl
|
||||||
|
SaveCsvPartList()
|
||||||
|
' Rinomino file originale
|
||||||
|
Dim sBakPath As String = sCsvPath & ".bak"
|
||||||
|
Dim sBakName As String = Path.GetFileName(sBakPath)
|
||||||
|
' cancello eventuale vecchio backup
|
||||||
|
If My.Computer.FileSystem.FileExists(sBakPath) Then
|
||||||
|
My.Computer.FileSystem.DeleteFile(sBakPath)
|
||||||
|
End If
|
||||||
|
' eseguo rinomina
|
||||||
|
My.Computer.FileSystem.RenameFile(sCsvPath, sBakName)
|
||||||
|
End If
|
||||||
|
' attacco i nuovi pezzi alla lista corrente
|
||||||
|
For Each Item As CsvPart In LocalPartList
|
||||||
|
m_CsvPartList.Add(Item)
|
||||||
|
Next
|
||||||
|
Return True
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Sub LoadCsvPartList(sFile As String)
|
||||||
|
Dim bFull = OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.CSV_AUTO) And
|
||||||
|
(GetMainPrivateProfileInt(S_CSV, K_FULL, 1) <> 0)
|
||||||
|
' Se Csv semplificato non va letta
|
||||||
|
If Not bFull Then Return
|
||||||
|
|
||||||
|
' aggiungo i pezzi su una lista temporanea
|
||||||
|
Dim LocalPartList As New List(Of CsvPart)
|
||||||
|
|
||||||
|
' Lettura del file
|
||||||
|
If ReadCsvPartList(sFile, LocalPartList) Then
|
||||||
|
' Creo un nuovo file che ospitarà il merge de
|
||||||
|
Dim sNewMergeFile As String = Path.GetDirectoryName(m_sCsvPath) & "\Merge.csv"
|
||||||
|
m_sCsvPath = sNewMergeFile
|
||||||
|
m_sFilePath = m_sCsvPath
|
||||||
|
End If
|
||||||
|
' Elimino pezzi nulli
|
||||||
|
RemoveWrongParts(LocalPartList)
|
||||||
|
' attacco i nuovi pezzi alla lista corrente
|
||||||
|
For Each Item As CsvPart In LocalPartList
|
||||||
|
m_CsvPartList.Add(Item)
|
||||||
|
Next
|
||||||
|
End Sub
|
||||||
|
|
||||||
Public Sub Insert()
|
Public Sub Insert()
|
||||||
' Recupero lo spessore della lastra corrente
|
' Recupero lo spessore della lastra corrente
|
||||||
Dim dRawHeight As Double = EstCalc.GetRawHeight()
|
Dim dRawHeight As Double = EstCalc.GetRawHeight()
|
||||||
@@ -88,7 +185,7 @@ Module CsvM
|
|||||||
End If
|
End If
|
||||||
' Recupero la tolleranza sullo spessore
|
' Recupero la tolleranza sullo spessore
|
||||||
Dim dToler As Double = GetMainPrivateProfileDouble(S_CSV, K_THICKTOLERANCE, 100 * EPS_SMALL)
|
Dim dToler As Double = GetMainPrivateProfileDouble(S_CSV, K_THICKTOLERANCE, 100 * EPS_SMALL)
|
||||||
dToler = Math.Max( dToler, 100 * EPS_SMALL)
|
dToler = Math.Max(dToler, 100 * EPS_SMALL)
|
||||||
' Creo la lista dei pezzi inseribili nella lastra corrente
|
' Creo la lista dei pezzi inseribili nella lastra corrente
|
||||||
Dim InsPartList As New List(Of CsvPart)
|
Dim InsPartList As New List(Of CsvPart)
|
||||||
For i As Integer = 1 To m_CsvPartList.Count()
|
For i As Integer = 1 To m_CsvPartList.Count()
|
||||||
@@ -174,25 +271,46 @@ Module CsvM
|
|||||||
If Not bMaxDimOnX Then
|
If Not bMaxDimOnX Then
|
||||||
Dim dH As Double = Math.Min(0.1 * dDimY, 30)
|
Dim dH As Double = Math.Min(0.1 * dDimY, 30)
|
||||||
Dim nText As Integer = EgtCreateTextAdv(nRegId, New Point3d(dDimX / 2, dDimY - 0.6 * dH, 0), 0, "*TOP*", "", 500, False, dH, 1, 0, INS_POS.MC)
|
Dim nText As Integer = EgtCreateTextAdv(nRegId, New Point3d(dDimX / 2, dDimY - 0.6 * dH, 0), 0, "*TOP*", "", 500, False, dH, 1, 0, INS_POS.MC)
|
||||||
EgtSetColor(nText, New Color3d( 0, 0, 0))
|
EgtSetColor(nText, New Color3d(0, 0, 0))
|
||||||
End If
|
End If
|
||||||
' Aggiusto per lavorazioni
|
' Aggiusto per lavorazioni
|
||||||
AdjustFlatPart(nId)
|
AdjustFlatPart(nId)
|
||||||
' Aggiungo info su CSV di origine
|
' Aggiungo info su CSV di origine
|
||||||
EgtSetInfo(nId, INFO_CSV_PATH, m_sCsvPath)
|
EgtSetInfo(nId, INFO_CSV_PATH, CurrPart.m_sPath)
|
||||||
EgtSetInfo(nId, INFO_CSV_PART, CurrPart.m_sName)
|
EgtSetInfo(nId, INFO_CSV_PART, CurrPart.m_sName)
|
||||||
EgtSetInfo(nId, INFO_CSV_ORD, CurrPart.m_sOrd)
|
EgtSetInfo(nId, INFO_CSV_ORD, CurrPart.m_sOrd)
|
||||||
EgtSetInfo(nId, INFO_CSV_DIST, CurrPart.m_sDist)
|
EgtSetInfo(nId, INFO_CSV_DIST, CurrPart.m_sDist)
|
||||||
EgtSetInfo(nId, INFO_CSV_MAT, CurrPart.m_sMaterial)
|
EgtSetInfo(nId, INFO_CSV_MAT, CurrPart.m_sMaterial)
|
||||||
' Imposto colore testi
|
' Imposto colore testi
|
||||||
EstCalc.SetTextColor( nRegId)
|
EstCalc.SetTextColor(nRegId)
|
||||||
' Lo sposto nel gruppo speciale
|
' Lo sposto nel gruppo speciale
|
||||||
EgtRelocate(nId, nIpGrp)
|
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
|
Next
|
||||||
EgtLuaResetGlobVar("CMP")
|
EgtLuaResetGlobVar("CMP")
|
||||||
EgtLuaResetGlobVar("CMP_Draw")
|
EgtLuaResetGlobVar("CMP_Draw")
|
||||||
' Provo ad inserire i pezzi
|
' Provo ad inserire i pezzi
|
||||||
Dim bDirect As Boolean = (GetMainPrivateProfileInt(S_CSV, K_CSVDIRECT, 1) <> 0)
|
Dim bFull = OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.CSV_AUTO) And
|
||||||
|
(GetMainPrivateProfileInt(S_CSV, K_FULL, 1) <> 0)
|
||||||
|
Dim bDirect As Boolean = bFull And (GetMainPrivateProfileInt(S_CSV, K_CSVDIRECT, 1) <> 0)
|
||||||
For i As Integer = 1 To InsPartList.Count()
|
For i As Integer = 1 To InsPartList.Count()
|
||||||
Dim CurrPart As CsvPart = InsPartList(i - 1)
|
Dim CurrPart As CsvPart = InsPartList(i - 1)
|
||||||
While CurrPart.m_nToNest > 0
|
While CurrPart.m_nToNest > 0
|
||||||
@@ -229,7 +347,7 @@ Module CsvM
|
|||||||
EgtErase(nId2)
|
EgtErase(nId2)
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
' altrimenti lo metto in parcheggio
|
' altrimenti lo metto in parcheggio
|
||||||
Else
|
Else
|
||||||
' Aggiungo riferimento e lo inserisco in VeinMatching
|
' Aggiungo riferimento e lo inserisco in VeinMatching
|
||||||
VeinMatching.SetRefOnPart(nId2)
|
VeinMatching.SetRefOnPart(nId2)
|
||||||
@@ -270,11 +388,11 @@ Module CsvM
|
|||||||
Dim sName As String = String.Empty
|
Dim sName As String = String.Empty
|
||||||
EgtGetInfo(nId, INFO_CSV_PART, sName)
|
EgtGetInfo(nId, INFO_CSV_PART, sName)
|
||||||
' Verifico che il pezzo appartenga a questo Csv
|
' Verifico che il pezzo appartenga a questo Csv
|
||||||
If String.Compare(sCsvPath, m_sCsvPath, True) = 0 Then
|
If SearchCurrCSV(sCsvPath) Then
|
||||||
' Cerco il pezzo nella lista dei pezzi
|
' Cerco il pezzo nella lista dei pezzi
|
||||||
For i = 1 To m_CsvPartList.Count()
|
For i = 1 To m_CsvPartList.Count()
|
||||||
Dim CurrPart As CsvPart = m_CsvPartList(i - 1)
|
Dim CurrPart As CsvPart = m_CsvPartList(i - 1)
|
||||||
If String.Compare(sName, CurrPart.m_sName, True) = 0 Then
|
If String.Compare(sName, CurrPart.m_sName, True) = 0 And String.Compare(sCsvPath, CurrPart.m_sPath, True) = 0 Then
|
||||||
' Se era nel grezzo
|
' Se era nel grezzo
|
||||||
If EgtGetParent(nId) = EstCalc.GetRawId() Then
|
If EgtGetParent(nId) = EstCalc.GetRawId() Then
|
||||||
' Rimuovo le lavorazioni
|
' Rimuovo le lavorazioni
|
||||||
@@ -282,12 +400,19 @@ Module CsvM
|
|||||||
' Rimuovo dal grezzo
|
' Rimuovo dal grezzo
|
||||||
EgtRemovePartFromRawPart(nId)
|
EgtRemovePartFromRawPart(nId)
|
||||||
End If
|
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
|
' Eventuale cancellazione per VM
|
||||||
VeinMatching.OnRemovePart(nId)
|
VeinMatching.OnRemovePart(nId)
|
||||||
' Cancello il pezzo
|
' Cancello il pezzo
|
||||||
EgtErase(nId)
|
EgtErase(nId)
|
||||||
|
' aggiorno il layer che indica il numero di pezzi in parcheggio (se sRefGroup<>"")
|
||||||
|
EstCalc.CountPartInFamily(sCurrRefGuid)
|
||||||
' Aggiorno il contatore
|
' Aggiorno il contatore
|
||||||
CurrPart.m_nToNest += 1
|
CurrPart.m_nToNest += 1
|
||||||
|
' ricreo la lista delle famiglie di pezzi presenti in parcheggio
|
||||||
|
GetFamilyGroupInPark()
|
||||||
' Esco
|
' Esco
|
||||||
Return True
|
Return True
|
||||||
End If
|
End If
|
||||||
@@ -297,10 +422,19 @@ Module CsvM
|
|||||||
Return False
|
Return False
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function LoadCsvFile(sCsvPath As String) As Boolean
|
Private Function SearchCurrCSV(ByVal sCSVFile As String) As Boolean
|
||||||
|
For i As Integer = 1 To m_CsvPartList.Count()
|
||||||
|
Dim CurrPart As CsvPart = m_CsvPartList(i - 1)
|
||||||
|
If String.Compare(sCSVFile, CurrPart.m_sPath, True) = 0 Then
|
||||||
|
Return True
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Return False
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Function ReadCsvFile(sCsvPath As String, ByRef LocalCsvPartList As List(Of CsvPart)) As Boolean
|
||||||
' Pulisco path e lista dei pezzi Csv
|
' Pulisco path e lista dei pezzi Csv
|
||||||
m_sCsvPath = String.Empty
|
m_sCsvPath = String.Empty
|
||||||
m_CsvPartList.Clear()
|
|
||||||
' Definizione variabili
|
' Definizione variabili
|
||||||
EgtLuaCreateGlobTable("CSV")
|
EgtLuaCreateGlobTable("CSV")
|
||||||
EgtLuaSetGlobStringVar("CSV.FILE", sCsvPath)
|
EgtLuaSetGlobStringVar("CSV.FILE", sCsvPath)
|
||||||
@@ -308,7 +442,10 @@ Module CsvM
|
|||||||
Dim nErr As Integer = 999
|
Dim nErr As Integer = 999
|
||||||
Dim sReader As String = String.Empty
|
Dim sReader As String = String.Empty
|
||||||
GetMainPrivateProfileString(S_CSV, K_READER, "CsvRead.lua", sReader)
|
GetMainPrivateProfileString(S_CSV, K_READER, "CsvRead.lua", sReader)
|
||||||
If EgtLuaExecFile(OmagOFFICEMap.refMainWindowVM.MainWindowM.sCsvAutoDir & "\" & sReader) AndAlso
|
Dim bFull = OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.CSV_AUTO) And
|
||||||
|
(GetMainPrivateProfileInt(S_CSV, K_FULL, 1) <> 0)
|
||||||
|
Dim sLuaScript As String = OmagOFFICEMap.refMainWindowVM.MainWindowM.sCsvAutoDir & If(bFull, "\" & sReader, "\CsvSimplRead.lua")
|
||||||
|
If EgtLuaExecFile(sLuaScript) AndAlso
|
||||||
EgtLuaCallFunction("CSV.Read") Then
|
EgtLuaCallFunction("CSV.Read") Then
|
||||||
' Verifica stato di errore
|
' Verifica stato di errore
|
||||||
EgtLuaGetGlobIntVar("CSV.ERR", nErr)
|
EgtLuaGetGlobIntVar("CSV.ERR", nErr)
|
||||||
@@ -325,6 +462,7 @@ Module CsvM
|
|||||||
For i As Integer = 1 To nNbr
|
For i As Integer = 1 To nNbr
|
||||||
Dim OnePart As New CsvPart
|
Dim OnePart As New CsvPart
|
||||||
Dim sN As String = i.ToString()
|
Dim sN As String = i.ToString()
|
||||||
|
OnePart.m_sPath = sCsvPath
|
||||||
EgtLuaGetGlobStringVar("CSV.NAME" & sN, OnePart.m_sName)
|
EgtLuaGetGlobStringVar("CSV.NAME" & sN, OnePart.m_sName)
|
||||||
OnePart.m_bActive = True
|
OnePart.m_bActive = True
|
||||||
EgtLuaGetGlobStringVar("CSV.ORD" & sN, OnePart.m_sOrd)
|
EgtLuaGetGlobStringVar("CSV.ORD" & sN, OnePart.m_sOrd)
|
||||||
@@ -336,63 +474,50 @@ Module CsvM
|
|||||||
EgtLuaGetGlobNumVar("CSV.DIMX" & sN, OnePart.m_dDimX)
|
EgtLuaGetGlobNumVar("CSV.DIMX" & sN, OnePart.m_dDimX)
|
||||||
EgtLuaGetGlobNumVar("CSV.DIMY" & sN, OnePart.m_dDimY)
|
EgtLuaGetGlobNumVar("CSV.DIMY" & sN, OnePart.m_dDimY)
|
||||||
EgtLuaGetGlobNumVar("CSV.TH" & sN, OnePart.m_dTh)
|
EgtLuaGetGlobNumVar("CSV.TH" & sN, OnePart.m_dTh)
|
||||||
|
EgtLuaGetGlobNumVar("CSV.A1_" & sN, OnePart.m_dAng1)
|
||||||
|
EgtLuaGetGlobNumVar("CSV.H1_" & sN, OnePart.m_dHeel1)
|
||||||
|
EgtLuaGetGlobNumVar("CSV.A2_" & sN, OnePart.m_dAng2)
|
||||||
|
EgtLuaGetGlobNumVar("CSV.H2_" & sN, OnePart.m_dHeel2)
|
||||||
|
EgtLuaGetGlobNumVar("CSV.A3_" & sN, OnePart.m_dAng3)
|
||||||
|
EgtLuaGetGlobNumVar("CSV.H3_" & sN, OnePart.m_dHeel3)
|
||||||
|
EgtLuaGetGlobNumVar("CSV.A4_" & sN, OnePart.m_dAng4)
|
||||||
|
EgtLuaGetGlobNumVar("CSV.H4_" & sN, OnePart.m_dHeel4)
|
||||||
OnePart.m_nOriInd = i
|
OnePart.m_nOriInd = i
|
||||||
|
If OnePart.m_nCount > 1 Then
|
||||||
|
OnePart.m_sRefGuid = System.Guid.NewGuid.ToString
|
||||||
|
End If
|
||||||
' inserisco in lista
|
' inserisco in lista
|
||||||
m_CsvPartList.Add(OnePart)
|
LocalCsvPartList.Add(OnePart)
|
||||||
Next
|
Next
|
||||||
EgtLuaResetGlobVar("CSV")
|
EgtLuaResetGlobVar("CSV")
|
||||||
' Ordinamento lista dei pezzi (ordine crescente su materiale e spessore)
|
' Ordinamento lista dei pezzi (ordine crescente su materiale e spessore)
|
||||||
m_CsvPartList.Sort(Function(x, y)
|
LocalCsvPartList.Sort(Function(x, y)
|
||||||
Dim nComp As Integer = String.Compare(x.m_sMaterial, y.m_sMaterial, True)
|
Dim nComp As Integer = String.Compare(x.m_sMaterial, y.m_sMaterial, True)
|
||||||
If nComp = 0 Then
|
If nComp = 0 Then
|
||||||
If Math.Abs(x.m_dTh - y.m_dTh) < EPS_SMALL Then
|
If Math.Abs(x.m_dTh - y.m_dTh) < EPS_SMALL Then
|
||||||
Return (x.m_nOriInd - y.m_nOriInd)
|
Return (x.m_nOriInd - y.m_nOriInd)
|
||||||
|
Else
|
||||||
|
Return CInt(Math.Ceiling(x.m_dTh - y.m_dTh))
|
||||||
|
End If
|
||||||
Else
|
Else
|
||||||
Return CInt(Math.Ceiling(x.m_dTh - y.m_dTh))
|
Return nComp
|
||||||
End If
|
End If
|
||||||
Else
|
End Function)
|
||||||
Return nComp
|
|
||||||
End If
|
|
||||||
End Function)
|
|
||||||
' Salvo come epl
|
|
||||||
m_bCsvPartListModified = True
|
|
||||||
SaveCsvPartList()
|
|
||||||
' Rinomino file originale
|
|
||||||
Dim sBakPath As String = sCsvPath & ".bak"
|
|
||||||
Dim sBakName As String = Path.GetFileName(sBakPath)
|
|
||||||
' cancello eventuale vecchio backup
|
|
||||||
If My.Computer.FileSystem.FileExists(sBakPath) Then
|
|
||||||
My.Computer.FileSystem.DeleteFile(sBakPath)
|
|
||||||
End If
|
|
||||||
' eseguo rinomina
|
|
||||||
My.Computer.FileSystem.RenameFile(sCsvPath, sBakName)
|
|
||||||
Return True
|
Return True
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function SaveCsvPartList() As Boolean
|
Public Function WriteCsvPartList(sFile As String, sCsvPath As String, LocalCsvPartList As List(Of CsvPart)) As Boolean
|
||||||
' Se non c'è nulla di attivo, non faccio alcunché
|
|
||||||
If String.IsNullOrEmpty(m_sCsvPath) Then
|
|
||||||
EgtOutLog("CSV List Save Skipped : missing")
|
|
||||||
Return True
|
|
||||||
End If
|
|
||||||
' Se lista non modificata, non faccio alcunchhé
|
|
||||||
If Not m_bCsvPartListModified Then
|
|
||||||
EgtOutLog("CSV List Save Skipped : not modified")
|
|
||||||
Return True
|
|
||||||
End If
|
|
||||||
' Path del file
|
|
||||||
Dim sFile As String = Path.ChangeExtension(m_sCsvPath, ".epl")
|
|
||||||
' Gestione file
|
|
||||||
Try
|
Try
|
||||||
' Apro file
|
' Apro file
|
||||||
Dim Writer As New IO.StreamWriter(sFile, False)
|
Dim Writer As New IO.StreamWriter(sFile, False)
|
||||||
' Intestazione
|
' Intestazione
|
||||||
Writer.WriteLine("[General]")
|
Writer.WriteLine("[General]")
|
||||||
Writer.WriteLine("Path=" & m_sCsvPath)
|
Writer.WriteLine("Path=" & sCsvPath)
|
||||||
' Ciclo sui pezzi
|
' Ciclo sui pezzi
|
||||||
For i As Integer = 1 To m_CsvPartList.Count()
|
For i As Integer = 1 To LocalCsvPartList.Count()
|
||||||
Dim CurrPart As CsvPart = m_CsvPartList(i - 1)
|
Dim CurrPart As CsvPart = LocalCsvPartList(i - 1)
|
||||||
Writer.WriteLine("[P" & i.ToString() & "]")
|
Writer.WriteLine("[P" & i.ToString() & "]")
|
||||||
|
Writer.WriteLine("Path=" & CurrPart.m_sPath)
|
||||||
Writer.WriteLine("Nam=" & CurrPart.m_sName)
|
Writer.WriteLine("Nam=" & CurrPart.m_sName)
|
||||||
Writer.WriteLine("Ord=" & CurrPart.m_sOrd)
|
Writer.WriteLine("Ord=" & CurrPart.m_sOrd)
|
||||||
Writer.WriteLine("Dist=" & CurrPart.m_sDist)
|
Writer.WriteLine("Dist=" & CurrPart.m_sDist)
|
||||||
@@ -405,7 +530,16 @@ Module CsvM
|
|||||||
Writer.WriteLine("DX=" & DoubleToString(CurrPart.m_dDimX, 4))
|
Writer.WriteLine("DX=" & DoubleToString(CurrPart.m_dDimX, 4))
|
||||||
Writer.WriteLine("DY=" & DoubleToString(CurrPart.m_dDimY, 4))
|
Writer.WriteLine("DY=" & DoubleToString(CurrPart.m_dDimY, 4))
|
||||||
Writer.WriteLine("Th=" & DoubleToString(CurrPart.m_dTh, 4))
|
Writer.WriteLine("Th=" & DoubleToString(CurrPart.m_dTh, 4))
|
||||||
|
Writer.WriteLine("A1=" & DoubleToString(CurrPart.m_dAng1, 4))
|
||||||
|
Writer.WriteLine("H1=" & DoubleToString(CurrPart.m_dHeel1, 4))
|
||||||
|
Writer.WriteLine("A2=" & DoubleToString(CurrPart.m_dAng2, 4))
|
||||||
|
Writer.WriteLine("H2=" & DoubleToString(CurrPart.m_dHeel2, 4))
|
||||||
|
Writer.WriteLine("A3=" & DoubleToString(CurrPart.m_dAng3, 4))
|
||||||
|
Writer.WriteLine("H3=" & DoubleToString(CurrPart.m_dHeel3, 4))
|
||||||
|
Writer.WriteLine("A4=" & DoubleToString(CurrPart.m_dAng4, 4))
|
||||||
|
Writer.WriteLine("H4=" & DoubleToString(CurrPart.m_dHeel4, 4))
|
||||||
Writer.WriteLine("OIn=" & CurrPart.m_nOriInd.ToString())
|
Writer.WriteLine("OIn=" & CurrPart.m_nOriInd.ToString())
|
||||||
|
Writer.WriteLine("Guid=" & CurrPart.m_sRefGuid)
|
||||||
Next
|
Next
|
||||||
' Terminatore
|
' Terminatore
|
||||||
Writer.WriteLine("[END]")
|
Writer.WriteLine("[END]")
|
||||||
@@ -416,18 +550,80 @@ Module CsvM
|
|||||||
' Registro in ini path
|
' Registro in ini path
|
||||||
WriteMainPrivateProfileString(S_CSV, K_CSVLASTFILE, sFile)
|
WriteMainPrivateProfileString(S_CSV, K_CSVLASTFILE, sFile)
|
||||||
Return True
|
Return True
|
||||||
' Errore
|
' Errore
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
EgtOutLog("CSV List error writing " & sFile)
|
EgtOutLog("CSV List error writing " & sFile)
|
||||||
Return False
|
Return False
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function LoadCsvPartList(sFile As String) As Boolean
|
' dato l'elenco completo dei file salvo ogni singolo epl
|
||||||
' Pulisco path e lista dei pezzi Csv
|
Friend Function WriteCsvMergePartList(CsvPartList As List(Of CsvPart)) As Boolean
|
||||||
m_sCsvPath = String.Empty
|
Dim bOk As Boolean = True
|
||||||
m_CsvPartList.Clear()
|
Dim LocalPartList As New List(Of CsvPart)
|
||||||
' Gestione file
|
Dim Index As Integer = 0
|
||||||
|
' devo dividere la lista in tante parti quanti sono i file che lo costituiscono
|
||||||
|
While Index < CsvPartList.Count
|
||||||
|
Dim CurrFile As String = CsvPartList(Index).m_sPath
|
||||||
|
Dim sFile As String = Path.ChangeExtension(CurrFile, ".epl")
|
||||||
|
LocalPartList.Clear()
|
||||||
|
While CurrFile = CsvPartList(Index).m_sPath
|
||||||
|
LocalPartList.Add(CsvPartList(Index))
|
||||||
|
Index += 1
|
||||||
|
' se terminata la lista
|
||||||
|
If Index = CsvPartList.Count Then
|
||||||
|
Exit While
|
||||||
|
End If
|
||||||
|
End While
|
||||||
|
' salvo l'elenco corrente
|
||||||
|
bOk = WriteCsvPartList(sFile, CurrFile, LocalPartList) And bOk
|
||||||
|
End While
|
||||||
|
Return bOk
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Friend Sub SaveCsvPartList()
|
||||||
|
Dim bFull = OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.CSV_AUTO) And
|
||||||
|
(GetMainPrivateProfileInt(S_CSV, K_FULL, 1) <> 0)
|
||||||
|
' Se Csv semplificato non va salvata
|
||||||
|
If Not bFull Then Return
|
||||||
|
' Se non c'è nulla di attivo, non faccio alcunché
|
||||||
|
If String.IsNullOrEmpty(m_sCsvPath) Then
|
||||||
|
EgtOutLog("CSV List missing")
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
' Path del file
|
||||||
|
Dim sFile As String = Path.ChangeExtension(m_sFilePath, ".epl")
|
||||||
|
' Scrittura dei file
|
||||||
|
If WriteCsvMergePartList(m_CsvPartList) Then
|
||||||
|
' Scrittura dei file Merge
|
||||||
|
If WriteCsvPartList(sFile, m_sCsvPath, m_CsvPartList) Then
|
||||||
|
WriteMainPrivateProfileString(S_CSV, K_CSVLASTFILE, sFile)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Friend Sub MySaveCsvPartList(ByVal CurrPartList As List(Of CsvPart))
|
||||||
|
Dim bFull = OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.CSV_AUTO) And
|
||||||
|
(GetMainPrivateProfileInt(S_CSV, K_FULL, 1) <> 0)
|
||||||
|
' Se Csv semplificato non va salvata
|
||||||
|
If Not bFull Then Return
|
||||||
|
Dim sCurrPath As String = String.Empty
|
||||||
|
' recupero dalla lista il nome del file corrente
|
||||||
|
For Each Item As CsvPart In CurrPartList
|
||||||
|
sCurrPath = Item.m_sPath
|
||||||
|
Next
|
||||||
|
' se non trov il nome del file assocciato all'elenco di pezzi esco
|
||||||
|
If String.IsNullOrEmpty(sCurrPath) Then
|
||||||
|
EgtOutLog("CSV Curr list missing")
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
' Path del file
|
||||||
|
Dim sFile As String = Path.ChangeExtension(sCurrPath, ".epl")
|
||||||
|
' Scrittura del file
|
||||||
|
WriteCsvPartList(sFile, sCurrPath, CurrPartList)
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Function ReadCsvPartList(sFile As String, LocalCsvPartList As List(Of CsvPart)) As Boolean
|
||||||
Try
|
Try
|
||||||
' Apro file
|
' Apro file
|
||||||
Dim Reader As New IO.StreamReader(sFile, False)
|
Dim Reader As New IO.StreamReader(sFile, False)
|
||||||
@@ -456,7 +652,7 @@ Module CsvM
|
|||||||
' se esiste pezzo precedente, lo salvo
|
' se esiste pezzo precedente, lo salvo
|
||||||
If nI > 1 Then
|
If nI > 1 Then
|
||||||
' inserisco in lista
|
' inserisco in lista
|
||||||
m_CsvPartList.Add(OnePart)
|
LocalCsvPartList.Add(OnePart)
|
||||||
End If
|
End If
|
||||||
' predisposizioni per prossimo pezzo
|
' predisposizioni per prossimo pezzo
|
||||||
nI += 1
|
nI += 1
|
||||||
@@ -466,7 +662,9 @@ Module CsvM
|
|||||||
Else
|
Else
|
||||||
Dim sItems() As String = sLine.Split("=".ToCharArray)
|
Dim sItems() As String = sLine.Split("=".ToCharArray)
|
||||||
If sItems.Count() >= 2 Then
|
If sItems.Count() >= 2 Then
|
||||||
If sItems(0) = "Nam" Then
|
If sItems(0) = "Path" Then
|
||||||
|
OnePart.m_sPath = sItems(1)
|
||||||
|
ElseIf sItems(0) = "Nam" Then
|
||||||
OnePart.m_sName = sItems(1)
|
OnePart.m_sName = sItems(1)
|
||||||
ElseIf sItems(0) = "Ord" Then
|
ElseIf sItems(0) = "Ord" Then
|
||||||
OnePart.m_sOrd = sItems(1)
|
OnePart.m_sOrd = sItems(1)
|
||||||
@@ -490,8 +688,26 @@ Module CsvM
|
|||||||
StringToDouble(sItems(1), OnePart.m_dDimY)
|
StringToDouble(sItems(1), OnePart.m_dDimY)
|
||||||
ElseIf sItems(0) = "Th" Then
|
ElseIf sItems(0) = "Th" Then
|
||||||
StringToDouble(sItems(1), OnePart.m_dTh)
|
StringToDouble(sItems(1), OnePart.m_dTh)
|
||||||
|
ElseIf sItems(0) = "A1" Then
|
||||||
|
StringToDouble(sItems(1), OnePart.m_dAng1)
|
||||||
|
ElseIf sItems(0) = "H1" Then
|
||||||
|
StringToDouble(sItems(1), OnePart.m_dHeel1)
|
||||||
|
ElseIf sItems(0) = "A2" Then
|
||||||
|
StringToDouble(sItems(1), OnePart.m_dAng2)
|
||||||
|
ElseIf sItems(0) = "H2" Then
|
||||||
|
StringToDouble(sItems(1), OnePart.m_dHeel2)
|
||||||
|
ElseIf sItems(0) = "A3" Then
|
||||||
|
StringToDouble(sItems(1), OnePart.m_dAng3)
|
||||||
|
ElseIf sItems(0) = "H3" Then
|
||||||
|
StringToDouble(sItems(1), OnePart.m_dHeel3)
|
||||||
|
ElseIf sItems(0) = "A4" Then
|
||||||
|
StringToDouble(sItems(1), OnePart.m_dAng4)
|
||||||
|
ElseIf sItems(0) = "H4" Then
|
||||||
|
StringToDouble(sItems(1), OnePart.m_dHeel4)
|
||||||
ElseIf sItems(0) = "OIn" Then
|
ElseIf sItems(0) = "OIn" Then
|
||||||
StringToInt(sItems(1), OnePart.m_nOriInd)
|
StringToInt(sItems(1), OnePart.m_nOriInd)
|
||||||
|
ElseIf sItems(0) = "Guid" Then
|
||||||
|
OnePart.m_sRefGuid = sItems(1).Trim
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@@ -502,18 +718,37 @@ Module CsvM
|
|||||||
' Dichiaro lista non modificata
|
' Dichiaro lista non modificata
|
||||||
m_bCsvPartListModified = False
|
m_bCsvPartListModified = False
|
||||||
Return True
|
Return True
|
||||||
' Errore
|
' Errore
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
EgtOutLog("Error reading " & sFile)
|
EgtOutLog("Error reading " & sFile)
|
||||||
Return False
|
Return False
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Friend Function RemoveNotToNestParts(ByRef CsvPartList As List(Of CsvPart)) As Boolean
|
||||||
|
For i As Integer = CsvPartList.Count() - 1 To 0 Step -1
|
||||||
|
If CsvPartList(i).m_nToNest = 0 Then
|
||||||
|
CsvPartList.RemoveAt(i)
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Return True
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Friend Function RemoveWrongParts(ByRef CsvPartList As List(Of CsvPart)) As Boolean
|
||||||
|
For i As Integer = CsvPartList.Count() - 1 To 0 Step -1
|
||||||
|
If Not CsvPartList(i).m_bIsRect Or CsvPartList(i).m_dDimX < EPS_SMALL Or CsvPartList(i).m_dDimY < EPS_SMALL Then
|
||||||
|
CsvPartList.RemoveAt(i)
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Return True
|
||||||
|
End Function
|
||||||
|
|
||||||
#End Region ' METHODS
|
#End Region ' METHODS
|
||||||
|
|
||||||
End Module
|
End Module
|
||||||
|
|
||||||
Public Class CsvPart
|
Public Class CsvPart
|
||||||
|
Public m_sPath As String = String.Empty
|
||||||
Public m_sName As String = String.Empty
|
Public m_sName As String = String.Empty
|
||||||
Public m_sOrd As String = String.Empty
|
Public m_sOrd As String = String.Empty
|
||||||
Public m_sDist As String = String.Empty
|
Public m_sDist As String = String.Empty
|
||||||
@@ -526,6 +761,18 @@ Public Class CsvPart
|
|||||||
Public m_dDimX As Double = 0
|
Public m_dDimX As Double = 0
|
||||||
Public m_dDimY As Double = 0
|
Public m_dDimY As Double = 0
|
||||||
Public m_dTh As Double = 0
|
Public m_dTh As Double = 0
|
||||||
|
Public m_dAng1 As Double = 0
|
||||||
|
Public m_dHeel1 As Double = 0
|
||||||
|
Public m_dAng2 As Double = 0
|
||||||
|
Public m_dHeel2 As Double = 0
|
||||||
|
Public m_dAng3 As Double = 0
|
||||||
|
Public m_dHeel3 As Double = 0
|
||||||
|
Public m_dAng4 As Double = 0
|
||||||
|
Public m_dHeel4 As Double = 0
|
||||||
Public m_nOriInd As Integer = 0
|
Public m_nOriInd As Integer = 0
|
||||||
Public m_nId As Integer = GDB_ID.NULL
|
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
|
End Class
|
||||||
|
|||||||
@@ -1424,7 +1424,6 @@ Friend Property sCurrMillNoTip As String
|
|||||||
Dim sFilePath As String = sMachDir & EgtWPFLib5.WaterjetDbWindowVM.WATERJETDB_PATH
|
Dim sFilePath As String = sMachDir & EgtWPFLib5.WaterjetDbWindowVM.WATERJETDB_PATH
|
||||||
WjMaterialList = EgtWPFLib5.WaterjetDbWindowVM.LoadWjMaterials(sFilePath)
|
WjMaterialList = EgtWPFLib5.WaterjetDbWindowVM.LoadWjMaterials(sFilePath)
|
||||||
' definisco la lista delle qualità
|
' definisco la lista delle qualità
|
||||||
m_Qualities.Add("")
|
|
||||||
m_Qualities.Add("Q1")
|
m_Qualities.Add("Q1")
|
||||||
m_Qualities.Add("Q2")
|
m_Qualities.Add("Q2")
|
||||||
m_Qualities.Add("Q3")
|
m_Qualities.Add("Q3")
|
||||||
|
|||||||
+274
-2
@@ -3,6 +3,16 @@ Imports EgtUILib
|
|||||||
Imports EgtWPFLib5
|
Imports EgtWPFLib5
|
||||||
|
|
||||||
Module EstCalc
|
Module EstCalc
|
||||||
|
Friend Function CompoColor(sIniFile As String) As Color3d
|
||||||
|
Dim InsertColor As New Color3d(89, 210, 210, 25)
|
||||||
|
Dim IndexColor As Integer = GetPrivateProfileInt(S_COMPO, K_LASTCOLOR, 1, sIniFile)
|
||||||
|
If Not GetPrivateProfileColor(S_COMPO, K_COLOR & IndexColor.ToString, InsertColor, sIniFile) Then
|
||||||
|
IndexColor = 1
|
||||||
|
GetPrivateProfileColor(S_COMPO, K_COLOR & IndexColor.ToString, InsertColor, sIniFile)
|
||||||
|
End If
|
||||||
|
WritePrivateProfileString(S_COMPO, K_LASTCOLOR, (IndexColor + 1).ToString, sIniFile)
|
||||||
|
Return InsertColor
|
||||||
|
End Function
|
||||||
|
|
||||||
'--------------------------------------------------------------------------------------------------
|
'--------------------------------------------------------------------------------------------------
|
||||||
Friend Function DoubleToString(ByVal dVal As Double, ByVal nNumDec As Integer) As String
|
Friend Function DoubleToString(ByVal dVal As Double, ByVal nNumDec As Integer) As String
|
||||||
@@ -41,6 +51,68 @@ Module EstCalc
|
|||||||
End If
|
End If
|
||||||
End Function
|
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
|
Private m_nRawId As Integer = GDB_ID.NULL
|
||||||
Public Function GetRawId() As Integer
|
Public Function GetRawId() As Integer
|
||||||
@@ -67,6 +139,8 @@ Module EstCalc
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function UpdateRawPart() As Boolean
|
Public Function UpdateRawPart() As Boolean
|
||||||
|
' Passo al contesto principale
|
||||||
|
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
|
||||||
' determino il grezzo (è il primo con fase 1)
|
' determino il grezzo (è il primo con fase 1)
|
||||||
m_nRawId = CamAuto.GetCurrentRaw()
|
m_nRawId = CamAuto.GetCurrentRaw()
|
||||||
If Not EgtGetRawPartBBox(m_nRawId, m_b3Raw) Then
|
If Not EgtGetRawPartBBox(m_nRawId, m_b3Raw) Then
|
||||||
@@ -614,6 +688,16 @@ Module EstCalc
|
|||||||
End If
|
End If
|
||||||
' Gestione risultato nesting
|
' Gestione risultato nesting
|
||||||
If bFit Then
|
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
|
' Eventuale aggiunta solido per taglio da sotto
|
||||||
UpdateSolidForDrip(nId)
|
UpdateSolidForDrip(nId)
|
||||||
Return True
|
Return True
|
||||||
@@ -690,12 +774,198 @@ Module EstCalc
|
|||||||
Return True
|
Return True
|
||||||
End Function
|
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
|
Public Function StoreOnePart(ByVal nId As Integer, Optional ByVal bForced As Boolean = False) As Boolean
|
||||||
' Se pezzo in grezzo, metto in parcheggio (sempre possibile)
|
' Se pezzo in grezzo, metto in parcheggio (sempre possibile)
|
||||||
If bForced OrElse
|
If bForced OrElse
|
||||||
(m_nRawId <> GDB_ID.NULL AndAlso EgtGetParent(nId) = m_nRawId) Then
|
(m_nRawId <> GDB_ID.NULL AndAlso EgtGetParent(nId) = m_nRawId) Then
|
||||||
' Ripristino lo stato originale
|
' 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
|
' Parcheggio
|
||||||
PackPartInStore(nId)
|
PackPartInStore(nId)
|
||||||
' Aggiusto la posizione in Z
|
' Aggiusto la posizione in Z
|
||||||
@@ -718,7 +988,8 @@ Module EstCalc
|
|||||||
' Parcheggio
|
' Parcheggio
|
||||||
Const STORE_LARGH As Double = 6000
|
Const STORE_LARGH As Double = 6000
|
||||||
Const STORE_DIST As Double = 200
|
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())
|
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)
|
Return EgtPackBox(nId, dStXmin, -INFINITO, dStXmin + STORE_LARGH, b3Tab.Min().y - STORE_DIST, STORE_OFFS, False)
|
||||||
End Function
|
End Function
|
||||||
@@ -819,3 +1090,4 @@ Module EstCalc
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
End Module
|
End Module
|
||||||
|
|
||||||
|
|||||||
+32
-12
@@ -747,35 +747,55 @@ Public Module SplitAuto
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function SafeMoveRawPart(nRawId As Integer, ByRef vtMove As Vector3d, dMindist As Double) As Boolean
|
Private Function SafeMoveRawPart(nRawId As Integer, ByRef vtMove As Vector3d, dMindist As Double) As Boolean
|
||||||
|
' Spostamento originale
|
||||||
|
Dim vtOriMove As New Vector3d(vtMove)
|
||||||
|
' Livello di movimento
|
||||||
|
Dim nMoveLevel As Integer = GetPrivateProfileInt(S_SPLIT, K_MOVE_LEV, 5, IniFile.m_sIniFile)
|
||||||
|
Dim nMove As Integer = 1
|
||||||
' Se esce dalla tavola, movimento già annullato ed esco con errore
|
' Se esce dalla tavola, movimento già annullato ed esco con errore
|
||||||
If Not EgtMoveRawPart(nRawId, vtMove) Then Return False
|
If Not EgtMoveRawPart(nRawId, vtOriMove) Then Return False
|
||||||
' Se interferisce con altri grezzi, annullo movimento ed esco con errore
|
' Se interferisce con altri grezzi, annullo movimento ed esco con errore
|
||||||
If Not VerifyRawWithOtherRaws(nRawId, dMindist) Then
|
If Not VerifyRawWithOtherRaws(nRawId, dMindist) Then
|
||||||
EgtMoveRawPart(nRawId, -vtMove)
|
EgtMoveRawPart(nRawId, -vtOriMove)
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
|
If nMoveLevel < 2 Then Return True
|
||||||
' Provo ad aggiungere un altro movimento
|
' Provo ad aggiungere un altro movimento
|
||||||
If EgtMoveRawPart(nRawId, vtMove) Then
|
If EgtMoveRawPart(nRawId, vtOriMove) Then
|
||||||
If VerifyRawWithOtherRaws(nRawId, dMindist) Then
|
If VerifyRawWithOtherRaws(nRawId, dMindist) Then
|
||||||
vtMove += vtMove
|
vtMove += vtOriMove
|
||||||
|
nMove += 1
|
||||||
|
If nMoveLevel = nMove Then Return True
|
||||||
Else
|
Else
|
||||||
EgtMoveRawPart(nRawId, -vtMove)
|
EgtMoveRawPart(nRawId, -vtOriMove)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
' Provo ad aggiungere un altro movimento
|
||||||
|
If EgtMoveRawPart(nRawId, vtOriMove) Then
|
||||||
|
If VerifyRawWithOtherRaws(nRawId, dMindist) Then
|
||||||
|
vtMove += vtOriMove
|
||||||
|
nMove += 1
|
||||||
|
If nMoveLevel = nMove Then Return True
|
||||||
|
Else
|
||||||
|
EgtMoveRawPart(nRawId, -vtOriMove)
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
' Provo ad aggiungere un movimento dimezzato
|
' Provo ad aggiungere un movimento dimezzato
|
||||||
If EgtMoveRawPart(nRawId, 0.5 * vtMove) Then
|
If EgtMoveRawPart(nRawId, 0.5 * vtOriMove) Then
|
||||||
If VerifyRawWithOtherRaws(nRawId, dMindist) Then
|
If VerifyRawWithOtherRaws(nRawId, dMindist) Then
|
||||||
vtMove += 0.5 * vtMove
|
vtMove += 0.5 * vtOriMove
|
||||||
|
nMove += 1
|
||||||
|
If nMoveLevel = nMove Then Return True
|
||||||
Else
|
Else
|
||||||
EgtMoveRawPart(nRawId, -0.5 * vtMove)
|
EgtMoveRawPart(nRawId, -0.5 * vtOriMove)
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
' Provo ad aggiunger un movimento 1/4
|
' Provo ad aggiungere un movimento 1/4
|
||||||
If EgtMoveRawPart(nRawId, 0.25 * vtMove) Then
|
If EgtMoveRawPart(nRawId, 0.25 * vtOriMove) Then
|
||||||
If VerifyRawWithOtherRaws(nRawId, dMindist) Then
|
If VerifyRawWithOtherRaws(nRawId, dMindist) Then
|
||||||
vtMove += 0.25 * vtMove
|
vtMove += 0.25 * vtOriMove
|
||||||
Else
|
Else
|
||||||
EgtMoveRawPart(nRawId, -0.25 * vtMove)
|
EgtMoveRawPart(nRawId, -0.25 * vtOriMove)
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Return True
|
Return True
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ Module VacuumCups
|
|||||||
Private m_nVacId As Integer = GDB_ID.NULL
|
Private m_nVacId As Integer = GDB_ID.NULL
|
||||||
Private m_nRefId As Integer = GDB_ID.NULL
|
Private m_nRefId As Integer = GDB_ID.NULL
|
||||||
Private m_dPreferredRot As Double = 0
|
Private m_dPreferredRot As Double = 0
|
||||||
|
Private m_dPrefVertRotXMinus As Double = 0
|
||||||
|
Private m_dPrefVertRotXPlus As Double = 0
|
||||||
Private m_dDripRefAng As Double = 0
|
Private m_dDripRefAng As Double = 0
|
||||||
|
|
||||||
' Nome del gruppo temporaneo per le ventose
|
' Nome del gruppo temporaneo per le ventose
|
||||||
@@ -73,7 +75,10 @@ Module VacuumCups
|
|||||||
m_nVacId = EgtCopyGlob(nLayId, m_nTempId)
|
m_nVacId = EgtCopyGlob(nLayId, m_nTempId)
|
||||||
If m_nVacId = GDB_ID.NULL Then Return False
|
If m_nVacId = GDB_ID.NULL Then Return False
|
||||||
' Angolo di rotazione preferito
|
' 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
|
' Direzione di riferimento per tagli Drip
|
||||||
EgtGetInfo( m_nVacId, KEY_VACLAY_DRIPREFDIR, m_dDripRefAng)
|
EgtGetInfo( m_nVacId, KEY_VACLAY_DRIPREFDIR, m_dDripRefAng)
|
||||||
' Nascondo il gruppo ma rendo visibili le curve di contorno delle ventose
|
' Nascondo il gruppo ma rendo visibili le curve di contorno delle ventose
|
||||||
@@ -363,6 +368,9 @@ Module VacuumCups
|
|||||||
If b3Vac.IsEmpty() Then Return INFINITO
|
If b3Vac.IsEmpty() Then Return INFINITO
|
||||||
' Se box maggiore di quello del pezzo, scarto soluzione
|
' Se box maggiore di quello del pezzo, scarto soluzione
|
||||||
If b3Vac.Radius() > b3Raw.Radius() Then Return INFINITO
|
If b3Vac.Radius() > b3Raw.Radius() Then Return INFINITO
|
||||||
|
' Recupero l'area della tavola
|
||||||
|
Dim b3Tab As New BBox3d
|
||||||
|
EgtGetTableArea(1, b3Tab)
|
||||||
' Determino il movimento
|
' Determino il movimento
|
||||||
vtMove = ptRawCen - b3Vac.Center()
|
vtMove = ptRawCen - b3Vac.Center()
|
||||||
b3Vac.Move(vtMove)
|
b3Vac.Move(vtMove)
|
||||||
@@ -374,11 +382,19 @@ Module VacuumCups
|
|||||||
frMinRect.VersX().ToSpherical(dLen, dAngVertDeg, dAngOrizzDeg)
|
frMinRect.VersX().ToSpherical(dLen, dAngVertDeg, dAngOrizzDeg)
|
||||||
dRotAngDeg = dAngOrizzDeg
|
dRotAngDeg = dAngOrizzDeg
|
||||||
If b3Vac.DimY() > b3Vac.DimX() + EPS_SMALL Then dRotAngDeg -= 90
|
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)
|
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
|
dRotAngDeg -= dAngDelta
|
||||||
End While
|
End While
|
||||||
While dRotAngDeg - m_dPreferredRot <= -dAngDelta / 2
|
While dRotAngDeg - dPreferredRot <= -dAngDelta / 2
|
||||||
dRotAngDeg += dAngDelta
|
dRotAngDeg += dAngDelta
|
||||||
End While
|
End While
|
||||||
Else
|
Else
|
||||||
@@ -431,8 +447,6 @@ Module VacuumCups
|
|||||||
ptRef.Move(vtMove)
|
ptRef.Move(vtMove)
|
||||||
ptRef.Rotate(ptRotCen, Vector3d.Z_AX(), dRotAngDeg)
|
ptRef.Rotate(ptRotCen, Vector3d.Z_AX(), dRotAngDeg)
|
||||||
' Ne calcolo la distanza dal centro della tavola
|
' 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())
|
Dim dDist As Double = Point3d.DistXY(ptRef, b3Tab.Center())
|
||||||
Return dDist
|
Return dDist
|
||||||
End Function
|
End Function
|
||||||
|
|||||||
@@ -25,7 +25,10 @@
|
|||||||
<Button Name="ExportBtn" Height="40" Width="80"
|
<Button Name="ExportBtn" Height="40" Width="80"
|
||||||
Margin="0,5,0,0"
|
Margin="0,5,0,0"
|
||||||
Content="Export"/>
|
Content="Export"/>
|
||||||
</StackPanel>
|
<Button Name="AssemblyBtn" Height="40" Width="80"
|
||||||
|
Margin="0,5,0,0"
|
||||||
|
Content="3D"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
Imports System.IO
|
Imports System.IO
|
||||||
Imports System.Windows.Interop
|
Imports System.Windows.Interop
|
||||||
|
Imports System.Collections.ObjectModel
|
||||||
Imports System.Runtime.InteropServices
|
Imports System.Runtime.InteropServices
|
||||||
Imports EgtUILib
|
Imports EgtUILib
|
||||||
Imports EgtWPFLib5
|
Imports EgtWPFLib5
|
||||||
@@ -316,6 +317,7 @@ Public Class VeinMatchingWindow
|
|||||||
MessageBox.Show(Me, EgtMsg(91607) & " " & sMachGrpName, EgtMsg(91122), MessageBoxButton.OK, MessageBoxImage.Exclamation)
|
MessageBox.Show(Me, EgtMsg(91607) & " " & sMachGrpName, EgtMsg(91122), MessageBoxButton.OK, MessageBoxImage.Exclamation)
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
EgtSetCurrentContext(VeinMatchingScene.GetCtx())
|
EgtSetCurrentContext(VeinMatchingScene.GetCtx())
|
||||||
' Se selezione riuscita, la eseguo anche in VME
|
' Se selezione riuscita, la eseguo anche in VME
|
||||||
@@ -378,6 +380,13 @@ Public Class VeinMatchingWindow
|
|||||||
VeinMatching.Export(SaveFileDialog.FileName)
|
VeinMatching.Export(SaveFileDialog.FileName)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Sub AssemblyBtn_Click(sender As Object, e As RoutedEventArgs) Handles AssemblyBtn.Click
|
||||||
|
EstCalc.UpdateRawPart()
|
||||||
|
' lo spessore deve essere aggiornato per ogni lastra! (devo cicolare sull'elenco delle "macchinate"
|
||||||
|
Dim ThicknessRaw As Double = EstCalc.GetRawHeight
|
||||||
|
VeinMatching.AssemblyParts(ThicknessRaw)
|
||||||
|
End Sub
|
||||||
|
|
||||||
Private Sub Scene_KeyDown(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles VeinMatchingScene.KeyDown
|
Private Sub Scene_KeyDown(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles VeinMatchingScene.KeyDown
|
||||||
' Con DEL eseguo cancellazione dei pezzi selezionati
|
' Con DEL eseguo cancellazione dei pezzi selezionati
|
||||||
If e.KeyData = System.Windows.Forms.Keys.Delete Then
|
If e.KeyData = System.Windows.Forms.Keys.Delete Then
|
||||||
@@ -401,6 +410,8 @@ Friend Module VeinMatching
|
|||||||
' Dimensioni immagine da esportare
|
' Dimensioni immagine da esportare
|
||||||
Private m_nImgWidth As Integer = 1600
|
Private m_nImgWidth As Integer = 1600
|
||||||
Private m_nImgHeight As Integer = 1200
|
Private m_nImgHeight As Integer = 1200
|
||||||
|
' Lista delle alzatine
|
||||||
|
Private m_ListAlzFront As New ObservableCollection(Of Aletta)
|
||||||
' Flag visualizzazione testi
|
' Flag visualizzazione testi
|
||||||
Private m_bShowText As Boolean = True
|
Private m_bShowText As Boolean = True
|
||||||
Friend ReadOnly Property bShowText As Boolean
|
Friend ReadOnly Property bShowText As Boolean
|
||||||
@@ -672,6 +683,15 @@ Friend Module VeinMatching
|
|||||||
' Sistemo il colore
|
' Sistemo il colore
|
||||||
Dim colWhite As New Color3d(255, 255, 255, 100)
|
Dim colWhite As New Color3d(255, 255, 255, 100)
|
||||||
EgtSetColor(nRegId, colWhite)
|
EgtSetColor(nRegId, colWhite)
|
||||||
|
|
||||||
|
' Ripeto le stesse operazioni con il solido del pezzo, se esiste
|
||||||
|
Dim nSolidId As Integer = GetVeinPartSolidId(nId)
|
||||||
|
If nSolidId <> GDB_ID.NULL Then
|
||||||
|
EgtSetTextureName(nSolidId, GetVeinPhotoName(nInd))
|
||||||
|
EgtSetTextureFrame(nSolidId, refTxr, GDB_RT.GLOB)
|
||||||
|
EgtSetColor(nSolidId, colWhite)
|
||||||
|
End If
|
||||||
|
|
||||||
' Se richiesto, eseguo deselezione
|
' Se richiesto, eseguo deselezione
|
||||||
If bDeselect Then EgtDeselectObj(nId)
|
If bDeselect Then EgtDeselectObj(nId)
|
||||||
End If
|
End If
|
||||||
@@ -698,10 +718,14 @@ Friend Module VeinMatching
|
|||||||
If nId <> GDB_ID.NULL Then
|
If nId <> GDB_ID.NULL Then
|
||||||
' Recupero la regione del pezzo
|
' Recupero la regione del pezzo
|
||||||
Dim nRegId As Integer = GetVeinPartRegionId(nId)
|
Dim nRegId As Integer = GetVeinPartRegionId(nId)
|
||||||
|
Dim nSolidId As Integer = GetVeinPartSolidId(nId)
|
||||||
' Sistemo il riferimento della texture
|
' Sistemo il riferimento della texture
|
||||||
Dim refTxr As New Frame3d
|
Dim refTxr As New Frame3d
|
||||||
GetVeinRefPhoto(nMainCtx, nPartId, nId, refTxr)
|
GetVeinRefPhoto(nMainCtx, nPartId, nId, refTxr)
|
||||||
EgtSetTextureFrame(nRegId, refTxr, GDB_RT.GLOB)
|
EgtSetTextureFrame(nRegId, refTxr, GDB_RT.GLOB)
|
||||||
|
If nSolidId <> GDB_ID.NULL Then
|
||||||
|
EgtSetTextureFrame(nSolidId, refTxr, GDB_RT.GLOB)
|
||||||
|
End If
|
||||||
EgtDraw()
|
EgtDraw()
|
||||||
End If
|
End If
|
||||||
EgtSetCurrentContext(nMainCtx)
|
EgtSetCurrentContext(nMainCtx)
|
||||||
@@ -728,8 +752,15 @@ Friend Module VeinMatching
|
|||||||
' Gli tolgo la texture
|
' Gli tolgo la texture
|
||||||
EgtRemoveTextureData(nRegId)
|
EgtRemoveTextureData(nRegId)
|
||||||
' Sistemo il colore
|
' Sistemo il colore
|
||||||
Dim colAqua As New Color3d(0, 255, 255, 25)
|
Dim colRegion As Color3d
|
||||||
EgtSetColor(nRegId, colAqua)
|
EgtGetColor(EgtGetParent(nRegId), colRegion)
|
||||||
|
EgtSetColor(nRegId, colRegion)
|
||||||
|
' ripeto per il solido
|
||||||
|
Dim nSolidId As Integer = GetVeinPartSolidId(nId)
|
||||||
|
If nSolidId <> GDB_ID.NULL Then
|
||||||
|
EgtRemoveTextureData(nSolidId)
|
||||||
|
EgtSetColor(nSolidId, colRegion)
|
||||||
|
End If
|
||||||
' Se richiesto, eseguo deselezione
|
' Se richiesto, eseguo deselezione
|
||||||
If bDeselect Then EgtDeselectObj(nId)
|
If bDeselect Then EgtDeselectObj(nId)
|
||||||
EgtDraw()
|
EgtDraw()
|
||||||
@@ -1240,4 +1271,538 @@ Friend Module VeinMatching
|
|||||||
Return nRegId
|
Return nRegId
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Private Function GetVeinPartSolidId(nVeinPartId As Integer) As Integer
|
||||||
|
' Imposto VeinMatching context
|
||||||
|
Dim nCurrCtx = SetVeinContext()
|
||||||
|
If nCurrCtx = 0 Then Return GDB_ID.NULL
|
||||||
|
' Gruppo regione
|
||||||
|
Dim nRegLayId As Integer = EgtGetFirstNameInGroup(nVeinPartId, NAME_VM_SOLID)
|
||||||
|
' Entità superficie regione piatta
|
||||||
|
Dim nRegId As Integer = EgtGetFirstInGroup(nRegLayId)
|
||||||
|
While nRegId <> GDB_ID.NULL
|
||||||
|
If EgtGetType(nRegId) = GDB_TY.SRF_MESH Then
|
||||||
|
Exit While
|
||||||
|
End If
|
||||||
|
nRegId = EgtGetNext(nRegId)
|
||||||
|
End While
|
||||||
|
' Se necessario, ripristino il contesto originale
|
||||||
|
If nCurrCtx > 0 Then EgtSetCurrentContext(nCurrCtx)
|
||||||
|
Return nRegId
|
||||||
|
End Function
|
||||||
|
|
||||||
|
' ------------------- FUNZIONI PER GESTIONE ALZATINE E FRONTALINI -------------------
|
||||||
|
Friend Function CreateListAlzAndFront() As Boolean
|
||||||
|
m_ListAlzFront.Clear()
|
||||||
|
EgtSetCurrentContext(m_nVeinCtx)
|
||||||
|
Dim nId As Integer = EgtGetFirstPart()
|
||||||
|
While nId <> GDB_ID.NULL
|
||||||
|
' verifico che il pezzo sia una alzatina
|
||||||
|
Dim sInfoName As String = String.Empty
|
||||||
|
EgtGetInfo(nId, "CMP", sInfoName)
|
||||||
|
If sInfoName = "AlzFront" Then
|
||||||
|
Dim AlzFront As New Aletta(nId)
|
||||||
|
m_ListAlzFront.Add(AlzFront)
|
||||||
|
End If
|
||||||
|
' Passo al pezzo successivo
|
||||||
|
nId = EgtGetNextPart(nId)
|
||||||
|
End While
|
||||||
|
Return True
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Friend Function LinkReferencesOnAlette() As Boolean
|
||||||
|
Dim x As Integer = EgtGetCurrentContext()
|
||||||
|
' forzo il DB geometrico corrente
|
||||||
|
EgtSetCurrentContext(m_nVeinCtx)
|
||||||
|
Dim nId As Integer = EgtGetFirstPart()
|
||||||
|
While nId <> GDB_ID.NULL
|
||||||
|
' escludo dalla ricerca le alette
|
||||||
|
Dim sCMP As String = String.Empty
|
||||||
|
EgtGetInfo(nId, "CMP", sCMP)
|
||||||
|
If sCMP = "AlzFront" Then
|
||||||
|
' Passo al pezzo successivo
|
||||||
|
nId = EgtGetNextPart(nId)
|
||||||
|
Continue While
|
||||||
|
End If
|
||||||
|
' Recupero gruppo regione
|
||||||
|
Dim nOutLoopLayId As Integer = EgtGetFirstNameInGroup(nId, NAME_OUTLOOP)
|
||||||
|
' Entità lato
|
||||||
|
Dim nSideId As Integer = EgtGetFirstInGroup(nOutLoopLayId)
|
||||||
|
While nSideId <> GDB_ID.NULL
|
||||||
|
Dim sInfoGUID As String = String.Empty
|
||||||
|
EgtGetInfo(nSideId, "RefAF", sInfoGUID)
|
||||||
|
If Not String.IsNullOrEmpty(sInfoGUID) Then
|
||||||
|
Dim Item As Aletta
|
||||||
|
For Each Item In m_ListAlzFront
|
||||||
|
If Item.RefGUID = sInfoGUID Then
|
||||||
|
Item.IdSideRef = nSideId
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
' ricerco nella lista delle alette il suo
|
||||||
|
End If
|
||||||
|
nSideId = EgtGetNext(nSideId)
|
||||||
|
End While
|
||||||
|
' Passo al pezzo successivo
|
||||||
|
nId = EgtGetNextPart(nId)
|
||||||
|
End While
|
||||||
|
Return True
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Friend Function AssemblyParts(ByVal ThicknessRaw As Double) As Boolean
|
||||||
|
Dim CurrContext As Integer = EgtGetCurrentContext()
|
||||||
|
' per definizione un piano cucicina deve avere lo stesso spessore delle alette
|
||||||
|
'(abbiamo dato per scontato che le alette siano realizate sullo stesso grezzo del pinao cucina...)
|
||||||
|
CreateListAlzAndFront()
|
||||||
|
LinkReferencesOnAlette()
|
||||||
|
|
||||||
|
EgtSetCurrentContext(m_nVeinCtx)
|
||||||
|
|
||||||
|
' costruisco tutti i piani cucina (recupero l'Id geometrico del VeinMatch)
|
||||||
|
Dim nId As Integer = EgtGetFirstPart()
|
||||||
|
While nId <> GDB_ID.NULL
|
||||||
|
Dim sInfoName As String = String.Empty
|
||||||
|
EgtGetInfo(nId, "CMP", sInfoName)
|
||||||
|
' recuoer
|
||||||
|
Dim sNominalThickness As String = String.Empty
|
||||||
|
EgtGetInfo(nId, "RawTN", sNominalThickness)
|
||||||
|
' verifico che il pezzo sia una piano cucina
|
||||||
|
If sInfoName.Contains("PCucina") Or sInfoName.Contains("PBagno") Then
|
||||||
|
If Not CreateKitchenTop(nId, ThicknessRaw) Then Return False
|
||||||
|
End If
|
||||||
|
' altrimenti passo al pezzo successivo
|
||||||
|
nId = EgtGetNextPart(nId)
|
||||||
|
End While
|
||||||
|
|
||||||
|
' costruisco alzatine e frontalini
|
||||||
|
Dim Item As Aletta
|
||||||
|
For Each Item In m_ListAlzFront
|
||||||
|
' verifico che il disegno 3D non sia già stato fatto
|
||||||
|
Dim nInfo3D As Integer = 0
|
||||||
|
EgtGetInfo(Item.SideId, "Info3D", nInfo3D)
|
||||||
|
If nInfo3D <> 1 Then
|
||||||
|
' EgtSetInfo(Item.SideId, "Info3D", 1)
|
||||||
|
' creo il solido
|
||||||
|
If Not CreateAlettaSolid(Item, ThicknessRaw) Then Return False
|
||||||
|
'' posiziono il solido
|
||||||
|
'If Not MoveAlettaSolid(Item, ThicknessRaw) Then Return False
|
||||||
|
End If
|
||||||
|
' posiziono il solido
|
||||||
|
If Not MoveAlettaSolid(Item, ThicknessRaw) Then Return False
|
||||||
|
' solo se arrivo fino a qui allora imposto l'info
|
||||||
|
EgtSetInfo(Item.SideId, "Info3D", 1)
|
||||||
|
Next
|
||||||
|
Draw()
|
||||||
|
Return True
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Friend Function CreateKitchenTop(ByRef nId As Integer, ByRef ThicknessRaw As Double) As Boolean
|
||||||
|
|
||||||
|
' creo o svuoto layer per facce del solido
|
||||||
|
Dim nSolidGrp As Integer = EgtGetFirstNameInGroup(nId, NAME_VM_SOLID)
|
||||||
|
If nSolidGrp <> GDB_ID.NULL Then
|
||||||
|
EgtEmptyGroup(nSolidGrp)
|
||||||
|
Else
|
||||||
|
nSolidGrp = EgtCreateGroup(nId)
|
||||||
|
EgtSetName(nSolidGrp, NAME_VM_SOLID)
|
||||||
|
End If
|
||||||
|
|
||||||
|
' recupero faccia top
|
||||||
|
Dim nRegGrp As Integer = EgtGetFirstNameInGroup(nId, NAME_REGION)
|
||||||
|
Dim nTopFr As Integer = EgtGetFirstInGroup(nRegGrp)
|
||||||
|
While nTopFr <> GDB_ID.NULL
|
||||||
|
If EgtGetType(nTopFr) = GDB_TY.SRF_FRGN Then Exit While
|
||||||
|
nTopFr = EgtGetNext(nTopFr)
|
||||||
|
End While
|
||||||
|
If nTopFr = GDB_ID.NULL Then Return False
|
||||||
|
EgtSetStatus(nTopFr, 0)
|
||||||
|
|
||||||
|
' setto colore per il solido
|
||||||
|
Dim cCol As New Color3d
|
||||||
|
EgtGetColor(nTopFr, cCol)
|
||||||
|
EgtSetColor(nSolidGrp, cCol)
|
||||||
|
|
||||||
|
' creo il solido
|
||||||
|
Dim bSameLoopsNbr As Boolean
|
||||||
|
Dim nSolidId As Integer
|
||||||
|
If Not CreateKitchenBaseSolid(nTopFr, nSolidGrp, ThicknessRaw, nSolidId, bSameLoopsNbr) Then Return False
|
||||||
|
|
||||||
|
' aggiungo componenti interni
|
||||||
|
If Not AddInternalComponents(nSolidId, nTopFr, bSameLoopsNbr, ThicknessRaw) Then Return False
|
||||||
|
|
||||||
|
' setto eventuale texture
|
||||||
|
Dim sTextName As String = String.Empty
|
||||||
|
EgtGetTextureName(nTopFr, sTextName)
|
||||||
|
If sTextName <> String.Empty Then
|
||||||
|
Dim frText As New Frame3d
|
||||||
|
EgtGetTextureFrame(nTopFr, nRegGrp, frText)
|
||||||
|
EgtSetTextureName(nSolidId, sTextName)
|
||||||
|
EgtSetTextureFrame(nSolidId, frText)
|
||||||
|
End If
|
||||||
|
|
||||||
|
' elimino curve ausiliarie
|
||||||
|
Dim nIdx As Integer = EgtGetFirstInGroup(nSolidGrp)
|
||||||
|
While nIdx <> GDB_ID.NULL
|
||||||
|
Dim newId As Integer = EgtGetNext(nIdx)
|
||||||
|
If EgtGetType(nIdx) <> GDB_TY.SRF_MESH Then
|
||||||
|
EgtErase(nIdx)
|
||||||
|
End If
|
||||||
|
nIdx = newId
|
||||||
|
End While
|
||||||
|
|
||||||
|
'Dim nOutloopGrpOrig As Integer = EgtGetFirstNameInGroup(nId, NAME_OUTLOOP & ".orig")
|
||||||
|
'If nOutloopGrpOrig <> GDB_ID.NULL Then
|
||||||
|
' EgtSetStatus(nOutloopGrpOrig, 1)
|
||||||
|
' Dim nOutloopGrp As Integer = EgtGetFirstNameInGroup(nId, NAME_OUTLOOP)
|
||||||
|
' EgtSetStatus(nOutloopGrp, 0)
|
||||||
|
'End If
|
||||||
|
|
||||||
|
Return True
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Friend Function CreateKitchenBaseSolid(ByRef nTopFr As Integer, ByRef nSolidGrp As Integer, ByRef ThicknessRaw As Double,
|
||||||
|
ByRef nSolidStm As Integer, ByRef bSameLoopsNbr As Boolean) As Boolean
|
||||||
|
|
||||||
|
' creo la faccia bottom
|
||||||
|
Dim nBottomFr As Integer
|
||||||
|
Dim nPartId As Integer = EgtGetParent(EgtGetParent(nTopFr))
|
||||||
|
If Not EgtCalcFlatPartDownRegion(nPartId, ThicknessRaw) Then Return False
|
||||||
|
Dim nDwnRegGrp As Integer = EgtGetFirstNameInGroup(nPartId, "DwnReg")
|
||||||
|
If nDwnRegGrp <> GDB_ID.NULL Then
|
||||||
|
EgtSetStatus(nDwnRegGrp, 0)
|
||||||
|
nBottomFr = EgtGetFirstInGroup(nDwnRegGrp)
|
||||||
|
If nBottomFr = GDB_ID.NULL Then Return False
|
||||||
|
Else
|
||||||
|
nBottomFr = EgtCopy(nTopFr, nSolidGrp)
|
||||||
|
End If
|
||||||
|
Dim vtMove As Vector3d = -ThicknessRaw * Vector3d.Z_AX()
|
||||||
|
EgtMove(nBottomFr, vtMove)
|
||||||
|
EgtSetStatus(nBottomFr, 0)
|
||||||
|
|
||||||
|
' superficie laterale
|
||||||
|
Dim nTopCrvCount, nBottomCrvCount As Integer
|
||||||
|
Dim nTopCrv, nBottomCrv As Integer
|
||||||
|
nTopCrv = EgtExtractSurfFrChunkLoops(nTopFr, 0, nSolidGrp, nTopCrvCount)
|
||||||
|
nBottomCrv = EgtExtractSurfFrChunkLoops(nBottomFr, 0, nSolidGrp, nBottomCrvCount)
|
||||||
|
' modifico il punto iniziale della curva bottom per ottenere una buona superficie rigata
|
||||||
|
Dim ptStartTop As Point3d
|
||||||
|
EgtStartPoint(nTopCrv, ptStartTop)
|
||||||
|
EgtChangeClosedCurveStartPoint(nBottomCrv, ptStartTop - vtMove)
|
||||||
|
Dim nLateralStm As Integer = EgtCreateSurfTmRuled(nSolidGrp, nBottomCrv, nTopCrv, 0, EPS_STM)
|
||||||
|
|
||||||
|
' superfici trimesh per faccia top e bottom
|
||||||
|
Dim nTopStm, nBottomStm As Integer
|
||||||
|
bSameLoopsNbr = (nTopCrvCount = nBottomCrvCount)
|
||||||
|
If bSameLoopsNbr Then
|
||||||
|
If Not GetSrfTmFromFlatRegion(nTopFr, nSolidGrp, nTopStm) Then Return False
|
||||||
|
If Not GetSrfTmFromFlatRegion(nBottomFr, nSolidGrp, nBottomStm) Then Return False
|
||||||
|
Else
|
||||||
|
' creo le facce top e bottom dimenticando eventuali aperture
|
||||||
|
nTopStm = EgtCreateSurfTmByFlatContour(nSolidGrp, nTopCrv, EPS_STM)
|
||||||
|
nBottomStm = EgtCreateSurfTmByFlatContour(nSolidGrp, nBottomCrv, EPS_STM)
|
||||||
|
End If
|
||||||
|
EgtInvertSurface(nBottomStm)
|
||||||
|
|
||||||
|
nSolidStm = EgtCreateSurfTmBySewing(nSolidGrp, 3, {nTopStm, nBottomStm, nLateralStm}, True)
|
||||||
|
|
||||||
|
' elimino il layer generato dalla funzione "EgtCalcFlatPartDownRegion" e rinomino quello acceso
|
||||||
|
Dim nOutLoopOrig As Integer = EgtGetFirstNameInGroup(nPartId, NAME_OUTLOOP & ".orig")
|
||||||
|
If nOutLoopOrig <> GDB_ID.NULL Then
|
||||||
|
Dim nCurrOutLoop As Integer = EgtGetFirstNameInGroup(nPartId, NAME_OUTLOOP)
|
||||||
|
EgtErase(nCurrOutLoop)
|
||||||
|
EgtSetName(nOutLoopOrig, NAME_OUTLOOP)
|
||||||
|
EgtSetStatus(nOutLoopOrig, GDB_ST.ON_)
|
||||||
|
End If
|
||||||
|
|
||||||
|
Return nSolidStm <> GDB_ID.NULL
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Friend Function AddInternalComponents(ByRef nSolidStm As Integer, ByRef nTopFr As Integer, ByRef bSameLoopsNbr As Boolean,
|
||||||
|
ByRef ThicknessRaw As Double) As Boolean
|
||||||
|
|
||||||
|
Dim nSolidGrp = EgtGetParent(nSolidStm)
|
||||||
|
|
||||||
|
' aperture interne
|
||||||
|
Dim nTopCrvCount As Integer
|
||||||
|
Dim nTopCrv As Integer = EgtExtractSurfFrChunkLoops(nTopFr, 0, nSolidGrp, nTopCrvCount)
|
||||||
|
If bSameLoopsNbr Then
|
||||||
|
Dim FacesStm(nTopCrvCount - 1) As Integer
|
||||||
|
FacesStm(0) = nSolidStm
|
||||||
|
' creo le superfici laterali definite dalle aperture
|
||||||
|
For i As Integer = 1 To nTopCrvCount - 1
|
||||||
|
FacesStm(i) = EgtCreateSurfTmByExtrusion(nSolidGrp, 1, {nTopCrv + i}, -ThicknessRaw * Vector3d.Z_AX(), EPS_STM)
|
||||||
|
EgtInvertSurface(FacesStm(i))
|
||||||
|
Next
|
||||||
|
nSolidStm = EgtCreateSurfTmBySewing(nSolidGrp, nTopCrvCount, FacesStm, True)
|
||||||
|
Else
|
||||||
|
' creo le aperture per sottrazione di solidi
|
||||||
|
For i As Integer = 1 To nTopCrvCount - 1
|
||||||
|
Dim nComponentSrf As Integer = EgtCreateSurfTmByRegionExtrusion(nSolidGrp, 1, {nTopCrv + i}, -(ThicknessRaw + 10) * Vector3d.Z_AX(), EPS_STM)
|
||||||
|
EgtSurfTmSubtract(nSolidStm, nComponentSrf)
|
||||||
|
EgtErase(nComponentSrf)
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
|
||||||
|
' ribassi
|
||||||
|
Dim nId As Integer = EgtGetFirstGroupInGroup(EgtGetParent(nSolidGrp))
|
||||||
|
While nId <> GDB_ID.NULL
|
||||||
|
Dim sName As String = ""
|
||||||
|
EgtGetName(nId, sName)
|
||||||
|
If sName <> "Pocket" Then
|
||||||
|
nId = EgtGetNextGroup(nId)
|
||||||
|
Continue While
|
||||||
|
End If
|
||||||
|
' cerco curva composita che definisce il ribasso
|
||||||
|
Dim nCrvCompoId As Integer = EgtGetFirstInGroup(nId)
|
||||||
|
While nCrvCompoId <> GDB_ID.NULL
|
||||||
|
If EgtGetType(nCrvCompoId) = GDB_TY.CRV_COMPO Then Exit While
|
||||||
|
nCrvCompoId = EgtGetNext(nCrvCompoId)
|
||||||
|
End While
|
||||||
|
|
||||||
|
Dim dThick As Double
|
||||||
|
EgtCurveThickness(nCrvCompoId, dThick)
|
||||||
|
Dim vtExtr As Vector3d
|
||||||
|
EgtCurveExtrusion(nCrvCompoId, vtExtr)
|
||||||
|
Dim nRecessSrf As Integer = EgtCreateSurfTmByRegionExtrusion(nId, 1, {nCrvCompoId}, (dThick + 100) * vtExtr, EPS_STM)
|
||||||
|
EgtSurfTmSubtract(nSolidStm, nRecessSrf)
|
||||||
|
EgtErase(nRecessSrf)
|
||||||
|
|
||||||
|
' Passo al pezzo successivo
|
||||||
|
nId = EgtGetNextGroup(nId)
|
||||||
|
End While
|
||||||
|
|
||||||
|
Return True
|
||||||
|
End Function
|
||||||
|
Friend Function GetSrfTmFromFlatRegion(ByRef nFlatRegion As Integer, ByRef nSolidGrp As Integer, ByRef nSrfTmId As Integer) As Boolean
|
||||||
|
|
||||||
|
If nFlatRegion = GDB_ID.NULL Then Return False
|
||||||
|
' curve che delimitano la superficie
|
||||||
|
Dim nCrvCount As Integer
|
||||||
|
Dim nCrv As Integer = EgtExtractSurfFrChunkLoops(nFlatRegion, 0, nSolidGrp, nCrvCount)
|
||||||
|
If nCrv = GDB_ID.NULL Then Return False
|
||||||
|
' creo array con gli indici delle curve
|
||||||
|
Dim CrvList(nCrvCount - 1) As Integer
|
||||||
|
For i As Integer = 0 To nCrvCount - 1
|
||||||
|
CrvList(i) = nCrv + i
|
||||||
|
Next
|
||||||
|
nSrfTmId = EgtCreateSurfTmByRegion(nSolidGrp, CrvList, EPS_STM)
|
||||||
|
' cancello le curve create
|
||||||
|
For i As Integer = 0 To nCrvCount - 1
|
||||||
|
EgtErase(CrvList(i))
|
||||||
|
Next
|
||||||
|
|
||||||
|
Return nSrfTmId <> GDB_ID.NULL
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Friend Function CreateAlettaSolid(ByRef Item As Aletta, ByRef ThicknessRaw As Double) As Boolean
|
||||||
|
|
||||||
|
' angoli per i tagli
|
||||||
|
Dim dAngL, dAngR, dAng As Double
|
||||||
|
EgtGetInfo(Item.SideId + 1, INFO_SIDE_ANGLE, dAngR)
|
||||||
|
EgtGetInfo(Item.SideId + 3, INFO_SIDE_ANGLE, dAngL)
|
||||||
|
EgtGetInfo(Item.SideId, INFO_SIDE_ANGLE, dAng)
|
||||||
|
|
||||||
|
If Math.Abs(dAngL - 90) < EPS_SMALL Or Math.Abs(dAngL + 90) < EPS_SMALL Then dAngL = 0
|
||||||
|
If Math.Abs(dAngR - 90) < EPS_SMALL Or Math.Abs(dAngR + 90) < EPS_SMALL Then dAngR = 0
|
||||||
|
If Math.Abs(dAng - 90) < EPS_SMALL Or Math.Abs(dAng + 90) < EPS_SMALL Then dAng = 0
|
||||||
|
|
||||||
|
' punti che delimitano la front face (faccia adiacente a top lungo il lato di riferimento)
|
||||||
|
Dim pt1, pt2, pt3, pt4 As Point3d
|
||||||
|
EgtStartPoint(Item.SideId, pt4)
|
||||||
|
EgtEndPoint(Item.SideId, pt3)
|
||||||
|
pt2 = pt3 - ThicknessRaw * Vector3d.Z_AX()
|
||||||
|
pt1 = pt4 - ThicknessRaw * Vector3d.Z_AX()
|
||||||
|
|
||||||
|
' aggiungo tagli inclinati
|
||||||
|
pt2 = pt2 + ThicknessRaw * Math.Tan(dAngR * Math.PI / 180) * Vector3d.X_AX()
|
||||||
|
pt1 = pt1 - ThicknessRaw * Math.Tan(dAngL * Math.PI / 180) * Vector3d.X_AX()
|
||||||
|
|
||||||
|
' aggiungo eventuale taglio sul lato superiore
|
||||||
|
pt2 = pt2 - ThicknessRaw * Math.Tan(dAng * Math.PI / 180) * Vector3d.Y_AX()
|
||||||
|
pt1 = pt1 - ThicknessRaw * Math.Tan(dAng * Math.PI / 180) * Vector3d.Y_AX()
|
||||||
|
|
||||||
|
' punti che delimitano back face
|
||||||
|
Dim HeightTop As Double
|
||||||
|
EgtCurveLength(Item.SideId + 1, HeightTop)
|
||||||
|
Dim HeightBottom As Double = HeightTop + ThicknessRaw * Math.Tan(dAng * Math.PI / 180)
|
||||||
|
Dim ptB1 As Point3d = pt1 + HeightBottom * Vector3d.Y_AX()
|
||||||
|
Dim ptB2 As Point3d = pt2 + HeightBottom * Vector3d.Y_AX()
|
||||||
|
Dim ptB3 As Point3d = pt3 + HeightTop * Vector3d.Y_AX()
|
||||||
|
Dim ptB4 As Point3d = pt4 + HeightTop * Vector3d.Y_AX()
|
||||||
|
|
||||||
|
' Creo o svuoto layer per facce del solido
|
||||||
|
Dim nSolidGrp As Integer = EgtGetFirstNameInGroup(Item.PartId, NAME_VM_SOLID)
|
||||||
|
If nSolidGrp <> GDB_ID.NULL Then
|
||||||
|
EgtEmptyGroup(nSolidGrp)
|
||||||
|
Else
|
||||||
|
nSolidGrp = EgtCreateGroup(Item.PartId)
|
||||||
|
EgtSetName(nSolidGrp, NAME_VM_SOLID)
|
||||||
|
End If
|
||||||
|
Dim nRegionGrp As Integer = EgtGetFirstNameInGroup(Item.PartId, NAME_REGION)
|
||||||
|
Dim cCol As New Color3d
|
||||||
|
EgtGetColor(EgtGetFirstInGroup(nRegionGrp), cCol)
|
||||||
|
EgtSetColor(nSolidGrp, cCol)
|
||||||
|
|
||||||
|
' Top Face
|
||||||
|
Dim nTopSrfFR As Integer = EgtGetFirstInGroup(nRegionGrp)
|
||||||
|
Dim tmp As Integer
|
||||||
|
Dim nTopCrv As Integer = EgtExtractSurfFrChunkLoops(nTopSrfFR, 0, nRegionGrp, tmp)
|
||||||
|
If nTopCrv = GDB_ID.NULL Then Return False
|
||||||
|
Dim nTopSrf As Integer = EgtCreateSurfTmByRegion(nSolidGrp, {nTopCrv}, EPS_SMALL)
|
||||||
|
EgtErase(nTopCrv)
|
||||||
|
EgtSetStatus(nTopSrfFR, 0)
|
||||||
|
|
||||||
|
Dim nFrontSrf, nBackSrf, nBottomSrf, nRightSrf, nLeftSrf As Integer
|
||||||
|
' Front Face
|
||||||
|
If Not CreateSolidFace(nSolidGrp, {pt1, pt2, pt3, pt4}, nFrontSrf, False) Then Return False
|
||||||
|
' Back Face
|
||||||
|
If Not CreateSolidFace(nSolidGrp, {ptB1, ptB4, ptB3, ptB2}, nBackSrf) Then Return False
|
||||||
|
' Bottom face
|
||||||
|
If Not CreateSolidFace(nSolidGrp, {pt2, pt1, ptB1, ptB2}, nBottomSrf) Then Return False
|
||||||
|
' Right face
|
||||||
|
If Not CreateSolidFace(nSolidGrp, {ptB1, pt1, pt4, ptB4}, nRightSrf) Then Return False
|
||||||
|
' Left face
|
||||||
|
If Not CreateSolidFace(nSolidGrp, {ptB2, ptB3, pt3, pt2}, nLeftSrf) Then Return False
|
||||||
|
|
||||||
|
' creo il solido
|
||||||
|
Dim nSolidSrf As Integer = EgtCreateSurfTmBySewing(nSolidGrp, 6, {nTopSrf, nFrontSrf, nBackSrf, nBottomSrf, nRightSrf, nLeftSrf}, True)
|
||||||
|
|
||||||
|
' setto eventuale texture
|
||||||
|
Dim sTextName As String = String.Empty
|
||||||
|
EgtGetTextureName(nTopSrfFR, sTextName)
|
||||||
|
If sTextName <> String.Empty Then
|
||||||
|
Dim frText As New Frame3d
|
||||||
|
EgtGetTextureFrame(nTopSrfFR, nRegionGrp, frText)
|
||||||
|
EgtSetTextureName(nSolidSrf, sTextName)
|
||||||
|
EgtSetTextureFrame(nSolidSrf, frText)
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim nOutloopGrp As Integer = EgtGetParent(Item.SideId)
|
||||||
|
EgtSetStatus(nOutloopGrp, 0)
|
||||||
|
|
||||||
|
Return True
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Friend Function CreateSolidFace(ByRef nSrfGrp As Integer, ByRef Points As Point3d(), ByRef nSrfId As Integer,
|
||||||
|
Optional ByRef bDeleteCrv As Boolean = True) As Boolean
|
||||||
|
|
||||||
|
If Points.Count() <> 4 Then Return False
|
||||||
|
|
||||||
|
Dim nCrvId As Integer = EgtCreateCurveCompo(nSrfGrp, {EgtCreateLine(nSrfGrp, Points(0), Points(1)),
|
||||||
|
EgtCreateLine(nSrfGrp, Points(1), Points(2)),
|
||||||
|
EgtCreateLine(nSrfGrp, Points(2), Points(3)),
|
||||||
|
EgtCreateLine(nSrfGrp, Points(3), Points(0))}, True)
|
||||||
|
|
||||||
|
If nCrvId = GDB_ID.NULL Then Return False
|
||||||
|
nSrfId = EgtCreateSurfTmByRegion(nSrfGrp, {nCrvId}, EPS_SMALL)
|
||||||
|
If bDeleteCrv Then
|
||||||
|
EgtErase(nCrvId)
|
||||||
|
Else
|
||||||
|
EgtSetStatus(nCrvId, GDB_ST.OFF)
|
||||||
|
End If
|
||||||
|
Return nSrfId <> GDB_ID.NULL
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Friend Function MoveAlettaSolid(ByRef Item As Aletta, ByRef ThicknessRaw As Double) As Boolean
|
||||||
|
|
||||||
|
Dim nType As Integer
|
||||||
|
If Not EgtGetInfo(Item.IdSideRef, "AF", nType) Then Return False
|
||||||
|
|
||||||
|
Dim ptSRef, ptERef, ptE As Point3d
|
||||||
|
If Not EgtStartPoint(Item.IdSideRef, GDB_ID.ROOT, ptSRef) Then Return False
|
||||||
|
If Not EgtEndPoint(Item.IdSideRef, GDB_ID.ROOT, ptERef) Then Return False
|
||||||
|
If Not EgtEndPoint(Item.SideId, GDB_ID.ROOT, ptE) Then Return False
|
||||||
|
|
||||||
|
' verifco che sia già stato ruotato
|
||||||
|
Dim nInfo3D As Integer = 0
|
||||||
|
EgtGetInfo(Item.SideId, "Info3D", nInfo3D)
|
||||||
|
|
||||||
|
If nInfo3D <> 1 Then
|
||||||
|
' ruoto il solido intorno al lato di riferimento
|
||||||
|
Dim vtRot As Vector3d = ptERef - ptSRef
|
||||||
|
If nType = 1 Then
|
||||||
|
EgtRotate(Item.PartId, ptE, vtRot, -90, GDB_RT.GLOB)
|
||||||
|
ElseIf nType = 2 Then
|
||||||
|
EgtRotate(Item.PartId, ptE, vtRot, 90, GDB_RT.GLOB)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
' punto di riferimento per la traslazione sul solido
|
||||||
|
Dim ptSolid As Point3d
|
||||||
|
If nType = 1 Then
|
||||||
|
' cerco id della curva che definisce la front face
|
||||||
|
Dim nSolidGrp As Integer = EgtGetFirstNameInGroup(Item.PartId, NAME_VM_SOLID)
|
||||||
|
Dim nFrontCrvId As Integer = EgtGetFirstInGroup(nSolidGrp)
|
||||||
|
EgtStartPoint(nFrontCrvId, ptSolid)
|
||||||
|
ElseIf nType = 2 Then
|
||||||
|
EgtStartPoint(Item.SideId, ptSolid)
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim ItemFrame As New Frame3d
|
||||||
|
If Not EgtGetGroupGlobFrame(Item.PartId, ItemFrame) Then Return False
|
||||||
|
ptSolid.ToGlob(ItemFrame)
|
||||||
|
|
||||||
|
'punto di riferimento per la traslazione sul piano cucina
|
||||||
|
Dim ptKitchen As Point3d = ptERef
|
||||||
|
' traslazione
|
||||||
|
Dim vtMove As Vector3d = ptKitchen - ptSolid
|
||||||
|
EgtMove(Item.PartId, vtMove, GDB_RT.GLOB)
|
||||||
|
|
||||||
|
Return True
|
||||||
|
End Function
|
||||||
End Module
|
End Module
|
||||||
|
|
||||||
|
Public Class Aletta
|
||||||
|
|
||||||
|
Private m_PartId As Integer = -1
|
||||||
|
Public ReadOnly Property PartId As Integer
|
||||||
|
Get
|
||||||
|
Return m_PartId
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Private m_SideId As Integer = -1
|
||||||
|
Public ReadOnly Property SideId As Integer
|
||||||
|
Get
|
||||||
|
Return m_SideId
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Private m_RefGUID As String = String.Empty
|
||||||
|
Public ReadOnly Property RefGUID As String
|
||||||
|
Get
|
||||||
|
Return m_RefGUID
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Private m_IdSideRef As Integer = -1
|
||||||
|
Public Property IdSideRef As Integer
|
||||||
|
Get
|
||||||
|
Return m_IdSideRef
|
||||||
|
End Get
|
||||||
|
Set(value As Integer)
|
||||||
|
m_IdSideRef = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Sub New(nId As Integer)
|
||||||
|
m_PartId = nId
|
||||||
|
|
||||||
|
' Recupero l'info legata al lato che contiene iil riferiemnto
|
||||||
|
Dim nOutLoopLayId As Integer = EgtGetFirstNameInGroup(nId, NAME_OUTLOOP)
|
||||||
|
' Entità lato
|
||||||
|
Dim nSideId As Integer = EgtGetFirstInGroup(nOutLoopLayId)
|
||||||
|
While nSideId <> GDB_ID.NULL
|
||||||
|
Dim sInfoGUID As String = String.Empty
|
||||||
|
EgtGetInfo(nSideId, "RefAF", sInfoGUID)
|
||||||
|
If Not String.IsNullOrEmpty(sInfoGUID) Then
|
||||||
|
m_RefGUID = sInfoGUID
|
||||||
|
m_SideId = nSideId
|
||||||
|
Exit While
|
||||||
|
End If
|
||||||
|
nSideId = EgtGetNext(nSideId)
|
||||||
|
End While
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
End Class
|
||||||
@@ -13,16 +13,17 @@
|
|||||||
Height="20" Width="150"/>-->
|
Height="20" Width="150"/>-->
|
||||||
|
|
||||||
<Button Command="{Binding ToolDbCommand}" ToolTip="{Binding ToolDBToolTip}"
|
<Button Command="{Binding ToolDbCommand}" ToolTip="{Binding ToolDBToolTip}"
|
||||||
Style="{StaticResource ToolBar_TextButton}" Width="55" Content="{Binding ToolDBMsg}"/>
|
Style="{StaticResource ToolBar_TextButton}" Width="70" Content="{Binding ToolDBMsg}"/>
|
||||||
<Button Command="{Binding MachDbCommand}" ToolTip="{Binding MachiningDbToolTip}"
|
<Button Command="{Binding MachDbCommand}" ToolTip="{Binding MachiningDbToolTip}"
|
||||||
Style="{StaticResource ToolBar_TextButton}" Width="55" Content="{Binding MachiningDbMsg}"/>
|
Style="{StaticResource ToolBar_TextButton}" Width="70" Content="{Binding MachiningDbMsg}"/>
|
||||||
<Button Command="{Binding SetUpCommand}" ToolTip="{Binding SetUpToolTip}"
|
<Button Command="{Binding SetUpCommand}" ToolTip="{Binding SetUpToolTip}"
|
||||||
Style="{StaticResource ToolBar_TextButton}" Width="55" Content="{Binding SetUpMsg}"
|
Style="{StaticResource ToolBar_TextButton}" Width="70" Content="{Binding SetUpMsg}"
|
||||||
Background="{Binding SetUp_Background}"/>
|
Background="{Binding SetUp_Background}"/>
|
||||||
|
<Button Command="{Binding WaterjetDbCommand}" ToolTip="{Binding WaterjetDbToolTip}"
|
||||||
|
Style="{StaticResource ToolBar_Button}" Width="70" Content="{Binding WaterjetDbMsg}" Visibility="{Binding WjDb_Visibility}"/>
|
||||||
<Button Command="{Binding MachOptionsCommand}" ToolTip="{Binding OptionsToolTip}">
|
<Button Command="{Binding MachOptionsCommand}" ToolTip="{Binding OptionsToolTip}">
|
||||||
<Image Source="/Resources/TopCommandBar/Options.png" Height="22" />
|
<Image Source="/Resources/TopCommandBar/Options.png" Height="22" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button Command="{Binding WaterjetDbCommand}" ToolTip="{Binding WaterjetDbToolTip}"
|
|
||||||
Style="{StaticResource ToolBar_Button}" Content="{Binding WaterjetDbMsg}" Visibility="{Binding WjDb_Visibility}"/>
|
|
||||||
|
|
||||||
</EgtFloating:EgtFloatingPanel>
|
</EgtFloating:EgtFloatingPanel>
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ Public Class MyMachinePanelVM
|
|||||||
End Property
|
End Property
|
||||||
Public ReadOnly Property WaterjetDbMsg As String
|
Public ReadOnly Property WaterjetDbMsg As String
|
||||||
Get
|
Get
|
||||||
Return "WJ" 'EgtMsg(MSG_MACHINEPAGEUC + 7)
|
Return "DB WaterJet" 'EgtMsg(MSG_MACHINEPAGEUC + 7)
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
|||||||
@@ -195,8 +195,8 @@ Public Class MainWindowM
|
|||||||
' Verifico abilitazione nesting automatico
|
' Verifico abilitazione nesting automatico
|
||||||
m_bAutoNestOption = Not String.IsNullOrWhiteSpace( sNestKey)
|
m_bAutoNestOption = Not String.IsNullOrWhiteSpace( sNestKey)
|
||||||
' Recupero livello e opzioni della chiave
|
' Recupero livello e opzioni della chiave
|
||||||
Dim bKey As Boolean = EgtGetKeyLevel(9423, 2311, 1, m_nKeyLevel) And
|
Dim bKey As Boolean = EgtGetKeyLevel(9423, 2402, 1, m_nKeyLevel) And
|
||||||
EgtGetKeyOptions(9423, 2311, 1, m_nKeyOptions)
|
EgtGetKeyOptions(9423, 2402, 1, m_nKeyOptions)
|
||||||
' Verifico abilitazione prodotto
|
' Verifico abilitazione prodotto
|
||||||
Dim bProd As Boolean = GetKeyOption(KEY_OPT.OFFICE_BASE)
|
Dim bProd As Boolean = GetKeyOption(KEY_OPT.OFFICE_BASE)
|
||||||
' Inizializzazione generale di EgtInterface
|
' Inizializzazione generale di EgtInterface
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ Imports System.Windows
|
|||||||
<Assembly: AssemblyDescription("OmagOFFICE 32 bit")>
|
<Assembly: AssemblyDescription("OmagOFFICE 32 bit")>
|
||||||
#End If
|
#End If
|
||||||
#End If
|
#End If
|
||||||
<Assembly: AssemblyCompany("EgalTech s.r.l.")>
|
<Assembly: AssemblyCompany("Egalware s.r.l.")>
|
||||||
<Assembly: AssemblyProduct("OmagOFFICE")>
|
<Assembly: AssemblyProduct("OmagOFFICE")>
|
||||||
<Assembly: AssemblyCopyright("Copyright © 2017-2021 by EgalTech s.r.l.")>
|
<Assembly: AssemblyCopyright("Copyright © 2017-2022 by Egalware s.r.l.")>
|
||||||
<Assembly: AssemblyTrademark("")>
|
<Assembly: AssemblyTrademark("")>
|
||||||
<Assembly: ComVisible(false)>
|
<Assembly: ComVisible(false)>
|
||||||
'In order to begin building localizable applications, set
|
'In order to begin building localizable applications, set
|
||||||
@@ -69,6 +69,6 @@ Imports System.Windows
|
|||||||
' by using the '*' as shown below:
|
' by using the '*' as shown below:
|
||||||
' <Assembly: AssemblyVersion("1.0.*")>
|
' <Assembly: AssemblyVersion("1.0.*")>
|
||||||
|
|
||||||
<Assembly: AssemblyVersion("2.3.11.2")>
|
<Assembly: AssemblyVersion("2.4.2.3")>
|
||||||
<Assembly: AssemblyFileVersion("2.3.11.2")>
|
<Assembly: AssemblyFileVersion("2.4.2.3")>
|
||||||
|
|
||||||
|
|||||||
@@ -255,6 +255,10 @@
|
|||||||
<DependentUpon>SplitModeV.xaml</DependentUpon>
|
<DependentUpon>SplitModeV.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="OptionPanel\MachiningTab\SplitModeVM.vb" />
|
<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">
|
<Compile Include="OptionPanel\NestingTab\NestingTabV.xaml.vb">
|
||||||
<DependentUpon>NestingTabV.xaml</DependentUpon>
|
<DependentUpon>NestingTabV.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -437,6 +441,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="OptionPanel\NestingTab\MultiSelectionV.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="OptionPanel\NestingTab\NestingTabV.xaml">
|
<Page Include="OptionPanel\NestingTab\NestingTabV.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
|||||||
@@ -663,7 +663,7 @@ Public Class SplitModeVM
|
|||||||
SplitModeIsEnabled = Not OmagOFFICEMap.refMachiningTabVM.IsShow
|
SplitModeIsEnabled = Not OmagOFFICEMap.refMachiningTabVM.IsShow
|
||||||
|
|
||||||
' nascondo i comandi che non devono essere visualizzati in funzione delle lavorazioni attive
|
' nascondo i comandi che non devono essere visualizzati in funzione delle lavorazioni attive
|
||||||
If m_nCountSawing = 0 And (m_nCountWaterjetting > 0 Or m_nCountOtherMachining) Then
|
If m_nCountSawing = 0 And (m_nCountWaterjetting > 0 Or m_nCountOtherMachining > 0) Then
|
||||||
VisibilityButtonFromMachining(MCH_OY.WATERJETTING)
|
VisibilityButtonFromMachining(MCH_OY.WATERJETTING)
|
||||||
Else
|
Else
|
||||||
VisibilityButtonFromMachining(MCH_OY.SAWING)
|
VisibilityButtonFromMachining(MCH_OY.SAWING)
|
||||||
@@ -1718,13 +1718,22 @@ Public Class SplitModeVM
|
|||||||
If Not ModifStartWindow.ShowDialog() Then Return
|
If Not ModifStartWindow.ShowDialog() Then Return
|
||||||
' Modifica della lavorazione
|
' Modifica della lavorazione
|
||||||
Dim dUsal As Double = ModifStartWindowVM.GetVal()
|
Dim dUsal As Double = ModifStartWindowVM.GetVal()
|
||||||
EgtSetCurrMachining(nOperId)
|
Dim bRepeat As Boolean = False
|
||||||
Dim dAddLen As Double = 0
|
Do
|
||||||
EgtGetMachiningParam(MCH_MP.STARTADDLEN, dAddLen)
|
EgtSetCurrMachining(nOperId)
|
||||||
If dAddLen - dOrigUsal < -10 * EPS_SMALL Then Return
|
Dim dAddLen As Double = 0
|
||||||
EgtSetMachiningParam(MCH_MP.STARTADDLEN, dAddLen + dUsal - dOrigUsal)
|
EgtGetMachiningParam(MCH_MP.STARTADDLEN, dAddLen)
|
||||||
EgtSetInfo(nOperId, INFO_MCH_USER_SAL, dUsal)
|
If dAddLen - dOrigUsal < -10 * EPS_SMALL Then Return
|
||||||
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
EgtSetMachiningParam(MCH_MP.STARTADDLEN, dAddLen + dUsal - dOrigUsal)
|
||||||
|
EgtSetInfo(nOperId, INFO_MCH_USER_SAL, dUsal)
|
||||||
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
||||||
|
bRepeat = Not UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
||||||
|
If bRepeat Then
|
||||||
|
EgtSetMachiningParam(MCH_MP.STARTADDLEN, dOrigUsal)
|
||||||
|
EgtSetInfo(nOperId, INFO_MCH_USER_SAL, dOrigUsal)
|
||||||
|
dUsal = dOrigUsal
|
||||||
|
End If
|
||||||
|
Loop Until Not bRepeat
|
||||||
' verifico interferenza
|
' verifico interferenza
|
||||||
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
|
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
|
||||||
ColorMachining(m_MachiningList(nI))
|
ColorMachining(m_MachiningList(nI))
|
||||||
@@ -1813,14 +1822,25 @@ Public Class SplitModeVM
|
|||||||
ModifStartWindowVM.SetVal(dOrigUeal)
|
ModifStartWindowVM.SetVal(dOrigUeal)
|
||||||
If Not ModifStartWindow.ShowDialog() Then Return
|
If Not ModifStartWindow.ShowDialog() Then Return
|
||||||
' Modifica della lavorazione
|
' Modifica della lavorazione
|
||||||
Dim dUsal As Double = ModifStartWindowVM.GetVal()
|
Dim dUeal As Double = ModifStartWindowVM.GetVal()
|
||||||
EgtSetCurrMachining(nOperId)
|
Dim bRepeat As Boolean = False
|
||||||
Dim dAddLen As Double = 0
|
Do
|
||||||
EgtGetMachiningParam(MCH_MP.ENDADDLEN, dAddLen)
|
EgtSetCurrMachining(nOperId)
|
||||||
If dAddLen - dOrigUeal < -10 * EPS_SMALL Then Return
|
Dim dAddLen As Double = 0
|
||||||
EgtSetMachiningParam(MCH_MP.ENDADDLEN, dAddLen + dUsal - dOrigUeal)
|
EgtGetMachiningParam(MCH_MP.ENDADDLEN, dAddLen)
|
||||||
EgtSetInfo(nOperId, INFO_MCH_USER_EAL, dUsal)
|
If dAddLen - dOrigUeal < -10 * EPS_SMALL Then
|
||||||
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
Return
|
||||||
|
End If
|
||||||
|
EgtSetMachiningParam(MCH_MP.ENDADDLEN, dAddLen + dUeal - dOrigUeal)
|
||||||
|
EgtSetInfo(nOperId, INFO_MCH_USER_EAL, dUeal)
|
||||||
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
||||||
|
bRepeat = Not UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
||||||
|
If bRepeat Then
|
||||||
|
EgtSetMachiningParam(MCH_MP.ENDADDLEN, dOrigUeal)
|
||||||
|
EgtSetInfo(nOperId, INFO_MCH_USER_EAL, dOrigUeal)
|
||||||
|
dUeal = dOrigUeal
|
||||||
|
End If
|
||||||
|
Loop Until Not bRepeat
|
||||||
' verifico interferenza
|
' verifico interferenza
|
||||||
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
|
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
|
||||||
ColorMachining(m_MachiningList(nI))
|
ColorMachining(m_MachiningList(nI))
|
||||||
@@ -2208,13 +2228,21 @@ Public Class SplitModeVM
|
|||||||
Set(value As Boolean)
|
Set(value As Boolean)
|
||||||
If Not IsNothing(value) Then
|
If Not IsNothing(value) Then
|
||||||
m_IsSelected = value
|
m_IsSelected = value
|
||||||
If value Then
|
If value AndAlso Not OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList.Contains(Me) Then
|
||||||
OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList.Add(Me)
|
OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList.Add(Me)
|
||||||
Else
|
Else
|
||||||
OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList.Remove(Me)
|
OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList.Remove(Me)
|
||||||
End If
|
End If
|
||||||
If OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList.Count = 0 Then Return
|
' se non è stato aggiunto nessun nuovo elemento alla lista dei selezionati allora esco
|
||||||
If OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList.Count = 1 Then OmagOFFICEMap.refSplitModeVM.m_bAreHomogeneous = True
|
If OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList.Count = 0 Then
|
||||||
|
EgtDraw()
|
||||||
|
NotifyPropertyChanged("IsSelected")
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
' se ho un solo elemento allora so che è coerrente con se stesso come lavorazione
|
||||||
|
If OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList.Count = 1 Then
|
||||||
|
OmagOFFICEMap.refSplitModeVM.m_bAreHomogeneous = True
|
||||||
|
End If
|
||||||
' creo lista ordinata dei selezionati
|
' creo lista ordinata dei selezionati
|
||||||
Dim ItemList As New List(Of NameIdLsBxItem)
|
Dim ItemList As New List(Of NameIdLsBxItem)
|
||||||
For Each Item In OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList
|
For Each Item In OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList
|
||||||
@@ -2223,37 +2251,6 @@ Public Class SplitModeVM
|
|||||||
|
|
||||||
' ------------------------ verifico che le lavorazioni siano dello stesso tipo ------------------------
|
' ------------------------ verifico che le lavorazioni siano dello stesso tipo ------------------------
|
||||||
OmagOFFICEMap.refSplitModeVM.VerifyHomogenousMachining(ItemList)
|
OmagOFFICEMap.refSplitModeVM.VerifyHomogenousMachining(ItemList)
|
||||||
'Dim nSawing As Integer = 0
|
|
||||||
'Dim nWaterjetting As Integer = 0
|
|
||||||
'Dim nOtherMachining As Integer = 0
|
|
||||||
'' conto il numero di tipi di lavprazioni
|
|
||||||
'For Each Item As NameIdLsBxItem In ItemList
|
|
||||||
' If Item.Type = MCH_OY.SAWING Then
|
|
||||||
' nSawing += 1
|
|
||||||
' ElseIf Item.Type = MCH_OY.WATERJETTING Then
|
|
||||||
' nWaterjetting += 1
|
|
||||||
' Else
|
|
||||||
' nOtherMachining += 1
|
|
||||||
' End If
|
|
||||||
'Next
|
|
||||||
'' verifico se le lavorazioni sono omeogenee
|
|
||||||
'If nSawing > 0 And (nWaterjetting > 0 Or nOtherMachining > 0) Then
|
|
||||||
' m_bAreHomogeneous = False
|
|
||||||
' VisibilityButtonFromMachinig(MCH_OY.SAWING)
|
|
||||||
'ElseIf nSawing = 0 And nOtherMachining > 0 And nWaterjetting > 0 Then
|
|
||||||
' m_bAreHomogeneous = False
|
|
||||||
' VisibilityButtonFromMachinig(MCH_OY.WATERJETTING)
|
|
||||||
'Else
|
|
||||||
' VisibilityButtonFromMachinig(ItemList(0).Type)
|
|
||||||
' m_bAreHomogeneous = True
|
|
||||||
'End If
|
|
||||||
'' eventualmente stampo messaggio
|
|
||||||
'If Not m_bAreHomogeneous Then
|
|
||||||
' m_MainWindow.m_CurrentProjectPageUC.ClearMessage()
|
|
||||||
' m_MainWindow.m_CurrentProjectPageUC.SetWarningMessage("Lavorazioni non omogenee")
|
|
||||||
'Else
|
|
||||||
' m_MainWindow.m_CurrentProjectPageUC.ClearMessage()
|
|
||||||
'End If
|
|
||||||
' -----------------------------------------------------------------------------------------------------
|
' -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
ItemList.Sort(Function(x, y) Comparer(Of Integer).Default.Compare(OmagOFFICEMap.refSplitModeVM.m_ItemList.IndexOf(x),
|
ItemList.Sort(Function(x, y) Comparer(Of Integer).Default.Compare(OmagOFFICEMap.refSplitModeVM.m_ItemList.IndexOf(x),
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -148,10 +148,23 @@
|
|||||||
Margin="2.5,0,0,0"/>
|
Margin="2.5,0,0,0"/>
|
||||||
</UniformGrid>
|
</UniformGrid>
|
||||||
|
|
||||||
<Button Content="{Binding RemovePartMsg}"
|
<Grid Margin="0,0,-2.5,5">
|
||||||
Style="{StaticResource OptionPanel_TextButton}"
|
<Grid.ColumnDefinitions>
|
||||||
Command="{Binding RemovePartCommand}"
|
<ColumnDefinition Width="1*"/>
|
||||||
Margin="0,0,0,5"/>
|
<ColumnDefinition Width="1*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Button Content="{Binding RemovePartMsg}"
|
||||||
|
Grid.ColumnSpan="{Binding DragRettangle_Cl_Span}"
|
||||||
|
Style="{StaticResource OptionPanel_TextButton}"
|
||||||
|
Command="{Binding RemovePartCommand}"
|
||||||
|
Margin="0,0,2.5,0"/>
|
||||||
|
<ToggleButton Content="{Binding DragRettangleMsg}" Grid.Column="1"
|
||||||
|
Visibility="{Binding DragRettangle_Visibility}"
|
||||||
|
Style="{StaticResource OptionPanel_ToggleButton}"
|
||||||
|
IsChecked="{Binding bDragRettangle}"
|
||||||
|
Margin="2.5,0,2.5,0"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
|
||||||
<UniformGrid Columns="2" Margin="0,0,0,5">
|
<UniformGrid Columns="2" Margin="0,0,0,5">
|
||||||
<Button Content="{Binding SelectAllMsg}"
|
<Button Content="{Binding SelectAllMsg}"
|
||||||
|
|||||||
@@ -35,6 +35,18 @@ Public Class NestingTabVM
|
|||||||
Private m_bTrfData As Boolean = False
|
Private m_bTrfData As Boolean = False
|
||||||
Private m_bCsvData As Boolean = False
|
Private m_bCsvData As Boolean = False
|
||||||
|
|
||||||
|
' Id del rettangolo, del traglio e della curva da modificare tramite Drag
|
||||||
|
Private m_nIdSelectedOutLoopRettangle As Integer = GDB_ID.NULL
|
||||||
|
Private m_nIdSelectedRegionRettangle As Integer = GDB_ID.NULL
|
||||||
|
Private m_nIdSelectedSawRettangle As Integer = GDB_ID.NULL
|
||||||
|
Private m_nIdSelectedCurvRettangle As Integer = GDB_ID.NULL
|
||||||
|
Private m_nIdSelectedTextRettangle As Integer = GDB_ID.NULL
|
||||||
|
Private m_nIdSelectedTextTopRettangle As Integer = GDB_ID.NULL
|
||||||
|
Private m_nIdSelectedFlatSurfRettangle As Integer = GDB_ID.NULL
|
||||||
|
Private m_SideListRettangle(4) As Integer
|
||||||
|
Private m_sTextContent As String = String.Empty
|
||||||
|
|
||||||
|
|
||||||
Private m_CsvImportWindow As CsvWindowV
|
Private m_CsvImportWindow As CsvWindowV
|
||||||
Friend ReadOnly Property CsvImportWindow As CsvWindowV
|
Friend ReadOnly Property CsvImportWindow As CsvWindowV
|
||||||
Get
|
Get
|
||||||
@@ -103,8 +115,7 @@ Public Class NestingTabVM
|
|||||||
End Get
|
End Get
|
||||||
Set(value As String)
|
Set(value As String)
|
||||||
Dim dValue As Double
|
Dim dValue As Double
|
||||||
'StringToDouble(value, m_dRotationAngle)
|
If StringToDouble(value, dValue) Then
|
||||||
If StringToLen(value, dValue) Then
|
|
||||||
If dValue < 0 Then
|
If dValue < 0 Then
|
||||||
dValue = 0
|
dValue = 0
|
||||||
ElseIf dValue > 180 Then
|
ElseIf dValue > 180 Then
|
||||||
@@ -161,6 +172,12 @@ Public Class NestingTabVM
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property DragRettangleMsg As String
|
||||||
|
Get
|
||||||
|
Return "Drag Rectangle"
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
Public ReadOnly Property SelectAllMsg As String
|
Public ReadOnly Property SelectAllMsg As String
|
||||||
Get
|
Get
|
||||||
Return EgtMsg(MSG_NESTPAGEUC + 4)
|
Return EgtMsg(MSG_NESTPAGEUC + 4)
|
||||||
@@ -211,6 +228,13 @@ Public Class NestingTabVM
|
|||||||
#Region "CONSTRUCTOR"
|
#Region "CONSTRUCTOR"
|
||||||
|
|
||||||
Sub New()
|
Sub New()
|
||||||
|
If (GetMainPrivateProfileInt(S_NEST, K_DRAGRETTANGLE, 1) <> 0) Then
|
||||||
|
m_DragRettangle_Visibility = Visibility.Visible
|
||||||
|
Else
|
||||||
|
m_DragRettangle_Visibility = Visibility.Collapsed
|
||||||
|
End If
|
||||||
|
NotifyPropertyChanged("DragRettangle_Visibility")
|
||||||
|
NotifyPropertyChanged("DragRettangle_Cl_Span")
|
||||||
' Creo riferimento a questa classe in OmagOFFICEMap
|
' Creo riferimento a questa classe in OmagOFFICEMap
|
||||||
OmagOFFICEMap.SetRefNestingTabVM(Me)
|
OmagOFFICEMap.SetRefNestingTabVM(Me)
|
||||||
End Sub
|
End Sub
|
||||||
@@ -389,8 +413,29 @@ Public Class NestingTabVM
|
|||||||
If Not EgtGetPartPartClusterCenterGlob(nId, ptCen) Then Return False
|
If Not EgtGetPartPartClusterCenterGlob(nId, ptCen) Then Return False
|
||||||
' Rotazione del pezzo attorno al suo centro
|
' Rotazione del pezzo attorno al suo centro
|
||||||
EgtRotate(nId, ptCen, Vector3d.Z_AX(), dAngRotDeg, GDB_RT.GLOB)
|
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
|
End If
|
||||||
' Passo al successivo selezionato
|
' Passo al successivo selezionato
|
||||||
nId = EgtGetNextSelectedObj()
|
nId = EgtGetNextSelectedObj()
|
||||||
@@ -506,8 +551,322 @@ Public Class NestingTabVM
|
|||||||
Return True
|
Return True
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
#Region "DRAG RETTANGLE"
|
||||||
|
|
||||||
|
' funzione chiamata da OnMyMouseMoveScene: verifica che la selezione sia corretta (deve essere il lato di una figura rettangolare)
|
||||||
|
Private Sub OnMyMouseDownSceneSelSideRettangle(sender As Object, e As System.Windows.Forms.MouseEventArgs)
|
||||||
|
' Si può selezionare solo con il tasto sinistro e se il bottone TEST Attivo
|
||||||
|
If e.Button <> Windows.Forms.MouseButtons.Left Then
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
' Verifico se selezionato indicativo di pezzo
|
||||||
|
EgtSetObjFilterForSelWin(False, True, False, False, False)
|
||||||
|
Dim nSelMy As Integer
|
||||||
|
EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSelMy)
|
||||||
|
Dim nIdMy As Integer = EgtGetFirstObjInSelWin()
|
||||||
|
While nIdMy <> GDB_ID.NULL
|
||||||
|
Dim sLayer As String = String.Empty
|
||||||
|
' layer di origine
|
||||||
|
Dim nIdParent As Integer = EgtGetParent(nIdMy)
|
||||||
|
' recupero il nome del Layer
|
||||||
|
EgtGetName(nIdParent, sLayer)
|
||||||
|
' solo se il nome del layer è quello associato ad un lato esterno allora procedo con l'evidenziazione
|
||||||
|
If sLayer = NAME_OUTLOOP Then
|
||||||
|
If EgtGetType(nIdMy) = GDB_TY.CRV_LINE Then
|
||||||
|
' -------------------------------- INIZIO VERIFICHE --------------------------------
|
||||||
|
m_nIdSelectedOutLoopRettangle = nIdParent
|
||||||
|
If Not IsRettangle(m_SideListRettangle) Then
|
||||||
|
'm_CurrProjPage.ClearMessage()
|
||||||
|
'm_CurrProjPage.SetWarningMessage("Non è un rettangolo (0)")
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
' recupero il gruppo della lavorazione associata
|
||||||
|
Dim nIdParentPart As Integer = EgtGetParent(nIdParent)
|
||||||
|
Dim nIdPV As Integer = EgtGetFirstNameInGroup(nIdParentPart, "PV")
|
||||||
|
' se non esiste un gruppo di lavorazione associato allora esco
|
||||||
|
If nIdPV = GDB_ID.NULL Then
|
||||||
|
'm_CurrProjPage.ClearMessage()
|
||||||
|
'm_CurrProjPage.SetWarningMessage("Pezzo in parcheggio (1)")
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
' se esiste ma è vuoto (pezzo scaricato da tavola)
|
||||||
|
If EgtGetFirstInGroup(nIdPV) = GDB_ID.NULL Then
|
||||||
|
'm_CurrProjPage.ClearMessage()
|
||||||
|
'm_CurrProjPage.SetWarningMessage("Pezzo in parcheggio (2)")
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
' Devo verificare che sia una lavorazione solo di lama?
|
||||||
|
Dim nIdSaw As Integer = EgtGetFirstNameInGroup(nIdPV, "Saw" & nIdMy.ToString)
|
||||||
|
' -------------------------------- FINE VERIFICHE --------------------------------
|
||||||
|
|
||||||
|
If Not EgtGetGroupObjs(nIdSaw) Then
|
||||||
|
m_nIdSelectedSawRettangle = nIdSaw
|
||||||
|
m_nIdSelectedCurvRettangle = nIdMy
|
||||||
|
|
||||||
|
m_nIdSelectedRegionRettangle = EgtGetFirstNameInGroup(nIdParentPart, NAME_REGION)
|
||||||
|
' recupero i testi cintenuti nel layer Region
|
||||||
|
If m_nIdSelectedRegionRettangle <> GDB_ID.NULL Then
|
||||||
|
Dim nCurrId As Integer = EgtGetFirstInGroup(m_nIdSelectedRegionRettangle)
|
||||||
|
While nCurrId <> GDB_ID.NULL
|
||||||
|
If EgtGetType(nCurrId) = GDB_TY.EXT_TEXT Then
|
||||||
|
Dim sVal As String = String.Empty
|
||||||
|
EgtTextGetContent(nCurrId, sVal)
|
||||||
|
If sVal = "*TOP*" Then
|
||||||
|
m_nIdSelectedTextTopRettangle = nCurrId
|
||||||
|
Else
|
||||||
|
m_nIdSelectedTextRettangle = nCurrId
|
||||||
|
m_sTextContent = GetMyRettangleText(sVal)
|
||||||
|
End If
|
||||||
|
ElseIf EgtGetType(nCurrId) = GDB_TY.SRF_FRGN Then
|
||||||
|
m_nIdSelectedFlatSurfRettangle = nCurrId
|
||||||
|
End If
|
||||||
|
nCurrId = EgtGetNext(nCurrId)
|
||||||
|
End While
|
||||||
|
End If
|
||||||
|
' seleziono ed evidenzio il lato selezionato
|
||||||
|
EgtSelectObj(nIdSaw)
|
||||||
|
EgtSetMark(nIdSaw)
|
||||||
|
EgtSelectObj(nIdMy)
|
||||||
|
EgtDraw()
|
||||||
|
Exit While
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
' se le'elemto corrente non è una linea
|
||||||
|
End If
|
||||||
|
' se le'elemto corrente non appartiene al layer OutLoop passo al prossimo elemento dell'elenco
|
||||||
|
nIdMy = EgtGetNextObjInSelWin()
|
||||||
|
End While
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
' restituisce il valore del Text ripulito dalle dimensioni
|
||||||
|
Private Function GetMyRettangleText(sTextPz As String) As String
|
||||||
|
' da DrawPageUC.xaml.vb/MultipleInsert
|
||||||
|
Dim sText As String = String.Empty
|
||||||
|
If sTextPz.Contains("<br/>") Then
|
||||||
|
Dim nLastIndex As Integer = sTextPz.LastIndexOf(">")
|
||||||
|
sText = sTextPz.Remove(nLastIndex + 1)
|
||||||
|
Return sText
|
||||||
|
End If
|
||||||
|
If sTextPz.Contains(" ") Then
|
||||||
|
Dim sInfo() As String = sTextPz.Split(" "c)
|
||||||
|
If sInfo.Count > 3 Then
|
||||||
|
Return sText = sInfo(0) & " " & sInfo(1) & " "
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Return sText
|
||||||
|
End Function
|
||||||
|
|
||||||
|
' verifico che la figura selezionata sia realmente un rettangolo
|
||||||
|
Private Function IsRettangle(ByRef IdSideList() As Integer) As Boolean
|
||||||
|
' creo una lista con i lati del rettangolo
|
||||||
|
Dim nCounter As Integer = 0
|
||||||
|
' recupero i lati dal leyer "OutLoop"
|
||||||
|
Dim IdSideRettangle As Integer = EgtGetFirstInGroup(m_nIdSelectedOutLoopRettangle)
|
||||||
|
While IdSideRettangle <> GDB_ID.NULL And nCounter < 4
|
||||||
|
Dim sVal As String = String.Empty
|
||||||
|
Dim dPrevAng As Double = 0
|
||||||
|
EgtGetInfo(IdSideRettangle, "PrevAng", sVal)
|
||||||
|
StringToDouble(sVal, dPrevAng)
|
||||||
|
Dim dNextAng As Double = 0
|
||||||
|
EgtGetInfo(IdSideRettangle, "NextAng", sVal)
|
||||||
|
StringToDouble(sVal, dNextAng)
|
||||||
|
' se gli angoli non sono retti allora esco senza caricare il lato corrente
|
||||||
|
If Math.Abs(dPrevAng - 90) > EPS_ANG_SMALL OrElse Math.Abs(dNextAng - 90) > EPS_ANG_SMALL Then
|
||||||
|
Exit While
|
||||||
|
End If
|
||||||
|
IdSideList(nCounter) = IdSideRettangle
|
||||||
|
nCounter += 1
|
||||||
|
IdSideRettangle = EgtGetNext(IdSideRettangle)
|
||||||
|
End While
|
||||||
|
' verifico che siano solo quattro lati
|
||||||
|
If IdSideRettangle = GDB_ID.NULL And nCounter = 4 Then
|
||||||
|
' solo se la figura ha 4 lati ortogonali
|
||||||
|
Return True
|
||||||
|
End If
|
||||||
|
|
||||||
|
m_nIdSelectedOutLoopRettangle = GDB_ID.NULL
|
||||||
|
' la figura presenta più/meno di 4 lati
|
||||||
|
Return False
|
||||||
|
End Function
|
||||||
|
|
||||||
|
' recupero le informazioni correnti per sapere se la figura è mdificabile
|
||||||
|
Private Function GetRettangleInfoScale(ByRef frFixed As Frame3d, ByRef MaxLen As Double, ByRef MinLen As Double) As Vector3d
|
||||||
|
' determino la direzione del lato selezionato
|
||||||
|
Dim vtDirSelectedCurv As New Vector3d
|
||||||
|
EgtStartVector(m_nIdSelectedCurvRettangle, GDB_ID.ROOT, vtDirSelectedCurv)
|
||||||
|
|
||||||
|
' recupero il lato successivo a quello selezionato
|
||||||
|
Dim Index As Integer = 0
|
||||||
|
Dim Len As Double = 0
|
||||||
|
For Ind As Integer = 0 To 3
|
||||||
|
If m_SideListRettangle(Ind) = m_nIdSelectedCurvRettangle Then
|
||||||
|
' verifico se esiste un lato Precedente altrimenti recupero l'ultimo della lista
|
||||||
|
If Ind = 0 Then
|
||||||
|
Index = 3
|
||||||
|
Else
|
||||||
|
Index = Ind - 1
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
' recupero la dimensione del lato
|
||||||
|
EgtCurveLength(m_SideListRettangle(Index), MaxLen)
|
||||||
|
EgtCurveLength(m_nIdSelectedCurvRettangle, MinLen)
|
||||||
|
|
||||||
|
' verifico che il lato selezionato sia il maggiore
|
||||||
|
If MinLen > MaxLen Then Return Nothing
|
||||||
|
|
||||||
|
' determimo il versore dal lato appena calcolato
|
||||||
|
Dim vtDir As New Vector3d
|
||||||
|
|
||||||
|
EgtStartVector(m_SideListRettangle(Index), GDB_ID.ROOT, vtDir)
|
||||||
|
vtDir.Normalize()
|
||||||
|
Dim dProjectionBaseX As Double = vtDir * Vector3d.X_AX
|
||||||
|
Dim ptFixed As New Point3d
|
||||||
|
EgtStartPoint(m_SideListRettangle(Index), GDB_ID.ROOT, ptFixed)
|
||||||
|
|
||||||
|
Dim vtPerp As New Vector3d(vtDir.x, vtDir.y, vtDir.z)
|
||||||
|
vtPerp.Rotate(Vector3d.Z_AX, 90)
|
||||||
|
|
||||||
|
' determino il Frame corrente
|
||||||
|
frFixed = New Frame3d(ptFixed, vtDir, vtPerp, Vector3d.Z_AX)
|
||||||
|
|
||||||
|
Return vtDir
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
' funzione chiamata da OnMyMouseMoveScene: gestisce la modifica lungo una dimensione del rettangolo selezionato
|
||||||
|
Private Sub OnMyMouseMoveSawRettangle(sender As Object, e As System.Windows.Forms.MouseEventArgs)
|
||||||
|
' Se drag non abilitato o già in esecuzione, esco
|
||||||
|
If Not m_bDrag Or m_bDragging Then Return
|
||||||
|
' Se primo movimento di drag, verifico di aver superato la soglia di movimento in pixel
|
||||||
|
If m_bDragToStart Then
|
||||||
|
If Math.Abs(e.Location.X - m_locPrev.X) < m_nRestRadius And
|
||||||
|
Math.Abs(e.Location.Y - m_locPrev.Y) < m_nRestRadius Then
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
m_bDragToStart = False
|
||||||
|
End If
|
||||||
|
|
||||||
|
' riferiemento che deve rimanere fisso del rettangolo
|
||||||
|
Dim frFixed As Frame3d = Nothing
|
||||||
|
' lunghezza del lato da modificare
|
||||||
|
Dim MaxLen As Double = 0
|
||||||
|
Dim MinLen As Double = 0
|
||||||
|
' recupero info sul rettangolo selezionato
|
||||||
|
Dim vtDir As Vector3d = GetRettangleInfoScale(frFixed, MaxLen, MinLen)
|
||||||
|
If vtDir.Equals(Vector3d.NULL) Then
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Inizio esecuzione di drag
|
||||||
|
m_bDragging = True
|
||||||
|
|
||||||
|
' Ricavo il punto corrente in coordinate mondo
|
||||||
|
Dim ptCurr As Point3d
|
||||||
|
EgtUnProjectPoint(e.Location, ptCurr)
|
||||||
|
' Ricavo il vettore di movimento
|
||||||
|
Dim vtMove As Vector3d = ptCurr - m_ptPrev
|
||||||
|
' ricavo il valore efficace di allungamento (la proiezione)
|
||||||
|
Dim dProjection As Double = vtMove * vtDir
|
||||||
|
vtMove = vtDir * dProjection
|
||||||
|
' recupero il valore di scalatura
|
||||||
|
Dim dScalefactor = dProjection / MaxLen + 1
|
||||||
|
|
||||||
|
' Modifico dimensione figura
|
||||||
|
If Math.Abs(dScalefactor) > EPS_SMALL * EPS_SMALL Then
|
||||||
|
EgtScale(m_nIdSelectedOutLoopRettangle, frFixed, dScalefactor, 1, 1, GDB_ID.ROOT)
|
||||||
|
EgtScale(m_nIdSelectedFlatSurfRettangle, frFixed, dScalefactor, 1, 1, GDB_ID.ROOT)
|
||||||
|
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, GDB_ID.ROOT)
|
||||||
|
If m_nIdSelectedTextTopRettangle <> GDB_ID.NULL Then
|
||||||
|
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) 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, GDB_ID.ROOT)
|
||||||
|
If m_nIdSelectedTextTopRettangle <> GDB_ID.NULL Then
|
||||||
|
EgtMove(m_nIdSelectedTextTopRettangle, -vtMove * 0.5, GDB_ID.ROOT)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
EgtDraw()
|
||||||
|
' Aggiorno il punto precedente
|
||||||
|
m_ptPrev = ptCurr
|
||||||
|
' Terminata esecuzione di drag
|
||||||
|
m_bDragging = False
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
' funzione chiamata da OnMyMouseUp: gestisce il reset di tutti gli indici in uso
|
||||||
|
Public Sub ResetDragRettangleParam()
|
||||||
|
' deseleziono l'elemento corrente
|
||||||
|
EgtDeselectObj(m_nIdSelectedSawRettangle)
|
||||||
|
EgtDeselectObj(m_nIdSelectedCurvRettangle)
|
||||||
|
EgtResetMark(m_nIdSelectedSawRettangle)
|
||||||
|
' resetto gli indici
|
||||||
|
m_nIdSelectedOutLoopRettangle = GDB_ID.NULL
|
||||||
|
m_nIdSelectedRegionRettangle = GDB_ID.NULL
|
||||||
|
m_nIdSelectedSawRettangle = GDB_ID.NULL
|
||||||
|
m_nIdSelectedCurvRettangle = GDB_ID.NULL
|
||||||
|
m_nIdSelectedTextRettangle = GDB_ID.NULL
|
||||||
|
m_nIdSelectedTextTopRettangle = GDB_ID.NULL
|
||||||
|
m_nIdSelectedFlatSurfRettangle = GDB_ID.NULL
|
||||||
|
m_SideListRettangle = {GDB_ID.NULL, GDB_ID.NULL, GDB_ID.NULL, GDB_ID.NULL}
|
||||||
|
m_sTextContent = String.Empty
|
||||||
|
' disattivo il drag
|
||||||
|
m_bDrag = False
|
||||||
|
' aggiorno le lavorazioni
|
||||||
|
Dim nWarn As Integer = 0
|
||||||
|
ResetAllMachinings(nWarn)
|
||||||
|
EgtDraw()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
#End Region ' Drag Rettangolo
|
||||||
|
|
||||||
#End Region ' METHODS
|
#End Region ' METHODS
|
||||||
|
|
||||||
|
Private m_bDragRettangle As Boolean
|
||||||
|
Public Property bDragRettangle As Boolean
|
||||||
|
Get
|
||||||
|
Return m_bDragRettangle
|
||||||
|
End Get
|
||||||
|
Set(value As Boolean)
|
||||||
|
m_bDragRettangle = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Private m_DragRettangle_Visibility As Visibility = Visibility.Collapsed
|
||||||
|
Public ReadOnly Property DragRettangle_Visibility As Visibility
|
||||||
|
Get
|
||||||
|
Return m_DragRettangle_Visibility
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property DragRettangle_Cl_Span As Integer
|
||||||
|
Get
|
||||||
|
If m_DragRettangle_Visibility = Visibility.Visible Then
|
||||||
|
Return 1
|
||||||
|
End If
|
||||||
|
Return 2
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
|
||||||
#Region "COMMANDS"
|
#Region "COMMANDS"
|
||||||
|
|
||||||
#Region "DrawCommand"
|
#Region "DrawCommand"
|
||||||
@@ -901,6 +1260,8 @@ Public Class NestingTabVM
|
|||||||
End Property
|
End Property
|
||||||
|
|
||||||
Public Sub StorePart(ByVal param As Object)
|
Public Sub StorePart(ByVal param As Object)
|
||||||
|
' creo la lista delle famiglie di pezzi presenti in parcheggio
|
||||||
|
GetFamilyGroupInPark()
|
||||||
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
|
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
|
||||||
' Ciclo di parcheggio dei pezzi selezionati
|
' Ciclo di parcheggio dei pezzi selezionati
|
||||||
Dim nId As Integer = EgtGetFirstSelectedObj()
|
Dim nId As Integer = EgtGetFirstSelectedObj()
|
||||||
@@ -973,13 +1334,20 @@ Public Class NestingTabVM
|
|||||||
If bEraseCsvParts OrElse Not EgtExistsInfo(nId, INFO_CSV_PATH) Then
|
If bEraseCsvParts OrElse Not EgtExistsInfo(nId, INFO_CSV_PATH) Then
|
||||||
' Se pezzo in parcheggio cancello direttamente
|
' Se pezzo in parcheggio cancello direttamente
|
||||||
If EgtIsPart(nId) Then
|
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
|
' Eventuale notifica al VeinMatching
|
||||||
VeinMatching.OnRemovePart(nId, False)
|
VeinMatching.OnRemovePart(nId, False)
|
||||||
' Rimuovo le lavorazioni
|
' Rimuovo le lavorazioni
|
||||||
EraseMachinings(nId)
|
EraseMachinings(nId)
|
||||||
' Cancello
|
' Cancello
|
||||||
EgtErase(nId)
|
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
|
ElseIf EgtGetParent(nId) = EstCalc.GetRawId() Then
|
||||||
If EgtRemovePartFromRawPart(nId) Then
|
If EgtRemovePartFromRawPart(nId) Then
|
||||||
' Eventuale notifica al VeinMatching
|
' Eventuale notifica al VeinMatching
|
||||||
@@ -1169,6 +1537,17 @@ Public Class NestingTabVM
|
|||||||
#Region "EVENTS"
|
#Region "EVENTS"
|
||||||
|
|
||||||
Friend Sub OnMouseDownScene(sender As Object, e As Windows.Forms.MouseEventArgs)
|
Friend Sub OnMouseDownScene(sender As Object, e As Windows.Forms.MouseEventArgs)
|
||||||
|
' se in modalità DragRettangle (deformazione delle componenti rettangolari)
|
||||||
|
If m_bDragRettangle Then
|
||||||
|
OnMyMouseDownSceneSelSideRettangle(sender, e)
|
||||||
|
' Dati per drag (abilito il Drag)
|
||||||
|
m_locPrev = e.Location
|
||||||
|
m_bDrag = EgtUnProjectPoint(e.Location, m_ptPrev) And m_nIdSelectedCurvRettangle <> GDB_ID.NULL
|
||||||
|
m_bDragToStart = m_bDrag
|
||||||
|
m_bVerify = m_bDrag AndAlso (Keyboard.Modifiers And ModifierKeys.Shift) > 0
|
||||||
|
m_vtTotMove = Vector3d.NULL()
|
||||||
|
Return
|
||||||
|
End If
|
||||||
' Per default no drag
|
' Per default no drag
|
||||||
m_bDrag = False
|
m_bDrag = False
|
||||||
' Verifico se selezionato indicativo di pezzo
|
' Verifico se selezionato indicativo di pezzo
|
||||||
@@ -1183,13 +1562,35 @@ Public Class NestingTabVM
|
|||||||
If EgtIsPart(nPartId) Or bPartInTable Then
|
If EgtIsPart(nPartId) Or bPartInTable Then
|
||||||
Dim nStat As Integer = GDB_ST.ON_
|
Dim nStat As Integer = GDB_ST.ON_
|
||||||
EgtGetStatus(nPartId, nStat)
|
EgtGetStatus(nPartId, nStat)
|
||||||
' Se già selezionato
|
|
||||||
If nStat = GDB_ST.SEL Then
|
' verifico se l'lemento selezionato è il numero di pezzi
|
||||||
' Memorizzo Id da deselezionare
|
If EgtGetType(nId) = GDB_TY.EXT_TEXT Then
|
||||||
m_nIdToDesel = nPartId
|
Dim NameLayer As String = String.Empty
|
||||||
Else
|
EgtGetName(EgtGetParent(nId), NameLayer)
|
||||||
' Memorizzo Id da selezionare
|
If NameLayer = INFO_COUNTERLY Then
|
||||||
m_nIdToSel = nPartId
|
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
|
End If
|
||||||
' Drag possibile
|
' Drag possibile
|
||||||
m_bDrag = True
|
m_bDrag = True
|
||||||
@@ -1216,6 +1617,13 @@ Public Class NestingTabVM
|
|||||||
End If
|
End If
|
||||||
m_bDragToStart = False
|
m_bDragToStart = False
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
' se devo muovere un lato del rettangolo
|
||||||
|
If m_bDragRettangle Then
|
||||||
|
OnMyMouseMoveSawRettangle(sender, e)
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
|
||||||
' Determino cosa muovere
|
' Determino cosa muovere
|
||||||
Dim nMoveId = If(m_nIdToSel <> GDB_ID.NULL, m_nIdToSel, GDB_ID.SEL)
|
Dim nMoveId = If(m_nIdToSel <> GDB_ID.NULL, m_nIdToSel, GDB_ID.SEL)
|
||||||
' Verifico se in tavola o in parcheggio
|
' Verifico se in tavola o in parcheggio
|
||||||
@@ -1235,7 +1643,20 @@ Public Class NestingTabVM
|
|||||||
Dim b3Ins As new BBox3d
|
Dim b3Ins As new BBox3d
|
||||||
EgtGetBBoxGlob( EgtGetFirstNameInGroup( nTestId, NAME_REGION), BBFLAG, b3Ins)
|
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)
|
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
|
' Gestione VeinMatching
|
||||||
VeinMatching.OnInsertPartInRaw( nMoveId)
|
VeinMatching.OnInsertPartInRaw( nMoveId)
|
||||||
' Imposto stato
|
' Imposto stato
|
||||||
@@ -1304,6 +1725,11 @@ Public Class NestingTabVM
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Friend Sub OnMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs)
|
Friend Sub OnMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs)
|
||||||
|
If m_bDragRettangle Then
|
||||||
|
' deseleziono gli oggeti, resetto le variabili usate, aggiorno il disegno
|
||||||
|
ResetDragRettangleParam()
|
||||||
|
Return
|
||||||
|
End If
|
||||||
' Se eseguito drag
|
' Se eseguito drag
|
||||||
If Not m_bDragToStart Then
|
If Not m_bDragToStart Then
|
||||||
' Se movimento con sola verifica finale
|
' Se movimento con sola verifica finale
|
||||||
@@ -1335,13 +1761,35 @@ Public Class NestingTabVM
|
|||||||
VeinMatching.OnMovePartInRaw(nMoveId)
|
VeinMatching.OnMovePartInRaw(nMoveId)
|
||||||
End If
|
End If
|
||||||
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
|
End If
|
||||||
m_bFromParking = False
|
m_bFromParking = False
|
||||||
' altrimenti caso con verifica durante il movimento
|
' altrimenti caso con verifica durante il movimento
|
||||||
Else
|
Else
|
||||||
' Basta reset alla fine
|
' Basta reset alla fine
|
||||||
End If
|
End If
|
||||||
' Se selezione da eseguire
|
|
||||||
|
' 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
|
ElseIf m_nIdToSel <> GDB_ID.NULL Then
|
||||||
' Determino se pezzo in tavola o in parcheggio
|
' Determino se pezzo in tavola o in parcheggio
|
||||||
Dim bPartInTable As Boolean = (EgtGetParent(m_nIdToSel) = GetRawId())
|
Dim bPartInTable As Boolean = (EgtGetParent(m_nIdToSel) = GetRawId())
|
||||||
@@ -1358,7 +1806,7 @@ Public Class NestingTabVM
|
|||||||
VeinMatching.OnSelectPart(m_nIdToSel)
|
VeinMatching.OnSelectPart(m_nIdToSel)
|
||||||
' Set flag posizione selezionati
|
' Set flag posizione selezionati
|
||||||
m_nPartPos = If(bPartInTable, PART_POS.IN_TABLE, PART_POS.OUT_TABLE)
|
m_nPartPos = If(bPartInTable, PART_POS.IN_TABLE, PART_POS.OUT_TABLE)
|
||||||
' Se deselezione da eseguire
|
' Se deselezione da eseguire
|
||||||
ElseIf m_nIdToDesel <> GDB_ID.NULL Then
|
ElseIf m_nIdToDesel <> GDB_ID.NULL Then
|
||||||
EgtDeselectObj(m_nIdToDesel)
|
EgtDeselectObj(m_nIdToDesel)
|
||||||
' Eventuale aggiornamento VeinMatching
|
' Eventuale aggiornamento VeinMatching
|
||||||
@@ -1414,3 +1862,48 @@ Public Class NestingTabVM
|
|||||||
#End Region ' EVENTS
|
#End Region ' EVENTS
|
||||||
|
|
||||||
End Class
|
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
|
||||||
@@ -129,7 +129,7 @@
|
|||||||
Margin="13,0,0,5"
|
Margin="13,0,0,5"
|
||||||
IsEnabled="{Binding OffsetYIsEnabled}" TextAlignment="Right"/>
|
IsEnabled="{Binding OffsetYIsEnabled}" TextAlignment="Right"/>
|
||||||
<TextBlock Text="{Binding KerfMsg}"/>
|
<TextBlock Text="{Binding KerfMsg}"/>
|
||||||
<EgtWpfLib5:EgtTextBox Text="{Binding Kerf}"
|
<EgtWpfLib5:EgtTextBox Text="{Binding Kerf, UpdateSourceTrigger=PropertyChanged}"
|
||||||
Margin="13,0,0,5"
|
Margin="13,0,0,5"
|
||||||
IsEnabled="{Binding KerfIsEnabled}" TextAlignment="Right"/>
|
IsEnabled="{Binding KerfIsEnabled}" TextAlignment="Right"/>
|
||||||
|
|
||||||
|
|||||||
@@ -223,6 +223,8 @@ Public Class RawPartTabVM
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
#Region "Parametri Grezzo"
|
||||||
|
|
||||||
Private m_dLength As Double
|
Private m_dLength As Double
|
||||||
Public Property Length As String
|
Public Property Length As String
|
||||||
Get
|
Get
|
||||||
@@ -388,7 +390,7 @@ Public Class RawPartTabVM
|
|||||||
RecalcRawPart()
|
RecalcRawPart()
|
||||||
ElseIf m_InvertKerf < 0 And dOffsetX >= 0 And dOffsetX < dMaxOffsetX + m_dKerf Then
|
ElseIf m_InvertKerf < 0 And dOffsetX >= 0 And dOffsetX < dMaxOffsetX + m_dKerf Then
|
||||||
OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
|
OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
|
||||||
m_dOffsetX = dOffsetX + m_dKerf
|
m_dOffsetX = dOffsetX
|
||||||
RecalcRawPart()
|
RecalcRawPart()
|
||||||
ElseIf dOffsetX <= dMinOffsetX - EPS_SMALL Then
|
ElseIf dOffsetX <= dMinOffsetX - EPS_SMALL Then
|
||||||
NotifyPropertyChanged("OffsetX")
|
NotifyPropertyChanged("OffsetX")
|
||||||
@@ -453,7 +455,7 @@ Public Class RawPartTabVM
|
|||||||
RecalcRawPart()
|
RecalcRawPart()
|
||||||
ElseIf m_InvertKerf < 0 And dOffsetY >= 0 And dOffsetY < dMaxOffsetY + m_dKerf Then
|
ElseIf m_InvertKerf < 0 And dOffsetY >= 0 And dOffsetY < dMaxOffsetY + m_dKerf Then
|
||||||
OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
|
OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
|
||||||
m_dOffsetY = dOffsetY + m_dKerf
|
m_dOffsetY = dOffsetY
|
||||||
RecalcRawPart()
|
RecalcRawPart()
|
||||||
ElseIf dOffsetY <= dMinOffsetY - EPS_SMALL Then
|
ElseIf dOffsetY <= dMinOffsetY - EPS_SMALL Then
|
||||||
NotifyPropertyChanged("OffsetY")
|
NotifyPropertyChanged("OffsetY")
|
||||||
@@ -496,6 +498,7 @@ Public Class RawPartTabVM
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Private m_PrecKerf As Double = 1
|
||||||
Private m_InvertKerf As Double = 1
|
Private m_InvertKerf As Double = 1
|
||||||
Public ReadOnly Property InvertKerf As Double
|
Public ReadOnly Property InvertKerf As Double
|
||||||
Get
|
Get
|
||||||
@@ -516,6 +519,12 @@ Public Class RawPartTabVM
|
|||||||
Dim dKerf As Double = 0
|
Dim dKerf As Double = 0
|
||||||
Dim dMaxKerf As Double = Math.Min(Math.Min(m_dOffsetX, m_dOffsetY),
|
Dim dMaxKerf As Double = Math.Min(Math.Min(m_dOffsetX, m_dOffsetY),
|
||||||
Math.Min(m_dTableLength - m_dLength - m_dOffsetX, m_dTableWidth - m_dWidth - m_dOffsetY))
|
Math.Min(m_dTableLength - m_dLength - m_dOffsetX, m_dTableWidth - m_dWidth - m_dOffsetY))
|
||||||
|
' recuper il segno del valore del Kerf precedente
|
||||||
|
Dim dInvertKerf As Double = 1
|
||||||
|
EgtGetInfo(EgtGetFirstRawPart(), KEY_INVERT_KERF, dInvertKerf)
|
||||||
|
m_PrecKerf = Math.Abs(m_dKerf)
|
||||||
|
m_PrecKerf = m_PrecKerf * dInvertKerf
|
||||||
|
|
||||||
' carcio di dati della lastra letti da intrfaccia
|
' carcio di dati della lastra letti da intrfaccia
|
||||||
Dim dRawLength, dRawWidth, dRawOffsetX, dRawOffsetY As Double
|
Dim dRawLength, dRawWidth, dRawOffsetX, dRawOffsetY As Double
|
||||||
If Not StringToLen(Length, dRawLength) Then Return
|
If Not StringToLen(Length, dRawLength) Then Return
|
||||||
@@ -526,9 +535,22 @@ Public Class RawPartTabVM
|
|||||||
If Not StringToLen(value, dKerf) Then
|
If Not StringToLen(value, dKerf) Then
|
||||||
Return
|
Return
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
' interrompo il processo di caricamento dati se il valore della TexBox è lo stesso della calsse
|
||||||
|
If dKerf * dInvertKerf = m_dKerf Then Return
|
||||||
|
|
||||||
If dKerf >= 0 And dKerf < dMaxKerf + EPS_SMALL Then
|
If dKerf >= 0 And dKerf < dMaxKerf + EPS_SMALL Then
|
||||||
OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
|
OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
|
||||||
If GetRawMode() <> RAWMODE.FROM_PHOTO Then
|
If GetRawMode() <> RAWMODE.FROM_PHOTO Then
|
||||||
|
If m_PrecKerf < 0 Then
|
||||||
|
' definsco la dimensione del grezzo pari a quella del kerf
|
||||||
|
m_dKerf = 0
|
||||||
|
AdjustRawPartNegativeKerf()
|
||||||
|
UpdateCircles()
|
||||||
|
UpdateRawPartKerf()
|
||||||
|
m_dKerf = dKerf
|
||||||
|
m_PrecKerf = 0
|
||||||
|
End If
|
||||||
' Specifico che si tratta di un Kerf negativo (per interfaccia grafica)
|
' Specifico che si tratta di un Kerf negativo (per interfaccia grafica)
|
||||||
EgtSetInfo(EstCalc.GetRawId(), KEY_INVERT_KERF, 1)
|
EgtSetInfo(EstCalc.GetRawId(), KEY_INVERT_KERF, 1)
|
||||||
SetInvertKerf(1)
|
SetInvertKerf(1)
|
||||||
@@ -554,14 +576,37 @@ Public Class RawPartTabVM
|
|||||||
EgtSetInfo(EstCalc.GetRawId(), KEY_INVERT_KERF, -1)
|
EgtSetInfo(EstCalc.GetRawId(), KEY_INVERT_KERF, -1)
|
||||||
SetInvertKerf(-1)
|
SetInvertKerf(-1)
|
||||||
' aggiorno dati grezzo (partendo dalle dimensioni esterne del grezzo)
|
' aggiorno dati grezzo (partendo dalle dimensioni esterne del grezzo)
|
||||||
m_dLength = dRawLength + 2 * dKerf
|
If m_PrecKerf >= 0 Then
|
||||||
m_dWidth = dRawWidth + 2 * dKerf
|
m_dLength = dRawLength + 2 * dKerf
|
||||||
m_dOffsetX = dRawOffsetX - dKerf
|
m_dWidth = dRawWidth + 2 * dKerf
|
||||||
m_dOffsetY = dRawOffsetY - dKerf
|
m_dOffsetX = dRawOffsetX - dKerf
|
||||||
|
m_dOffsetY = dRawOffsetY - dKerf
|
||||||
|
End If
|
||||||
m_dKerf = -dKerf
|
m_dKerf = -dKerf
|
||||||
|
If m_PrecKerf >= 0 Then
|
||||||
|
' definsco la dimensione del grezzo pari a quella del kerf
|
||||||
|
m_dKerf = 0
|
||||||
|
AdjustRawPartNegativeKerf(False)
|
||||||
|
EgtDraw()
|
||||||
|
UpdateCircles()
|
||||||
|
EgtDraw()
|
||||||
|
UpdateRawPartKerf()
|
||||||
|
EgtDraw()
|
||||||
|
m_dKerf = -dKerf
|
||||||
|
m_PrecKerf = 0
|
||||||
|
End If
|
||||||
|
If Not AdjustRawPartNegativeKerf() Then
|
||||||
|
' se fallisce la generazione (TEMPORANEAMENTE) ripristino l'ultimo valore inserito (vedi riga sopra)!
|
||||||
|
m_dKerf = 0
|
||||||
|
NotifyPropertyChanged("Kerf")
|
||||||
|
End If
|
||||||
|
EgtDraw()
|
||||||
|
UpdateCircles()
|
||||||
|
EgtDraw()
|
||||||
' RecalcRawPart()
|
' RecalcRawPart()
|
||||||
'EstCalc.UpdateRawPart()
|
'EstCalc.UpdateRawPart()
|
||||||
UpdateRawPartKerf()
|
'UpdateRawPartKerf()
|
||||||
|
|
||||||
' Recupero id contorno kerf
|
' Recupero id contorno kerf
|
||||||
Dim nKerfId As Integer = EgtGetFirstNameInGroup(EstCalc.GetRawId(), NAME_KERF)
|
Dim nKerfId As Integer = EgtGetFirstNameInGroup(EstCalc.GetRawId(), NAME_KERF)
|
||||||
' Modifico il colore
|
' Modifico il colore
|
||||||
@@ -601,6 +646,8 @@ Public Class RawPartTabVM
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
#End Region ' Parametri Grezzo
|
||||||
|
|
||||||
Public ReadOnly Property MaterialList As ObservableCollection(Of Material)
|
Public ReadOnly Property MaterialList As ObservableCollection(Of Material)
|
||||||
Get
|
Get
|
||||||
Return CurrentMachine.Materials
|
Return CurrentMachine.Materials
|
||||||
@@ -1079,6 +1126,8 @@ Public Class RawPartTabVM
|
|||||||
ElseIf dRawKerf > Math.Min(m_dTableLength, m_dTableWidth) / 5 Then
|
ElseIf dRawKerf > Math.Min(m_dTableLength, m_dTableWidth) / 5 Then
|
||||||
dRawKerf = Math.Min(m_dTableLength, m_dTableWidth) / 5
|
dRawKerf = Math.Min(m_dTableLength, m_dTableWidth) / 5
|
||||||
End If
|
End If
|
||||||
|
' assegno il valore del Kerf corrente
|
||||||
|
m_PrecKerf = dRawKerf
|
||||||
If dRawLen < 0 Then
|
If dRawLen < 0 Then
|
||||||
dRawLen = 100
|
dRawLen = 100
|
||||||
ElseIf dRawLen > m_dTableLength - 2 * dRawKerf Then
|
ElseIf dRawLen > m_dTableLength - 2 * dRawKerf Then
|
||||||
@@ -1307,6 +1356,52 @@ Public Class RawPartTabVM
|
|||||||
Return True
|
Return True
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
' -------------------------------- INIZIO Nuove funzioni per la gestione del Kerf negativo --------------------------------
|
||||||
|
|
||||||
|
Private Function AdjustRawPartNegativeKerf(Optional NegativeOffset As Boolean = True) As Boolean
|
||||||
|
' Se non c'è il grezzo, esco
|
||||||
|
If EstCalc.GetRawId() = GDB_ID.NULL Then Return False
|
||||||
|
' Cancello eventuale vecchio contorno di kerf
|
||||||
|
Dim nKerfId As Integer = EgtGetFirstNameInGroup(EstCalc.GetRawId(), NAME_KERF)
|
||||||
|
Dim nInvert As Double = 1
|
||||||
|
If Not NegativeOffset Then
|
||||||
|
nInvert = -1
|
||||||
|
End If
|
||||||
|
Dim dOffset As Double = (-m_dKerf - m_PrecKerf) * nInvert
|
||||||
|
EgtSaveFile("c:\EgtData\OmagOFFICE\Temp\Error.nge", NGE.TEXT)
|
||||||
|
Dim nCount As Integer = 0
|
||||||
|
Dim bOK As Boolean = EgtOffsetCurve(nKerfId, dOffset, OFF_TYPE.EXTEND)
|
||||||
|
EgtSetColor(nKerfId, m_KerfCol)
|
||||||
|
' ------ Gestione corretta dei kerf ------
|
||||||
|
'Dim nNewKerfId As Integer = EgtOffsetCurveAdv(nKerfId, dOffset, OFF_TYPE.EXTEND, nCount)
|
||||||
|
'EgtSetColor(nNewKerfId, m_KerfCol)
|
||||||
|
'EgtSetName(nNewKerfId, "Kerf")
|
||||||
|
'EgtErase(nKerfId)
|
||||||
|
'-----------------------------------------
|
||||||
|
' Salvo il valore del kerf (sempre in mm)
|
||||||
|
EgtSetInfo(EstCalc.GetRawId(), KEY_KERF, m_dKerf)
|
||||||
|
Return bOK
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Function AdjustRawPartPositionNegativeKerf() As Boolean
|
||||||
|
' Sistemo la posizione
|
||||||
|
Dim ptRef As New Point3d(m_dOffsetX, m_dOffsetY, CurrentMachine.dAdditionalTable)
|
||||||
|
If EgtMoveToCornerRawPart(EstCalc.GetRawId(), ptRef, MCH_CR.BL) Then
|
||||||
|
' Parametro ereditato da OmagCUT
|
||||||
|
' OkBtn.IsEnabled = True
|
||||||
|
OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
|
||||||
|
Else
|
||||||
|
' OkBtn.IsEnabled = False
|
||||||
|
Dim sMsg As String = EgtMsg(MSG_RAWPARTPAGEUC + 47)
|
||||||
|
OmagOFFICEMap.refStatusBarVM.SetOutputMessage(sMsg, 3, MSG_TYPE.ERROR_) ' Errore nella posizione o dimensione del grezzo
|
||||||
|
End If
|
||||||
|
' Aggiorno visualizzazione
|
||||||
|
EgtZoom(ZM.ALL)
|
||||||
|
Return True
|
||||||
|
End Function
|
||||||
|
|
||||||
|
' -------------------------------- FINE Nuove funzioni per la gestione del Kerf negativo --------------------------------
|
||||||
|
|
||||||
Private Sub UpdateRawPartHeight()
|
Private Sub UpdateRawPartHeight()
|
||||||
' Se da creare
|
' Se da creare
|
||||||
If EstCalc.GetRawId() = GDB_ID.NULL Then
|
If EstCalc.GetRawId() = GDB_ID.NULL Then
|
||||||
@@ -1583,8 +1678,11 @@ Public Class RawPartTabVM
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub AdjustRawPartOnExit()
|
Private Sub AdjustRawPartOnExit()
|
||||||
' Se non c'è il grezzo, esco
|
' Se non c'è il grezzo, esco dopo aver nascosto eventuale foto
|
||||||
If EstCalc.GetRawId() = GDB_ID.NULL Then Return
|
If EstCalc.GetRawId() = GDB_ID.NULL Then
|
||||||
|
ShowPhoto(False)
|
||||||
|
Return
|
||||||
|
End If
|
||||||
' Disabilito impostazione modificato
|
' Disabilito impostazione modificato
|
||||||
Dim bOldEnMod = EgtGetEnableModified()
|
Dim bOldEnMod = EgtGetEnableModified()
|
||||||
If bOldEnMod Then EgtDisableModified()
|
If bOldEnMod Then EgtDisableModified()
|
||||||
|
|||||||
@@ -469,6 +469,7 @@ Public Class SideEntityControlVM
|
|||||||
Parameter23_Visibility = Windows.Visibility.Hidden
|
Parameter23_Visibility = Windows.Visibility.Hidden
|
||||||
Parameter2_Visibility = Visibility.Visible
|
Parameter2_Visibility = Visibility.Visible
|
||||||
Parameter2ab_Visibility = Visibility.Hidden
|
Parameter2ab_Visibility = Visibility.Hidden
|
||||||
|
Parameter4_Visibility = Visibility.Hidden
|
||||||
ElseIf m_Mode = ModeOpt.FILOTOP Then
|
ElseIf m_Mode = ModeOpt.FILOTOP Then
|
||||||
Parameter23_Visibility = Windows.Visibility.Hidden
|
Parameter23_Visibility = Windows.Visibility.Hidden
|
||||||
Parameter2_Visibility = Visibility.Visible
|
Parameter2_Visibility = Visibility.Visible
|
||||||
@@ -795,6 +796,13 @@ Public Class SideEntityControlVM
|
|||||||
NewEntity.SetbIsCheckedAlz(False)
|
NewEntity.SetbIsCheckedAlz(False)
|
||||||
NewEntity.SetbIsCheckedFront(False)
|
NewEntity.SetbIsCheckedFront(False)
|
||||||
End If
|
End If
|
||||||
|
' inserisco riferimento univoco al lato (solo se non esiste)
|
||||||
|
Dim sInfoRef As String = String.Empty
|
||||||
|
EgtGetInfo(CurrLine, "RefAF", sInfoRef)
|
||||||
|
If String.IsNullOrEmpty(sInfoRef) Then
|
||||||
|
Dim sRefGUID As String = System.Guid.NewGuid().ToString()
|
||||||
|
EgtSetInfo(CurrLine, "RefAF", sRefGUID)
|
||||||
|
End If
|
||||||
EgtSetInfo(NewEntity.nGeomId, "IsModify", 0)
|
EgtSetInfo(NewEntity.nGeomId, "IsModify", 0)
|
||||||
m_SideEntityList.Add(NewEntity)
|
m_SideEntityList.Add(NewEntity)
|
||||||
NotifyPropertyChanged("Legenda_Visibility")
|
NotifyPropertyChanged("Legenda_Visibility")
|
||||||
@@ -1020,6 +1028,8 @@ Public Class SideEntityControlVM
|
|||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
If vJoint.Count < 1 Then Return
|
||||||
|
|
||||||
If vJoint(0) And vJoint(vJoint.Count - 1) Then
|
If vJoint(0) And vJoint(vJoint.Count - 1) Then
|
||||||
bJointStart = True
|
bJointStart = True
|
||||||
End If
|
End If
|
||||||
|
|||||||
Reference in New Issue
Block a user