Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3075c2f4af | |||
| 045e7cba61 | |||
| 57d4a29b74 | |||
| b045f0ce7b | |||
| 41767f4f3a | |||
| 85f05f280f | |||
| b4338ef88e | |||
| 9d6236b767 | |||
| d946c39a9d | |||
| 55bd41ca4c | |||
| 5e6208a9c4 | |||
| 29ecd7c780 | |||
| 6ca56d3a12 | |||
| 92196b99e6 | |||
| a3d40c5bc1 | |||
| e25bbc9216 | |||
| a2b561e944 | |||
| 5bc49d30b9 | |||
| c30ecc0574 | |||
| f7e9401e15 | |||
| 9a48c3beb3 | |||
| 5032ba4b0b | |||
| 8724afe392 | |||
| 4fc97ddf4f | |||
| fb4cb7d26b | |||
| d0672157a8 | |||
| 0195d19884 | |||
| c24bb386fc | |||
| ba0987ba3e | |||
| ac809502ed | |||
| 69b3db94f5 | |||
| 67da8aa6ed | |||
| 451dbed3b3 | |||
| 5ab9204cda |
@@ -154,6 +154,7 @@ Friend Module CamAuto
|
||||
Return ResetAllMachinings(nWarn)
|
||||
End Function
|
||||
|
||||
' Ricalcola tutte le lavorazioni
|
||||
Friend Function ResetAllMachinings(ByRef nWarn As Integer) As Boolean
|
||||
' Cancello tutte le lavorazioni
|
||||
EraseMachinings(GDB_ID.NULL)
|
||||
@@ -170,6 +171,7 @@ Friend Module CamAuto
|
||||
Return True
|
||||
End Function
|
||||
|
||||
' Elimina da ogni entità il nome della lavorazione asseganta
|
||||
Friend Function RestoreDef_Machinig(Optional bOnlySideAng As Boolean = True)
|
||||
Dim sSawingTilted As String = m_MainWindow.m_CurrentMachine.sCurrSawingTilted
|
||||
Dim bApplySawingTilted As Boolean = m_MainWindow.m_CurrentMachine.bApplySawingTilted
|
||||
@@ -180,6 +182,11 @@ Friend Module CamAuto
|
||||
Dim nIdLayerOutLoop As Integer = EgtGetFirstNameInGroup(nIdPart, NAME_OUTLOOP)
|
||||
Dim nEntId As Integer = EgtGetFirstInGroup(nIdLayerOutLoop)
|
||||
SetResetDef_Machining(nEntId, sSawingTilted, bApplySawingTilted, bOnlySideAng)
|
||||
'nIdLayerOutLoop = EgtGetFirstNameInGroup(nIdPart, NAME_OUTLOOP & ".orig")
|
||||
'If nIdLayerOutLoop <> GDB_ID.NULL Then
|
||||
' nEntId = EgtGetFirstInGroup(nIdLayerOutLoop)
|
||||
' SetResetDef_Machining(nEntId, sSawingTilted, bApplySawingTilted, bOnlySideAng)
|
||||
'End If
|
||||
nIdPart = EgtGetNextPart(nIdPart)
|
||||
End While
|
||||
Dim nRawId As Integer = CamAuto.GetCurrentRaw()
|
||||
@@ -189,6 +196,11 @@ Friend Module CamAuto
|
||||
Dim nIdLayerOutLoop As Integer = EgtGetFirstNameInGroup(nIdPart, NAME_OUTLOOP)
|
||||
Dim nEntId As Integer = EgtGetFirstInGroup(nIdLayerOutLoop)
|
||||
SetResetDef_Machining(nEntId, sSawingTilted, bApplySawingTilted, bOnlySideAng)
|
||||
nIdLayerOutLoop = EgtGetFirstNameInGroup(nIdPart, NAME_OUTLOOP & ".orig")
|
||||
If nIdLayerOutLoop <> GDB_ID.NULL Then
|
||||
nEntId = EgtGetFirstInGroup(nIdLayerOutLoop)
|
||||
SetResetDef_Machining(nEntId, sSawingTilted, bApplySawingTilted, bOnlySideAng)
|
||||
End If
|
||||
nIdPart = EgtGetNextPartInRawPart(nIdPart)
|
||||
End While
|
||||
Return bOk
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib
|
||||
Imports System.Reflection
|
||||
Imports System.Globalization
|
||||
Imports EgtWPFLib5
|
||||
Imports System.Windows.Forms
|
||||
|
||||
Public Class CadCutPageUC
|
||||
|
||||
|
||||
@@ -916,6 +916,8 @@ Public Class SplitPageUC
|
||||
Next
|
||||
m_CurrFirstInd = m_ItemList.IndexOf(ItemList(0))
|
||||
m_CurrLastInd = m_ItemList.IndexOf(ItemList(ItemList.Count - 1))
|
||||
' Aggiorno lo stato dei bottoni
|
||||
UpdateEnableMoveBtn()
|
||||
EgtDraw()
|
||||
End Sub
|
||||
|
||||
@@ -932,7 +934,9 @@ Public Class SplitPageUC
|
||||
If m_IsCtrlKeyDown Or m_IsShiftKeyDown Then Return
|
||||
Dim Index As Integer = MachiningLsBx.SelectedIndex
|
||||
If Index = -1 Then Return
|
||||
ChangeMachinig(m_MachiningList(Index).m_nId)
|
||||
If m_MainWindow.m_CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.TOOLCHANGERWITHSAW Then
|
||||
ChangeMachinig(m_MachiningList(Index).m_nId)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub MoveUpBtn_Click(sender As Object, e As RoutedEventArgs) Handles MoveUpBtn.Click
|
||||
@@ -962,11 +966,27 @@ Public Class SplitPageUC
|
||||
End If
|
||||
End Sub
|
||||
|
||||
' Uno spostamento è possibile solo se la pozione di arrivo è un taglio dello stesso tipo (FinalCut)
|
||||
Private Sub UpdateEnableMoveBtn()
|
||||
If Not MoveUpBtn.IsEnabled And Not MoveDownBtn.IsEnabled Then Return
|
||||
|
||||
' MOVE UP (-1)
|
||||
Dim OldItem As SplitMach = m_MachiningList(m_CurrFirstInd - 1)
|
||||
Dim NewItem As SplitMach = m_MachiningList(m_CurrLastInd)
|
||||
MoveUpBtn.IsEnabled = Not (OldItem.m_bFinalCut Or NewItem.m_bFinalCut) Or (OldItem.m_bFinalCut And NewItem.m_bFinalCut)
|
||||
|
||||
' MOVE DOWN (1)
|
||||
OldItem = m_MachiningList(m_CurrLastInd + 1)
|
||||
NewItem = m_MachiningList(m_CurrFirstInd)
|
||||
MoveDownBtn.IsEnabled = Not (OldItem.m_bFinalCut Or NewItem.m_bFinalCut) Or (OldItem.m_bFinalCut And NewItem.m_bFinalCut)
|
||||
End Sub
|
||||
|
||||
Private Sub MoveItem(direction As Integer)
|
||||
' Checking selected item
|
||||
If m_CurrFirstInd = -1 OrElse MachiningLsBx.SelectedIndex < 0 Then
|
||||
Return
|
||||
End If
|
||||
m_MainWindow.m_CurrentProjectPageUC.ClearMessage()
|
||||
|
||||
' Se la direzione è giù
|
||||
If direction = 1 And m_CurrLastInd < m_ItemList.Count - 1 Then
|
||||
@@ -990,7 +1010,8 @@ Public Class SplitPageUC
|
||||
m_CurrFirstInd -= 1
|
||||
m_CurrLastInd -= 1
|
||||
End If
|
||||
|
||||
' Aggiorno lo stato dei bottoni
|
||||
UpdateEnableMoveBtn()
|
||||
' Imposto flag di modifica
|
||||
m_bModified = True
|
||||
End Sub
|
||||
@@ -1371,7 +1392,7 @@ Public Class SplitPageUC
|
||||
|
||||
' se ho forzato il tipo di ingresso da CamAuto qui non posso moficarlo!
|
||||
If m_MachiningList(nI).m_bMngLeadInOnIntCorner Then
|
||||
EgtOutLog(" ⚠️ L'ingresso di taglio associato all'entita'_" & m_MachiningList(nI).m_nEntId & " non puo' essere modificato per problemi di ingombro lama ⚠️")
|
||||
EgtOutLog("L'ingresso di taglio associato all'entita'_" & m_MachiningList(nI).m_nEntId & " non puo' essere modificato per problemi di ingombro lama")
|
||||
Else
|
||||
|
||||
EgtSetCurrMachining(m_MachiningList(nI).m_nId)
|
||||
@@ -1448,7 +1469,7 @@ Public Class SplitPageUC
|
||||
|
||||
' se ho forzato il tipo di ingresso da CamAuto qui non posso moficarlo!
|
||||
If m_MachiningList(nI).m_bMngLeadInOnIntCorner Then
|
||||
EgtOutLog(" ⚠️ L'ingresso di taglio associato all'entita'_" & m_MachiningList(nI).m_nEntId & " non puo' essere modificato per problemi di ingombro lama ⚠️")
|
||||
EgtOutLog("L'ingresso di taglio associato all'entita'_" & m_MachiningList(nI).m_nEntId & " non puo' essere modificato per problemi di ingombro lama")
|
||||
Else
|
||||
|
||||
EgtSetCurrMachining(m_MachiningList(nI).m_nId)
|
||||
@@ -1490,7 +1511,7 @@ Public Class SplitPageUC
|
||||
|
||||
' se ho forzato il tipo di ingresso da CamAuto qui non posso moficarlo!
|
||||
If m_MachiningList(nI).m_bMngLeadInOnIntCorner Then
|
||||
EgtOutLog(" ⚠️ L'uscita di taglio associato all'entita'_" & m_MachiningList(nI).m_nEntId & " non puo' essere modificato per problemi di ingombro lama ⚠️")
|
||||
EgtOutLog("L'uscita di taglio associato all'entita'_" & m_MachiningList(nI).m_nEntId & " non puo' essere modificato per problemi di ingombro lama")
|
||||
Else
|
||||
|
||||
EgtSetCurrMachining(m_MachiningList(nI).m_nId)
|
||||
@@ -1567,7 +1588,7 @@ Public Class SplitPageUC
|
||||
|
||||
' se ho forzato il tipo di ingresso da CamAuto qui non posso moficarlo!
|
||||
If m_MachiningList(nI).m_bMngLeadInOnIntCorner Then
|
||||
EgtOutLog(" ⚠️ L'uscita di taglio associato all'entita'_" & m_MachiningList(nI).m_nEntId & " non puo' essere modificato per problemi di ingombro lama ⚠️")
|
||||
EgtOutLog("L'uscita di taglio associato all'entita'_" & m_MachiningList(nI).m_nEntId & " non puo' essere modificato per problemi di ingombro lama")
|
||||
Else
|
||||
|
||||
EgtSetCurrMachining(m_MachiningList(nI).m_nId)
|
||||
@@ -1670,7 +1691,7 @@ Public Class SplitPageUC
|
||||
(m_MachiningList(nI).m_bIsLine Or m_MachiningList(nI).m_dPrevAng > FL_ARC_ANG_MIN Or m_MachiningList(nI).m_sLay = NAME_ONPATH) Then
|
||||
|
||||
If Not m_MachiningList(nI).m_bCanStartAll Then
|
||||
EgtOutLog(" ⚠️ Il taglio non puo' essere allungato all'interno del pezzo ⚠️")
|
||||
EgtOutLog("Il taglio non puo' essere allungato all'interno del pezzo")
|
||||
Return
|
||||
End If
|
||||
|
||||
@@ -1850,7 +1871,7 @@ Public Class SplitPageUC
|
||||
(m_MachiningList(nI).m_bIsLine Or m_MachiningList(nI).m_dNextAng > FL_ARC_ANG_MIN Or m_MachiningList(nI).m_sLay = NAME_ONPATH) Then
|
||||
|
||||
If Not m_MachiningList(nI).m_bCanEndAll Then
|
||||
EgtOutLog(" ⚠️ Il taglio non puo' essere allungato all'interno del pezzo ⚠️")
|
||||
EgtOutLog("Il taglio non puo' essere allungato all'interno del pezzo")
|
||||
Return
|
||||
End If
|
||||
|
||||
|
||||
@@ -563,6 +563,9 @@ Module VacuumCups
|
||||
|
||||
' assegnate le posizioni del centro delle ventose e l'angolo di posizionamento orizzontale verifica che la posizione sia raggiungibile
|
||||
Public Function VerifyOutOfStrokes(ptRef As Point3d, dRotAngDeg As Double) As Integer
|
||||
' Se macchina con ventosa dietro (VacType=1) non eseguo nessun controllo
|
||||
If GetVacuumType() = 1 Then Return 0
|
||||
' Verifico se usare l'asse W per la gestione delle ventose
|
||||
Dim sAxisName As String = "C"
|
||||
' verifico che il nome dell'asse impostato sia corretto
|
||||
If EgtGetAxisId(sAxisName) = GDB_ID.NULL Then
|
||||
|
||||
@@ -12,24 +12,34 @@
|
||||
Public Const K_SIMULATIONAXESNUM As String = "SimulationAxesNum"
|
||||
Public Const K_L1NAME As String = "L1Name"
|
||||
Public Const K_L1ID As String = "L1Id"
|
||||
Public Const K_L1TYPE As String = "L1Type"
|
||||
Public Const K_L2NAME As String = "L2Name"
|
||||
Public Const K_L2ID As String = "L2Id"
|
||||
Public Const K_L2TYPE As String = "L2Type"
|
||||
Public Const K_L3NAME As String = "L3Name"
|
||||
Public Const K_L3ID As String = "L3Id"
|
||||
Public Const K_L3TYPE As String = "L3Type"
|
||||
Public Const K_R1NAME As String = "R1Name"
|
||||
Public Const K_R1ID As String = "R1Id"
|
||||
Public Const K_R1TYPE As String = "R1Type"
|
||||
Public Const K_R2NAME As String = "R2Name"
|
||||
Public Const K_R2ID As String = "R2Id"
|
||||
Public Const K_R2TYPE As String = "R2Type"
|
||||
Public Const K_A6NAME As String = "A6Name"
|
||||
Public Const K_A6ID As String = "A6Id"
|
||||
Public Const K_A6TYPE As String = "A6Type"
|
||||
Public Const K_A7NAME As String = "A7Name"
|
||||
Public Const K_A7ID As String = "A7Id"
|
||||
Public Const K_A7TYPE As String = "A7Type"
|
||||
Public Const K_A8NAME As String = "A8Name"
|
||||
Public Const K_A8ID As String = "A8Id"
|
||||
Public Const K_A8TYPE As String = "A8Type"
|
||||
Public Const K_A9NAME As String = "A9Name"
|
||||
Public Const K_A9ID As String = "A9Id"
|
||||
Public Const K_A9TYPE As String = "A9Type"
|
||||
Public Const K_A10NAME As String = "A10Name"
|
||||
Public Const K_A10ID As String = "A10Id"
|
||||
Public Const K_A10TYPE As String = "A10Type"
|
||||
Public Const K_DELTA_C As String = "DeltaC"
|
||||
Public Const K_ININCHES As String = "InInches"
|
||||
Public Const K_CPOS As String = "CPos"
|
||||
@@ -127,6 +137,7 @@
|
||||
Public Const K_VACUUMOFF As String = "VacuumOff"
|
||||
Public Const K_BYPASSTATE As String = "BypassState"
|
||||
Public Const K_FEEDHOLD As String = "FeedHold"
|
||||
Public Const K_SPOTLIGHT As String = "SpotLight"
|
||||
Public Const K_SPOTLIGHT1 As String = "SpotLight1"
|
||||
Public Const K_SPOTLIGHT2 As String = "SpotLight2"
|
||||
Public Const K_NAXES As String = "nAxes"
|
||||
@@ -178,10 +189,15 @@
|
||||
Public Const K_CHANGETABWD As String = "ChangeTabWD"
|
||||
|
||||
Public Const S_PHOTO As String = "Photo"
|
||||
Public Const K_PHOTO_CAMERACOUNTER As String = "CameraCounter"
|
||||
Public Const K_PHOTO_OFFSETX As String = "OffsetX"
|
||||
Public Const K_PHOTO_OFFSETY As String = "OffsetY"
|
||||
Public Const K_PHOTO_TAB2_OFFSETX As String = "Tab2OffsetX"
|
||||
Public Const K_PHOTO_TAB2_OFFSETY As String = "Tab2OffsetY"
|
||||
Public Const K_PHOTO_TAB3_OFFSETX As String = "Tab3OffsetX"
|
||||
Public Const K_PHOTO_TAB3_OFFSETY As String = "Tab3OffsetY"
|
||||
Public Const K_PHOTO_TAB4_OFFSETX As String = "Tab4OffsetX"
|
||||
Public Const K_PHOTO_TAB4_OFFSETY As String = "Tab4OffsetY"
|
||||
Public Const K_PHOTO_HQ_OFFSETX As String = "HQOffsetX"
|
||||
Public Const K_PHOTO_HQ_OFFSETY As String = "HQOffsetY"
|
||||
Public Const K_CAMERA_DIRECT_CMD As String = "CameraDirectCmd"
|
||||
|
||||
@@ -1563,10 +1563,15 @@ Public Class DrawPageUC
|
||||
LeftButtonGrd.Children.Remove(m_CompoDimension.m_AlzFrontPage)
|
||||
|
||||
End Select
|
||||
|
||||
' Pulisco l'ambiente lua
|
||||
ResetLuaVariables()
|
||||
|
||||
Try
|
||||
VariablesGrd.Children.Remove(m_CompoDimension)
|
||||
Catch ex As Exception
|
||||
Dim x As Boolean = True
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
Private Class CompoVar
|
||||
|
||||
@@ -248,5 +248,5 @@ Public Class SecondaryComponentPageUC
|
||||
m_MainWindow.m_DrawPageUC.LeftButtonGrd.Children.Add(m_MainComponentPage)
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
@@ -167,7 +167,42 @@ Public Class SideAngleUC
|
||||
End If
|
||||
|
||||
' Gestisco Checkbox e nomi in base al numero di lati inclinabili
|
||||
TxBlChBxView()
|
||||
' Controllo se la checkbox SideAngle è attiva
|
||||
If SideAngleChBx.IsChecked Then
|
||||
Dim dSideAngle As Double = 0
|
||||
Dim dHell As Double = 0
|
||||
' Controllo se l'angolo della nuova entità non è nullo
|
||||
If Not String.IsNullOrEmpty(NewA1TxBx.Text) Then
|
||||
StringToDouble(NewA1TxBx.Text, dSideAngle)
|
||||
' Controllo se l'angolo è diverso da 0
|
||||
If dSideAngle <> 0 Then
|
||||
' Aggiorno l'angolo delle entità
|
||||
UpdateSideAngleAllEntities()
|
||||
End If
|
||||
End If
|
||||
' Controllo se il tallone della nuova entità non è nullo
|
||||
If Not String.IsNullOrEmpty(NewH1TxBx.Text) Then
|
||||
StringToDouble(NewH1TxBx.Text, dHell)
|
||||
' Controllo se il tallone è maggiore di 0
|
||||
If dHell > 0 Then
|
||||
' Aggiorno il tallone delle entità
|
||||
UpdateHeelAllEntities()
|
||||
End If
|
||||
End If
|
||||
' Elimino le righe per riposizionarle
|
||||
Grid.SetRow(NewEntity, MAX_LINES - m_nShow + 1)
|
||||
Grid.SetRow(NewA1TxBx, MAX_LINES - m_nShow + 1)
|
||||
Grid.SetRow(NewH1TxBx, MAX_LINES - m_nShow + 1)
|
||||
|
||||
Grid.SetRow(SideAngleBl, MAX_LINES - m_nShow)
|
||||
Grid.SetRow(HeelBl, MAX_LINES - m_nShow)
|
||||
Grid.SetRow(SideAngleGrid, MAX_LINES - m_nShow)
|
||||
' Rendo visibile solo la nuova entità
|
||||
CollapsedCheckAllTextSideAng()
|
||||
Else
|
||||
' Altrimenti eseguo impaginazione classica
|
||||
TxBlChBxView()
|
||||
End If
|
||||
|
||||
' Aggiorno valori
|
||||
If m_Mode = ModeOpt.DRIP Then
|
||||
@@ -406,10 +441,16 @@ Public Class SideAngleUC
|
||||
Grid.SetRow(NewA1TxBx, MAX_LINES - m_nShow + 1)
|
||||
Grid.SetRow(NewH1TxBx, MAX_LINES - m_nShow + 1)
|
||||
|
||||
NewEntity.Text = "A#"
|
||||
' Se interrompo la creazione di un unico SideAng
|
||||
If Not GetSideAngleFromAllEntities() Then Return
|
||||
|
||||
CollapsedCheckAllTextSideAng()
|
||||
End Sub
|
||||
|
||||
' Rende visibile NewEntity quando si attiva la spunta sulla checkbox
|
||||
Private Sub CollapsedCheckAllTextSideAng()
|
||||
NewEntity.Text = "A#"
|
||||
|
||||
PrevBtn.Visibility = Visibility.Collapsed
|
||||
NextBtn.Visibility = Visibility.Collapsed
|
||||
|
||||
@@ -1465,7 +1506,7 @@ Public Class SideAngleUC
|
||||
EgtSetInfo(CurrEntity.nGeomId, INFO_SIDE_ANGLE, dSideAngle)
|
||||
EgtSetInfo(CurrEntity.nGeomId, INFO_ORIG_SIDE_ANGLE, dSideAngle)
|
||||
Dim sSawingTilted As String = m_MainWindow.m_CurrentMachine.sCurrSawingTilted
|
||||
If Not String.IsNullOrEmpty(sSawingTilted) Then
|
||||
If Not String.IsNullOrEmpty(sSawingTilted) And m_MainWindow.m_CurrentMachine.bApplySawingTilted Then
|
||||
EgtSetInfo(CurrEntity.nGeomId, DEF_MACHINING_TILTED, sSawingTilted)
|
||||
End If
|
||||
' Cancello inclinazione nell'apposito campo info
|
||||
|
||||
@@ -614,6 +614,24 @@ Public Class AlarmsPageUC
|
||||
m_MainWindow.m_WorkInProgressPageUC.UpdateTools()
|
||||
' aggiorno la lista delle lavorazioni
|
||||
RefreschMachining()
|
||||
|
||||
' Se è associata anche una lavorazione inclinata allora deve essere resettata
|
||||
If m_CurrentMachine.MountedToolConfig <> CurrentMachine.MountedToolConfigs.TOOLCHANGERWITHSAW Then
|
||||
m_CurrentMachine.sCurrSawTilted = CurrSawCmBx.SelectedItem.ToString()
|
||||
' Se nuova lama incompatibile con lavorazione di taglio corrente, resetto quest'ultima
|
||||
sMchTuuid = String.Empty
|
||||
sMchTool = String.Empty
|
||||
If Not EgtMdbSetCurrMachining(m_CurrentMachine.sCurrSawingTilted) Or
|
||||
Not EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sMchTuuid) Or
|
||||
Not EgtTdbGetToolFromUUID(sMchTuuid, sMchTool) Or
|
||||
String.Compare(sMchTool, m_CurrentMachine.sCurrSawTilted, True) <> 0 Then
|
||||
m_CurrentMachine.sCurrSawingTilted = String.Empty
|
||||
End If
|
||||
' Aggiorno utensili per lavoro in corso
|
||||
m_MainWindow.m_WorkInProgressPageUC.UpdateTools()
|
||||
' aggiorno la lista delle lavorazioni
|
||||
RefreschMachining()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
' -- SAW TILTED --
|
||||
|
||||
@@ -142,8 +142,14 @@ Public Class CurrentMachine
|
||||
Private m_dPhotoOffsetY As Double = 0
|
||||
Private m_dTab2PhotoOffsetX As Double = 0
|
||||
Private m_dTab2PhotoOffsetY As Double = 0
|
||||
Private m_dTab3PhotoOffsetX As Double = 0
|
||||
Private m_dTab3PhotoOffsetY As Double = 0
|
||||
Private m_dTab4PhotoOffsetX As Double = 0
|
||||
Private m_dTab4PhotoOffsetY As Double = 0
|
||||
Private m_dHQPhotoOffsetX As Double = 0
|
||||
Private m_dHQPhotoOffsetY As Double = 0
|
||||
' Numero di camere attive in macchina
|
||||
Private m_nCamCounter As Integer = 0
|
||||
|
||||
' Abilitazione scelta restart
|
||||
Private m_bEnableRestart As Boolean = False
|
||||
@@ -917,18 +923,30 @@ Public Class CurrentMachine
|
||||
Friend ReadOnly Property PhotoOffset As Vector3d
|
||||
Get
|
||||
Select Case GetCurrentTable()
|
||||
Case 4
|
||||
Return New Vector3d(m_dTab4PhotoOffsetX, m_dTab4PhotoOffsetY, 0)
|
||||
Case 3
|
||||
Return New Vector3d(m_dTab3PhotoOffsetX, m_dTab3PhotoOffsetY, 0)
|
||||
Case 2
|
||||
Return New Vector3d(m_dTab2PhotoOffsetX, m_dTab2PhotoOffsetY, 0)
|
||||
Case Else
|
||||
Case 1
|
||||
' verifico quale delle due fotocamere è attualmente attiva
|
||||
If GetPrivateProfileInt(S_CAMERAHQ, K_CAMERAHQ_ACTIVATE, 0, m_MainWindow.GetMachIniFile()) = 1 Then
|
||||
Return New Vector3d(m_dHQPhotoOffsetX, m_dHQPhotoOffsetY, 0)
|
||||
End If
|
||||
Return New Vector3d(m_dPhotoOffsetX, m_dPhotoOffsetY, 0)
|
||||
Case Else
|
||||
Return New Vector3d(m_dPhotoOffsetX, m_dPhotoOffsetY, 0)
|
||||
End Select
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Friend ReadOnly Property CameraCounter As Integer
|
||||
Get
|
||||
Return m_nCamCounter
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Friend ReadOnly Property bEnableRestart As Boolean
|
||||
Get
|
||||
Return m_bEnableRestart
|
||||
@@ -1428,11 +1446,21 @@ Public Class CurrentMachine
|
||||
' Leggo centratura del pezzo in X sulla tavola (per macchine con nastro)
|
||||
m_bCenterRawOnX = (GetPrivateProfileInt(S_TABLE, K_CENTER_RAW_ONX, 0, sMachIniFile) <> 0)
|
||||
|
||||
' Leggo offset aggiuntivo a fotografia
|
||||
' Leggo il numero di camere installate a bordo macchina
|
||||
m_nCamCounter = GetPrivateProfileInt(S_PHOTO, K_PHOTO_CAMERACOUNTER, -1, sMachIniFile)
|
||||
' Leggo offset aggiuntivo a fotografia (Tab1 oppure Tab di carico)
|
||||
m_dPhotoOffsetX = GetPrivateProfileDouble(S_PHOTO, K_PHOTO_OFFSETX, 0, sMachIniFile)
|
||||
m_dPhotoOffsetY = GetPrivateProfileDouble(S_PHOTO, K_PHOTO_OFFSETY, 0, sMachIniFile)
|
||||
' Tab2
|
||||
m_dTab2PhotoOffsetX = GetPrivateProfileDouble(S_PHOTO, K_PHOTO_TAB2_OFFSETX, 0, sMachIniFile)
|
||||
m_dTab2PhotoOffsetY = GetPrivateProfileDouble(S_PHOTO, K_PHOTO_TAB2_OFFSETY, 0, sMachIniFile)
|
||||
' Tab3
|
||||
m_dTab3PhotoOffsetX = GetPrivateProfileDouble(S_PHOTO, K_PHOTO_TAB3_OFFSETX, 0, sMachIniFile)
|
||||
m_dTab3PhotoOffsetY = GetPrivateProfileDouble(S_PHOTO, K_PHOTO_TAB3_OFFSETY, 0, sMachIniFile)
|
||||
' Tab4
|
||||
m_dTab4PhotoOffsetX = GetPrivateProfileDouble(S_PHOTO, K_PHOTO_TAB4_OFFSETX, 0, sMachIniFile)
|
||||
m_dTab4PhotoOffsetY = GetPrivateProfileDouble(S_PHOTO, K_PHOTO_TAB4_OFFSETY, 0, sMachIniFile)
|
||||
' Tab1 Hq
|
||||
m_dHQPhotoOffsetX = GetPrivateProfileDouble(S_PHOTO, K_PHOTO_HQ_OFFSETX, 0, sMachIniFile)
|
||||
m_dHQPhotoOffsetY = GetPrivateProfileDouble(S_PHOTO, K_PHOTO_HQ_OFFSETY, 0, sMachIniFile)
|
||||
|
||||
|
||||
@@ -236,6 +236,10 @@ Public Class MachineStatusUC
|
||||
End Sub
|
||||
|
||||
Sub DisplayPosition()
|
||||
Dim nNumDec As Integer = -3
|
||||
If m_MainWindow.m_CNCommunication.GetMachineInInches() Then
|
||||
nNumDec = -4
|
||||
End If
|
||||
' Recupero le posizioni macchina
|
||||
Dim dL1, dL2, dL3, dR1, dR2, dA6, dA7, dA8, dA9, dA10 As Double
|
||||
m_MainWindow.m_CNCommunication.GetAxesPositions(dL1, dL2, dL3, dR1, dR2, dA6, dA7, dA8, dA9, dA10)
|
||||
@@ -247,33 +251,37 @@ Public Class MachineStatusUC
|
||||
dL3 = ptTip.z
|
||||
End If
|
||||
' Visualizzazione
|
||||
Axis1TxBx.Text = LenToString(dL1, -3, True)
|
||||
Axis2TxBx.Text = LenToString(dL2, -3, True)
|
||||
Axis3TxBx.Text = LenToString(dL3, -3, True)
|
||||
Axis1TxBx.Text = LenToString(dL1, nNumDec, True)
|
||||
Axis2TxBx.Text = LenToString(dL2, nNumDec, True)
|
||||
Axis3TxBx.Text = LenToString(dL3, nNumDec, True)
|
||||
Axis4TxBx.Text = DoubleToString(dR1, -3)
|
||||
Axis5TxBx.Text = DoubleToString(dR2, -3)
|
||||
If m_AxesNumber >= 6 Then Axis6TxBx.Text = DoubleToString(dA6, -3)
|
||||
If m_AxesNumber >= 7 Then Axis7TxBx.Text = LenToString(dA7, -3, True)
|
||||
If m_AxesNumber >= 8 Then Axis8TxBx.Text = LenToString(dA8, -3, True)
|
||||
If m_AxesNumber >= 9 Then Axis9TxBx.Text = LenToString(dA9, -3, True)
|
||||
If m_AxesNumber >= 10 Then Axis10TxBx.Text = LenToString(dA10, -3, True)
|
||||
If m_AxesNumber >= 7 Then Axis7TxBx.Text = LenToString(dA7, nNumDec, True)
|
||||
If m_AxesNumber >= 8 Then Axis8TxBx.Text = LenToString(dA8, nNumDec, True)
|
||||
If m_AxesNumber >= 9 Then Axis9TxBx.Text = LenToString(dA9, nNumDec, True)
|
||||
If m_AxesNumber >= 10 Then Axis10TxBx.Text = LenToString(dA10, nNumDec, True)
|
||||
End Sub
|
||||
|
||||
Sub DisplayPositionDelta()
|
||||
Dim nNumDec As Integer = -3
|
||||
If m_MainWindow.m_CNCommunication.GetMachineInInches() Then
|
||||
nNumDec = -4
|
||||
End If
|
||||
' Recupero le posizioni macchina
|
||||
Dim dL1, dL2, dL3, dR1, dR2, dA6, dA7, dA8, dA9, dA10 As Double
|
||||
m_MainWindow.m_CNCommunication.GetAxesDeltas(dL1, dL2, dL3, dR1, dR2, dA6, dA7, dA8, dA9, dA10)
|
||||
' Visualizzazione
|
||||
DeltaAxis1TxBx.Text = LenToString(dL1, -3, True)
|
||||
DeltaAxis2TxBx.Text = LenToString(dL2, -3, True)
|
||||
DeltaAxis3TxBx.Text = LenToString(dL3, -3, True)
|
||||
DeltaAxis1TxBx.Text = LenToString(dL1, nNumDec, True)
|
||||
DeltaAxis2TxBx.Text = LenToString(dL2, nNumDec, True)
|
||||
DeltaAxis3TxBx.Text = LenToString(dL3, nNumDec, True)
|
||||
DeltaAxis4TxBx.Text = DoubleToString(dR1, -3)
|
||||
DeltaAxis5TxBx.Text = DoubleToString(dR2, -3)
|
||||
If m_AxesNumber >= 6 Then DeltaAxis6TxBx.Text = DoubleToString(dA6, -3)
|
||||
If m_AxesNumber >= 7 Then DeltaAxis7TxBx.Text = LenToString(dA7, -3, True)
|
||||
If m_AxesNumber >= 8 Then DeltaAxis8TxBx.Text = LenToString(dA8, -3, True)
|
||||
If m_AxesNumber >= 9 Then DeltaAxis9TxBx.Text = LenToString(dA9, -3, True)
|
||||
If m_AxesNumber >= 10 Then DeltaAxis10TxBx.Text = LenToString(dA10, -3, True)
|
||||
If m_AxesNumber >= 7 Then DeltaAxis7TxBx.Text = LenToString(dA7, nNumDec, True)
|
||||
If m_AxesNumber >= 8 Then DeltaAxis8TxBx.Text = LenToString(dA8, nNumDec, True)
|
||||
If m_AxesNumber >= 9 Then DeltaAxis9TxBx.Text = LenToString(dA9, nNumDec, True)
|
||||
If m_AxesNumber >= 10 Then DeltaAxis10TxBx.Text = LenToString(dA10, nNumDec, True)
|
||||
End Sub
|
||||
|
||||
Sub DisplayFeed()
|
||||
@@ -335,16 +343,16 @@ Public Class MachineStatusUC
|
||||
|
||||
Sub DisplayActiveMode(Mode As Integer)
|
||||
Select Case Mode
|
||||
Case 0
|
||||
MachineStatusImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("\Resources\MachineStatusImage\Auto.png", UriKind.Relative))
|
||||
Case 1
|
||||
MachineStatusImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("\Resources\MachineStatusImage\Single.png", UriKind.Relative))
|
||||
Case 2
|
||||
MachineStatusImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("\Resources\MachineStatusImage\Mdi.png", UriKind.Relative))
|
||||
Case 7
|
||||
MachineStatusImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("\Resources\MachineStatusImage\Manual.png", UriKind.Relative))
|
||||
Case 8
|
||||
MachineStatusImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("\Resources\MachineStatusImage\Home.png", UriKind.Relative))
|
||||
Case 0
|
||||
MachineStatusImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("\Resources\MachineStatusImage\Auto.png", UriKind.Relative))
|
||||
Case 1
|
||||
MachineStatusImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("\Resources\MachineStatusImage\Single.png", UriKind.Relative))
|
||||
Case 2
|
||||
MachineStatusImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("\Resources\MachineStatusImage\Mdi.png", UriKind.Relative))
|
||||
Case 7
|
||||
MachineStatusImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("\Resources\MachineStatusImage\Manual.png", UriKind.Relative))
|
||||
Case 8
|
||||
MachineStatusImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("\Resources\MachineStatusImage\Home.png", UriKind.Relative))
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
|
||||
+5
-1
@@ -274,6 +274,10 @@ Class MainWindow
|
||||
Return m_bIsSiemensPc
|
||||
End Function
|
||||
|
||||
Public Function GetDebug() As Integer
|
||||
Return m_nDebug
|
||||
End Function
|
||||
|
||||
Private Sub MainWindow_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
|
||||
' Verifico sia l'unica istanza
|
||||
ManageSingleIstance()
|
||||
@@ -704,7 +708,7 @@ Class MainWindow
|
||||
MyLicWn.Show()
|
||||
End If
|
||||
|
||||
' inizilizzo
|
||||
' inizializzo
|
||||
End Sub
|
||||
|
||||
#Region "Selezione dei bottoni IN LAVORO, TAGLII DIRETTI, TAGLI CAD, CORNICI, MACCHINA, OPZIONI"
|
||||
|
||||
@@ -62,5 +62,5 @@ Imports System.Windows
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.7.7.1")>
|
||||
<Assembly: AssemblyFileVersion("2.7.7.1")>
|
||||
<Assembly: AssemblyVersion("2.7.8.2")>
|
||||
<Assembly: AssemblyFileVersion("2.7.8.2")>
|
||||
|
||||
+143
-60
@@ -73,6 +73,11 @@ Public Class CNCommunication
|
||||
Private m_nA10 As Integer = 9
|
||||
Private m_bInInches As Boolean = False ' Solo per comandi diretti (assi sempre in mm)
|
||||
|
||||
' NUVO! ver. 2.7h2: m_sA1=nome (in grafica), tipo (Linear/Rotary), m_nA1=indice (nel vettore CN)
|
||||
Private m_ListAxesData As New List(Of AxisData)
|
||||
Public Function GetListAxesData() As List(Of AxisData)
|
||||
Return m_ListAxesData
|
||||
End Function
|
||||
|
||||
Friend Sub CNCommunication_Initialization()
|
||||
|
||||
@@ -164,83 +169,149 @@ Public Class CNCommunication
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#Region "ver 2.7h2 NUOVA LETTURA ASSI"
|
||||
|
||||
' Dal nome della chiave cerca di estrarre la definizione del tipo di asse
|
||||
Private Sub GetDefaultTypeAxis(sKeyAxis As String, ByRef bIsLinear As Boolean)
|
||||
' non è stato definito il tipo asse: cerco di assegnarlo di default
|
||||
Dim sMsg As String = String.Empty
|
||||
If sKeyAxis.StartsWith("L") Then
|
||||
sMsg = "Linear"
|
||||
bIsLinear = True
|
||||
ElseIf sKeyAxis.StartsWith("R") Then
|
||||
sMsg = "Rotary"
|
||||
bIsLinear = False
|
||||
Else
|
||||
sMsg = "Linear"
|
||||
bIsLinear = True
|
||||
End If
|
||||
EgtOutLog("In file *.ini machine in section '[Axes]' axis type '" & sKeyAxis & "' has been defined by default as " & sMsg)
|
||||
End Sub
|
||||
|
||||
' Legge da file *.ini macchina la definizione del tipo di asse
|
||||
Private Function GetTypeAxis(sKeyAxis As String)
|
||||
Dim bIsLinear As Boolean = True
|
||||
Dim sValue As String = String.Empty
|
||||
GetPrivateProfileString(S_AXES, sKeyAxis, "", sValue, m_MainWindow.GetMachIniFile())
|
||||
If Not String.IsNullOrEmpty(sValue) Then
|
||||
If sValue.ToLower = "linear" Then
|
||||
bIsLinear = True
|
||||
ElseIf sValue.ToLower = "rotary" Then
|
||||
bIsLinear = False
|
||||
Else
|
||||
GetDefaultTypeAxis(sKeyAxis, bIsLinear)
|
||||
End If
|
||||
Else
|
||||
GetDefaultTypeAxis(sKeyAxis, bIsLinear)
|
||||
End If
|
||||
' Ritorno il booleano che definisce il tipo di asse che è stato letto
|
||||
Return bIsLinear
|
||||
End Function
|
||||
|
||||
' Imposto il vettore dei tipi asse macchina
|
||||
Private Sub SetArrayAxisIsLinear()
|
||||
For Each Item As AxisData In m_ListAxesData
|
||||
m_CN.b_axis_is_linear(Item.nIndex) = Item.bIsLinear
|
||||
Next
|
||||
End Sub
|
||||
|
||||
' Legge da file *.ini macchina il nome dell'asse, se non esiste impone il valore di default e restituisce FALSE
|
||||
Private Function SetNameAxis(sKeyAxis As String, sAxisDefaultName As String, ByRef sAxisName As String) As Boolean
|
||||
Dim bAxisExist As Boolean = False
|
||||
Dim sValue As String = String.Empty
|
||||
bAxisExist = (GetPrivateProfileString(S_AXES, sKeyAxis, "", sValue, m_MainWindow.GetMachIniFile()) > 0)
|
||||
If String.IsNullOrEmpty(sValue) Then
|
||||
sAxisName = sAxisDefaultName
|
||||
Else
|
||||
sAxisName = sValue
|
||||
End If
|
||||
Return bAxisExist
|
||||
End Function
|
||||
|
||||
Private Function SetIndexAxis(sKeyAxis As String, nAxisDefaultIndex As Integer, ByRef nAxisIndex As String) As Boolean
|
||||
Dim bAxisExist As Boolean = True
|
||||
nAxisIndex = GetPrivateProfileInt(S_AXES, sKeyAxis, nAxisDefaultIndex, m_MainWindow.GetMachIniFile())
|
||||
If Not m_CN.VerifyAxis(nAxisIndex) Then
|
||||
nAxisIndex = -1
|
||||
m_bAxesOk = False
|
||||
EgtOutLog("Error on " & sKeyAxis)
|
||||
bAxisExist = False
|
||||
End If
|
||||
Return bAxisExist
|
||||
End Function
|
||||
|
||||
Private Sub ReadAxesData()
|
||||
' Nomi e indici degli assi macchina: definisco il nome degli assi da satampare nella pagina MachineStatusUC
|
||||
m_bAxesOk = True
|
||||
GetPrivateProfileString(S_AXES, K_L1NAME, "X", m_sA1, m_MainWindow.GetMachIniFile())
|
||||
m_nA1 = GetPrivateProfileInt(S_AXES, K_L1ID, 0, m_MainWindow.GetMachIniFile())
|
||||
If Not m_CN.VerifyAxis(m_nA1) Then
|
||||
m_nA1 = -1
|
||||
m_bAxesOk = False
|
||||
EgtOutLog("Error on L1ID")
|
||||
Dim bAxisExist As Boolean = False
|
||||
bAxisExist = SetNameAxis(K_L1NAME, "X", m_sA1)
|
||||
If SetIndexAxis(K_L1ID, 0, m_nA1) Then
|
||||
' aggiungo l'asse alla lista degli assi
|
||||
If bAxisExist Then m_ListAxesData.Add(New AxisData(GetTypeAxis(K_L1TYPE), m_sA1, m_nA1))
|
||||
End If
|
||||
GetPrivateProfileString(S_AXES, K_L2NAME, "Y", m_sA2, m_MainWindow.GetMachIniFile())
|
||||
m_nA2 = GetPrivateProfileInt(S_AXES, K_L2ID, 1, m_MainWindow.GetMachIniFile())
|
||||
If Not m_CN.VerifyAxis(m_nA2) Then
|
||||
m_nA2 = -1
|
||||
m_bAxesOk = False
|
||||
EgtOutLog("Error on L2ID")
|
||||
|
||||
bAxisExist = SetNameAxis(K_L2NAME, "Y", m_sA2)
|
||||
If SetIndexAxis(K_L2ID, 1, m_nA2) Then
|
||||
' aggiungo l'asse alla lista degli assi
|
||||
If bAxisExist Then m_ListAxesData.Add(New AxisData(GetTypeAxis(K_L2TYPE), m_sA2, m_nA2))
|
||||
End If
|
||||
GetPrivateProfileString(S_AXES, K_L3NAME, "Z", m_sA3, m_MainWindow.GetMachIniFile())
|
||||
m_nA3 = GetPrivateProfileInt(S_AXES, K_L3ID, 2, m_MainWindow.GetMachIniFile())
|
||||
If Not m_CN.VerifyAxis(m_nA3) Then
|
||||
m_nA3 = -1
|
||||
m_bAxesOk = False
|
||||
EgtOutLog("Error on L3ID")
|
||||
|
||||
bAxisExist = SetNameAxis(K_L3NAME, "Z", m_sA3)
|
||||
If SetIndexAxis(K_L3ID, 2, m_nA3) Then
|
||||
' aggiungo l'asse alla lista degli assi
|
||||
If bAxisExist Then m_ListAxesData.Add(New AxisData(GetTypeAxis(K_L3TYPE), m_sA3, m_nA3))
|
||||
End If
|
||||
GetPrivateProfileString(S_AXES, K_R1NAME, "C", m_sA4, m_MainWindow.GetMachIniFile())
|
||||
m_nA4 = GetPrivateProfileInt(S_AXES, K_R1ID, 8, m_MainWindow.GetMachIniFile())
|
||||
If Not m_CN.VerifyAxis(m_nA4) Then
|
||||
m_nA4 = -1
|
||||
m_bAxesOk = False
|
||||
EgtOutLog("Error on R1ID")
|
||||
|
||||
bAxisExist = SetNameAxis(K_R1NAME, "C", m_sA4)
|
||||
If SetIndexAxis(K_R1ID, 8, m_nA4) Then
|
||||
' aggiungo l'asse alla lista degli assi
|
||||
If bAxisExist Then m_ListAxesData.Add(New AxisData(GetTypeAxis(K_R1TYPE), m_sA4, m_nA4))
|
||||
End If
|
||||
GetPrivateProfileString(S_AXES, K_R2NAME, "B", m_sA5, m_MainWindow.GetMachIniFile())
|
||||
m_nA5 = GetPrivateProfileInt(S_AXES, K_R2ID, 7, m_MainWindow.GetMachIniFile())
|
||||
If Not m_CN.VerifyAxis(m_nA5) Then
|
||||
m_nA5 = -1
|
||||
m_bAxesOk = False
|
||||
EgtOutLog("Error on R2ID")
|
||||
|
||||
bAxisExist = SetNameAxis(K_R2NAME, "B", m_sA5)
|
||||
If SetIndexAxis(K_R2ID, 7, m_nA5) Then
|
||||
' aggiungo l'asse alla lista degli assi
|
||||
If bAxisExist Then m_ListAxesData.Add(New AxisData(GetTypeAxis(K_R2TYPE), m_sA5, m_nA5))
|
||||
End If
|
||||
GetPrivateProfileString(S_AXES, K_A6NAME, "A", m_sA6, m_MainWindow.GetMachIniFile())
|
||||
m_nA6 = GetPrivateProfileInt(S_AXES, K_A6ID, 6, m_MainWindow.GetMachIniFile())
|
||||
If Not m_CN.VerifyAxis(m_nA6) Then
|
||||
m_nA6 = -1
|
||||
m_bAxesOk = False
|
||||
EgtOutLog("Error on A6ID")
|
||||
|
||||
bAxisExist = SetNameAxis(K_A6NAME, "A", m_sA6)
|
||||
If SetIndexAxis(K_A6ID, 6, m_nA6) Then
|
||||
' aggiungo l'asse alla lista degli assi
|
||||
If bAxisExist Then m_ListAxesData.Add(New AxisData(GetTypeAxis(K_A6TYPE), m_sA6, m_nA6))
|
||||
End If
|
||||
GetPrivateProfileString(S_AXES, K_A7NAME, "U", m_sA7, m_MainWindow.GetMachIniFile())
|
||||
m_nA7 = GetPrivateProfileInt(S_AXES, K_A7ID, 3, m_MainWindow.GetMachIniFile())
|
||||
If Not m_CN.VerifyAxis(m_nA7) Then
|
||||
m_nA7 = -1
|
||||
m_bAxesOk = False
|
||||
EgtOutLog("Error on A7ID")
|
||||
|
||||
bAxisExist = SetNameAxis(K_A7NAME, "U", m_sA7)
|
||||
If SetIndexAxis(K_A7ID, 3, m_nA7) Then
|
||||
' aggiungo l'asse alla lista degli assi
|
||||
If bAxisExist Then m_ListAxesData.Add(New AxisData(GetTypeAxis(K_A7TYPE), m_sA7, m_nA7))
|
||||
End If
|
||||
GetPrivateProfileString(S_AXES, K_A8NAME, "V", m_sA8, m_MainWindow.GetMachIniFile())
|
||||
m_nA8 = GetPrivateProfileInt(S_AXES, K_A8ID, 4, m_MainWindow.GetMachIniFile())
|
||||
If Not m_CN.VerifyAxis(m_nA8) Then
|
||||
m_nA8 = -1
|
||||
m_bAxesOk = False
|
||||
EgtOutLog("Error on A8ID")
|
||||
|
||||
bAxisExist = SetNameAxis(K_A8NAME, "V", m_sA8)
|
||||
If SetIndexAxis(K_A8ID, 4, m_nA8) Then
|
||||
' aggiungo l'asse alla lista degli assi
|
||||
If bAxisExist Then m_ListAxesData.Add(New AxisData(GetTypeAxis(K_A8TYPE), m_sA8, m_nA8))
|
||||
End If
|
||||
GetPrivateProfileString(S_AXES, K_A9NAME, "W", m_sA9, m_MainWindow.GetMachIniFile())
|
||||
m_nA9 = GetPrivateProfileInt(S_AXES, K_A9ID, 5, m_MainWindow.GetMachIniFile())
|
||||
If Not m_CN.VerifyAxis(m_nA9) Then
|
||||
m_nA9 = -1
|
||||
m_bAxesOk = False
|
||||
EgtOutLog("Error on A9ID")
|
||||
|
||||
bAxisExist = SetNameAxis(K_A9NAME, "W", m_sA9)
|
||||
If SetIndexAxis(K_A9ID, 5, m_nA9) Then
|
||||
' aggiungo l'asse alla lista degli assi
|
||||
If bAxisExist Then m_ListAxesData.Add(New AxisData(GetTypeAxis(K_A9TYPE), m_sA9, m_nA9))
|
||||
End If
|
||||
GetPrivateProfileString(S_AXES, K_A10NAME, "P", m_sA10, m_MainWindow.GetMachIniFile())
|
||||
m_nA10 = GetPrivateProfileInt(S_AXES, K_A10ID, 5, m_MainWindow.GetMachIniFile())
|
||||
If Not m_CN.VerifyAxis(m_nA10) Then
|
||||
m_nA10 = -1
|
||||
m_bAxesOk = False
|
||||
EgtOutLog("Error on A10ID")
|
||||
|
||||
bAxisExist = SetNameAxis(K_A10NAME, "P", m_sA10)
|
||||
If SetIndexAxis(K_A10ID, 5, m_nA10) Then
|
||||
' aggiungo l'asse alla lista degli assi
|
||||
If bAxisExist Then m_ListAxesData.Add(New AxisData(GetTypeAxis(K_A10TYPE), m_sA10, m_nA10))
|
||||
End If
|
||||
|
||||
' Unità di misura
|
||||
m_bInInches = (GetPrivateProfileInt(S_AXES, K_ININCHES, 0, m_MainWindow.GetMachIniFile()) <> 0)
|
||||
' Crea il vettore che ad ogni posizione definisce il tipo di asse assegnato
|
||||
SetArrayAxisIsLinear()
|
||||
End Sub
|
||||
|
||||
#End Region ' ver 2.7h2 nuova gestione
|
||||
|
||||
Private Sub KillSimensCom(sProcessName As String)
|
||||
Dim sAppName As String = Path.GetFileNameWithoutExtension(sProcessName)
|
||||
Dim pList() As System.Diagnostics.Process = System.Diagnostics.Process.GetProcesses
|
||||
@@ -1808,4 +1879,16 @@ Public Class IndexArrayToBit
|
||||
m_sNameVar = NameVar
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
' Utlizzata per definire la lista degli assi impostati in macchina
|
||||
Public Class AxisData
|
||||
Public bIsLinear As Boolean
|
||||
Public sName As String
|
||||
Public nIndex As Integer
|
||||
Sub New(_bIsLinear As Boolean, _sName As String, _nINdex As Integer)
|
||||
bIsLinear = _bIsLinear
|
||||
sName = _sName
|
||||
nIndex = _nINdex
|
||||
End Sub
|
||||
End Class
|
||||
@@ -131,6 +131,8 @@ Public MustInherit Class CN_generico
|
||||
Public d_axis_position(MAX_AXES) As Double
|
||||
Public d_axis_delta(MAX_AXES) As Double
|
||||
Public b_axis_valid(MAX_AXES) As Boolean
|
||||
' ver. 2.7h2: gestione del tipo di asse per eseguire una corretta conversione dei dati inch/mm
|
||||
Public b_axis_is_linear(MAX_AXES) As Boolean
|
||||
|
||||
Public d_DReadELS_value As Double
|
||||
Public n_DReadELS_handle As Short
|
||||
|
||||
+884
-866
File diff suppressed because it is too large
Load Diff
+19
-8
@@ -734,15 +734,26 @@ Module M_MMFiles
|
||||
' Copia delle quote degli assi
|
||||
For nI As Integer = 0 To (m_Axes_Id.Count() - 1)
|
||||
Dim nId As Short = m_Axes_Id(nI)
|
||||
' agli assi lineari devo applicare il coefficiente
|
||||
If (nId Mod 10) < 3 Then
|
||||
CurrCN.d_axis_position(nI) = SiemensRet.d_interf_axis_position(nId) * LinCoeff
|
||||
CurrCN.d_axis_delta(nI) = SiemensRet.d_interf_axis_delta(nId) * LinCoeff
|
||||
' gli assi rotanti sono sempre in gradi
|
||||
Else
|
||||
CurrCN.d_axis_position(nI) = SiemensRet.d_interf_axis_position(nId)
|
||||
CurrCN.d_axis_delta(nI) = SiemensRet.d_interf_axis_delta(nId)
|
||||
|
||||
'' agli assi lineari devo applicare il coefficiente
|
||||
'If (nId Mod 10) < 3 Then
|
||||
' CurrCN.d_axis_position(nI) = SiemensRet.d_interf_axis_position(nId) * LinCoeff
|
||||
' CurrCN.d_axis_delta(nI) = SiemensRet.d_interf_axis_delta(nId) * LinCoeff
|
||||
' ' gli assi rotanti sono sempre in gradi
|
||||
'Else
|
||||
' CurrCN.d_axis_position(nI) = SiemensRet.d_interf_axis_position(nId)
|
||||
' CurrCN.d_axis_delta(nI) = SiemensRet.d_interf_axis_delta(nId)
|
||||
'End If
|
||||
|
||||
' ver 2.7h2
|
||||
CurrCN.d_axis_position(nI) = SiemensRet.d_interf_axis_position(nId)
|
||||
CurrCN.d_axis_delta(nI) = SiemensRet.d_interf_axis_delta(nId)
|
||||
' verifico se l'indice 'i' è associato ad un asse rotativo oppure lineare
|
||||
If CurrCN.b_axis_is_linear(nI) Then
|
||||
CurrCN.d_axis_position(nI) *= LinCoeff
|
||||
CurrCN.d_axis_delta(nI) *= LinCoeff
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
' Copia variabili R
|
||||
|
||||
@@ -8,86 +8,96 @@
|
||||
d:DesignHeight="853.3" d:DesignWidth="1280"
|
||||
Initialized="CurrentProjectPage_Initialized" Loaded="CurrentProjectPage_Loaded">
|
||||
|
||||
<!-- Definizione della CurrentProjectPage -->
|
||||
<Grid Name="CurrentProjectPageGrid" >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="3*"/>
|
||||
<ColumnDefinition Width="12*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="8*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Definizione della Grid superiore -->
|
||||
<Grid Name="UpperButtonGrid" Grid.Column="1" Grid.Row="0" >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="5*"/>
|
||||
<ColumnDefinition Width="7*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
</Grid>
|
||||
|
||||
<!-- Definizione della Grid laterale -->
|
||||
<Grid Grid.RowSpan="3">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="2*"/>
|
||||
<RowDefinition Height="7*"/>
|
||||
<!-- Definizione della CurrentProjectPage -->
|
||||
<Grid Name="CurrentProjectPageGrid" >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="3*"/>
|
||||
<ColumnDefinition Width="12*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<RowDefinition Height="8*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Definizione della Grid con le caratteristiche del progetto -->
|
||||
<Border Name="CurrProjGrid" Style="{DynamicResource OmagCut_MachiningBorder}" Grid.Row="0" >
|
||||
<Grid >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.2*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<!-- Definizione della Grid superiore -->
|
||||
<Grid Name="UpperButtonGrid" Grid.Column="1" Grid.Row="0" >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="5*"/>
|
||||
<ColumnDefinition Width="7*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
</Grid>
|
||||
|
||||
<Image Name="MaterialTxBl"
|
||||
Source="{DynamicResource RawPartImg}" Style="{DynamicResource OmagCut_TextIcon}"/>
|
||||
<EgtWPFLib:EgtTextBox Name="MaterialTxBx" Grid.Column="1" Grid.Row="0" Margin="0,0,10,0"
|
||||
TextAlignment="Right" Style="{DynamicResource OmagCut_FixedTextBox}"/>
|
||||
<Image Name="HeightTxBl" Grid.Row="1"
|
||||
Source="{DynamicResource RawHeightImg}" Style="{DynamicResource OmagCut_TextIcon}"/>
|
||||
<EgtWPFLib:EgtTextBox Name="HeightTxBx" Grid.Column="1" Grid.Row="1" Margin="0,0,10,0"
|
||||
Style="{DynamicResource OmagCut_FixedTextBox}" TextAlignment="Right"/>
|
||||
<Image Name="ToolTxBl" Grid.Row="2"
|
||||
Source="{DynamicResource DB-utensiliImg}" Style="{DynamicResource OmagCut_TextIcon}"/>
|
||||
<EgtWPFLib:EgtTextBox Name="ToolTxBx" Grid.Column="1" Grid.Row="2" Margin="0,0,10,0"
|
||||
Style="{DynamicResource OmagCut_FixedTextBox}" TextAlignment="Right"/>
|
||||
<Image Name="MachiningTxBl" Grid.Row="3"
|
||||
Source="{DynamicResource DB-lavorazioniImg}" Style="{DynamicResource OmagCut_TextIcon}"/>
|
||||
<EgtWPFLib:EgtTextBox Name="MachiningTxBx" Grid.Column="1" Grid.Row="3" Margin="0,0,10,0"
|
||||
Style="{DynamicResource OmagCut_FixedTextBox}" TextAlignment="Right"/>
|
||||
<!-- Definizione della Grid laterale -->
|
||||
<Grid Grid.RowSpan="3">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="2*"/>
|
||||
<RowDefinition Height="7*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<!-- Definizione della Grid laterale -->
|
||||
<Grid Grid.RowSpan="3">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="2*"/>
|
||||
<RowDefinition Height="7*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Definizione della Grid con le caratteristiche del progetto -->
|
||||
<Border Name="CurrProjGrid" Style="{DynamicResource OmagCut_MachiningBorder}" Grid.Row="0" >
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.2*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Image Name="MaterialTxBl"
|
||||
Source="{DynamicResource RawPartImg}" Style="{StaticResource OmagCut_TextIcon}"/>
|
||||
<EgtWPFLib:EgtTextBox Name="MaterialTxBx" Grid.Column="1" Grid.Row="0" Margin="0,0,10,0"
|
||||
TextAlignment="Right" Style="{DynamicResource OmagCut_FixedTextBox}"/>
|
||||
<Image Name="HeightTxBl" Grid.Row="1"
|
||||
Source="{DynamicResource RawHeightImg}" Style="{StaticResource OmagCut_TextIcon}"/>
|
||||
<EgtWPFLib:EgtTextBox Name="HeightTxBx" Grid.Column="1" Grid.Row="1" Margin="0,0,10,0"
|
||||
Style="{DynamicResource OmagCut_FixedTextBox}" TextAlignment="Right"/>
|
||||
<Image Name="ToolTxBl" Grid.Row="2"
|
||||
Source="{DynamicResource DB-utensiliImg}" Style="{StaticResource OmagCut_TextIcon}"/>
|
||||
<EgtWPFLib:EgtTextBox Name="ToolTxBx" Grid.Column="1" Grid.Row="2" Margin="0,0,10,0"
|
||||
Style="{DynamicResource OmagCut_FixedTextBox}" TextAlignment="Right"/>
|
||||
<Image Name="MachiningTxBl" Grid.Row="3"
|
||||
Source="{DynamicResource DB-lavorazioniImg}" Style="{StaticResource OmagCut_TextIcon}"/>
|
||||
<EgtWPFLib:EgtTextBox Name="MachiningTxBx" Grid.Column="1" Grid.Row="3" Margin="0,0,10,0"
|
||||
Style="{DynamicResource OmagCut_FixedTextBox}" TextAlignment="Right"/>
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
|
||||
<StackPanel Grid.Row="2" Orientation="Vertical" Name="PhotoProgressStackPanel">
|
||||
<ProgressBar Name="PhotoProgress" Height="50" Margin="10,0,10,0" Minimum="0" Maximum="100"/>
|
||||
<Label Name="PhotoProgressText" Foreground="WhiteSmoke" HorizontalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
|
||||
<Border Name="OutMessageBrd" Grid.Row="2" >
|
||||
<TextBlock Name="OutMessageTxBl" TextAlignment="Center"
|
||||
Style="{StaticResource OmagCut_LowerCaseCharacterTextBlock}"/>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
|
||||
<ProgressBar Name="PhotoProgress" Grid.Row="2" Height="50" Margin="10,0,10,0" Minimum="0" Maximum="100"/>
|
||||
|
||||
<Border Name="OutMessageBrd" Grid.Row="2" >
|
||||
<TextBlock Name="OutMessageTxBl" TextAlignment="Center"
|
||||
Style="{DynamicResource OmagCut_LowerCaseCharacterTextBlock}"/>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
|
||||
<Grid Name="SceneHostGrid" Grid.Row="1" Grid.Column="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="6*"/>
|
||||
<ColumnDefinition Width="1.2*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
<Grid Name="SceneHostGrid" Grid.Row="1" Grid.Column="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="6*"/>
|
||||
<ColumnDefinition Width="1.2*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
</UserControl>
|
||||
|
||||
@@ -202,8 +202,8 @@ Public Class CurrentProjectPageUC
|
||||
m_nCurrProj = GetPrivateProfileInt(S_GENERAL, K_LASTPROJ, 0, m_MainWindow.GetIniFile())
|
||||
'NewProject()
|
||||
|
||||
' Nascondo progress per fotografia
|
||||
PhotoProgress.Visibility = Windows.Visibility.Hidden
|
||||
' Nascondo progress e testo per fotografia
|
||||
PhotoProgressStackPanel.Visibility = Windows.Visibility.Hidden
|
||||
|
||||
Else
|
||||
EgtSetCurrentContext(CurrentProjectScene.GetCtx())
|
||||
@@ -330,13 +330,18 @@ Public Class CurrentProjectPageUC
|
||||
EgtSetCurrentContext(CurrentProjectScene.GetCtx())
|
||||
' Cancello eventuali messaggi
|
||||
ClearMessage()
|
||||
' Se è stata modificata l'uso della lama inclinata allora aggiorno anche questa lavorazione
|
||||
If m_MainWindow.m_CurrentMachine.MountedToolConfig <> CurrentMachine.MountedToolConfigs.TOOLCHANGERWITHSAW Then
|
||||
' assegno la lavorazione corrente per i tagli di lama inclinati (solo se specificato nella ComboBox della ChooseMachinig)
|
||||
RestoreDef_Machinig(True)
|
||||
End If
|
||||
' Ricalcolo tutte le lavorazioni
|
||||
Dim nWarn As Integer = 0
|
||||
ResetAllMachinings(nWarn)
|
||||
If nWarn = 1 Then SetWarningMessage(EgtMsg(90351)) ' Lama troppo grande per utilizzo ventosa
|
||||
' Aggiorno visualizzazione
|
||||
EgtDraw()
|
||||
End If
|
||||
' Aggiorno visualizzazione
|
||||
EgtDraw()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub OnMyMouseDownScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles CurrentProjectScene.OnMouseDownScene
|
||||
|
||||
@@ -56,10 +56,10 @@
|
||||
PlacementTarget="{Binding ElementName=ResetCutBtn}">
|
||||
<WrapPanel Orientation="Vertical"
|
||||
Background="{DynamicResource OmagCut_Gray}">
|
||||
<Button x:Name="ResetCut1Btn"
|
||||
<Button x:Name="ResetCut2Btn"
|
||||
Width ="78" Height="78"
|
||||
Style="{DynamicResource OmagCut_YellowTextButton}"/>
|
||||
<Button x:Name="ResetCut2Btn"
|
||||
<Button x:Name="ResetCut1Btn"
|
||||
Width ="78" Height="78"
|
||||
Style="{DynamicResource OmagCut_YellowTextButton}"/>
|
||||
</WrapPanel>
|
||||
|
||||
+165
-20
@@ -2,6 +2,9 @@
|
||||
Imports EgtWPFLib
|
||||
|
||||
Public Class ProjectMgrUC
|
||||
' Creo una varibile statica per verificare di non stampare due volte lo stesso messaggio
|
||||
Public Shared bFirstRun As Boolean = True
|
||||
|
||||
' Riferimenti a pagine (condivisi tra tutte le istanze della classe)
|
||||
Private Shared m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow)
|
||||
Private Shared m_CurrProjPage As CurrentProjectPageUC
|
||||
@@ -11,6 +14,7 @@ Public Class ProjectMgrUC
|
||||
' usato per scrivere i comadi di movimento test lavorazione
|
||||
Friend m_CN As CN_generico
|
||||
|
||||
' L'inizializzazine avviene 2 volte: una per i tagli CAD ed una per le cornici
|
||||
Private Sub ProjectMgrUC_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
|
||||
' Imposto i messaggi letti dal file dei messaggi
|
||||
NewBtn.ToolTip = EgtMsg(90303) ' Nuovo
|
||||
@@ -21,9 +25,12 @@ Public Class ProjectMgrUC
|
||||
VeinMatchingBtn.ToolTip = EgtMsg(90309) ' Vein Match
|
||||
|
||||
RegisterBtn.Content = "REG" ' Shape Registration
|
||||
ResetCutBtn.Content = EgtMsg(90336) ' Reset
|
||||
ResetCut2Btn.Content = EgtMsg(91024) ' Reset lavorazioni
|
||||
ResetCut1Btn.Content = EgtMsg(91025) ' Aggiorna feed/speed
|
||||
|
||||
'ResetCutBtn.Content = EgtMsg(90336) ' Reset
|
||||
'ResetCut2Btn.Content = EgtMsg(91024) ' Reset lavorazioni
|
||||
'ResetCut1Btn.Content = EgtMsg(91025) ' Aggiorna feed/speed
|
||||
PopulateListCmdReset()
|
||||
|
||||
SimulateBtn.ToolTip = EgtMsg(90301) ' Simulate - Simula
|
||||
If m_MainWindow.GetKeyOption(MainWindow.KEY_OPT.OFFICE_TYPE) Then
|
||||
WorkBtn.ToolTip = EgtMsg(90310) ' Export - Esporta
|
||||
@@ -255,6 +262,8 @@ Public Class ProjectMgrUC
|
||||
m_MainWindow.m_PrevActivePage = MainWindow.Pages.CadCut
|
||||
End Sub
|
||||
|
||||
#Region "RESET"
|
||||
|
||||
Private Sub ResetCutBtn_Click(sender As Object, e As RoutedEventArgs) Handles ResetCutBtn.Click
|
||||
If (Keyboard.Modifiers And ModifierKeys.Shift) > 0 Then
|
||||
If ResetCutPopUp.IsOpen Then
|
||||
@@ -263,18 +272,28 @@ Public Class ProjectMgrUC
|
||||
ResetCutPopUp.IsOpen = True
|
||||
End If
|
||||
Else
|
||||
ResetCut3Btn_Click()
|
||||
CallFunction(0)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
' Reimposto le feed di tutte le lavorazioni
|
||||
Private Sub ResetCut1Btn_Click(sender As Object, e As RoutedEventArgs) Handles ResetCut1Btn.Click
|
||||
CallFunction(1)
|
||||
End Sub
|
||||
|
||||
' Reimposto le lavorazioni di default e ripristino i parametri
|
||||
Private Sub ResetCut2Btn_Click(sender As Object, e As RoutedEventArgs) Handles ResetCut2Btn.Click
|
||||
CallFunction(2)
|
||||
End Sub
|
||||
|
||||
' Reimposto le feed di tutte le lavorazioni
|
||||
Private Sub FeedReset()
|
||||
' eseguo il ricalcolo delle sole FEED di lavorazione
|
||||
UpdateFeedAllMachining()
|
||||
End Sub
|
||||
|
||||
' Reimposto le lavorazioni di default e ripristino i parametri
|
||||
Private Sub ResetCut2Btn_Click(sender As Object, e As RoutedEventArgs) Handles ResetCut2Btn.Click
|
||||
Private Sub HardReset()
|
||||
EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx())
|
||||
' Cancello eventuali messaggi
|
||||
m_CurrProjPage.ClearMessage()
|
||||
@@ -307,7 +326,7 @@ Public Class ProjectMgrUC
|
||||
End Sub
|
||||
|
||||
' Resetta i valori dei parametri (ma non le lavorazioni)
|
||||
Private Sub ResetCut3Btn_Click()
|
||||
Private Sub StandardReset()
|
||||
EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx())
|
||||
' Cancello eventuali messaggi
|
||||
m_CurrProjPage.ClearMessage()
|
||||
@@ -333,6 +352,96 @@ Public Class ProjectMgrUC
|
||||
EgtDraw()
|
||||
End Sub
|
||||
|
||||
Private Const HARD_RESET As String = "HARD"
|
||||
Private Const STANDARD_RESET As String = "STANDARD"
|
||||
Private Const FEED_RESET As String = "FEED"
|
||||
|
||||
Private Enum RESET_TYPE
|
||||
HARD
|
||||
STANDARD
|
||||
FEED
|
||||
End Enum
|
||||
|
||||
Private m_ListCmdReset As New List(Of RESET_TYPE) From {RESET_TYPE.HARD, RESET_TYPE.STANDARD, RESET_TYPE.FEED}
|
||||
|
||||
Private Sub CallFunction(IndexListCmdReset As Integer)
|
||||
Select Case m_ListCmdReset(IndexListCmdReset)
|
||||
Case RESET_TYPE.STANDARD
|
||||
EgtOutLog("STNADRD Reset")
|
||||
StandardReset()
|
||||
Case RESET_TYPE.HARD
|
||||
EgtOutLog("HARD Reset")
|
||||
HardReset()
|
||||
Case RESET_TYPE.FEED
|
||||
EgtOutLog("FEED Reset")
|
||||
FeedReset()
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Private Sub SetBtnResetContent(IndexListCmdReset As Integer, Btn As Button)
|
||||
Select Case m_ListCmdReset(IndexListCmdReset)
|
||||
Case RESET_TYPE.STANDARD
|
||||
Btn.Content = EgtMsg(90336) ' Reset
|
||||
Case RESET_TYPE.HARD
|
||||
Btn.Content = EgtMsg(91024) ' Reset lavorazioni
|
||||
Case RESET_TYPE.FEED
|
||||
Btn.Content = EgtMsg(91025) ' Aggiorna feed/speed
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Private Sub PopulateListCmdReset()
|
||||
Dim sConfig As String = "HARD,STANDARD,FEED"
|
||||
GetPrivateProfileString(S_GENERAL, "ResetCmd", sConfig, sConfig, m_MainWindow.GetIniFile())
|
||||
Dim sItems As String() = sConfig.Split(",")
|
||||
' VERIFICA della lettura configurazione
|
||||
If sItems.Count <> 3 Then
|
||||
If bFirstRun Then
|
||||
EgtOutLog("WARNING configurazione: in Config.ini del programma nella sezione 'General/ResetCmd' " &
|
||||
"non trovato una sequenza del tipo 'HARD,STANDARD,FEED'")
|
||||
End If
|
||||
Else
|
||||
Dim bOk As Boolean = True
|
||||
Dim sErrMsg As String = String.Empty
|
||||
' popolo una lista di appoggio
|
||||
Dim TempList As New List(Of RESET_TYPE) From {RESET_TYPE.STANDARD, RESET_TYPE.STANDARD, RESET_TYPE.STANDARD}
|
||||
For Index As Integer = 0 To sItems.Count - 1
|
||||
If sItems(Index).Trim = STANDARD_RESET Then
|
||||
TempList(Index) = RESET_TYPE.STANDARD
|
||||
ElseIf sItems(Index).Trim = HARD_RESET Then
|
||||
TempList(Index) = RESET_TYPE.HARD
|
||||
ElseIf sItems(Index).Trim = FEED_RESET Then
|
||||
TempList(Index) = RESET_TYPE.FEED
|
||||
Else
|
||||
bOk = False
|
||||
sErrMsg = sErrMsg & If(String.IsNullOrEmpty(sErrMsg), "", ",") & sItems(Index).Trim
|
||||
End If
|
||||
Next
|
||||
' verifico che non ci siano elementi ripetuti nella lista
|
||||
If Not bOk Then
|
||||
If bFirstRun Then
|
||||
EgtOutLog("WARNING configurazione: in Config.ini del programma nella sezione 'General/ResetCmd' " &
|
||||
"non trovato una sequenza del tipo 'HARD,STANDARD,FEED' (i seguenti parametri non sono decodificati: " &
|
||||
sErrMsg & " )")
|
||||
End If
|
||||
ElseIf TempList(0) = TempList(1) Or TempList(0) = TempList(2) Or TempList(1) = TempList(2) Then
|
||||
If bFirstRun Then
|
||||
EgtOutLog("WARNING configurazione: in Config.ini del programma nella sezione 'General/ResetCmd' " &
|
||||
"non trovato una sequenza del tipo 'HARD,STANDARD,FEED' (due o più dati sono ripetuti)")
|
||||
End If
|
||||
Else
|
||||
m_ListCmdReset = TempList
|
||||
End If
|
||||
End If
|
||||
|
||||
SetBtnResetContent(0, ResetCutBtn)
|
||||
SetBtnResetContent(1, ResetCut1Btn)
|
||||
SetBtnResetContent(2, ResetCut2Btn)
|
||||
|
||||
bFirstRun = False
|
||||
End Sub
|
||||
|
||||
#End Region ' Reset
|
||||
|
||||
Private Sub SimulateBtn_Click(sender As Object, e As RoutedEventArgs) Handles SimulateBtn.Click
|
||||
EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx())
|
||||
m_CurrProjPage.m_SceneButtons.MeasureBtn.IsChecked = False
|
||||
@@ -923,35 +1032,32 @@ Public Class ProjectMgrUC
|
||||
End Sub
|
||||
|
||||
Public Sub UpdateFeedAllMachining()
|
||||
' recupero il valore di Feed della lavorazione corrente
|
||||
Dim SettedMachinig As String = String.Empty
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.NAME, SettedMachinig)
|
||||
|
||||
' Parametri della lavorazione letta da DB
|
||||
Dim sMachiningName As String = String.Empty
|
||||
If Not EgtMdbGetCurrMachiningParam(MCH_MP.NAME, sMachiningName) Then
|
||||
' errore: lavorazione non trovata
|
||||
EgtOutLog(" - Prima di 'Reset Feed' accedere alla pagina MACCHINA!")
|
||||
'm_MainWindow.m_CurrentProjectPageUC.SetErrorMessage("Salvare la lavorazione corrente")
|
||||
Return
|
||||
End If
|
||||
Dim dFeed As Double = 0
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.FEED, dFeed)
|
||||
Dim dFeedStarted As Double = 0
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.STARTFEED, dFeedStarted)
|
||||
Dim dFeedEnded As Double = 0
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.ENDFEED, dFeedEnded)
|
||||
Dim dFeedTipped As Double = 0
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.TIPFEED, dFeedTipped)
|
||||
Dim dFeedBack As Double = 0
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.BACKFEED, dFeedBack)
|
||||
Dim dFeedSideAng As Double = 0
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.SIDEANGFEED, dFeedSideAng)
|
||||
' Elenco delle lavorazioni
|
||||
Dim MachiningList As New List(Of SplitMach)
|
||||
|
||||
' Recupero l'indice della fase corrente
|
||||
Dim nCurrPhase As Integer = 1
|
||||
' recupero in numero di fasi presenti nel progetto
|
||||
Dim nCountPhase As Integer = EgtGetPhaseCount()
|
||||
' ciclo su tutte le fasi di lavorazione
|
||||
' Numero di lavorazioni del progetto (conteggiate nel ciclo for)
|
||||
Dim nMach As Integer = 0
|
||||
' Numero di lavorazioni aggiornate (conteggate nel ciclo for)
|
||||
Dim nMachUpdated As Integer = 0
|
||||
' Elenco dei nomi lavorazioni aggiorniate
|
||||
Dim UpdateMachinigNameList As New List(Of String)
|
||||
|
||||
' ciclo su tutte le fasi di lavorazione
|
||||
For IndexPhase As Integer = 1 To nCountPhase
|
||||
' imposto la fase corrente
|
||||
nCurrPhase = IndexPhase
|
||||
@@ -963,6 +1069,31 @@ Public Class ProjectMgrUC
|
||||
Dim nOperId As Integer = MachiningList(IndexMachining).m_nId
|
||||
' setto la lavorazione come corrente
|
||||
If EgtSetCurrMachining(nOperId) Then
|
||||
Dim sCurrMachiningName As String = String.Empty
|
||||
EgtGetMachiningParam(MCH_MP.NAME, sCurrMachiningName)
|
||||
' Se la lavorazione corrente da DB è diversa da quella della lavorazione allora aggiorno i dati
|
||||
If sCurrMachiningName <> sMachiningName Then
|
||||
sMachiningName = sCurrMachiningName
|
||||
' Recupero la lavorazione dell'operazione indicata
|
||||
If Not EgtMdbSetCurrMachining(sMachiningName) Then
|
||||
EgtOutLog("ERRORE: Machining '" & sMachiningName & "' does not exist in DB of machining.")
|
||||
sMachiningName = String.Empty
|
||||
Continue For
|
||||
End If
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.FEED, dFeed)
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.STARTFEED, dFeedStarted)
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.ENDFEED, dFeedEnded)
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.TIPFEED, dFeedTipped)
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.BACKFEED, dFeedBack)
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.SIDEANGFEED, dFeedSideAng)
|
||||
Else
|
||||
' verifico se è stata applicata una variazione delle Feed
|
||||
If UpdateMachinigNameList.FindIndex(Function(x) x = sCurrMachiningName) = -1 Then
|
||||
' La lavorazione corrente non ha nessun parametro nuovo
|
||||
Continue For
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim bUpdate As Boolean = False
|
||||
' STANDARD
|
||||
Dim dOrigFeed As Double
|
||||
@@ -1021,10 +1152,24 @@ Public Class ProjectMgrUC
|
||||
' conto il numero di lavorazioni aggiornate
|
||||
If bUpdate Then
|
||||
nMachUpdated += 1
|
||||
If UpdateMachinigNameList.FindIndex(Function(x) x = sCurrMachiningName) = -1 Then
|
||||
UpdateMachinigNameList.Add(sCurrMachiningName)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
|
||||
If UpdateMachinigNameList.Count > 0 Then
|
||||
Dim sMsg As String = String.Empty
|
||||
For Each Item As String In UpdateMachinigNameList
|
||||
sMsg = sMsg & If(String.IsNullOrEmpty(sMsg), "", ",") & Item
|
||||
Next
|
||||
EgtOutLog("Le lavorazioni aggiornate sono: " & sMsg)
|
||||
Else
|
||||
EgtOutLog("Nessuna lavorazione è stata aggiornata: Feed da DB uguali a quelle impostate nelle lavorazioni")
|
||||
End If
|
||||
|
||||
m_MainWindow.m_CurrentProjectPageUC.SetInfoMessage(EgtMsg(91243) & nMachUpdated & "/ " & nMach) ' Lavorazione aggiornate:
|
||||
End Sub
|
||||
|
||||
|
||||
+566
-271
@@ -14,6 +14,7 @@
|
||||
Imports System.Threading
|
||||
Imports System.IO
|
||||
Imports EgtUILib
|
||||
Imports System.Reflection
|
||||
|
||||
Public Class Camera
|
||||
|
||||
@@ -25,40 +26,67 @@ Public Class Camera
|
||||
Private m_bCalcContour As Boolean = False
|
||||
Private m_nCameraCount As Integer = 0
|
||||
Private m_sCameraPath As String = String.Empty
|
||||
Private m_sCameraPath2 As String = String.Empty
|
||||
'Private m_sCameraPath2 As String = String.Empty
|
||||
Private m_sCameraProcName As String = String.Empty
|
||||
Private m_sCameraProcName2 As String = String.Empty
|
||||
'Private m_sCameraProcName2 As String = String.Empty
|
||||
Private m_sImage As String = String.Empty
|
||||
Private m_sImage2 As String = String.Empty
|
||||
'Private m_sImage2 As String = String.Empty
|
||||
Private m_sInfo As String = String.Empty
|
||||
Private m_sInfo2 As String = String.Empty
|
||||
'Private m_sInfo2 As String = String.Empty
|
||||
Private m_sResult As String = String.Empty
|
||||
Private m_sResult2 As String = String.Empty
|
||||
'Private m_sResult2 As String = String.Empty
|
||||
Private m_sContour As String = String.Empty
|
||||
Private m_sContour2 As String = String.Empty
|
||||
'Private m_sContour2 As String = String.Empty
|
||||
Private m_nThreshold As Integer = 60
|
||||
Private m_dTolerance As Double = 5
|
||||
Private m_nTimeout As Integer = 30
|
||||
Private m_sImageDir As String = String.Empty
|
||||
|
||||
Private Const CAMERAMNG As String = "CameraMng"
|
||||
Private Const N_LOOP As Integer = 20
|
||||
|
||||
'Public m_ProcessCmg As New Process()
|
||||
|
||||
' Lista dei processi Cmg associati ad igni tavola
|
||||
Public m_ProcessCmgList As New List(Of Process)
|
||||
' restituisce lo stato che il processo associato alla tavola corrente (PrepareCamera)
|
||||
Private m_bIsRunnigProc As Boolean = False
|
||||
' restituisce l'esito dello scatto di una foto
|
||||
Private m_bClickOk As Boolean = False
|
||||
Private m_dClickOk As Double = 10
|
||||
' restituisce l'esito dello scatto di una foto
|
||||
Private m_bCorrectedImgOk As Boolean = False
|
||||
Private m_dCorrectedImgOk As Double = 10
|
||||
' restituisce l'esito di salvataggio BackImage
|
||||
Private m_bSavedBackImage As Boolean = False
|
||||
Private m_dSavedBackImage As Double = 90
|
||||
'
|
||||
Private m_bDowloadedPicFromCamera As Boolean = False
|
||||
Private m_dDowloadedPicFromCamera As Double = 10
|
||||
'
|
||||
Private m_bReadOCV As Boolean = False
|
||||
Private m_dReadOCV As Double = 10
|
||||
'
|
||||
Private m_bStartDistCorrect As Boolean = False
|
||||
Private m_dStartDistCorrect As Double = 30
|
||||
'
|
||||
Private m_bStartProspCorrect As Boolean = False
|
||||
Private m_dStartProspCorrect As Double = 20
|
||||
|
||||
Private DeltaCameraTab As Integer = 0
|
||||
|
||||
' Flag per foto in esecuzione
|
||||
Friend m_bBusy As Boolean = False
|
||||
|
||||
Public Function Init() As Boolean
|
||||
' Lettura dati di configurazione da file Ini
|
||||
m_bCameraLink = (GetPrivateProfileInt(S_GENERAL, K_CAMERALINK, 0, m_MainWindow.GetIniFile()) <> 0) And
|
||||
Not m_MainWindow.GetKeyOption( MainWindow.KEY_OPT.OFFICE_TYPE)
|
||||
m_nCameraCount = GetPrivateProfileInt(S_CAMERA, K_CAM_COUNT, 1, m_MainWindow.GetIniFile())
|
||||
Not m_MainWindow.GetKeyOption(MainWindow.KEY_OPT.OFFICE_TYPE)
|
||||
GetPrivateProfileString(S_CAMERA, K_CAM_EXEPATH, "", m_sCameraPath, m_MainWindow.GetIniFile())
|
||||
GetPrivateProfileString(S_CAMERA, K_CAM_IMAGE, "", m_sImage, m_MainWindow.GetIniFile())
|
||||
GetPrivateProfileString(S_CAMERA, K_CAM_INFO, "", m_sInfo, m_MainWindow.GetIniFile())
|
||||
GetPrivateProfileString(S_CAMERA, K_CAM_RESULT, "", m_sResult, m_MainWindow.GetIniFile())
|
||||
GetPrivateProfileString(S_CAMERA, K_CAM_CONTOUR, "", m_sContour, m_MainWindow.GetIniFile())
|
||||
GetPrivateProfileString(S_CAMERA, K_CAM_EXEPATH2, "", m_sCameraPath2, m_MainWindow.GetIniFile())
|
||||
GetPrivateProfileString(S_CAMERA, K_CAM_IMAGE2, "", m_sImage2, m_MainWindow.GetIniFile())
|
||||
GetPrivateProfileString(S_CAMERA, K_CAM_INFO2, "", m_sInfo2, m_MainWindow.GetIniFile())
|
||||
GetPrivateProfileString(S_CAMERA, K_CAM_RESULT2, "", m_sResult2, m_MainWindow.GetIniFile())
|
||||
GetPrivateProfileString(S_CAMERA, K_CAM_CONTOUR2, "", m_sContour2, m_MainWindow.GetIniFile())
|
||||
m_nThreshold = GetPrivateProfileInt(S_CAMERA, K_CAM_THRESHOLD, 60, m_MainWindow.GetIniFile())
|
||||
m_dTolerance = GetPrivateProfileDouble(S_CAMERA, K_CAM_TOLERANCE, 5, m_MainWindow.GetIniFile())
|
||||
m_nTimeout = GetPrivateProfileInt(S_CAMERA, K_CAM_TIMEOUT, 30, m_MainWindow.GetIniFile())
|
||||
@@ -68,42 +96,15 @@ Public Class Camera
|
||||
(GetPrivateProfileInt(S_GENERAL, K_CONTOURFROMCAMERA, 1, m_MainWindow.GetIniFile()) <> 0)
|
||||
' Ricavo il nome del processo associato
|
||||
m_sCameraProcName = Path.GetFileNameWithoutExtension(m_sCameraPath)
|
||||
m_sCameraProcName2 = Path.GetFileNameWithoutExtension(m_sCameraPath2)
|
||||
' Se camera abilitata, lancio l'esecuzione in cieco
|
||||
If m_bCameraLink Then
|
||||
If m_nCameraCount <> 2 Then
|
||||
Dim bOk As Boolean = True
|
||||
If Not CameraHide(1) Then
|
||||
bOk = False
|
||||
EgtOutLog("CameraMng not starting")
|
||||
End If
|
||||
Return bOk
|
||||
Else
|
||||
Dim bOk As Boolean = True
|
||||
If Not CameraHide(1) Then
|
||||
bOk = False
|
||||
EgtOutLog("CameraMng 1 not starting")
|
||||
End If
|
||||
If Not CameraHide(2) Then
|
||||
bOk = False
|
||||
EgtOutLog("CameraMng 2 not starting")
|
||||
End If
|
||||
Return bOk
|
||||
End If
|
||||
Else
|
||||
Return True
|
||||
End If
|
||||
' Avvio processi del camera manager per ogni tavola
|
||||
CamerasHide()
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Public Function Close() As Boolean
|
||||
If m_bBusy Then Return False
|
||||
If m_bCameraLink Then
|
||||
If m_nCameraCount <> 2 Then
|
||||
KillProcess(1)
|
||||
Else
|
||||
KillProcess(1)
|
||||
KillProcess(2)
|
||||
End If
|
||||
KillProcess()
|
||||
End If
|
||||
Return True
|
||||
End Function
|
||||
@@ -154,191 +155,197 @@ Public Class Camera
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Function CameraHide(nInd As Integer) As Boolean
|
||||
' Lancio il programma in cieco, se già attivo lo nascondo
|
||||
Try
|
||||
Process.Start(If(nInd <> 2, m_sCameraPath, m_sCameraPath2), "0")
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
Return False
|
||||
End Try
|
||||
' OK: Restituisce la tavola a cui è associato il processo
|
||||
Private Function GetCurrentTableFromCameraProcess(nIndProc As Integer) As Integer
|
||||
Dim nIndTab As Integer = 1
|
||||
Select Case DeltaCameraTab
|
||||
Case 0
|
||||
nIndTab = nIndProc
|
||||
Case 1
|
||||
' La cameraHq è sempre associata all'ultimo processo e sempre alla prima tavola
|
||||
nIndTab = 1
|
||||
Case -1
|
||||
nIndTab = GetCurrentTable()
|
||||
End Select
|
||||
|
||||
Return nIndTab
|
||||
End Function
|
||||
|
||||
Public Function CameraShow(nInd As Integer) As Boolean
|
||||
' Lancio il programma in modo visibile, se già attivo lo rendo visibile
|
||||
Try
|
||||
Process.Start(If(nInd <> 2, m_sCameraPath, m_sCameraPath2), "1")
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function CameraTest(nInd As Integer) As Boolean
|
||||
' Cancello il risultato
|
||||
If My.Computer.FileSystem.FileExists(If(nInd <> 2, m_sResult, m_sResult2)) Then
|
||||
My.Computer.FileSystem.DeleteFile(If(nInd <> 2, m_sResult, m_sResult2))
|
||||
End If
|
||||
' Lancio il programma per sapere se macchina fotografica collegata
|
||||
Try
|
||||
' Interrogo
|
||||
Process.Start(If(nInd <> 2, m_sCameraPath, m_sCameraPath2), "3")
|
||||
' Ciclo di attesa risultato
|
||||
Dim nMaxThick = 10 * 4
|
||||
For nThick As Integer = 0 To nMaxThick
|
||||
' Se esiste il file di risultato
|
||||
Dim nErr = 999
|
||||
If VerifyResult(nInd, nErr) Then
|
||||
Return (nErr = 0)
|
||||
End If
|
||||
' Aspetto 100 ms
|
||||
Thread.Sleep(100)
|
||||
Next
|
||||
Catch ex As Exception
|
||||
'
|
||||
End Try
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Private Function PrepareCamera() As Integer
|
||||
' Determino la camera da utilizzare, se più di una (max 2)
|
||||
Dim nInd As Integer = 1
|
||||
If m_nCameraCount = 2 Then
|
||||
nInd = GetCurrentTable()
|
||||
' verifico se la macchina è configurata per fotocamera sulla tavola di lavoro
|
||||
If (GetPrivateProfileInt(S_CAMERAHQ, K_CAMERAHQ_ENABLE, 0, m_MainWindow.GetMachIniFile()) <> 0) AndAlso
|
||||
(GetPrivateProfileInt(S_CAMERAHQ, K_CAMERAHQ_ACTIVATE, 0, m_MainWindow.GetMachIniFile()) <> 0) Then
|
||||
' forzo l'utilizzo della seconda camera (sopra alla tavola di lavoro)
|
||||
nInd = 2
|
||||
End If
|
||||
If nInd <> 1 And nInd <> 2 Then Return 0
|
||||
End If
|
||||
' Se gestore macchina non attivo, lo lancio in modo cieco
|
||||
If Not ProcessIsRunning(nInd) Then
|
||||
If Not CameraHide(nInd) Then
|
||||
Return 0
|
||||
End If
|
||||
' Aspetto 5000 ms
|
||||
Thread.Sleep(5000)
|
||||
' Altrimenti richiedo verifica di camera connessa
|
||||
Else
|
||||
If Not CameraTest(nInd) Then
|
||||
Return 0
|
||||
End If
|
||||
' Aspetto 100 ms
|
||||
Thread.Sleep(100)
|
||||
End If
|
||||
Return nInd
|
||||
End Function
|
||||
|
||||
Public Function CameraBackImage() As Boolean
|
||||
' Verifiche preliminari
|
||||
Dim nInd As Integer = PrepareCamera()
|
||||
If nInd = 0 Then Return False
|
||||
' Visualizzo progressbar
|
||||
m_bBusy = True
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Visibility = Visibility.Visible
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Value = 1
|
||||
' Cancellazione eventuali vecchi file rimasti
|
||||
Try
|
||||
If My.Computer.FileSystem.FileExists(If(nInd <> 2, m_sResult, m_sResult2)) Then
|
||||
My.Computer.FileSystem.DeleteFile(If(nInd <> 2, m_sResult, m_sResult2))
|
||||
End If
|
||||
Catch ex As Exception
|
||||
End Try
|
||||
' Scatto una foto come sfondo (il programma deve essere già attivo)
|
||||
Dim bOk As Boolean = False
|
||||
Try
|
||||
Process.Start(If(nInd <> 2, m_sCameraPath, m_sCameraPath2), "4")
|
||||
bOk = WaitBackImage(nInd)
|
||||
Catch ex As Exception
|
||||
bOk = False
|
||||
End Try
|
||||
' Nascondo progressbar
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Visibility = Visibility.Hidden
|
||||
m_bBusy = False
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
Private Function WaitBackImage(nInd As Integer) As Boolean
|
||||
' Ciclo di ricerca foto scattata
|
||||
Dim nMaxThick = 10 * m_nTimeout
|
||||
For nThick As Integer = 0 To nMaxThick
|
||||
' Se esiste il file di risultato
|
||||
Dim nErr = 999
|
||||
If VerifyResult(nInd, nErr) Then
|
||||
If nErr = 0 Then
|
||||
Return True
|
||||
' OK: Restituisce il processo a cui è associata la tavola
|
||||
Private Function GetProcessFromCurrentTable(nIndTab As Integer) As Integer
|
||||
Dim nIndProc As Integer = 1
|
||||
Select Case DeltaCameraTab
|
||||
Case 0
|
||||
' Indice di processo uguale all'indice della tavola
|
||||
nIndProc = nIndTab
|
||||
Case 1
|
||||
' Alla tavola 1 possono essre associati 2 processi (solo se camera Hq abilitata e attiva)
|
||||
If nIndTab = 1 And
|
||||
(GetPrivateProfileInt(S_CAMERAHQ, K_CAMERAHQ_ENABLE, 0, m_MainWindow.GetMachIniFile()) <> 0) AndAlso
|
||||
(GetPrivateProfileInt(S_CAMERAHQ, K_CAMERAHQ_ACTIVATE, 0, m_MainWindow.GetMachIniFile()) <> 0) Then
|
||||
' forzo l'utilizzo della seconda Hq (sopra alla tavola 1 di lavoro)
|
||||
nIndProc = nIndTab + 1
|
||||
Else
|
||||
nIndProc = 1
|
||||
End If
|
||||
Case -1
|
||||
nIndProc = 1
|
||||
End Select
|
||||
|
||||
Return nIndProc
|
||||
End Function
|
||||
|
||||
' OK: Avvio un processo per ogni tavola presente in macchina
|
||||
Public Function CamerasHide() As Boolean
|
||||
If Not m_bCameraLink Then Return False
|
||||
|
||||
' Lancio il programma in cieco, se già attivo lo nascondo
|
||||
m_nCameraCount = GetTableCount()
|
||||
|
||||
' Se esiste una configurazione, ne verifico la sua valità
|
||||
If m_MainWindow.m_CurrentMachine.CameraCounter > -1 Then
|
||||
DeltaCameraTab = m_MainWindow.m_CurrentMachine.CameraCounter - GetTableCount()
|
||||
Select Case DeltaCameraTab
|
||||
Case 0
|
||||
' ad ogni tavola associo una camera/configurazione
|
||||
Case 1
|
||||
' Gestisco correttamente solo il caso: 1 tavola e 2 camere
|
||||
If GetPrivateProfileInt(S_CAMERAHQ, K_CAMERAHQ_ENABLE, 0, m_MainWindow.GetMachIniFile()) = 1 Then
|
||||
m_nCameraCount = m_nCameraCount + 1
|
||||
End If
|
||||
Case -1
|
||||
' Gestisco correttamente solo il caso: 2 tavole e 1 camera
|
||||
m_nCameraCount = m_nCameraCount - 1
|
||||
Case Else
|
||||
EgtOutLog(" --> CAUTION : Differenza tra numero di camere e numero di tavole: " & DeltaCameraTab.ToString &
|
||||
", sarà attivata solo la prima camera.")
|
||||
DeltaCameraTab = 0
|
||||
End Select
|
||||
Else
|
||||
' 🚨 CAUTION:
|
||||
EgtOutLog(" --> CAUTION : In file *.ini machine '[Photo]' there is not param 'CameraCounter'.")
|
||||
' Aggiungo un altro processo se camera Hq abilitata (non esite una vera tavola associata)
|
||||
If GetPrivateProfileInt(S_CAMERAHQ, K_CAMERAHQ_ENABLE, 0, m_MainWindow.GetMachIniFile()) = 1 Then
|
||||
m_nCameraCount = m_nCameraCount + 1
|
||||
DeltaCameraTab = 1
|
||||
End If
|
||||
End If
|
||||
|
||||
Try
|
||||
For Index As Integer = 1 To m_nCameraCount
|
||||
Dim m_ProcessCmg As New Process()
|
||||
m_ProcessCmg.StartInfo.FileName = m_sCameraPath
|
||||
m_ProcessCmg.StartInfo.RedirectStandardInput = True
|
||||
m_ProcessCmg.StartInfo.RedirectStandardOutput = True
|
||||
' Assegno argomento 0 per avvio in cieco, index per specificare il numero di processo
|
||||
m_ProcessCmg.StartInfo.Arguments = "0" & " " & Index.ToString()
|
||||
m_ProcessCmg.StartInfo.UseShellExecute = False
|
||||
m_ProcessCmg.StartInfo.CreateNoWindow = True
|
||||
AddHandler m_ProcessCmg.OutputDataReceived, AddressOf Thread_OutputDataReceived
|
||||
If m_ProcessCmg.Start() Then
|
||||
m_ProcessCmg.BeginOutputReadLine()
|
||||
' Richiesta lettura configurazione corrente
|
||||
m_ProcessCmg.StandardInput.WriteLine("0")
|
||||
m_ProcessCmgList.Add(m_ProcessCmg)
|
||||
Else
|
||||
EgtOutLog("Camera err=" & nErr.ToString())
|
||||
Return False
|
||||
End If
|
||||
' Altrimenti aspetto
|
||||
Else
|
||||
' Imposto ProgressBar
|
||||
Dim nProgress As Integer = CInt(nThick * 100 / nMaxThick)
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Value = nProgress
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
' Aspetto 100 ms
|
||||
Thread.Sleep(100)
|
||||
End If
|
||||
Next
|
||||
EgtOutLog("Camera generic error")
|
||||
' Chiudo il gestore della macchina per resettarlo
|
||||
KillProcess(nInd)
|
||||
Next
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
EgtOutLog(ex.Message)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
' OK: Creo un nuovo processo associato alla tavola indicata
|
||||
Public Function ReloadCameraHide(nInd As Integer) As Boolean
|
||||
Dim m_ProcessCmg As New Process()
|
||||
m_ProcessCmg.StartInfo.FileName = m_sCameraPath
|
||||
m_ProcessCmg.StartInfo.RedirectStandardInput = True
|
||||
m_ProcessCmg.StartInfo.RedirectStandardOutput = True
|
||||
' Assegno argomento 0 per avvio in cieco, index per specificare il numero di processo
|
||||
m_ProcessCmg.StartInfo.Arguments = "0" & " " & nInd.ToString()
|
||||
m_ProcessCmg.StartInfo.UseShellExecute = False
|
||||
m_ProcessCmg.StartInfo.CreateNoWindow = True
|
||||
AddHandler m_ProcessCmg.OutputDataReceived, AddressOf Thread_OutputDataReceived
|
||||
If m_ProcessCmg.Start() Then
|
||||
m_ProcessCmg.BeginOutputReadLine()
|
||||
m_ProcessCmgList(nInd) = m_ProcessCmg
|
||||
Return True
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Public Function CameraClick() As Boolean
|
||||
' Verifiche preliminari
|
||||
Dim nInd As Integer = PrepareCamera()
|
||||
' Visualizzo progressbar
|
||||
m_bBusy = True
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Visibility = Visibility.Visible
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Value = 1
|
||||
' Cancellazione eventuali vecchi file rimasti
|
||||
Try
|
||||
If My.Computer.FileSystem.FileExists(If(nInd <> 2, m_sResult, m_sResult2)) Then
|
||||
My.Computer.FileSystem.DeleteFile(If(nInd <> 2, m_sResult, m_sResult2))
|
||||
' OK: Ogni processo cameramanager che restituisce un messaggio passa di qua
|
||||
Private Sub Thread_OutputDataReceived(sender As Object, e As DataReceivedEventArgs)
|
||||
' Il formato del messaggio è 'esempio messaggio: #IndProc'
|
||||
If Not IsNothing(e.Data) Then
|
||||
Dim sMsg As String() = e.Data.Split(":"c)
|
||||
' reinserisco eventuali ":" che sono stati rimossi
|
||||
If sMsg.Length > 2 Then
|
||||
For Index As Integer = 2 To sMsg.Length - 1
|
||||
sMsg(1) &= ":" & sMsg(Index)
|
||||
Next
|
||||
End If
|
||||
If My.Computer.FileSystem.FileExists(If(nInd <> 2, m_sImage, m_sImage2)) Then
|
||||
My.Computer.FileSystem.DeleteFile(If(nInd <> 2, m_sImage, m_sImage2))
|
||||
If sMsg.Length > 1 Then
|
||||
Select Case sMsg(0)
|
||||
' Metodo WaitingForInstruction
|
||||
' Se richiesto comando 7 stampo questo messaggio
|
||||
Case "PROCESSO ATTIVO"
|
||||
m_bIsRunnigProc = True
|
||||
' Metodo TakeFoto
|
||||
Case "SCATTO FOTO AVVENUTO"
|
||||
m_bClickOk = True
|
||||
' Metodo Camera_DownloadedCompleted
|
||||
Case "DOWNLOAD DA CAMERA COMPLETATO"
|
||||
m_bDowloadedPicFromCamera = True
|
||||
' Metodo LeggiFileCalibrazioneLenteOCV
|
||||
Case "LETTURA OCV"
|
||||
m_bReadOCV = True
|
||||
' Metodo CorrezioneCompleta
|
||||
Case "RICHIESTA CORREZIONE DISTORSIONE"
|
||||
m_bStartDistCorrect = True
|
||||
Case "RICHIESTA CORREZIONE PROSPETTICA"
|
||||
m_bStartProspCorrect = True
|
||||
' Metodo CorreggiProspettivaDaMatriceOCV
|
||||
Case "FINE CREAZIONE IMMAGINE CON CORREZIONE OCV"
|
||||
m_bCorrectedImgOk = True
|
||||
' Metodo SalvaNuovoBackGround
|
||||
Case "BACKIMAGE PRONTA"
|
||||
m_bSavedBackImage = True
|
||||
End Select
|
||||
If m_MainWindow.GetDebug > 3 Then
|
||||
EgtOutLog(" § " & sMsg(0) & " Process_" & sMsg(1))
|
||||
End If
|
||||
End If
|
||||
If My.Computer.FileSystem.FileExists(If(nInd <> 2, m_sContour, m_sContour2)) Then
|
||||
My.Computer.FileSystem.DeleteFile(If(nInd <> 2, m_sContour, m_sContour2))
|
||||
End If
|
||||
If My.Computer.FileSystem.FileExists(If(nInd <> 2, m_sInfo, m_sInfo2)) Then
|
||||
My.Computer.FileSystem.DeleteFile(If(nInd <> 2, m_sInfo, m_sInfo2))
|
||||
End If
|
||||
Catch ex As Exception
|
||||
End Try
|
||||
End If
|
||||
End Sub
|
||||
|
||||
' OK : Accendo fari e vado in Home
|
||||
Private Sub PrepareMachine(nInd As Integer)
|
||||
' ------------------------------------ accensione riflettori ------------------------------------
|
||||
Dim sPLCVarSpotLight1 As String = String.Empty
|
||||
GetPrivateProfileString(S_NCDATA, K_SPOTLIGHT1, "", sPLCVarSpotLight1, m_MainWindow.GetMachIniFile())
|
||||
Dim sPLCVarSpotLight2 As String = String.Empty
|
||||
GetPrivateProfileString(S_NCDATA, K_SPOTLIGHT2, "", sPLCVarSpotLight2, m_MainWindow.GetMachIniFile())
|
||||
Dim sPLCVarSpotLightList As New List(Of String)
|
||||
For IndexSpot As Integer = 1 To GetTableCount()
|
||||
Dim sPLCVarSpotLight As String = String.Empty
|
||||
GetPrivateProfileString(S_NCDATA, K_SPOTLIGHT & IndexSpot.ToString(), "", sPLCVarSpotLight, m_MainWindow.GetMachIniFile())
|
||||
' eventualmente rimuovo inizio stringa: "PLC, ___"
|
||||
Dim sItemString() As String = Split(sPLCVarSpotLight, ","c)
|
||||
If sItemString.Count > 1 Then
|
||||
sPLCVarSpotLight = sItemString(1).Trim
|
||||
End If
|
||||
sPLCVarSpotLightList.Add(sPLCVarSpotLight)
|
||||
Next
|
||||
Dim nPhotoDeley As Integer = GetPrivateProfileInt(S_NCNUM, K_PHOTODELEY, "100", m_MainWindow.GetMachIniFile())
|
||||
|
||||
' eventualmente rimuovo inizio stringa: "PLC, ___"
|
||||
Dim sItemString1() As String = Split(sPLCVarSpotLight1, ","c)
|
||||
If sItemString1.Count > 1 Then
|
||||
sPLCVarSpotLight1 = sItemString1(1).Trim
|
||||
End If
|
||||
Dim sItemString2() As String = Split(sPLCVarSpotLight2, ","c)
|
||||
If sItemString2.Count > 1 Then
|
||||
sPLCVarSpotLight2 = sItemString2(1).Trim
|
||||
End If
|
||||
|
||||
Select Case m_MainWindow.m_CNCommunication.m_nNCType
|
||||
Case 1, 2
|
||||
If m_MainWindow.m_CNCommunication.m_nNCType = 2 Then
|
||||
' solo per Flexium
|
||||
m_MainWindow.m_CNCommunication.m_CN.DPlcVariables_WriteVariables(If(nInd <> 2, sPLCVarSpotLight1, sPLCVarSpotLight2), "1")
|
||||
m_MainWindow.m_CNCommunication.m_CN.DPlcVariables_WriteVariables(sPLCVarSpotLightList(nInd - 1), "1")
|
||||
' altrimenti scrittura delle variabili E
|
||||
Else
|
||||
m_MainWindow.m_CNCommunication.m_CN.DVariables_WriteVariables2(If(nInd <> 2, sPLCVarSpotLight1, sPLCVarSpotLight2), "1")
|
||||
m_MainWindow.m_CNCommunication.m_CN.DVariables_WriteVariables2(sPLCVarSpotLightList(nInd - 1), "1")
|
||||
End If
|
||||
System.Threading.Thread.Sleep(nPhotoDeley)
|
||||
Case 3
|
||||
@@ -351,25 +358,8 @@ Public Class Camera
|
||||
If Not GoHomeForPhoto() Then
|
||||
EgtOutLog("Error in positioning")
|
||||
End If
|
||||
|
||||
' ------------------------------------ mando la testa in home ------------------------------------
|
||||
|
||||
' Scatto una foto con eventuale riconoscimento del contorno (il programma deve essere già attivo)
|
||||
Dim bOk As Boolean = False
|
||||
Dim sArgs As String = "2 0"
|
||||
If m_bCalcContour Then sArgs = " 5 0 " & m_nThreshold.ToString() & " 0"
|
||||
Try
|
||||
Process.Start(If(nInd <> 2, m_sCameraPath, m_sCameraPath2), sArgs)
|
||||
bOk = WaitPhoto(nInd)
|
||||
Catch ex As Exception
|
||||
EgtOutLog(ex.Message())
|
||||
bOk = False
|
||||
End Try
|
||||
' Nascondo progressbar
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Visibility = Visibility.Hidden
|
||||
m_bBusy = False
|
||||
Return bOk
|
||||
End Function
|
||||
End Sub
|
||||
|
||||
Private Function GoHomeForPhoto() As Boolean
|
||||
Dim bGoHome As Boolean = GetPrivateProfileInt(S_PHOTO, K_ENABELE_GOHOME_FOR_PHOTO, 0, m_MainWindow.GetMachIniFile()) <> 0
|
||||
@@ -431,55 +421,359 @@ Public Class Camera
|
||||
Return bPositionOk
|
||||
End Function
|
||||
|
||||
Private Function WaitPhoto(nInd As Integer) As Boolean
|
||||
' Ciclo di ricerca foto scattata
|
||||
Dim nMaxThick = 10 * m_nTimeout
|
||||
For nThick As Integer = 0 To nMaxThick
|
||||
' Se esiste il file di risultato
|
||||
Dim nErr = 999
|
||||
If VerifyResult(nInd, nErr) Then
|
||||
If nErr = 0 Then
|
||||
' Copio i file
|
||||
Dim sImageDest As String = m_sImageDir & "\" & Path.GetFileName(If(nInd <> 2, m_sImage, m_sImage2))
|
||||
Dim sInfoDest As String = Path.ChangeExtension(sImageDest, "txt")
|
||||
File.Copy(If(nInd <> 2, m_sImage, m_sImage2), sImageDest, True)
|
||||
File.Copy(If(nInd <> 2, m_sInfo, m_sInfo2), sInfoDest, True)
|
||||
' Se richiesto il riconoscimento del contorno
|
||||
Dim sContourDest As String = String.Empty
|
||||
If m_bCalcContour Then
|
||||
sContourDest = Path.ChangeExtension(sImageDest, "dxf")
|
||||
File.Copy(If(nInd <> 2, m_sContour, m_sContour2), sContourDest, True)
|
||||
' altrimenti cancello eventuale contorno presente
|
||||
Else
|
||||
m_MainWindow.m_CurrentProjectPageUC.RemoveContour()
|
||||
End If
|
||||
' Lancio caricamento della foto e del contorno
|
||||
m_MainWindow.m_CadCutPageUC.PostPhoto(sImageDest, sContourDest)
|
||||
Return True
|
||||
Else
|
||||
EgtOutLog("Camera err=" & nErr.ToString())
|
||||
Return False
|
||||
End If
|
||||
' Altrimenti aspetto
|
||||
' OK: Ottengo l'indice del processo associato alla tavola e la configurazione del processo
|
||||
Private Function PrepareCamera() As Integer
|
||||
' Stati del processo
|
||||
m_bIsRunnigProc = False
|
||||
m_bClickOk = False
|
||||
m_bCorrectedImgOk = False
|
||||
m_bSavedBackImage = False
|
||||
' Argomento utilizzato per verificare lo stato della comunicazione
|
||||
Dim sArgs As String = "7"
|
||||
Dim nIndTab As Integer = GetCurrentTable()
|
||||
Dim nIndProc As Integer = GetProcessFromCurrentTable(nIndTab)
|
||||
' Invio richiesta al processo per vedere se la comunicazione è aperta
|
||||
Try
|
||||
If Not m_ProcessCmgList(nIndProc - 1).HasExited Then
|
||||
m_ProcessCmgList(nIndProc - 1).StandardInput.WriteLine(sArgs)
|
||||
Else
|
||||
' Imposto ProgressBar
|
||||
Dim nProgress As Integer = CInt(nThick * 100 / nMaxThick)
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Value = nProgress
|
||||
Return -2
|
||||
End If
|
||||
Catch ex As Exception
|
||||
EgtOutLog(ex.Message())
|
||||
End Try
|
||||
' Attendo massimo N_LOOP secondi per avere una risposta dal programma (la risposta arriva al metodo Thread_OutputDataReceived)
|
||||
For i As Integer = 0 To N_LOOP
|
||||
Thread.Sleep(1000)
|
||||
If m_bIsRunnigProc Then Exit For
|
||||
Next
|
||||
' Se processo non attivo allora provo a rilanciarlo
|
||||
If Not m_bIsRunnigProc Then
|
||||
EgtOutLog(" ~ PROCESSO NON RISPONDE: Process_" & (nIndProc).ToString())
|
||||
ReloadCameraHide(nIndProc - 1)
|
||||
For i As Integer = 0 To N_LOOP
|
||||
Thread.Sleep(1000)
|
||||
' Invio richiesta al processo per vedere se la comunicazione è aperta
|
||||
m_ProcessCmgList(nIndProc - 1).StandardInput.WriteLine(sArgs)
|
||||
If m_bIsRunnigProc Then Exit For
|
||||
Next
|
||||
End If
|
||||
|
||||
' -----------------------------------------------------------------
|
||||
' ----- PREPARAZIONE PERCORSO FILE -----
|
||||
' -----------------------------------------------------------------
|
||||
GetPrivateProfileString(S_CAMERA, K_CAM_IMAGE, "", m_sImage, m_MainWindow.GetIniFile())
|
||||
GetPrivateProfileString(S_CAMERA, K_CAM_INFO, "", m_sInfo, m_MainWindow.GetIniFile())
|
||||
GetPrivateProfileString(S_CAMERA, K_CAM_RESULT, "", m_sResult, m_MainWindow.GetIniFile())
|
||||
GetPrivateProfileString(S_CAMERA, K_CAM_CONTOUR, "", m_sContour, m_MainWindow.GetIniFile())
|
||||
|
||||
m_sImage = m_sImage.Replace(CAMERAMNG, CAMERAMNG & (nIndProc).ToString())
|
||||
m_sInfo = m_sInfo.Replace(CAMERAMNG, CAMERAMNG & (nIndProc).ToString())
|
||||
m_sResult = m_sResult.Replace(CAMERAMNG, CAMERAMNG & (nIndProc).ToString())
|
||||
m_sContour = m_sContour.Replace(CAMERAMNG, CAMERAMNG & (nIndProc).ToString())
|
||||
|
||||
Return If(m_bIsRunnigProc, nIndProc, -1)
|
||||
End Function
|
||||
|
||||
' OK: Scatto foto e aspetto WaitBackImage
|
||||
Public Function CameraBackImage() As Boolean
|
||||
' Verifiche preliminari
|
||||
Dim nIndProc As Integer = PrepareCamera()
|
||||
' Se non è stato trovato il processo associato alla tavola allora esco
|
||||
Select Case nIndProc
|
||||
Case -2
|
||||
EgtOutLog("Direttorio di configurazione 'CamerMng" & GetCurrentTable().ToString() & "' non è stato trovato")
|
||||
Case -1
|
||||
EgtOutLog("Camera " & GetCurrentTable().ToString() & " spenta")
|
||||
End Select
|
||||
If nIndProc < 0 Then Return False
|
||||
' Visualizzo progressbar
|
||||
m_bBusy = True
|
||||
m_MainWindow.m_CurrentProjectPageUC.ClearMessage()
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgressStackPanel.Visibility = Visibility.Visible
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Value = 0
|
||||
' Cancellazione eventuali vecchi file rimasti
|
||||
Try
|
||||
If My.Computer.FileSystem.FileExists(m_sResult) Then
|
||||
My.Computer.FileSystem.DeleteFile(m_sResult)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
End Try
|
||||
|
||||
' Se richiesto: accendo fari ed eventualmente mando la testa in Home
|
||||
Dim nIndTab As Integer = GetCurrentTableFromCameraProcess(nIndProc)
|
||||
PrepareMachine(nIndTab)
|
||||
|
||||
' Scatto una foto come sfondo (il programma deve essere già attivo)
|
||||
Dim bOk As Boolean = False
|
||||
|
||||
Dim sArgs As String = "4"
|
||||
Try
|
||||
m_ProcessCmgList(nIndProc - 1).StandardInput.WriteLine(sArgs)
|
||||
bOk = WaitBackImage(nIndProc)
|
||||
Catch ex As Exception
|
||||
bOk = False
|
||||
End Try
|
||||
' Nascondo progressbar
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgressStackPanel.Visibility = Visibility.Hidden
|
||||
m_bBusy = False
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
' OK: cerco l'immagine nella confidurazione di indica nInd
|
||||
Private Function WaitBackImage(nInd As Integer) As Boolean
|
||||
Dim dProgVal As Double = 0
|
||||
' verifico che abbia scattato la foto (dalla lettura degli eventi restituiti dal processo)
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgressText.Content = "CLICK"
|
||||
For i As Integer = 0 To N_LOOP
|
||||
Thread.Sleep(1000)
|
||||
If m_bClickOk Then
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Value = m_dClickOk
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
' Aspetto 100 ms
|
||||
Thread.Sleep(100)
|
||||
Exit For
|
||||
End If
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Value = m_dClickOk / N_LOOP * (i + 1)
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
Next
|
||||
dProgVal = m_dClickOk
|
||||
If Not m_bClickOk Then Return False
|
||||
' verifico che sia stata scaricata l'immagine
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgressText.Content = "DOWNLOAD PIC"
|
||||
For i As Integer = 0 To N_LOOP
|
||||
Thread.Sleep(1000)
|
||||
If m_bDowloadedPicFromCamera Then
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Value = dProgVal + m_dDowloadedPicFromCamera
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
Exit For
|
||||
End If
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Value = dProgVal + m_dDowloadedPicFromCamera / N_LOOP * (i + 1)
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
Next
|
||||
dProgVal = dProgVal + m_dDowloadedPicFromCamera
|
||||
If Not m_bDowloadedPicFromCamera Then Return False
|
||||
|
||||
' verifico che sia stata scaricata l'immagine
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgressText.Content = "SAVE BACKIMG"
|
||||
For i As Integer = 0 To N_LOOP
|
||||
Thread.Sleep(1000)
|
||||
If m_bSavedBackImage Then
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Value = dProgVal + m_dSavedBackImage
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
Exit For
|
||||
End If
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Value = dProgVal + m_dSavedBackImage / N_LOOP * (i + 1)
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
Next
|
||||
dProgVal = dProgVal + m_dSavedBackImage
|
||||
If Not m_bSavedBackImage Then Return False
|
||||
|
||||
' Se esiste il file di risultato (NON ho modo di vedere se il risultato è andato a buon fine)
|
||||
Dim nErr = 999
|
||||
If VerifyResult(nInd, nErr) Then
|
||||
If nErr = 0 Then
|
||||
Return True
|
||||
Else
|
||||
EgtOutLog("Camera err=" & nErr.ToString())
|
||||
Return False
|
||||
End If
|
||||
' Altrimenti aspetto
|
||||
End If
|
||||
|
||||
EgtOutLog("Camera generic error")
|
||||
' Chiudo il gestore della macchina per resettarlo
|
||||
KillProcess(nInd)
|
||||
Return False
|
||||
End Function
|
||||
|
||||
' OK: Scatto foto e aspetto WaitPhoto
|
||||
Public Function CameraClick() As Boolean
|
||||
' Verifiche preliminari
|
||||
Dim nIndProc As Integer = PrepareCamera()
|
||||
' Se non è stato trovato il processo associato alla tavola allora esco
|
||||
Select Case nIndProc
|
||||
Case -2
|
||||
EgtOutLog("Direttorio di configurazione 'CamerMng" & GetCurrentTable().ToString() & "' non è stato trovato")
|
||||
Case -1
|
||||
EgtOutLog("Camera " & GetCurrentTable().ToString() & " spenta")
|
||||
End Select
|
||||
If nIndProc < 0 Then Return False
|
||||
' Visualizzo progressbar
|
||||
m_bBusy = True
|
||||
m_MainWindow.m_CurrentProjectPageUC.ClearMessage()
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgressStackPanel.Visibility = Visibility.Visible
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Value = 0
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
' Cancellazione eventuali vecchi file rimasti
|
||||
Try
|
||||
If My.Computer.FileSystem.FileExists(m_sResult) Then
|
||||
My.Computer.FileSystem.DeleteFile(m_sResult)
|
||||
End If
|
||||
If My.Computer.FileSystem.FileExists(m_sImage) Then
|
||||
My.Computer.FileSystem.DeleteFile(m_sImage)
|
||||
End If
|
||||
If My.Computer.FileSystem.FileExists(m_sContour) Then
|
||||
My.Computer.FileSystem.DeleteFile(m_sContour)
|
||||
End If
|
||||
If My.Computer.FileSystem.FileExists(m_sInfo) Then
|
||||
My.Computer.FileSystem.DeleteFile(m_sInfo)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
End Try
|
||||
|
||||
' Se richiesto: accendo fari ed eventualmente mando la testa in Home
|
||||
Dim nIndTab As Integer = GetCurrentTableFromCameraProcess(nIndProc)
|
||||
PrepareMachine(nIndTab)
|
||||
|
||||
' Scatto una foto con eventuale riconoscimento del contorno (il programma deve essere già attivo)
|
||||
Dim bOk As Boolean = False
|
||||
Dim sArgs As String = "2"
|
||||
' Per ricavare il contorno bisogna passare i segunti valori: 5,Valore_Soglia
|
||||
If m_bCalcContour Then sArgs = "5" & "," & m_nThreshold.ToString()
|
||||
Try
|
||||
' invio la richiesta di scattare una foto
|
||||
m_ProcessCmgList(nIndProc - 1).StandardInput.WriteLine(sArgs)
|
||||
bOk = WaitPhoto()
|
||||
Catch ex As Exception
|
||||
EgtOutLog(ex.Message())
|
||||
bOk = False
|
||||
End Try
|
||||
' Nascondo progressbar
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgressStackPanel.Visibility = Visibility.Hidden
|
||||
m_bBusy = False
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
' OK: attendo che sia pronta l'immagine
|
||||
Private Function WaitPhoto() As Boolean
|
||||
Dim dProgVal As Double = 0
|
||||
' verifico che abbia scattato la foto (dalla lettura degli eventi restituiti dal processo)
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgressText.Content = "CLICK"
|
||||
For i As Integer = 0 To N_LOOP
|
||||
Thread.Sleep(1000)
|
||||
If m_bClickOk Then
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Value = m_dClickOk
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
Exit For
|
||||
End If
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Value = m_dClickOk / N_LOOP * (i + 1)
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
Next
|
||||
dProgVal = m_dClickOk
|
||||
If Not m_bClickOk Then Return False
|
||||
'
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgressText.Content = "DOWNLOAD PIC"
|
||||
For i As Integer = 0 To N_LOOP
|
||||
Thread.Sleep(1000)
|
||||
If m_bDowloadedPicFromCamera Then
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Value = dProgVal + m_dDowloadedPicFromCamera
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
Exit For
|
||||
End If
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Value = dProgVal + m_dDowloadedPicFromCamera / N_LOOP * (i + 1)
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
Next
|
||||
dProgVal = dProgVal + m_dDowloadedPicFromCamera
|
||||
If Not m_bDowloadedPicFromCamera Then Return False
|
||||
'
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgressText.Content = "READ OCV"
|
||||
For i As Integer = 0 To N_LOOP
|
||||
Thread.Sleep(1000)
|
||||
If m_bReadOCV Then
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Value = dProgVal + m_dReadOCV
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
Exit For
|
||||
End If
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Value = dProgVal + m_dReadOCV / N_LOOP * (i + 1)
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
Next
|
||||
dProgVal = dProgVal + m_dReadOCV
|
||||
If Not m_bReadOCV Then Return False
|
||||
'
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgressText.Content = "START DIST"
|
||||
For i As Integer = 0 To N_LOOP
|
||||
Thread.Sleep(1000)
|
||||
If m_bStartDistCorrect Then
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Value = dProgVal + m_dStartDistCorrect
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
Exit For
|
||||
End If
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Value = dProgVal + m_dStartDistCorrect / N_LOOP * (i + 1)
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
Next
|
||||
dProgVal = dProgVal + m_dStartDistCorrect
|
||||
If Not m_bStartDistCorrect Then Return False
|
||||
'
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgressText.Content = "START PROSP"
|
||||
For i As Integer = 0 To N_LOOP
|
||||
Thread.Sleep(1000)
|
||||
If m_bStartProspCorrect Then
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Value = dProgVal + m_dStartProspCorrect
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
Exit For
|
||||
End If
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Value = dProgVal + m_dStartProspCorrect / N_LOOP * (i + 1)
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
Next
|
||||
dProgVal = dProgVal + m_dStartProspCorrect
|
||||
If Not m_bStartProspCorrect Then Return False
|
||||
' verifico che il processo di correzione della foto sia terminato correttamente
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgressText.Content = "CORRECT IMG"
|
||||
For i As Integer = 0 To N_LOOP
|
||||
Thread.Sleep(1000)
|
||||
If m_bCorrectedImgOk Then
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Value = dProgVal + m_dCorrectedImgOk
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
Exit For
|
||||
End If
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Value = dProgVal + m_dCorrectedImgOk / N_LOOP * (i + 1)
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
Next
|
||||
dProgVal = dProgVal + m_dCorrectedImgOk
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgressText.Content = "IMPORT IMG"
|
||||
' Copio i file
|
||||
Dim sImageDest As String = m_sImageDir & "\" & Path.GetFileName(m_sImage)
|
||||
Dim sInfoDest As String = Path.ChangeExtension(sImageDest, "txt")
|
||||
File.Copy(m_sImage, sImageDest, True)
|
||||
File.Copy(m_sInfo, sInfoDest, True)
|
||||
' Se richiesto il riconoscimento del contorno
|
||||
Dim sContourDest As String = String.Empty
|
||||
If m_bCalcContour Then
|
||||
sContourDest = Path.ChangeExtension(sImageDest, "dxf")
|
||||
File.Copy(m_sContour, sContourDest, True)
|
||||
' altrimenti cancello eventuale contorno presente
|
||||
Else
|
||||
m_MainWindow.m_CurrentProjectPageUC.RemoveContour()
|
||||
End If
|
||||
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Value = 95
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
' Lancio caricamento della foto e del contorno
|
||||
m_MainWindow.m_CadCutPageUC.PostPhoto(sImageDest, sContourDest)
|
||||
Return True
|
||||
|
||||
End Function
|
||||
|
||||
' OK: verifica che la backimage sia stata scaricata correttamente nel direttorio CameraMng#n
|
||||
Private Function VerifyResult(nInd As Integer, ByRef nErr As Integer) As Boolean
|
||||
' Se non esiste il file con il risultato
|
||||
If Not My.Computer.FileSystem.FileExists(If(nInd <> 2, m_sResult, m_sResult2)) Then
|
||||
If Not My.Computer.FileSystem.FileExists(m_sResult) Then
|
||||
Return False
|
||||
End If
|
||||
' Leggo il file
|
||||
@@ -487,7 +781,7 @@ Public Class Camera
|
||||
Try
|
||||
' Controllo errori nel file di info
|
||||
Dim sLine As String = String.Empty
|
||||
Dim sr As StreamReader = New StreamReader(If(nInd <> 2, m_sResult, m_sResult2))
|
||||
Dim sr As StreamReader = New StreamReader(m_sResult)
|
||||
Do While sr.Peek() > -1
|
||||
sLine = sr.ReadLine()
|
||||
sLine = sLine.Replace(" ", "")
|
||||
@@ -505,19 +799,20 @@ Public Class Camera
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
Private Function ProcessIsRunning(nInd As Integer) As Boolean
|
||||
Private Function ProcessIsRunning() As Boolean
|
||||
Dim Procs() As Process
|
||||
Procs = Process.GetProcessesByName(If(nInd <> 2, m_sCameraProcName, m_sCameraProcName2))
|
||||
Procs = Process.GetProcessesByName(m_sCameraProcName)
|
||||
Return (Procs.Length() > 0)
|
||||
End Function
|
||||
|
||||
Private Sub KillProcess(nInd As Integer)
|
||||
' OK: chiudo tutti i processi che hanno il nome CameraMng.exe
|
||||
Private Sub KillProcess()
|
||||
Dim Procs() As Process
|
||||
Procs = Process.GetProcessesByName(If(nInd <> 2, m_sCameraProcName, m_sCameraProcName2))
|
||||
Procs = Process.GetProcessesByName(m_sCameraProcName)
|
||||
For i As Integer = 0 To Procs.Length() - 1
|
||||
Procs(i).Kill()
|
||||
Procs(i).WaitForExit(2000)
|
||||
Next i
|
||||
End Sub
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
+1
-132
@@ -45,140 +45,9 @@ Module Utility
|
||||
|
||||
'--------------------------------------------------------------------------------------------------
|
||||
#Region "INCHES FRACTIONS"
|
||||
'Enum FractionPattern
|
||||
' None
|
||||
' Feet_Inches
|
||||
' Inches
|
||||
'End Enum
|
||||
|
||||
'' seleziona il tipo di Pattern con cui stamoare i dati
|
||||
' seleziona il tipo di Pattern di stampa dei dati
|
||||
Friend nCurrFractionPattern As FractionStringConverter.FractionPattern = FractionPattern.Feet_Inches
|
||||
Friend dPrecision As Double = 64
|
||||
|
||||
'Friend Function StringFractionToStringDecimal(dVal As Double, dBase As Double) As String
|
||||
' Dim sSign As String = String.Empty
|
||||
' If dVal < 0 Then
|
||||
' sSign = "-"
|
||||
' dVal = Math.Abs(dVal)
|
||||
' End If
|
||||
' Dim sFraction As String = String.Empty
|
||||
' ' integer and decima part of the value
|
||||
' Dim dInteger As Double = Math.Floor(dVal)
|
||||
' Dim dFraction As Double = dVal - dInteger
|
||||
' ' the nearest decimal numerator
|
||||
' Dim dNumeretor As Double = dFraction * dBase
|
||||
' Dim dRound As Double = Math.Round(dNumeretor)
|
||||
' ' estimates the irreducible fraction
|
||||
' If dRound = 0 Then
|
||||
' ' no decimal part
|
||||
' ElseIf dRound = dBase Then
|
||||
' ' no decimal part
|
||||
' dInteger = dInteger + 1
|
||||
' Else
|
||||
' ' simplify fraction
|
||||
' While dRound Mod 2 = 0
|
||||
' dRound = dRound / 2
|
||||
' dBase = dBase / 2
|
||||
' End While
|
||||
' sFraction = DoubleToString(dRound, 0) & "/" & DoubleToString(dBase, 0)
|
||||
' End If
|
||||
' ' sVal: dFeet'dInteger"sFraction --- dInteger sFraction
|
||||
' Return WriteFraction(dInteger, sFraction)
|
||||
'End Function
|
||||
|
||||
'' trasforma il valore da pollici a piedi
|
||||
'Private Sub ConvertInchesToFeet(ByRef dFeet As Double, ByRef dInches As Double)
|
||||
' If dInches = 0 Then Return
|
||||
' While dInches - 12 >= 0
|
||||
' dFeet = dFeet + 1
|
||||
' dInches = dInches - 12
|
||||
' End While
|
||||
'End Sub
|
||||
|
||||
'' stampa dati in funzione del pattern dichiarato
|
||||
'Private Function WriteFraction(ByVal dInches As Double, sFraction As String) As String
|
||||
' Dim sVal As String = String.Empty
|
||||
' Select Case nCurrFractionPattern
|
||||
' Case FractionPattern.Feet_Inches
|
||||
' Dim dFeet As Double = 0
|
||||
' ConvertInchesToFeet(dFeet, dInches)
|
||||
' If dFeet > 0 Then
|
||||
' sVal = String.Format("{0}'{1}""{2}", DoubleToString(dFeet, 0), DoubleToString(dInches, 0), sFraction).Trim
|
||||
' Else
|
||||
' sVal = String.Format("{0}""{1}", DoubleToString(dInches, 0), sFraction).Trim
|
||||
' End If
|
||||
' Case FractionPattern.Inches
|
||||
' sVal = DoubleToString(dInches, 0) & " " & sFraction
|
||||
' sVal = String.Format("{0}""{1}", DoubleToString(dInches, 0), sFraction).Trim
|
||||
' End Select
|
||||
' Return sVal
|
||||
'End Function
|
||||
|
||||
'' riceve la stringa sorgente e restituisce la nuova strunga in formato decimale (senza eseguire conversioni di unità)
|
||||
'Friend Function StringFractionToDouble(sVal As String, ByRef sValConverted As String) As Boolean
|
||||
' Dim dVal As Double = 0
|
||||
' ' dato in ingresso: sVal = 2'3"23/32
|
||||
' Dim sFeet As String = String.Empty
|
||||
' Dim sFeetPattern As String = "^.*?(?=')"
|
||||
' Dim dFeet As Double = 0
|
||||
' Dim bOkFeet As Boolean = True
|
||||
' Dim bFeetExists As Boolean = False
|
||||
' Dim sInch As String = String.Empty
|
||||
' Dim sInchPattern As String = "(?<=')(.*?)(?="")" ' se la stringa contiene l'apice singolo
|
||||
' Dim sInchPattern1 As String = "(.*?)(?="")" ' se la stringa NON contiene l'apice singolo
|
||||
' Dim dInch As Double = 0
|
||||
' Dim bOkInch As Boolean = True
|
||||
' Dim bInchExists As Boolean = False
|
||||
' Dim sFraction As String = String.Empty
|
||||
' Dim sFractionPattern As String = "(?<="")(.*)" ' se la stringa contiene l'apice doppio
|
||||
' Dim sFractionPattern1 As String = "(?<=')(.*)" ' se la stringa NON contiene l'apice doppio ma solo quello singolo
|
||||
' Dim dFraction As Double = 0
|
||||
' Dim bOkFraction As Boolean = True
|
||||
' Dim bFractionExists As Boolean = False
|
||||
|
||||
' ' recupero il valore di Feet (2')
|
||||
' Dim sMyMatch As String = Regex.Match(sVal, sFeetPattern).Groups(1).Value
|
||||
' If Not String.IsNullOrEmpty(sMyMatch) Or Not String.IsNullOrWhiteSpace(sMyMatch) Then
|
||||
' sFeet = sMyMatch.Trim
|
||||
' bOkFeet = StringToDouble(sFeet, dFeet)
|
||||
' bFeetExists = True
|
||||
' End If
|
||||
|
||||
' ' recupero il valore di Inch (3") dopo i Feet - oppure direttamente i pollici
|
||||
' If bFeetExists Then
|
||||
' sMyMatch = Regex.Match(sVal, sInchPattern).Groups(1).Value
|
||||
' Else
|
||||
' sMyMatch = Regex.Match(sVal, sInchPattern1).Groups(1).Value
|
||||
' End If
|
||||
' If Not String.IsNullOrEmpty(sMyMatch) Or Not String.IsNullOrWhiteSpace(sMyMatch) Then
|
||||
' sInch = sMyMatch.Trim
|
||||
' bOkInch = StringToDouble(sInch, dInch)
|
||||
' bInchExists = True
|
||||
' End If
|
||||
|
||||
' ' recupero il valore frazionario (23/32) dopo i pollici - oppure dopo i feet - oppure direttamente i valore inteso come pollici
|
||||
' If bInchExists Then
|
||||
' sMyMatch = Regex.Match(sVal, sFractionPattern).Groups(1).Value
|
||||
' ElseIf bFeetExists And Not bInchExists Then
|
||||
' sMyMatch = Regex.Match(sVal, sFractionPattern1).Groups(1).Value
|
||||
' ElseIf Not bFeetExists And Not bInchExists Then
|
||||
' sMyMatch = sVal
|
||||
' End If
|
||||
' If Not String.IsNullOrEmpty(sMyMatch) Or Not String.IsNullOrWhiteSpace(sMyMatch) Then
|
||||
' sFraction = sMyMatch
|
||||
' bOkFraction = StringToDouble(sFraction, dFraction)
|
||||
' End If
|
||||
|
||||
' ' calcolo il valore decimale dell'espressione
|
||||
' If bOkFeet And bOkInch And bOkFraction Then
|
||||
' dVal = dFeet / 12 + dInch + dFraction
|
||||
' sValConverted = DoubleToString(dVal, 4)
|
||||
' Return True
|
||||
' Else
|
||||
' Return False
|
||||
' End If
|
||||
'End Function
|
||||
|
||||
#End Region ' Inches Fraction
|
||||
'--------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user