Compare commits

...

14 Commits

Author SHA1 Message Date
NicolaP 0477c42208 Salvo dimensione sovratavola per ogni macchinata 2022-06-09 12:37:44 +02:00
NicolaP c11925e90f Merge remote-tracking branch 'origin/master' into develop 2022-06-08 17:21:26 +02:00
DarioS d745119195 OmagOFFICE 2.4e4 :
- correzione versione.
2022-05-31 00:29:40 +02:00
NicolaP aa283fd190 Merge branch 'develop' 2022-05-30 15:13:27 +02:00
NicolaP 243125cbb4 Merge remote-tracking branch 'origin/master' 2022-05-30 15:12:22 +02:00
NicolaP 2789051005 Cambio versione 2022-05-30 14:54:55 +02:00
NicolaP 0b13379731 Inseriti messaggi e costanti 2022-05-30 11:02:11 +02:00
NicolaP 6cc7ba8ccd Gestione StartPoint per tagli WJ InLoop 2022-05-26 17:47:39 +02:00
NicolaP 36674aeb65 Aggiunta gestione grafica per Taglio WJ separato 2022-05-26 16:29:11 +02:00
NicolaP 9aa9b51710 Merge branch 'Features/Manage_Interference_On_Vacuum_Move' into develop 2022-05-25 18:23:15 +02:00
NicolaP 15b87d7911 Merge branch 'Features/WaterJet_Punto_Inizio' into develop 2022-05-25 18:22:47 +02:00
NicolaP c8bf133113 Gestione comando StartPoint lavorazioni waterjet 2022-05-25 18:21:57 +02:00
NicolaP faba640eee Gestione comando per separazione lavorazione WaterJet 2022-05-25 15:19:22 +02:00
DarioS e9ff1c198b OmagOFFICE 2.4e3 :
- modifiche per prima versione con chiave di rete.
2022-05-17 08:27:56 +02:00
10 changed files with 637 additions and 31 deletions
+1
View File
@@ -18,6 +18,7 @@ Module ConstIni
Public Const S_GENERAL As String = "General"
Public Const K_DEBUG As String = "Debug"
Public Const K_LICENCE As String = "Licence"
Public Const K_NETKEY As String = "NetKey"
Public Const K_USERLEVEL As String = "UserLevel"
Public Const K_MAXINST As String = "MaxInstances"
Public Const K_INSTANCES As String = "Instances"
+68
View File
@@ -95,6 +95,74 @@ Friend Module CamAuto
Return True
End Function
Friend Function ResetAllSplitCurv() As Boolean
Dim bOk As Boolean = True
Dim nIdPart As Integer = EgtGetFirstPart()
While nIdPart <> GDB_ID.NULL
' elimino il layer dei flag di separazione "AUX_SPLIT_WJ"
Dim IdAuxLayer As Integer = EgtGetFirstNameInGroup(nIdPart, "AUX_SPLIT_WJ")
EgtErase(IdAuxLayer)
' accedo al Layer OutLoop
Dim nIdLayerOutLoop As Integer = EgtGetFirstNameInGroup(nIdPart, NAME_OUTLOOP)
Dim nIdMy As Integer = EgtGetFirstInGroup(nIdLayerOutLoop)
While nIdMy <> GDB_ID.NULL
EgtRemoveInfo(nIdMy, "JoinEntity")
nIdMy = EgtGetNext(nIdMy)
End While
nIdPart = EgtGetNextPart(nIdPart)
End While
Dim nRawId As Integer = CamAuto.GetCurrentRaw()
nIdPart = EgtGetFirstPartInRawPart(nRawId)
While nIdPart <> GDB_ID.NULL
' elimino il layer dei flag di separazione "AUX_SPLIT_WJ"
Dim IdAuxLayer As Integer = EgtGetFirstNameInGroup(nIdPart, "AUX_SPLIT_WJ")
EgtErase(IdAuxLayer)
' accedo al Layer OutLoop
Dim nIdLayerOutLoop As Integer = EgtGetFirstNameInGroup(nIdPart, NAME_OUTLOOP)
Dim nIdMy As Integer = EgtGetFirstInGroup(nIdLayerOutLoop)
While nIdMy <> GDB_ID.NULL
EgtRemoveInfo(nIdMy, "JoinEntity")
nIdMy = EgtGetNext(nIdMy)
End While
nIdPart = EgtGetNextPartInRawPart(nIdPart)
End While
Return bOk
End Function
Friend Function ResetAllStartCurv() As Boolean
Dim bOk As Boolean = True
Dim nIdPart As Integer = EgtGetFirstPart()
While nIdPart <> GDB_ID.NULL
' accedo al Layer OutLoop
Dim nIdLayerOutLoop As Integer = EgtGetFirstNameInGroup(nIdPart, NAME_OUTLOOP)
EgtRemoveInfo(nIdLayerOutLoop, "Start")
nIdPart = EgtGetNextPart(nIdPart)
End While
Dim nRawId As Integer = CamAuto.GetCurrentRaw()
nIdPart = EgtGetFirstPartInRawPart(nRawId)
While nIdPart <> GDB_ID.NULL
' accedo al Layer OutLoop
Dim nIdLayerOutLoop As Integer = EgtGetFirstNameInGroup(nIdPart, NAME_OUTLOOP)
EgtRemoveInfo(nIdLayerOutLoop, "Start")
nIdPart = EgtGetNextPartInRawPart(nIdPart)
End While
Return bOk
End Function
' verifico che il contorno passato non sia stato separato
Friend Function VerifyOutLoopIsClosed(nIdLayerOutLoop As Integer) As Boolean
Dim nIdMy As Integer = EgtGetFirstInGroup(nIdLayerOutLoop)
While nIdMy <> GDB_ID.NULL
Dim nValInfo As Integer = 1
If EgtGetInfo(nIdMy, "JoinEntity", nValInfo) Then
If nValInfo = 0 Then Return False
End If
EgtRemoveInfo(nIdMy, "JoinEntity")
nIdMy = EgtGetNext(nIdMy)
End While
Return True
End Function
Friend Function RemoveFinalEmptyPhases() As Boolean
Dim nOpeId As Integer = EgtGetLastOperation()
While nOpeId <> GDB_ID.NULL
+6
View File
@@ -251,6 +251,12 @@ Module ConstMach
Public Const SELECT_REGION_LAYER As String = "SelectRegion"
' Info in pezzo per stato rotazione
Public Const INFO_PARTROT As String = "ROT"
' Info in entità in OutLoop per indicare se è separata WaterJet
Public Const INFO_JOINTENTITY As String = "JoinEntity"
' Nome layer per "*" inidcanti un lato separato nel taglio WaterJet
Public Const INFO_AUX_SPLIT_WJ As String = "AUX_SPLIT_WJ"
' Info in OutLoop per punto inzio lavorazione WaterJet
Public Const INFO_START As String = "Start"
' Nome di pezzo che è una cornice
Public Const NAME_FRAME As String = "Frame"
+2
View File
@@ -192,6 +192,8 @@ Public Class MainWindowM
Dim sNestKey As String = ""
EgtUILib.GetPrivateProfileString( S_LICENCE, K_NESTKEY, "", sNestKey, sLicFile)
EgtSetNestKey( sNestKey)
Dim bNetHwKey As Boolean = ( GetMainPrivateProfileInt(S_GENERAL, K_NETKEY, 0) = 1)
EgtSetNetHwKey( bNetHwKey)
' Verifico abilitazione nesting automatico
m_bAutoNestOption = Not String.IsNullOrWhiteSpace( sNestKey)
' Recupero livello e opzioni della chiave
+2 -2
View File
@@ -69,6 +69,6 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.4.5.1")>
<Assembly: AssemblyFileVersion("2.4.5.1")>
<Assembly: AssemblyVersion("2.4.5.4")>
<Assembly: AssemblyFileVersion("2.4.5.4")>
+4
View File
@@ -248,6 +248,10 @@ Public Class MyMachGroupPanelVM
' aggiungo alla lista delle lastre correnti/orig
Dim sSlabNameDB As String = GetSlabName()
LoadSlabsList(sSlabNameDB)
' imposto la visibilità dei comandi per il waterjet
OmagOFFICEMap.refNestingTabVM.Set_WJ_Cmd_Visibility()
Return True
End Function
+30 -2
View File
@@ -223,6 +223,8 @@ Public Class MySceneHostVM
End Sub
Private Function ExecExport(sDirDest As String) As Boolean
' salvo il nome della macchina correntemente selezionata
Dim CurrentSelectedMachGroup As String = OmagOFFICEMap.refMachGroupPanelVM.SelectedMachGroup.Machine
' Path completa del progetto corrente
Dim sFilePath As String = String.Empty
EgtGetCurrFilePath(sFilePath)
@@ -282,10 +284,10 @@ Public Class MySceneHostVM
File.Copy(sOriPath, sNewPath, True)
Catch ex As Exception
bOk = False
EgtOutLog( "Slab image not found :" & sOriPath)
EgtOutLog("Slab image not found :" & sOriPath)
End Try
EgtSetName(nPhotoId, PHOTO_NAME)
EgtChangePhotoCenterAsFlatScan( nPhotoId)
EgtChangePhotoCenterAsFlatScan(nPhotoId)
End If
' Elimino gli altri gruppi di lavorazioni
For Each nMGrpId As Integer In vMchGrps
@@ -308,6 +310,25 @@ Public Class MySceneHostVM
Dim nMarkId As Integer = EgtCreateGroup(GDB_ID.ROOT)
EgtSetName(nMarkId, NAME_PROJMARK)
EgtSetLevel(nMarkId, GDB_LV.SYSTEM)
' Imposto la macchina: salvo l'altezza della sovratavola
Dim sMachine As String = String.Empty
EgtGetInfo(nMchGrpId, "Machine", sMachine)
If Not String.IsNullOrEmpty(sMachine) Then
InitCurrentMachine(OmagOFFICEMap.refMainWindowVM.MainWindowM.sMachinesRoot, sMachine,
OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.PRODUCTION_LINE),
OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.ENABLE_MILL),
OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.ENABLE_POLISHING),
OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.ENABLE_WJ),
True)
Select Case GetCurrentTable()
Case 3
EgtSetInfo(nMarkId, K_TAB3_ADDITIONALTABLE, CurrentMachine.dAdditionalTable)
Case 2
EgtSetInfo(nMarkId, K_TAB2_ADDITIONALTABLE, CurrentMachine.dAdditionalTable)
Case Else
EgtSetInfo(nMarkId, K_ADDITIONALTABLE, CurrentMachine.dAdditionalTable)
End Select
End If
Dim nReducedCut As Integer = 1
EgtGetInfo(nMchGrpId, INFO_REDUCEDCUT, nReducedCut)
EgtSetInfo(nMarkId, INFO_REDUCEDCUT, nReducedCut)
@@ -326,6 +347,13 @@ Public Class MySceneHostVM
' Salvo il file
If Not EgtSaveFile(sFileDest, NGE.CMPTEXT) Then bOk = False
Next
' reimposto la macchina corrente
InitCurrentMachine(OmagOFFICEMap.refMainWindowVM.MainWindowM.sMachinesRoot, CurrentSelectedMachGroup,
OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.PRODUCTION_LINE),
OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.ENABLE_MILL),
OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.ENABLE_POLISHING),
OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.ENABLE_WJ),
True)
' Distruggo il contesto corrente e ripristino quello originale
EgtSetCurrentContext(nCurrCtx)
EgtDeleteContext(nCtx)
+39
View File
@@ -797,6 +797,15 @@ Public Class SplitModeVM
vtXY.Normalize()
Dim ptCen As Point3d = Point3d.Media(ptMin, ptMax) + vtXY * If(Not b2ndLav, -0.8, 0.8) * dHtxt
ptCen.z = ptMax.z + 1
' ricavo la posizione del punto (se waterjet separata)
If m_MachiningList(nI).m_nType = MCH_OY.WATERJETTING Or m_MachiningList(nI).m_nType = MCH_OY.MILLING Then
Dim ptMid As Point3d
Dim vVers As Vector3d
MidPointOfCurve(m_MachiningList(nI).m_nId, ptMid, vVers)
ptCen = ptMid ' + vVers * If(Not b2ndLav, -0.8, 0.8) * dHtxt
End If
If bNumber Then
Dim nNbrId As Integer = EgtCreateTextAdv(m_nNbrGrpId, ptCen, 0, (nI + 1).ToString(), "",
300, False, dHtxt, dRat, 0, INS_POS.MC)
@@ -851,6 +860,36 @@ Public Class SplitModeVM
Return EgtGetBBoxGlob(nPvId, GDB_BB.STANDARD, ptMin, ptMax)
End Function
Private Function MidPointOfCurve(nOperId As Integer, ByRef ptMid As Point3d, ByRef vVers As Vector3d) As Boolean
Dim nPvId As Integer = GDB_ID.NULL
EgtGetInfo(EgtGetFirstNameInGroup(nOperId, NAME_PREVIEW), INFO_PV_ONPART_ID, nPvId)
' creo un layer ausiliario per creare la curva composita
Dim AuxLayer As Integer = EgtCreateGroup(nPvId)
' imposto la lavorazione corrente
EgtSetCurrMachining(nOperId)
' recupero tutte le entità della lavorazione corrente
Dim nInd As Integer = 0
Dim nIdCurr As Integer
Dim nSub As Integer
Dim CurveCompoList As New List(Of Integer)
While EgtGetMachiningGeometry(nInd, nIdCurr, nSub)
CurveCompoList.Add(nIdCurr)
nInd += 1
End While
Dim PtNearStart As Point3d
Dim nIdCutPath As Integer = EgtCreateCurveCompoByChain(AuxLayer, CurveCompoList.ToArray, PtNearStart, False)
Dim dLength As Double = 0
EgtCurveLength(nIdCutPath, dLength)
Dim dParam As Double = 0
EgtCurveParamAtLength(nIdCutPath, dLength / 2, dParam)
EgtAtParamPoint(nIdCutPath, dParam, GDB_RT.GLOB, ptMid)
EgtAtParamVector(nIdCutPath, dParam, -1, vVers)
vVers.Normalize()
vVers.Rotate(Vector3d.Z_AX, 90)
EgtErase(AuxLayer)
Return True
End Function
Private Function AddMachiningDirection(ptStart As Point3d, vtDir As Vector3d, dLen As Double, bTwin As Boolean) As Integer
Dim dArrX As Double = dLen * Math.Cos(30 * Math.PI / 180)
Dim dArrY As Double = dLen * Math.Sin(30 * Math.PI / 180)
+31 -16
View File
@@ -137,24 +137,24 @@
</Border>
<UniformGrid Grid.Column="0" Columns="2" Margin="0,0,0,5">
<Button Content="{Binding InsertPartMsg}"
Style="{StaticResource OptionPanel_TextButton}"
Command="{Binding InsertPartCommand}"
Margin="0,0,2.5,0"/>
<Button Content="{Binding StorePartMsg}"
Style="{StaticResource OptionPanel_TextButton}"
Command="{Binding StorePartCommand}"
Margin="2.5,0,0,0"/>
<UniformGrid Grid.Column="0" Columns="2" Margin="0,0,0,5">
<Button Content="{Binding InsertPartMsg}"
Style="{StaticResource OptionPanel_TextButton}"
Command="{Binding InsertPartCommand}"
Margin="0,0,2.5,0"/>
<Button Content="{Binding StorePartMsg}" Grid.Column="1"
Style="{StaticResource OptionPanel_TextButton}"
Command="{Binding StorePartCommand}"
Margin="2.5,0,0,0"/>
<!--<ToggleButton Content="{Binding StartCurvWJMsg}" Grid.Column="2"
Visibility="{Binding StartCurvWJ_Visibility}"
Style="{StaticResource OptionPanel_ToggleButton}"
IsChecked="{Binding bStartCurvWJ}"
Margin="2.5,0,2.5,0"/>-->
</UniformGrid>
<Grid Margin="0,0,-2.5,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<UniformGrid Grid.Column="0" Columns="{Binding CountColumn}" Margin="0,0,0,5">
<Button Content="{Binding RemovePartMsg}"
Grid.ColumnSpan="{Binding DragRectangle_Cl_Span}"
Style="{StaticResource OptionPanel_TextButton}"
Command="{Binding RemovePartCommand}"
Margin="0,0,2.5,0"/>
@@ -163,8 +163,23 @@
Style="{StaticResource OptionPanel_ToggleButton}"
IsChecked="{Binding bDragRectangle}"
Margin="2.5,0,2.5,0"/>
</Grid>
<!--<ToggleButton Content="{Binding SplitCurvWJMsg}" Grid.Column="2"
Visibility="{Binding SplitCurvWJ_Visibility}"
Style="{StaticResource OptionPanel_ToggleButton}"
IsChecked="{Binding bSplitCurvWJ}"
Margin="2.5,0,2.5,0"/>-->
</UniformGrid>
<UniformGrid Grid.Column="0" Columns="2" Margin="0,0,0,5" Visibility="{Binding WJ_Cmd_Visibility}">
<ToggleButton Content="{Binding SplitCurvWJMsg}" Grid.Column="2"
Style="{StaticResource OptionPanel_ToggleButton}"
IsChecked="{Binding bSplitCurvWJ}"
Margin="2.5,0,2.5,0"/>
<ToggleButton Content="{Binding StartCurvWJMsg}" Grid.Column="2"
Style="{StaticResource OptionPanel_ToggleButton}"
IsChecked="{Binding bStartCurvWJ}"
Margin="2.5,0,2.5,0"/>
</UniformGrid>
<UniformGrid Columns="2" Margin="0,0,0,5">
<Button Content="{Binding SelectAllMsg}"
+454 -11
View File
@@ -46,6 +46,9 @@ Public Class NestingTabVM
Private m_SideListRectangle(4) As Integer
Private m_sTextContent As String = String.Empty
' Id dei lato WJ da separare tramite comando ON_OFF
Private m_nIdSelectedSideWJ As Integer = GDB_ID.NULL
Private m_nIdSelectedWaterJet As Integer = GDB_ID.NULL
Private m_CsvImportWindow As CsvWindowV
Friend ReadOnly Property CsvImportWindow As CsvWindowV
@@ -152,6 +155,13 @@ Public Class NestingTabVM
End Set
End Property
Private m_CountColumn As Integer = 1
Public ReadOnly Property CountColumn As Integer
Get
Return m_CountColumn
End Get
End Property
#Region "Messages"
Public ReadOnly Property InsertPartMsg As String
@@ -178,6 +188,20 @@ Public Class NestingTabVM
End Get
End Property
Public ReadOnly Property SplitCurvWJMsg As String
Get
'91133=Separa
Return EgtMsg(91133)
End Get
End Property
Public ReadOnly Property StartCurvWJMsg As String
Get
'91132=Start
Return EgtMsg(91132)
End Get
End Property
Public ReadOnly Property SelectAllMsg As String
Get
Return EgtMsg(MSG_NESTPAGEUC + 4)
@@ -198,7 +222,7 @@ Public Class NestingTabVM
Public ReadOnly Property CsvDataMsg As String
Get
Return EgtMsg( 90398) 'Dati Csv
Return EgtMsg(90398) 'Dati Csv
End Get
End Property
@@ -230,11 +254,12 @@ Public Class NestingTabVM
Sub New()
If GetMainPrivateProfileInt(S_NEST, K_DRAGRECTANGLE, 1) <> 0 Then
m_DragRectangle_Visibility = Visibility.Visible
m_CountColumn += 1
Else
m_DragRectangle_Visibility = Visibility.Collapsed
End If
NotifyPropertyChanged("DragRectangle_Visibility")
NotifyPropertyChanged("DragRectangle_Cl_Span")
NotifyPropertyChanged("CountColumn")
' Creo riferimento a questa classe in OmagOFFICEMap
OmagOFFICEMap.SetRefNestingTabVM(Me)
End Sub
@@ -580,7 +605,7 @@ Public Class NestingTabVM
End If
' recupero il gruppo della lavorazione associata
Dim nIdParentPart As Integer = EgtGetParent(nIdParent)
Dim nIdPV As Integer = EgtGetFirstNameInGroup(nIdParentPart, "PV")
Dim nIdPV As Integer = EgtGetFirstNameInGroup(nIdParentPart, NAME_PREVIEW)
' se non esiste un gruppo di lavorazione associato allora esco
If nIdPV = GDB_ID.NULL Then
'm_CurrProjPage.ClearMessage()
@@ -846,6 +871,12 @@ Public Class NestingTabVM
End Get
Set(value As Boolean)
m_bDragRectangle = value
m_bSplitCurvWJ = False
ResetSplitCurvWJParam(True)
m_bStartCurvWJ = False
ResetStartCurvWJParam(True)
NotifyPropertyChanged("bSplitCurvWJ")
NotifyPropertyChanged("bStartCurvWJ")
End Set
End Property
@@ -856,15 +887,401 @@ Public Class NestingTabVM
End Get
End Property
Public ReadOnly Property DragRectangle_Cl_Span As Integer
Get
If m_DragRectangle_Visibility = Visibility.Visible Then
Return 1
#Region "WATERJET SPLIT CURVE"
' funzione per la selezione dei lati su cui operare la separazione del tagli waterjet
Private Sub OnMyMouseDownSceneSplitCurv(sender As Object, e As System.Windows.Forms.MouseEventArgs)
' Si può selezionare solo con il tasto sinistro e se il bottone TEST Attivo
If e.Button <> Windows.Forms.MouseButtons.Left Or
Not m_bSplitCurvWJ Then
Return
End If
' Se esiste un elemento selezionato
EgtResetMark(m_nIdSelectedWaterJet)
' Verifico se selezionato indicativo di pezzo
EgtSetObjFilterForSelWin(False, True, False, False, False)
Dim nSelMy As Integer
EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSelMy)
Dim nIdMy As Integer = EgtGetFirstObjInSelWin()
While nIdMy <> GDB_ID.NULL
Dim sLayer As String = String.Empty
' layer di origine
Dim nIdParent As Integer = EgtGetParent(nIdMy)
' recupero il nome del Layer
EgtGetName(nIdParent, sLayer)
' solo se il nome del layer è quello associato ad un lato esterno allora procedo con l'evidenziazione
If sLayer = NAME_OUTLOOP Then
If EgtGetType(nIdMy) = GDB_TY.CRV_ARC OrElse EgtGetType(nIdMy) = GDB_TY.CRV_COMPO OrElse EgtGetType(nIdMy) = GDB_TY.CRV_LINE Then
If m_nIdSelectedSideWJ <> GDB_ID.NULL Or m_nIdSelectedSideWJ = nIdMy Then
EgtDeselectObj(m_nIdSelectedSideWJ)
End If
' recupero il gruppo della lavorazione associata
Dim nIdParentPart As Integer = EgtGetParent(nIdParent)
Dim nIdPV As Integer = EgtGetFirstNameInGroup(nIdParentPart, NAME_PREVIEW)
' VERIFICA: recupero l'elenco delle Preview di Tipo WaterJet associate a questo Part
Dim ListGroup As List(Of Integer) = ResearchGropuWJ(nIdParent, nIdPV)
' VERIFICA: se esistono delle lavorazioni associate al percorso OutLoop di tipo Saw allora non procedo
Dim ListGroupSaw As List(Of Integer) = ResearchGropuSaw(nIdParent, nIdPV)
' se non esiste almeno 1 Preview di tipo WaterJet
If ListGroup.Count > 0 And ListGroupSaw.Count = 0 Then
m_nIdSelectedSideWJ = nIdMy
Dim nValInfo As Integer = 1
Dim nNewValInfo As Integer = nValInfo
If EgtGetInfo(nIdMy, INFO_JOINTENTITY, nValInfo) Then
If nValInfo = 1 Then
nNewValInfo = 0
Else
nNewValInfo = 1
End If
Else
' se manca l'info allora il taglio sValInfo = "1" quindi separo il taglio
nNewValInfo = 0
End If
EgtSetInfo(nIdMy, INFO_JOINTENTITY, nNewValInfo)
' Ricalcolo tutte le lavorazioni
Dim nWarn As Integer = 0
ResetAllMachinings(nWarn)
' recupero l'indice del PreView che deve essere acceso per indicare la selezione
ListGroup = ResearchGropuWJ(nIdParent, nIdPV)
Dim nIdWJ As Integer = GetPVIdFromIdSide(ListGroup, nIdMy)
GetCurrentPVFromIdSide(ListGroup, nIdMy, nIdWJ, nIdParent)
' assegno un identificativo grafico per inidcare che è un taglio separato
If nNewValInfo = 0 Then
AssignFlagOnGraphic(nIdMy, nIdParentPart)
Else
EraseFlagOnGraphic(nIdMy, nIdParentPart)
End If
' salvo il valore del PreView evidenziato
m_nIdSelectedWaterJet = nIdWJ
EgtSetMark(nIdWJ)
EgtSelectObj(nIdMy)
EgtDraw()
Exit While
End If
End If
End If
Return 2
nIdMy = EgtGetNextObjInSelWin()
End While
Return
End Sub
' restituisce l'elenco dei Gruppi Waterjet associati al contorno indicato
Public Function ResearchGropuWJ(nIdOutLoop As Integer, nIdPV As Integer) As List(Of Integer)
Dim ListOfGroupPV As New List(Of Integer)
Dim nIdGroup As Integer = GDB_ID.NULL
Dim nIdMy As Integer = GDB_ID.NULL
' recupero il primo lato dall'elenco dei lati della figura
nIdMy = EgtGetFirstInGroup(nIdOutLoop)
' altrimenti cerco all'interno del layer OutLoop per ogni lato la lavorazione associata
While nIdMy <> GDB_ID.NULL
' verifico se esiste una Preview associata al lato
nIdGroup = EgtGetFirstNameInGroup(nIdPV, "Waterjet" & nIdMy.ToString & "S")
If nIdGroup <> GDB_ID.NULL Then
ListOfGroupPV.Add(nIdGroup)
End If
nIdMy = EgtGetNext(nIdMy)
End While
Return ListOfGroupPV
End Function
' restituisce l'elenco dei Gruppi Saw associati al contorno indicato
Public Function ResearchGropuSaw(nIdOutLoop As Integer, nIdPV As Integer) As List(Of Integer)
Dim ListOfGroupPV As New List(Of Integer)
Dim nIdGroup As Integer = GDB_ID.NULL
Dim nIdMy As Integer = GDB_ID.NULL
' recupero il primo lato dall'elenco dei lati della figura
nIdMy = EgtGetFirstInGroup(nIdOutLoop)
' altrimenti cerco all'interno del layer OutLoop per ogni lato la lavorazione associata
While nIdMy <> GDB_ID.NULL
' verifico se esiste una Preview associata al lato
nIdGroup = EgtGetFirstNameInGroup(nIdPV, "Saw" & nIdMy.ToString)
If nIdGroup <> GDB_ID.NULL Then
ListOfGroupPV.Add(nIdGroup)
End If
nIdMy = EgtGetNext(nIdMy)
End While
Return ListOfGroupPV
End Function
Public Function GetPVIdFromIdSide(ListGroup As List(Of Integer), nIdMy As Integer) As Integer
Dim IdWaterjetPV As Integer = GDB_ID.NULL
For Each nIdItem As Integer In ListGroup
Dim sName As String = String.Empty
If EgtGetName(nIdItem, sName) Then
If sName.Contains(nIdMy.ToString) Then
IdWaterjetPV = nIdItem
Exit For
End If
End If
Next
Return IdWaterjetPV
End Function
Public Sub GetCurrentPVFromIdSide(ListGroup As List(Of Integer), nIdMy As Integer, ByRef nIdWj As Integer, nIdParent As Integer)
Dim nObjInGroup As Integer = EgtGetGroupObjs(nIdParent)
Dim nCount As Integer = 0
GetNextSideJoint(ListGroup, nIdMy, nIdWj, nCount, nObjInGroup)
If nIdWj <> GDB_ID.NULL Then Return
GetPrevSideJoint(ListGroup, nIdMy, nIdWj, nCount, nObjInGroup)
End Sub
' funzione ricorsiva per la ricerca del lato al quale è associata la PreView
Private Sub GetNextSideJoint(ListGroup As List(Of Integer), nIdMy As Integer, ByRef nIdWj As Integer, ByRef nCount As Integer, nObjInGroup As Integer)
Dim nValInfo As Integer = 1
' espressione di controllo per evitare di generare Loop infinito
If nCount > nObjInGroup Then Return
If nIdWj = GDB_ID.NULL Then
Dim nIdWJNext As Integer = EgtGetNext(nIdMy)
If nIdWJNext = GDB_ID.NULL Then nIdWJNext = EgtGetFirstInGroup(EgtGetParent(nIdMy))
nCount += 1
EgtGetInfo(nIdWJNext, "JoinEntity", nValInfo)
If nValInfo = 1 Then
nIdWj = GetPVIdFromIdSide(ListGroup, nIdWJNext)
If nIdWj <> GDB_ID.NULL Then Return
Else
Return
End If
'nIdWJNext = EgtGetNext(nIdWJNext)
GetNextSideJoint(ListGroup, nIdWJNext, nIdWj, nCount, nObjInGroup)
If nIdWj <> GDB_ID.NULL Then Return
End If
End Sub
' funzione ricorsiva per la ricerca del lato al quale è associata la PreView
Private Sub GetPrevSideJoint(ListGroup As List(Of Integer), nIdMy As Integer, ByRef nIdWj As Integer, ByRef nCount As Integer, nObjInGroup As Integer)
Dim nValInfo As Integer = 1
' espressione di controllo per evitare di generare Loop infinito
If nCount > nObjInGroup Then Return
If nIdWj = GDB_ID.NULL Then
Dim nIdWJPrev As Integer = EgtGetPrev(nIdMy)
' se arrivato al primo valore allora continuo la ricerca dall'ultimo
If nIdWJPrev = GDB_ID.NULL Then nIdWJPrev = EgtGetLastInGroup(EgtGetParent(nIdMy))
nCount += 1
EgtGetInfo(nIdWJPrev, INFO_JOINTENTITY, nValInfo)
If nValInfo = 1 Then
nIdWj = GetPVIdFromIdSide(ListGroup, nIdWJPrev)
If nIdWj <> GDB_ID.NULL Then Return
Else
Return
End If
'nIdWJPrev = EgtGetPrev(nIdWJPrev)
GetPrevSideJoint(ListGroup, nIdWJPrev, nIdWj, nCount, nObjInGroup)
If nIdWj <> GDB_ID.NULL Then Return
End If
End Sub
Public Sub ResetSplitCurvWJParam(Optional bAllParam As Boolean = True)
If bAllParam Then
EgtDeselectObj(m_nIdSelectedSideWJ)
EgtResetMark(m_nIdSelectedWaterJet)
End If
m_nIdSelectedSideWJ = GDB_ID.NULL
m_nIdSelectedWaterJet = GDB_ID.NULL
EgtDraw()
End Sub
' ricevo l'ID del percorso di lavorazione WJ al quale associo una etichetta grafica con scritto "S"
Private Sub AssignFlagOnGraphic(nIdMy As Integer, IdParentPart As Integer)
' cerco se esiste già un layer nominato "AUX_SPLIT_WJ", altrimenti lo creo
Dim IdAuxLayer As Integer = EgtGetFirstNameInGroup(IdParentPart, INFO_AUX_SPLIT_WJ)
If IdAuxLayer = GDB_ID.NULL Then
IdAuxLayer = EgtCreateGroup(IdParentPart)
EgtSetName(IdAuxLayer, INFO_AUX_SPLIT_WJ)
End If
' recupero il punto medio del segmento selezionato
Dim MidPoint As Point3d
EgtMidPoint(nIdMy, GDB_RT.GLOB, MidPoint)
'Dim nIdTextFlag As Integer = EgtCreateText(IdAuxLayer, MidPoint, "*", 20, GDB_RT.GLOB)
Dim nIdTextFlag As Integer = GetCreateFlagText(nIdMy, IdAuxLayer)
EgtSetColor(nIdTextFlag, New Color3d(255, 0, 0))
EgtSetName(nIdTextFlag, "RefSide_" & nIdMy.ToString)
End Sub
Private Function GetCreateFlagText(nId As Integer, nIdLayer As Integer, Optional sText As String = "*") As Integer
' recupero il punto medio
Dim MidPoint As Point3d
EgtMidPoint(nId, GDB_RT.GLOB, MidPoint)
' recupero la direzione del vettore nel punto medio
Dim vVers As Vector3d
EgtMidVector(nId, GDB_RT.GLOB, vVers)
vVers.Normalize()
vVers.Rotate(Vector3d.Z_AX, 90)
' Ingombro complessivo della lavorazione
Dim ptMin, ptMax As Point3d
EgtStartPoint(nId, GDB_RT.GLOB, ptMin)
EgtEndPoint(nId, GDB_RT.GLOB, ptMax)
' Metto il numero nel centro
Dim dRadXY = Point3d.DistXY(ptMin, ptMax)
Dim dHtxt As Double = 50
Dim dRat As Double = 0.75
If dRadXY < 200 Then
dHtxt = 40
dRat = 0.6
ElseIf dRadXY < 25 Then
dHtxt = 25
dRat = 0.5
End If
' determino la posizione del flag
MidPoint.x += vVers.x * dHtxt / 2
MidPoint.y += vVers.y * dHtxt / 2
Return EgtCreateTextAdv(nIdLayer, MidPoint, 0, sText, "", 300, False, dHtxt, dRat, 0, INS_POS.MC, GDB_RT.GLOB)
End Function
Private Sub EraseFlagOnGraphic(nIdMy As Integer, IdParentPart As Integer)
' cerco se esiste già un layer nominato "AUX_SPLIT_WJ", altrimenti lo creo
Dim IdAuxLayer As Integer = EgtGetFirstNameInGroup(IdParentPart, INFO_AUX_SPLIT_WJ)
If IdAuxLayer = GDB_ID.NULL Then Return
Dim nIdTextFlag As Integer = EgtGetFirstNameInGroup(IdAuxLayer, "RefSide_" & nIdMy.ToString)
EgtErase(nIdTextFlag)
End Sub
#End Region ' WaterJet Section and StartPoint
Private m_bSplitCurvWJ As Boolean
Public Property bSplitCurvWJ As Boolean
Get
Return m_bSplitCurvWJ
End Get
Set(value As Boolean)
m_bSplitCurvWJ = value
If Not m_bSplitCurvWJ Then
' resetto i parametri di selezione dei lati
ResetSplitCurvWJParam(True)
End If
m_bDragRectangle = False
m_bStartCurvWJ = False
ResetStartCurvWJParam(True)
NotifyPropertyChanged("bDragRectangle")
NotifyPropertyChanged("bStartCurvWJ")
End Set
End Property
Private m_WJ_Cmd_Visibility As Visibility = Visibility.Collapsed
Public ReadOnly Property WJ_Cmd_Visibility As Visibility
Get
Return m_WJ_Cmd_Visibility
End Get
End Property
' in funzione della macchinata attiva predispone la visualizzazione del bottone SplitCurv (abilitato solo per WaterJet Machine)
Public Sub Set_WJ_Cmd_Visibility()
' gestisco la visualizzazione del comando ON_OFF (per i tagli waterjet)
If CurrentMachine.WaterJettingActive Then
m_WJ_Cmd_Visibility = Visibility.Visible
Else
m_WJ_Cmd_Visibility = Visibility.Collapsed
End If
NotifyPropertyChanged("WJ_Cmd_Visibility")
End Sub
#Region "WATERJET START POINT"
' funzione per la selezione del punto di inizio tagli waterjet (percorso chiuso)
Private Sub OnMyMouseDownSceneStartCurv(sender As Object, e As System.Windows.Forms.MouseEventArgs)
' Si può selezionare solo con il tasto sinistro e se il bottone TEST Attivo
If e.Button <> Windows.Forms.MouseButtons.Left Or
Not m_bStartCurvWJ Then
Return
End If
' Acquisisco punto da disegno
Dim ptStartCurv As New Point3d
EgtUnProjectPoint(e.Location, ptStartCurv)
' Aggiusto Z punto acquisito (è in globale)
Dim ptRawMax As New Point3d
Dim ptRawMin As New Point3d
If GetRawBox(ptRawMin, ptRawMax) Then
ptStartCurv.z = ptRawMax.z
End If
' Se esiste un elemento selezionato
EgtResetMark(m_nIdSelectedWaterJet)
' Verifico se selezionato indicativo di pezzo
EgtSetObjFilterForSelWin(False, True, False, False, False)
Dim nSelMy As Integer
EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSelMy)
Dim nIdMy As Integer = EgtGetFirstObjInSelWin()
While nIdMy <> GDB_ID.NULL
Dim sLayer As String = String.Empty
' layer di origine
Dim nIdParent As Integer = EgtGetParent(nIdMy)
' recupero il nome del Layer
EgtGetName(nIdParent, sLayer)
' solo se il nome del layer è quello associato ad un lato esterno allora procedo con l'evidenziazione
If sLayer = NAME_OUTLOOP Or sLayer = NAME_INLOOP Then
If EgtGetType(nIdMy) = GDB_TY.CRV_ARC OrElse EgtGetType(nIdMy) = GDB_TY.CRV_COMPO OrElse EgtGetType(nIdMy) = GDB_TY.CRV_LINE Then
' verifico che il contorno sia chiuso, altrimenti esco
If Not VerifyOutLoopIsClosed(nIdParent) Then
'91131=Il contorno non è chiuso
OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(91131), MSG_TYPE.WARNING)
Exit While
End If
' recupero il gruppo della lavorazione associata
Dim nIdParentPart As Integer = EgtGetParent(nIdParent)
Dim nIdPV As Integer = EgtGetFirstNameInGroup(nIdParentPart, NAME_PREVIEW)
' VERIFICA: recupero l'elenco delle Preview di Tipo WaterJet_n_S associate a questo Part
Dim ListGroup As List(Of Integer) = ResearchGropuWJ(nIdParent, nIdPV)
' VERIFICA: se esistono delle lavorazioni associate al percorso OutLoop di tipo Saw allora non procedo
Dim ListGroupSaw As List(Of Integer) = ResearchGropuSaw(nIdParent, nIdPV)
' se non esiste almeno 1 Preview di tipo WaterJet
If ListGroup.Count = 1 And ListGroupSaw.Count = 0 Then
EgtSetInfo(nIdParent, INFO_START, ptStartCurv)
' Ricalcolo tutte le lavorazioni
Dim nWarn As Integer = 0
ResetAllMachinings(nWarn)
' recupero l'indice del PreView che deve essere acceso per indicare la selezione
ListGroup = ResearchGropuWJ(nIdParent, nIdPV)
Dim nIdWJ As Integer = GetPVIdFromIdSide(ListGroup, nIdMy)
GetCurrentPVFromIdSide(ListGroup, nIdMy, nIdWJ, nIdParent)
m_nIdSelectedWaterJet = nIdWJ
EgtSetMark(nIdWJ)
EgtDraw()
Exit While
Else
'91131=Il contorno non è chiuso
OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(91131), MSG_TYPE.WARNING)
Exit While
End If
End If
End If
nIdMy = EgtGetNextObjInSelWin()
End While
Return
End Sub
#End Region ' Water Start Point
Private m_bStartCurvWJ As Boolean
Public Property bStartCurvWJ As Boolean
Get
Return m_bStartCurvWJ
End Get
Set(value As Boolean)
m_bStartCurvWJ = value
If Not m_bStartCurvWJ Then
ResetStartCurvWJParam(True)
End If
m_bDragRectangle = False
m_bSplitCurvWJ = False
ResetSplitCurvWJParam(True)
NotifyPropertyChanged("bDragRectangle")
NotifyPropertyChanged("bSplitCurvWJ")
End Set
End Property
Public Sub ResetStartCurvWJParam(Optional bAllParam As Boolean = True)
If bAllParam Then
EgtDeselectObj(m_nIdSelectedSideWJ)
EgtResetMark(m_nIdSelectedWaterJet)
End If
m_nIdSelectedSideWJ = GDB_ID.NULL
m_nIdSelectedWaterJet = GDB_ID.NULL
EgtDraw()
End Sub
#Region "COMMANDS"
@@ -1450,6 +1867,10 @@ Public Class NestingTabVM
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
' Cancello eventuali messaggi
OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
' cancello tutti i tagli di separazione
ResetAllSplitCurv()
' cancello tutti i punti di inizio (Waterjet)
ResetAllStartCurv()
' Cancello tutte le lavorazioni
CamAuto.EraseMachinings(GDB_ID.NULL)
' Reinserisco tutte le lavorazioni piane
@@ -1512,8 +1933,8 @@ Public Class NestingTabVM
EgtTextGetContent( nTextId, sText)
Dim nPos As Integer = sText.IndexOf( sCsvName)
Dim sNewText As String
If nPos < 0 Then
sNewText = sNewName & "<br/>" & sText
If nPos <0 Then
sNewText= sNewName & "<br/>" & sText
Else
sNewText = sText.Remove( nPos, sCsvName.Length()).Insert( nPos, sNewName)
End If
@@ -1547,6 +1968,17 @@ Public Class NestingTabVM
m_vtTotMove = Vector3d.NULL()
Return
End If
' se in modalità separazione curve WaterJet
If m_bSplitCurvWJ Then
OnMyMouseDownSceneSplitCurv(sender, e)
Return
End If
' se in modalità punto inizio curve WaterJet
If m_bStartCurvWJ Then
OnMyMouseDownSceneStartCurv(sender, e)
Return
End If
' Per default no drag
m_bDrag = False
' Verifico se selezionato indicativo di pezzo
@@ -1610,7 +2042,7 @@ Public Class NestingTabVM
If Not m_bDrag Or m_bDragging Then Return
' Se primo movimento di drag, verifico di aver superato la soglia di movimento in pixel
If m_bDragToStart Then
If Math.Abs(e.Location.X - m_locPrev.X) < m_nRestRadius And
If Math.Abs(e.Location.X - m_locPrev.X) <m_nRestRadius And
Math.Abs(e.Location.Y - m_locPrev.Y) < m_nRestRadius Then
Return
End If
@@ -1729,6 +2161,17 @@ Public Class NestingTabVM
ResetDragRectangleParam()
Return
End If
' verifico che sia attivo il comando di modifica tagli waterjet
If m_bSplitCurvWJ Then
' deseleziono gli oggeti, resetto le variabili usate, aggiorno il disegno
' ResetSplitCurvWJParam(False)
Return
End If
If m_bStartCurvWJ Then
' ResetStartCurvWJParam(False)
Return
End If
' Se eseguito drag
If Not m_bDragToStart Then
' Se movimento con sola verifica finale