Exemplo n.º 1
0
        public void ShowModelText()
        {
            Editor editor = Application.DocumentManager.MdiActiveDocument.Editor;

            try
            {
                // Create a new mtext and set the text
                var text = new MText();
                text.Contents = "Plugin Text";

                AutocadAPI.AppendMTextToModelSpace(text);

                AutocadAPI.OpenLayout("Layout1");
            }
            catch (System.Exception ex)
            {
                editor.WriteMessage(Environment.NewLine + "Error in Show Text message: " + ex.Message);
            }
        }
        public void Initialize()
        {
            Editor editor = Application.DocumentManager.MdiActiveDocument.Editor;

            try
            {
                PluginCommandButton[] buttons = GetShowMessageButtons();

                if (AutocadAPI.RemoveRibbonPanel("ID_ADDINSTAB", PluginName, buttons))
                {
                    Application.ReloadAllMenus();

                    editor.WriteMessage(ProgramMessage[KEY_UNINS]);
                }
                else
                {
                    editor.WriteMessage(ProgramMessage[KEY_REMOV]);
                }
            }
            catch (System.Exception ex)
            {
                editor.WriteMessage(ProgramMessage[KEY_ERROR] + ex.Message);
            }
        }
        public void Initialize()
        {
            Editor editor = Application.DocumentManager.MdiActiveDocument.Editor;

            try
            {
                RibbonPanelSource panelSource = AutocadAPI.AddRibbonPanel("ID_ADDINSTAB", PluginName, PluginText);
                if (panelSource == null)
                {
                    editor.WriteMessage(ProgramMessage[KEY_ADDED]);
                }
                else
                {
                    RibbonSplitButton splitButton = AutocadAPI.AddSplitButtonToRibbonPanel(panelSource);

                    CustomizationSection custSection = panelSource.CustomizationSection;
                    MacroGroup           macroGroup  = custSection.MenuGroup.MacroGroups[0];

                    PluginCommandButton[] buttons = GetShowMessageButtons();
                    foreach (PluginCommandButton button in buttons)
                    {
                        AutocadAPI.AddCommandButtonToRibbonSplitButton(macroGroup, splitButton, button.Text, button.Command, button.SmallBitmapPath, button.LargeBitmapPath, button.Tooltip);
                    }

                    custSection.Save();

                    Application.ReloadAllMenus();

                    editor.WriteMessage(ProgramMessage[KEY_INST]);
                }
            }
            catch (System.Exception ex)
            {
                editor.WriteMessage(ProgramMessage[KEY_ERROR] + ex.Message);
            }
        }