Code Red > .NET

Creating ribbons for AutoCAD

(1/5) > >>

Keith™:
I've never created ribbons dynamically before. I've always shipped a cui and imported it. I want to move away from that and dynamically create a ribbon when the assembly is loaded.

I've looked at the few examples of this I could find, but none of them appear to work, even if I try to load it manually.

I'd appreciate any assistance.

No code yet because I've only tested code from other public sources and haven't actually written any yet.

Keith Brown:
Can you post the code that does not work for you?


spiderinnet1.typepad.com has a large amount of samples that all work just fine for me.


You just need to remember to load the ribbon after autocad is idle in 2016 I believe that they added a ribbon component initialized event you can monitor to add your ribbon at that time.  Prior to that you needed to wait for Autocad to be idle and to monitor a few commands to reload your ribbon as those commands wiped it out.  I believe that "quickcui", "cui", "customize", "cuiload", and "wssettings" were the commands.  I still use those for my bricscad ribbon.

dgorsman:
Make sure you include checking things like using user-specified workspaces and switching between workspaces.  I've used programmatically generated CUI content before and almost all of them fail miserably with workspaces.  One of them wouldn't even *run* the overall plug-in unless a specifically named and configured workspace was in use;  *reeeeeally* annoying when you can't position the palettes, panels, etc. where you want.

Keith™:
After posting this, last night I copied a bit of sample code from here and put it in its own project.

From my project, was able to create a sample ribbon. I am not sure what I differently, but it worked. Now I have to come up with a way to make it do what I need it to do. Some of the buttons aren't firing, but I'm sure it has something to do with my implementation.

The hope is to build this as part of my overall project as a ribbon that is loaded only when my project is loaded. I've got some ideas, and they show promise.


--- Quote from: Keith Brown on June 21, 2017, 09:43:24 AM ---You just need to remember to load the ribbon after autocad is idle in 2016 I believe that they added a ribbon component initialized event you can monitor to add your ribbon at that time.  Prior to that you needed to wait for Autocad to be idle and to monitor a few commands to reload your ribbon as those commands wiped it out.  I believe that "quickcui", "cui", "customize", "cuiload", and "wssettings" were the commands.  I still use those for my bricscad ribbon.

--- End quote ---

I'll have to keep an eye out for that! That would be a huge problem.

CADbloke:
Don't forget the Light / Dark theme fun and games. Here's the beginnings of your our homework. Palettes would be a similar deal, I suppose.

https://forums.autodesk.com/t5/net/again-about-supporting-dark-and-light-themes-for-custom-cui/td-p/6538741

https://forums.autodesk.com/t5/objectarx/how-to-support-autocad-2015-dark-amp-light-themes-for-ribbon/td-p/5056294

https://www.theswamp.org/index.php?topic=47877.0

and a search that might break on the previously mentioned spiderinnet1 blog   http://spiderinnet1.typepad.com/.services/blog/6a0153928ee38e970b0153928f11cc970b/search?filter.q=ribbon

Navigation

[0] Message Index

[#] Next page

Go to full version