Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Custom Toolbar 7

Status
Not open for further replies.

SteveJJH

Mechanical
Feb 5, 2009
109
GB
Hello all,

I was wondering if there was a way of adding a new entirely empty toolbar? I suppose I could add one we don't use and empty it, but it would be nice to add a nice blank one with our own title. We're running 2009sp2.0 if it makes a difference.

Any Ideas?

Thanks
 
Replies continue below

Recommended for you

You can use command Tabs Instead of toolbars. You can create new command tab within the customization environment and place commands to it.

As for the toolbars. You can create your own toolbar with your own title, icon etc using SolidWorks API (SldWorks::AddToolbar4 method or with the command manager APIs)

Artem Taturevich
CSWP
 
I don't use the command manager in my setup, but I'll give that API a go, thanks
 
I believe that this can only be done in an Add-in, not in a plain macro or an exe file. Also, I don't believe the toolbar will persist from session to session. Basically, if you want to make your own toolbar like that you'll have to create an add-in. I'm pretty sure that, once created, that toolbar will not be customizable by the SW interface either. All commands will have to be added in code.

-handleman, CSWP (The new, easy test)
 
handleman,

You are right with the Add-in. But it is easy to do (with the standard VS SW template). It is also possible to disable the addin's menus, PMP, command managers etc and keep just the toolbar.

BTW. It is possible to edit this toolbar as well as standard ones: you can add or remove buttons from it within the customization environment.

And these setting will persist from session to session (they stored in the registry).

Artem Taturevich
CSWP
 
Not everyone has VS. I don't.

So all you have to do to create a new toolbar is use the add-in to create the toolbar once, and it exists in SW forever, whether or not the add-in is active or not? And it behaves/customizes just like any other toolbar? If so, could you create a little add-in that does nothing but create a toolbar with whatever the user specifies in an InputBox or something?

-handleman, CSWP (The new, easy test)
 
Hello Handleman,

Please find the sample addin in the attachment.

You should open the dll-file from the menu File->Open, set filter to "add-ins (*.dll)". Once you have loaded it you can select it from the tollbars list.

You can customize it and add standard button from another toolbar (please take a look at the attached picture).

BTW. I haven't mentioned about the toolbar visibility with add-in unloaded. It will be removed once the add-in unloads. But I believe it isn't a problem just set "Load on start-up" option to add-in automatically loads with the new session of SolidWorks.

Thanks,
Artem

Artem Taturevich
CSWP
 
 http://files.engineering.com/getfile.aspx?folder=44f2abae-a6f4-4e79-b5ad-97f7879ffb12&file=SwCustToolbar.zip
Thanks, Artem!

Unfortunately, I can't seem to get it to work. I opened the .dll file in the File->Open dialog, but it did not seem to do anything. I didn't get any error messages or anything, but it doesn't appear in the Add-ins list under Tools->Add-Ins, and the custom toolbar doesn't appear in the list of toolbars.

-handleman, CSWP (The new, easy test)
 
handleman,

The issue is probably a dependancy on one of the Visual Studio runtime dlls. If Artem can tell you which version of Visual Studio was used to compile the dll, you can download the corresponding redistributable from Microsoft.

Eric
 
I think Eric right. I've used VS 2005 to compile the dll.

handleman, please download the Visual Studio redistributable from Microsoft web site. (the add-in name is "SwCustToolbar")

Thanks,
Artem

Artem Taturevich
CSWP
 
handleman, what version of SolidWorks do you use?

As I know the redistributable from Microsoft was required on SolidWorks 2007 and earlier but in newer version it might be not obligatory but I'm not sure...

Artem Taturevich
CSWP
 
Hello Matt,

Yes, that is in c++.

I've written and tested this addin on two workstations with SolidWorks 2009. Probably some of the APIs I have used isn't presented in SolidWorks 2007.

Thanks,

Artem Taturevich
CSWP
 
Hello,

I have recreated this sample addin in c# with the libraries from SolidWorks 2007 and created the installer.

Once the addin installed you can open it from the File->Open menu and choose "SwCSharpCustTB.dll" file from installation directory. The "SwCustTB" toolbar should appears under the toolbars menu.

Thanks

Artem Taturevich
CSWP
 
Artem,

Thanks once again for your work on this. This time I was able to install the Add-In and the toolbar appears in my SW session each time I start SW. I am able to add/remove buttons from the new toolbar, but they do not persist from session to session. Every time I start SW only that first default button shows up. Is that the behavior you get on your test machines?

-handleman, CSWP (The new, easy test)
 
Hello Handleman,

No I have different behavior. The customozation remains from session to session.

I have tried different combinations: adding buttons from Command menu, drag-n-drop buttons from another toolbar. Unloading addins from the menu, shutting down SolidWorks and reopening it. Every time I have my toolbar costumized.

I have tested it in SolidWorks 2009. Probably there is some another behaviour with another versions of SolidWorks.

Do you have your addin set to "Load on start up". Or you have reloadin it each session? And what version of SolidWorks do you use?

Thanks,

Artem Taturevich
CSWP
 
I'm running 2009 SP 3.0. The add-in is set to load on startup.

-handleman, CSWP (The new, easy test)
 
Please try to drag-n-drop the button from anoter toolbar to custom one. So it is removed from standard toolbar and added to custom toolbar.

Next close/open SolidWorks. Does this button back to it original toolbar?

Thanks,
Artem

Artem Taturevich
CSWP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top