/// <summary> /// Choose the target file /// </summary> /// <param name="obj">Not in use</param> private void ChooseTargetFileExecuted(object obj) { RwSaveFileDialogCreationData saveFileCreationData = new RwSaveFileDialogCreationData { Title = "Select the file where to store the informations", Filter = "Mfg file|*.txt|Textfile|*.txt" }; TargetFilename = RwFileAndDirectoryUtilities.SaveFileDialog(saveFileCreationData); }
/// <summary> /// Get the directory of a selected robot in the RobotsMachineDataFiles directory /// </summary> /// <param name="robot">The robot</param> /// <returns>The path to the robot machine data directory</returns> public static string GetMachineDataDirectory(this ITxRobot robot) { string path = string.Empty; string systemRoot = TxApplication.SystemRootDirectory; if (robot is ITxProcessModelObject processModelObject) { path = RwFileAndDirectoryUtilities.CombinePathSegments(systemRoot.TrimEnd('\\'), "RobotsMachineDataFiles", processModelObject.ProcessModelId.ExternalId); } return(path); }
/// <summary> /// Choose the source/import file /// </summary> /// <param name="obj">Not in use</param> private void ChooseSourceFileExecuted(object obj) { RwOpenFileDialogCreationData dialogCreationData = new RwOpenFileDialogCreationData { Multiselect = false, Title = "Select Mfg file", Filter = "Textfile|*.txt" }; SourceFilename = RwFileAndDirectoryUtilities.OpenFileDialog(dialogCreationData); if (!string.IsNullOrEmpty(SourceFilename)) { ReadMfgData(); } }
/// <summary> /// Choose a source file on the file system /// </summary> /// <param name="obj">Not in use</param> private void ChooseSourceFileExecuted(object obj) { RwOpenFileDialogCreationData creationData = new RwOpenFileDialogCreationData { Title = "Select the files with frame informations", Multiselect = false, Filter = "Frame file|*.csv" }; SourceFilename = RwFileAndDirectoryUtilities.OpenFileDialog(creationData); if (!string.IsNullOrEmpty(SourceFilename)) { ReadFrameData(); } }
/// <summary> /// Group the components by the filename of the prototype /// </summary> /// <param name="component">The current component</param> private void GroupComponentByPartName(TxComponent component) { TxStorage storage = component.StorageObject as TxStorage; if (storage is TxLibraryStorage && component.Visibility != TxDisplayableObjectVisibility.CannotBeDisplayed && rules != null && rules.Length > 0) { string filename = RwFileAndDirectoryUtilities.GetFilenameWithoutExtension((storage as TxLibraryStorage).FullPath).ToUpper(); foreach (string rule in rules) { if (filename.Contains(rule)) { AddToDictionary(rule, component); return; } } AddToDictionary("EMPTY", component); } }
/// <summary> /// Opens the machine data directory of the selected robot /// </summary> internal static void OpenMachineDataDirectory() { TxObjectList selectedObjects = TxApplication.ActiveSelection.GetItems(); if (selectedObjects.Count == 1) { if (selectedObjects[0] is ITxRobot robot) { string path = robot.GetMachineDataDirectory(); if (RwFileAndDirectoryUtilities.DoesDirectoryExist(path)) { Process.Start("explorer.exe", path); } else { throw new TxArgumentException($"The directory {path} does not exist!"); } } } }