Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Put Revit Original function to personalized Ribon

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
Anonymous
691 Views, 5 Replies

Put Revit Original function to personalized Ribon

Hi Everybody,

 

I'm actually doing my first Revit Addin, so sorry for the basics knowledges about the API.

 

For this Addin I did a new ribbon tab with all the new function inside.

I often use these functions with Standard functions from the Architecture tab, and I always need to switch between these 2 Ribbon Tab.

To minimize the miles covered by the mouse, do you know if it's possible to take few of these "Revit original function", with the button, and to add them in my personalized Ribbon tab ?

 

I don't know if my question was clear, if you need other informations do not hesitate to contact me.

 

Best Regards,

Tags (3)
5 REPLIES 5
Message 2 of 6
RPTHOMAS108
in reply to: Anonymous

You could create an IExternalCommand that overrides the Revit built in command and posts it but you'd have to replicate all the icons and that seems a bit extreme. Not all built-in command can be posted however.

 

You could also pull the command button out of the ribbon and have them floating. In the below I'm drawing lines but I have the spelling button floating; you never know when you might need to check the spelling of a line. There is also the quick access area.

 

Capture19-02.PNG

 

Message 3 of 6
MarryTookMyCoffe
in reply to: Anonymous

it is possible to replace them, so maybe you can do copy from it too:

read this, maybe it will  help:
http://thebuildingcoder.typepad.com/blog/2012/06/replacing-built-in-commands-and-their-ids.html

-------------------------------------------------------------
--------------------------------|\/\/|------------------------
do not worry it only gonna take Autodesk 5 years to fix bug
Message 4 of 6
FAIR59
in reply to: Anonymous

Assuming your Addin is an ExternalApplication, you can indeed add a "standard" button to your tab.

 

this code should give you the Aligned Dimension button in your tab.

 

        // reference  AdWindows.dll
        // using adWin = Autodesk.Windows;

        // my_tab and my_panel created in OnStartup()
        // application.CreateRibbonTab("FAIR");
        // m_ribbonPanel = application.CreateRibbonPanel("FAIR", "myPanel");

        // applicationInitialized declared in OnStartup()
        // application.ControlledApplication.ApplicationInitialized += ControlledApplication_ApplicationInitialized;


       void ControlledApplication_ApplicationInitialized(object sender, Autodesk.Revit.DB.Events.ApplicationInitializedEventArgs e)
        {
            adWin.RibbonControl ribbon = adWin.ComponentManager.Ribbon;
            adWin.RibbonPanel my_Panel = null;
            foreach (var tab in ribbon.Tabs)
            {
                foreach ( var panel in tab.Panels)
                {
                    if (panel.Source.Title == "myPanel")
                    {
                        my_Panel = panel;
                        break;
                    }
                }
                if (my_Panel != null) break;
            }
            adWin.RibbonItem originalCommandItem = ribbon.FindItem("ID_ANNOTATIONS_DIMENSION_ALIGNED", false);
            if (my_Panel!=null && originalCommandItem!=null)
            {
                my_Panel.Source.Items.Add(originalCommandItem);
            }
}

 

 

Message 5 of 6
Anonymous
in reply to: FAIR59

Thanks,

 

Works great in my code.

Just a question where did you found a list of the ribbon items? (ID_ANNOTATIONS_DIMENSION_ALIGNED)

I couldn't find them in the API Docs.

Message 6 of 6
FAIR59
in reply to: Anonymous

there is a reference to a list (txt- or Excel format) on the BuildingCoder page http://thebuildingcoder.typepad.com/blog/2012/06/replacing-built-in-commands-and-their-ids.html

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report