/// <summary>
 /// Execute the frame creation process
 /// </summary>
 /// <param name="obj">Not in use</param>
 private void FrameCreationExecuted(object obj)
 {
     if (ReferenceFrame != null && ReferenceFrame != originalFrame)
     {
         TxApplication.ActiveDocument.WorkingFrame = ReferenceFrame;
     }
     try
     {
         foreach (RwFrameCreationViewModel frameViewModel in FramesData)
         {
             TxTransformation    location          = RwMathUtilities.CreateRpyTransformation(frameViewModel.X, frameViewModel.Y, frameViewModel.Z, frameViewModel.Rx, frameViewModel.Ry, frameViewModel.Rz, true);
             TxFrameCreationData frameCreationData = new TxFrameCreationData(frameViewModel.Name, location);
             TxApplication.ActiveDocument.PhysicalRoot.CreateFrame(frameCreationData);
         }
         string message = $"Successsfully created {FramesData.Count} frames";
         TxMessageBox.Show(message, "Frame creation", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
     }
     catch
     {
         string message = "An error occured during frame creation";
         TxMessageBox.Show(message, "Frame creation", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
     }
     finally
     {
         TxApplication.ActiveDocument.WorkingFrame = originalFrame;
     }
 }
Exemple #2
0
        /// <summary>
        /// Load the manufacturing features by their name to the study
        /// </summary>
        private void LoadMfgByName()
        {
            TxObjectList mfgsToLoad = new TxObjectList();

            TxEmsCacheManager emsCacheManager = new TxEmsCacheManager();

            QueryEmsCache(emsCacheManager, "wpMfgLibrary", "children", planningObject, null);

            TxObjectList mfgsInLibrary = planningObject.GetField("children") as TxObjectList;

            QueryEmsCache(emsCacheManager, "wpMfgLibrary", "name", null, mfgsInLibrary);

            foreach (ITxPlanningObject mfg in mfgsInLibrary)
            {
                string name = mfg.GetField("name") as string;
                if (MfgCollection.Contains(name))
                {
                    mfgsToLoad.Add(mfg);
                }
            }

            if (mfgsToLoad.Count > 0)
            {
                TxDocumentEx document = new TxDocumentEx();
                document.LoadComplete(mfgsToLoad, true);
                TxMessageBox.Show($"{mfgsToLoad.Count} Mfgs loaded!", "Mfg import", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
            }
            else
            {
                TxMessageBox.Show("No wanted Mfgs found in library", "Mfg import", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
        }
 /// <summary>
 /// Execute the frame creation process
 /// </summary>
 /// <param name="obj">Not in use</param>
 private void FrameCreationExecuted(object obj)
 {
     if (ReferenceFrame != null && ReferenceFrame != originalFrame)
     {
         TxApplication.ActiveDocument.WorkingFrame = ReferenceFrame;
     }
     try
     {
         foreach (RwFrameCreationData frameData in FramesData)
         {
             //TxVector translation = new TxVector(frameData.X, frameData.Y, frameData.Z);
             //TxVector rotation = new TxVector(RwMath.Deg2Rad(frameData.Rx), RwMath.Deg2Rad(frameData.Ry), RwMath.Deg2Rad(frameData.Rz));
             //TxTransformation location = new TxTransformation(translation, rotation, TxTransformation.TxRotationType.RPY_XYZ);
             TxTransformation    location          = RwMath.CreateRpyTransformation(frameData.X, frameData.Y, frameData.Z, frameData.Rx, frameData.Ry, frameData.Rz, true);
             TxFrameCreationData frameCreationData = new TxFrameCreationData(frameData.Name, location);
             TxApplication.ActiveDocument.PhysicalRoot.CreateFrame(frameCreationData);
         }
         string message = $"Successsfully created {FramesData.Count} frames";
         TxMessageBox.Show(message, "Frame creation", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
     }
     catch
     {
         string message = "An error occured during frame creation";
         TxMessageBox.Show(message, "Frame creation", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
     }
     finally
     {
         TxApplication.ActiveDocument.WorkingFrame = originalFrame;
     }
 }
Exemple #4
0
        /// <summary>
        /// Execute the selected command
        /// </summary>
        /// <param name="cmdParams"></param>
        public override void Execute(object cmdParams)
        {
            try
            {
                if (cmdParams is ITxCompoundButtonElement element)
                {
                    switch (element.Name.ToUpper())
                    {
                    //Cases are similar to the name strings in StringTable.resx
                    case "MFGEXPORT":
                        RwMfgExportView exportView = new RwMfgExportView();
                        exportView.Show();
                        break;

                    case "MFGIMPORT":
                        RwMfgImportView importView = new RwMfgImportView();
                        importView.Show();
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (TxException ex)
            {
                string caption = "An Exception occured!!";
                TxMessageBox.ShowModal(ex.Message, caption, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
            }
        }
Exemple #5
0
        /// <summary>
        /// Execute the selected command
        /// </summary>
        /// <param name="cmdParams">The selected compound button element</param>
        public override void Execute(object cmdParams)
        {
            try
            {
                if (cmdParams is ITxCompoundButtonElement element)
                {
                    switch (element.Name.ToUpper())
                    {
                    case "MFG EXPORT":
                        MfgIEQ.RwExportMfgView exportView = new MfgIEQ.RwExportMfgView();
                        exportView.Show();
                        break;

                    case "MFG IMPORT":
                        MfgIEQ.RwImportMfgView importView = new MfgIEQ.RwImportMfgView();
                        importView.Show();
                        break;

                    case "MFG QUERY":
                        MfgIEQ.RwQueryMfgView queryView = new MfgIEQ.RwQueryMfgView();
                        queryView.Show();
                        break;

                    default:
                        TxMessageBox.ShowModal($"{element.Name} is a non supported command", "Mfg Import/Export/Query error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
                        break;
                    }
                }
            }
            catch (TxException ex)
            {
                string caption = "An Exception occured!!";
                TxMessageBox.ShowModal(ex.Message, caption, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
            }
        }
Exemple #6
0
 /// <summary>
 /// Execute the selected command
 /// </summary>
 /// <param name="cmdParams"></param>
 public override void Execute(object cmdParams)
 {
     try
     {
         RwCreateFramesFromListView view = new RwCreateFramesFromListView();
         view.Show();
     }
     catch (TxException ex)
     {
         string caption = "An Exception occured!!";
         TxMessageBox.ShowModal(ex.Message, caption, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
     }
 }
Exemple #7
0
 /// <summary>
 /// Initialize the viewer
 /// </summary>
 public override void Initialize()
 {
     try
     {
         Uri resourceLocator = new Uri("/Robworld.PsViewers;component/RoboticOperations/RwRoboticOperationView.xaml", UriKind.Relative);
         System.Windows.Application.LoadComponent(this, resourceLocator);
     }
     catch (TxException ex)
     {
         string caption = "An Exception occured!!";
         TxMessageBox.ShowModal(ex.Message, caption, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
     }
 }
Exemple #8
0
 /// <summary>
 /// Executes the OpenMDD command
 /// </summary>
 /// <param name="cmdParams"></param>
 public override void Execute(object cmdParams)
 {
     try
     {
         OpenMDD.RwOpenMDD.OpenMachineDataDirectory();
     }
     catch (TxArgumentException exception)
     {
         string caption = "OpenMDD argument exception!";
         TxMessageBox.ShowModal(exception.Message, caption, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
     }
     catch (System.Exception exception)
     {
         string caption = "OpenMDD exception!";
         TxMessageBox.ShowModal(exception.Message, caption, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
     }
 }
Exemple #9
0
 /// <summary>
 /// Read the name of the manufacturing features of the import list
 /// </summary>
 private void ReadMfgData()
 {
     try
     {
         string[] mfgData = System.IO.File.ReadAllLines(SourceFilename);
         if (mfgData != null && mfgData.Length > 0)
         {
             foreach (string name in mfgData)
             {
                 MfgCollection.Add(name);
             }
         }
     }
     catch
     {
         TxMessageBox.Show("Error in reading import file", "Mfg import", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
     }
 }
Exemple #10
0
 /// <summary>
 /// Write the mfg collection to the target file
 /// </summary>
 /// <param name="obj">Not in use</param>
 private void ExportMfgsExecuted(object obj)
 {
     try
     {
         using (StreamWriter file = new StreamWriter(TargetFilename))
         {
             foreach (TxMfgFeature mfg in Mfgs)
             {
                 file.WriteLine(mfg.Name);
             }
         }
         string message = $"Successsfully saved Manufacturing features to file {TargetFilename}";
         TxMessageBox.Show(message, "Mfg export", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
     }
     catch
     {
         string message = "An error occured during Mfg export";
         TxMessageBox.Show(message, "Mfg export", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
     }
 }
Exemple #11
0
 /// <summary>
 /// Execute the pick event on a selected planning object
 /// </summary>
 /// <param name="obj">The control of the UI</param>
 private void MfgLibraryPickedExecuted(object obj)
 {
     try
     {
         isSelectedPlanningObjectValid = false;
         if (obj is TxObjEditBoxControl control)
         {
             planningObject = control.Object as ITxPlanningObject;
             if (planningObject != null)
             {
                 if (planningObject.PlanningType.Equals("PmMfgLibrary"))
                 {
                     isSelectedPlanningObjectValid = true;
                 }
             }
         }
     }
     catch (TxPlanningObjectNotLoadedException exception)
     {
         TxMessageBox.Show($"{exception.Message}", "Mfg import - Exception", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
     }
 }
Exemple #12
0
        /// <summary>
        /// Load the manufacturing features by their name to the study
        /// </summary>
        private void LoadMfgByName()
        {
            /*
             * Thanks to Siemens API Team for the support
             * https://community.plm.automation.siemens.com/t5/Tecnomatix-Developer-Forum/Tx13-0-Import-Mfg/m-p/519783#M1240
             */
            TxObjectList mfgsToLoad = new TxObjectList();

            TxEmsCacheManager emsCacheManager = new TxEmsCacheManager();

            QueryEmsCache(emsCacheManager, "wpMfgLibrary", "children", planningObject, null);

            TxObjectList mfgsInLibrary = planningObject.GetField("children") as TxObjectList;

            QueryEmsCache(emsCacheManager, "wpMfgLibrary", "name", null, mfgsInLibrary);

            foreach (ITxPlanningObject mfg in mfgsInLibrary)
            {
                string name = mfg.GetField("name") as string;
                if (MfgCollection.Contains(name))
                {
                    mfgsToLoad.Add(mfg);
                }
            }

            if (mfgsToLoad.Count > 0)
            {
                TxDocumentEx document = new TxDocumentEx();
                document.LoadComplete(mfgsToLoad, true);
                TxMessageBox.Show($"{mfgsToLoad.Count} Mfgs loaded!", "Mfg import", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
            }
            else
            {
                TxMessageBox.Show("No wanted Mfgs found in library", "Mfg import", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
        }