Author Topic: Create Ribbon  (Read 1864 times)

0 Members and 1 Guest are viewing this topic.

shers

  • Guest
Create Ribbon
« on: October 01, 2015, 05:03:12 AM »
Hi,

I would like to create a ribbon and add it to AutoCAD on startup when the user installs the exe. Can this be done with code and added to the Autoloader?

Thanks

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: Create Ribbon
« Reply #1 on: October 01, 2015, 05:49:52 AM »
Hi,

If you're using the Autoloader/bundle mechanism, you'd rather add a partial CUIX with your ribbon to the bundle.
Speaking English as a French Frog

shers

  • Guest
Re: Create Ribbon
« Reply #2 on: October 01, 2015, 06:54:43 AM »
I shall try adding the partial cuix with one of the tutorials available.


Keith Brown

  • Swamp Rat
  • Posts: 601
Re: Create Ribbon
« Reply #3 on: October 01, 2015, 08:21:57 AM »
There are alot of things that you can do with the API that you cannot achieve with creating a ribbon with the cui editor and adding it via the autoloader.  If you just have a couple commands that you want to display a button for then by all means go ahead and use the autoloader to load your ribbon.  But you are missing out on alot of great things that are available via the ribbon api.  I have started playing around with creating all of my ribbon panels via wpf and placing them on a tab.  This allows me to let the user change settings on the fly without having to resort to commandline settings, a big bulky palette, or even a popup window.


For instance, I have a button that inserts equipment in AutoCAD MEP.  When that button is pressed it starts the insert command but it also brings up a new panel on the ribbon that will allow the user to select manufacturer, type, size, elevation, etc.  They can go with the last value used which was already populated or they can make the change on the fly before inserting.  Another scenario involves creating an equipment pad.  They can start the command and choose the height, width, and depth, and apply checkmarks on options to auto dimension or not.  All of this on the ribbon using the API.  That kind of customization is not possible with just the CUI editor and the autoloader.


The downside (and not sure it is really a downside) is that the user cannot customize your ribbon tab.  In my case I do not want them to.  To me it is not any different then having the same controls on a palette.  They are not able to customize that either by default.
Keith Brown | AutoCAD MEP Blog | RSS Feed
AutoCAD MEP 2014 / Revit MEP 2014 / EastCoast CAD/CAM addon / Visual Studio 2013

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Create Ribbon
« Reply #4 on: October 01, 2015, 10:16:06 AM »
Keith, I've found workspace problems with code-generated UI content in other products.  I want to save a workspace with certain elements in certain locations e.g. maybe tear off a panel, or have it further left or right.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

shers

  • Guest
Re: Create Ribbon
« Reply #5 on: October 01, 2015, 10:39:30 AM »
I went through the video on creating the partial menu.

I already have created a Tab and 3 buttons in the tab. I have added the Initialize and Terminate functions in the code to initialize on netloading the dll. In that case, how do I use it with the Autoloader?

Keith Brown

  • Swamp Rat
  • Posts: 601
Re: Create Ribbon
« Reply #6 on: October 01, 2015, 10:44:08 AM »
That is a drawback from code generated UI.  In my case it does not affect my designs.  The ribbon panels that I create are not designed to be torn off.  Because I am combining contextual tabs and regular tabs into one ribbon tab, the panels constantly rebuild themselves.  i.e.  reset.  This is a consequence of using the ribbon tab that I have created.  The user does not have to use the tab but they will need to choose settings at the command line every time they use the command. 


My ribbon buttons all call commands that used at the command line albeit with alot more work to modify settings via the command line.  They are certainly free to rebuild the tab and the commands if they want to.  In fact, i supply a cui that contains the commands already ready to go onto any buttons that they create via the ribbon or toolbars.


Its a design decision.  There are some things that the user just does not need to change in my opinion.  If they are so against using the tool because they cannot tear off a panel and place it somewhere else then so be it.
Keith Brown | AutoCAD MEP Blog | RSS Feed
AutoCAD MEP 2014 / Revit MEP 2014 / EastCoast CAD/CAM addon / Visual Studio 2013