From ac49588b3164c7d88493a37389cbb9957ae483ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rk=20Vitarius?= Date: Thu, 12 Jun 2025 13:27:34 +0200 Subject: [PATCH] Design done --- Dokumentáció Készítő 3/MainWindow.xaml | 317 ++++++++--------- Dokumentáció Készítő 3/MainWindow.xaml.vb | 403 +--------------------- 2 files changed, 142 insertions(+), 578 deletions(-) diff --git a/Dokumentáció Készítő 3/MainWindow.xaml b/Dokumentáció Készítő 3/MainWindow.xaml index d98873e..f5d041d 100644 --- a/Dokumentáció Készítő 3/MainWindow.xaml +++ b/Dokumentáció Készítő 3/MainWindow.xaml @@ -1,190 +1,151 @@ - + + + - - + - - - - - + + - + + + + + + \ No newline at end of file diff --git a/Dokumentáció Készítő 3/MainWindow.xaml.vb b/Dokumentáció Készítő 3/MainWindow.xaml.vb index 993b710..c95afd0 100644 --- a/Dokumentáció Készítő 3/MainWindow.xaml.vb +++ b/Dokumentáció Készítő 3/MainWindow.xaml.vb @@ -117,10 +117,6 @@ Public Class MainWindow XLSCheckbox.IsChecked = True NamingSyntaxStefani.IsChecked = True namingsyntax = "stefani" - AktualisRajzRadioButton.IsChecked = True - - - If params.Contains("-arg") Then Try @@ -379,51 +375,10 @@ Public Class MainWindow conn.Disconnect(1) End Sub - Private Sub PurgeBongeszesButton_Click(sender As Object, e As EventArgs) Handles PurgeBongeszesButton.Click - - Dim mydig As New Ookii.Dialogs.Wpf.VistaFolderBrowserDialog - mydig.ShowDialog() - - Dim PurgeSelectedPath = mydig.SelectedPath() + "\" - - Try - My.Computer.FileSystem.DeleteFile(Path.GetTempPath() + "FilesDeletedRenamed.txt") - Catch ex As Exception - - End Try - Dim TempTxtFile As String = Path.GetTempPath() + "FilesDeletedRenamed.txt" - Dim fs As FileStream = File.Create(TempTxtFile) - fs.Close() - Dim allDirectories = System.IO.Directory.EnumerateDirectories(PurgeSelectedPath, "*", System.IO.SearchOption.AllDirectories) - 'Dim allDirectoriesList As String() - For Each DirD In allDirectories - ' MsgBox(DirD) - - If PRTCheckBox.IsChecked = True Then - Purge.Purge(DirD, 1, ".prt", True, False, TempTxtFile) - End If - If ASMCheckBox.IsChecked = True Then - Purge.Purge(DirD, 1, ".asm", True, False, TempTxtFile) - End If - If DRWCheckBox.IsChecked = True Then - Purge.Purge(DirD, 1, ".drw", True, False, TempTxtFile) - End If - - Next - - Process.Start(Path.GetTempPath() + "FilesDeletedRenamed.txt") - End Sub - - - Private Sub drwSplitButton_Click_1(sender As Object, e As EventArgs) Handles drwSplitButton.Click - - TakeAway() - - End Sub 'Radio Buttons Private Sub MaterialRadioButton4_CheckedChanged(sender As Object, e As EventArgs) @@ -657,7 +612,7 @@ Public Class MainWindow 'Handles sheets on drw - ParamaterChecker(model1) + ' ChangeSheets(model1, session, Drawing) @@ -1523,175 +1478,7 @@ Public Class MainWindow iParamValueStr = iParamValue.StringValue End Sub 'drw Split sub - Private Sub TakeAway() - Dim session As IpfcBaseSession = Nothing - Dim conn As IpfcAsyncConnection = Nothing - Connect(session, conn) - Dim model1 As IpfcModel - Dim sheetowner As IpfcSheetOwner = Nothing - Dim Drawing As IpfcDrawing = Nothing - Dim model2d As IpfcModel2D - Dim cmodels As CpfcModels - Dim oModelDescriptor As IpfcModelDescriptor = Nothing - Dim oModelDescriptorCreate As New CCpfcModelDescriptor - Dim options As IpfcRetrieveModelOptions = Nothing - Dim NewWorkingDir As String - Dim OldWorkDir As String - Dim model2 As IpfcModel = Nothing - ' Dim copyins As New CopyInstructions - model1 = session.CurrentModel - Dim model1name As String = model1.FileName - sheetowner = model1 - Dim numberorsheets As Integer = sheetowner.NumberOfSheets - Dim oPath As String = Path.GetDirectoryName(model1.Origin) - - Dim mydig As New Ookii.Dialogs.Wpf.VistaFolderBrowserDialog - mydig.ShowDialog() - NewWorkingDir = mydig.SelectedPath() + "\" - - OldWorkDir = session.GetCurrentDirectory - session.ChangeDirectory(NewWorkingDir) - - For k = 1 To numberorsheets - sheetowner = model1 - If Not AktualisRajzRadioButton.IsChecked = True Then - sheetowner.CurrentSheetNumber = k - Else - - End If - - - Dim h As Integer = 1 - Dim numberofsheetsforloop As Integer - If k = 1 And AktualisRajzRadioButton.IsChecked = False Then - numberofsheetsforloop = numberorsheets - Else - numberofsheetsforloop = numberorsheets - 1 - End If - - For j = 1 To numberofsheetsforloop - If Not sheetowner.CurrentSheetNumber = h Then - sheetowner.DeleteSheet(h) - End If - If Not h = sheetowner.CurrentSheetNumber Then - h = h - 1 - End If - h = h + 1 - Next - - model2d = model1 - - cmodels = model2d.ListModels() - For i = 0 To cmodels.Count - 1 - Try - model2d.DeleteModel(cmodels.Item(i)) - Catch ex As Exception - - End Try - Next - - Dim FileNameMod As String - namingsyntax = "stefani" - - FileNameMod = model1.FileName - - FileNames.Add(FileNameMod) - HandleNames(FileNameMod, 0, 0, ".DRW", model1) - Console.WriteLine(FileNameMod) - - Dim savedName As String = Strings.Left(Path.GetFileName(FileNameMod), Path.GetFileName(FileNameMod).Length - 4) - Dim fname As String = "r_" + Strings.Left(Path.GetFileName(FileNameMod), Path.GetFileName(FileNameMod).Length - 4) - - Try - model1.Copy(savedName, Nothing) - Catch ex As Exception - model1.Copy(fname, Nothing) - End Try - - - options = (New CCpfcRetrieveModelOptions).Create - options.AskUserAboutReps = False - - MsgBox(FileNameMod) - - Dim oModelDescriptor2 As IpfcModelDescriptor - - oModelDescriptor2 = oModelDescriptorCreate.Create(EpfcModelType.EpfcMDL_PART, FileNameMod, "") - oModelDescriptor2.Path = oPath - model2 = session.RetrieveModelWithOpts(oModelDescriptor2, options) - - oModelDescriptor = oModelDescriptorCreate.Create(EpfcModelType.EpfcMDL_PART, NewWorkingDir, "") - model2.Backup(oModelDescriptor) - - - Dim iWindow As IpfcWindow - iWindow = session.CurrentWindow - iWindow.Close() - model1name = model1.FileName - - model1.Erase() - options = (New CCpfcRetrieveModelOptions).Create - options.AskUserAboutReps = False - oModelDescriptor = oModelDescriptorCreate.Create(EpfcModelType.EpfcMDL_DRAWING, Strings.Left(model1name, model1name.Length - 4), "") - oModelDescriptor.Path = oPath - Try - model1 = session.RetrieveModelWithOpts(oModelDescriptor, options) - Catch ex As Exception - MsgBox("Nem megefelelő munkakönyvtár?") - Exit Sub - End Try - - - model1 = session.RetrieveModelWithOpts(oModelDescriptor, options) - iWindow = session.OpenFile(oModelDescriptor) - iWindow.Activate() - - - - - If AktualisRajzRadioButton.IsChecked = True Then - Exit For - End If - Next - - - Dim iWindows As IpfcWindows - iWindows = session.ListWindows - - For Each iWindow As IpfcWindow In iWindows - iWindow.Close() - Next - - Dim model3 As IpfcModel - Dim model4 As IpfcModel - - - Dim modelToRetrive As String = model2.InstanceName - oModelDescriptor = oModelDescriptorCreate.Create(EpfcModelType.EpfcMDL_DRAWING, modelToRetrive, "") - - session.EraseUndisplayedModels() - model3 = session.RetrieveModel(oModelDescriptor) - - Dim newModelName As String - newModelName = InputBox("Eneter new model name", "New model name", "") - model3.Rename(newModelName, False) - oModelDescriptor = oModelDescriptorCreate.Create(EpfcModelType.EpfcMDL_PART, modelToRetrive, "") - - model4 = session.RetrieveModel(oModelDescriptor) - model4.Rename(newModelName, False) - model3.Save() - session.EraseUndisplayedModels() - - - - session.ChangeDirectory(OldWorkDir) - conn.Disconnect(1) - FileNames.Clear() - - - End Sub - 'Don't know wtf this is atm Private Sub AutomatedFolderPick(ByVal session As IpfcBaseSession) 'WTF is this? Dim WorkingDir As String @@ -2048,153 +1835,6 @@ Public Class MainWindow End Function - Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click - - Dim session As IpfcBaseSession = Nothing - Dim conn As IpfcAsyncConnection = Nothing - - Dim fs As New FileStream("Serialized.ser", FileMode.Open) - Dim MyFormatter As New BinaryFormatter() - - dict = MyFormatter.Deserialize(fs) - fs.Close() - - - - Try - Connect(session, conn) - Catch ex As Exception - If ex.Message = "pfcExceptions::XToolkitAmbiguous" Then - MsgBox("Egynél több Creo fut, kérlezk zárd be az egyiket.") - End If - Exit Sub - End Try - - Dim WorkingDir As String - WorkingDir = session.GetCurrentDirectory() - Dim strFileSize As String = "" - Dim di As New IO.DirectoryInfo(WorkingDir) - Dim aryFi As IO.FileInfo() = di.GetFiles("SHM-*.prt*") - Dim options As IpfcRetrieveModelOptions = Nothing - Dim model1 As IpfcModel = Nothing - Dim oWindow As IpfcWindow - - For Each fi In aryFi - strFileSize = (Math.Round(fi.Length / 1024)).ToString() - Console.WriteLine("File Name: {0}", fi.FullName) - Next - - 'Clean up list - Dim PrtList As New List(Of String) 'prt list with duplicates - - 'remove version number from - For Each fi In aryFi - PrtList.Add(Path.GetFileNameWithoutExtension(Path.GetFileNameWithoutExtension(fi.Name))) - Next - - Dim result As List(Of String) = PrtList.Distinct().ToList 'prtlist without duplicates - - Dim MyFile As New FileStream("Serialized.ser", FileMode.Create, FileAccess.Write, FileShare.None) - Try - - - For Each Strss In result - Dim oModelDescriptor As IpfcModelDescriptor = Nothing - Dim oModelDescriptorCreate As New CCpfcModelDescriptor - Dim PrtNaneWE As String = Strss - - - oModelDescriptor = oModelDescriptorCreate.Create(EpfcModelType.EpfcMDL_PART, PrtNaneWE, "") - - options = (New CCpfcRetrieveModelOptions).Create - options.AskUserAboutReps = False - oModelDescriptor.Path = WorkingDir - - model1 = session.RetrieveModelWithOpts(oModelDescriptor, options) - - oWindow = session.OpenFile(oModelDescriptor) - oWindow.Activate() - Dim ParamValueR As String = "" - - Try - ReadParam(model1, "MEGNEVEZES_1", ParamValueR) - Catch ex As Exception - ParamValueR = "Nem létezik a paraméter" - End Try - - Dim form5window As New Form5 - - form5window.NemetMegnevezes.Text = ParamValueR - Dim ParamValueW As String = "" - - If dict.TryGetValue(ParamValueR, ParamValueW) = True Then - form5window.MaterialLabel4.Background = Brushes.Green - form5window.MaterialLabel4.Content = "Megtaláható a szótárban!" - Else - 'form5window.MaterialLabel4.Background = SystemColors.ButtonFace - form5window.MaterialLabel4.Content = "" - ParamValueW = gtranslate(ParamValueR, "de", "hu") - End If - - form5window.MagyarMegnevezes.Text = ParamValueW - - - - If Not PromtTranslateCBOX.IsChecked = True And dict.TryGetValue(ParamValueR, ParamValueW) = True Then - form5window.WWClicked = "OK" - Else - form5window.ShowDialog() - - End If - - - - ParamValueW = form5window.MagyarMegnevezes.Text - - If form5window.WWClicked = "OK" Then - WriteParam(model1, ParamValueW, "Megnevezes_1") - - If ParamValueR = form5window.NemetMegnevezes.Text Then - Else - ' WriteParam(model1, Form5.NemetMegnevezes.Text, "Megnevezes_1") - End If - - - Dim TestForChange As String = "" - If dict.TryGetValue(ParamValueR, TestForChange) = True Then - If Not TestForChange = ParamValueW Then - dict(ParamValueR) = ParamValueW - End If - Else - - dict.Add(ParamValueR, ParamValueW) - End If - - - ElseIf form5window.WWClicked = "FB" Then - - MyFormatter.Serialize(MyFile, dict) - MyFile.Close() - conn.Disconnect(1) - Exit Sub - End If - - - - - - oWindow.Close() - Next - Catch ex As Exception - - End Try - MyFormatter.Serialize(MyFile, dict) - MyFile.Close() - - conn.Disconnect(1) - - End Sub - @@ -2430,9 +2070,6 @@ Public Class MainWindow End Sub - Private Sub Button1_Click_1(sender As Object, e As RoutedEventArgs) Handles Button1.Click - - End Sub Private Sub KulonAloRajzok_Checked(sender As Object, e As RoutedEventArgs) Handles KulonAloRajzok.Checked If KulonAloRajzok.IsChecked = True Then @@ -2450,8 +2087,9 @@ Public Class MainWindow End If End Sub - Private Sub Button_Click(sender As Object, e As RoutedEventArgs) + Private Sub ExitButton_Click(sender As Object, e As RoutedEventArgs) Environment.Exit(0) + End Sub Private Sub AutomaticFolderSelect_Checked(sender As Object, e As RoutedEventArgs) Handles AutomaticFolderSelect.Checked @@ -2465,29 +2103,9 @@ Public Class MainWindow - Private Sub Subdirctories_Checked(sender As Object, e As RoutedEventArgs) Handles subdirctories.Checked - - End Sub - Private Sub ParamaterChecker(model1 As IpfcModel) - Dim ParamValueDef As String - ParamNameD = "OA_MEGNEVEZES_1" - ParamValueDef = "Focsoport" - ReadParam(model1, ParamNameD, ParamValueD) - - - If ParamValueD = ParamValueDef Then - ' MsgBox(sresult) - NewWindow.ShowDialog() - End If - If Form2.ans = "ok" Then - WriteParam(model1, Form2.NewParamValue, ParamNameD) - End If - - - End Sub Private Sub BackgroundWorker3_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker3.DoWork @@ -2528,20 +2146,5 @@ Public Class MainWindow End Sub - Private Sub Test_Click(sender As Object, e As RoutedEventArgs) Handles test.Click - Dim session As IpfcBaseSession = Nothing - Dim conn As IpfcAsyncConnection = Nothing - Connect(session, conn) - - Dim iWindows As IpfcWindows - iWindows = session.ListWindows - - For Each iWindow As IpfcWindow In iWindows - iWindow.Close() - Next - - session.EraseUndisplayedModels() - conn.Disconnect(1) - End Sub End Class \ No newline at end of file