Creating Civil 3D Plugin with Custom Ribbon Tab and Buttons

Creating Civil 3D Plugin with Custom Ribbon Tab and Buttons

mohamed_ebrahim3016
Contributor Contributor
1,279 Views
4 Replies
Message 1 of 5

Creating Civil 3D Plugin with Custom Ribbon Tab and Buttons

mohamed_ebrahim3016
Contributor
Contributor

Hey everyone,

I'm coming from the Revit API, where I'm familiar with setting up plugins using IExternalApplication, adding custom ribbon tabs and buttons, and creating a manifest file to load everything automatically at startup. Recently, I've been working with the Civil 3D API and using NETLOAD to test my code.

Now, I'd like to create a full Civil 3D plugin with a custom ribbon tab and buttons that loads at startup—ideally, as smoothly as in Revit. However, I’m finding that Civil 3D doesn’t seem to support this approach directly.

Does anyone have guidance on how to set up a Civil 3D plugin with custom ribbon tabs and buttons that can load automatically?

Thanks in advance for any advice or examples

0 Likes
Accepted solutions (1)
1,280 Views
4 Replies
Replies (4)
Message 2 of 5

norman.yuan
Mentor
Mentor

Your description is a bit vague on what exactly it means by saying "... Civil 3D doesn't seem to support...". Do you mean you can NETLOAD your plugin DLL, but the DLL is not autoloaded by "plugin bundle"? or do you mean the DLL indeed loaded, but the code in IExtemsionApplication.Initialize(), which runs automatically when the DLL is loaded into AutoCAD (regardless by command NETLOAD, or by autoloading on AutoCAD startup), does not do the work as you expected?

 

If it is latter (you can prove the DLL is indeed loaded by showing a message box, for example), then your conclusion of "...doesn't seem to support..." is wrong. It is your code wrong. Especially when trying to load a custom ribbon items with IExtensionApplication.Innitialize(), it is very important to determine when the custom ribbon items are loadable (i.e. only when the ribbon control is available at some point when AutoCAD gets started). There are many past discussions on this topics in this forum and quite a few good answers/solutions were provided.

 

Or, maybe you want to provide more details about what issue you have, other than simply saying/guessing something "seem to" not supported.

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 3 of 5

mohamed_ebrahim3016
Contributor
Contributor

Hold on norman I'm just asking not judge, it's my first deal with AutoCAD document. what I'm asking is how I could add button to call my dll as I didn't want to call it by Netload, I need a custom button. I don't know it's applicable or not so I'm asking. Something like Revizto or Diroots plugin which create their tabs and buttons.
Thanks

0 Likes
Message 4 of 5

norman.yuan
Mentor
Mentor

Since you have said you "use NETLOAD to test the code" and somehow got the impression that "seem to" not support without saying what you have tried, thus I thought your question is vague on what you are asking.

 

If you ONLY need to know whether it is possible to load custom ribbon items (be it created by your code, or by CULX file) on AutoCAD startup with simple answer of yes/no without the need to know how for now, then the answer is YES.

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 5 of 5

ActivistInvestor
Mentor
Mentor
Accepted solution

You can't use a manifest file to load your plugin's UI, but you can create a partial CUIX file that can be loaded, and it can add tabs and controls to the Ribbon.  You can add a button that executes a command defined by your plugin using the CommandMethod attribute.

 

You can also add your plugin's content to the ribbon manually when your plugin loads, by implementing IExtensionApplication on a class in your plugin. AutoCAD automatically calls the Initialize() method of that interface when your assembly loads. From that method you can add content to the ribbon. 

 

There are some gotcha's related to the manual means of adding your content to the ribbon, and you can find some helper classes here and some examples here that can help simplify doing that.

0 Likes