Example #1
0
        protected override void OnExecute(NameValueMap context)
        {
            try
            {
                var assembly = AddIn.GetAssemblyDocument();

                if (assembly == null)
                {
                    return;
                }

                var subassemblies = assembly.Subassemblies();

                if (subassemblies.Count == 0)
                {
                    AddIn.ShowWarningMessageBox(
                        caption: _generateDrawingsWindow.Title,
                        message: $"Assembly '{assembly.FullFileName}' doesn't contain subassemblies."
                        );

                    return;
                }

                _generateDrawingsWindow.Show(subassemblies);
            }
            catch (Exception ex)
            {
                ShowWarningMessageBox(ex);
            }
        }
        protected override void OnExecute(NameValueMap context)
        {
            try
            {
                var assembly = AddIn.GetAssemblyDocument();

                if (assembly == null)
                {
                    return;
                }

                var sheetMetalParts = assembly.SheetMetalParts();

                if (sheetMetalParts.Count == 0)
                {
                    ShowWarningMessageBox($"Assembly {assembly.FullFileName} doesn't contain any sheet metal parts.");
                    return;
                }

                _generateSheetMetalDrawingsWindow.Show(assembly, sheetMetalParts);
            }
            catch (Exception ex)
            {
                ShowWarningMessageBox(ex);
            }
        }
        protected override void OnExecute(NameValueMap context)
        {
            try
            {
                var assemblyDocument = AddIn.GetAssemblyDocument();

                if (assemblyDocument == null)
                {
                    return;
                }

                var mdfParts = assemblyDocument.MdfParts();

                if (mdfParts.Count == 0)
                {
                    AddIn.ShowWarningMessageBox(
                        caption: _generateDrawingsWindow.Title,
                        messageFormat:
                        "Assembly '{0}' doesn't contain MDF parts."
                        + Environment.NewLine + Environment.NewLine
                        + "A part file name must contain 'MDF' to be recognized as a MDF part.",
                        messageArgs: assemblyDocument.FullFileName
                        );

                    return;
                }

                _generateDrawingsWindow.Show(assemblyDocument.MdfParts());
            }
            catch (Exception ex)
            {
                ShowWarningMessageBox(ex);
            }
        }