Custom Macro Buttons Unavailable?

Is it possible to make Custom Macro Buttons unavailable like native tools? For instance you create a macro that only works on .sldprt documents. Can you make it unavailable when an Assembly doc is active?

Corey Scheich

Reply to
Corey Scheich
Loading thread data ...

I don't know about the button ( I don't think so, though.), but the proper way is to deal with it inside the macro. That way, regardless of whether the macro is run from a button, or by calling from some program, or by the menus, it handles the situation properly. Just have it check the type of document and make decisions/error messages based on that. Let me know if you need an example.

WT

Reply to
Wayne Tiffany

It sure would be nice to have 3 macro toolbars tho woudn't it? One for Assemblies, one for Part files, and one for Drawings. Of course, then I'd probably want one for sketching, and... :)

Ken

Reply to
Ken Bolen

well, if you ever write a Solidworks Plugin, you'll find thats

*exactly* the way they do it (unfortunately)

I think it would be a helluva lot easier to just enable/disable a button on a single menu, than having to write 3 (sometimes identical) menus, and let SW display the one depending on what the active doc is.

A quick-and-dirty way around this (if you're running 2001+ or newer) is to just write a single .swp, drop command buttons with images on them, and make the form non-modal. You'll still have a titlebar showing on your 'toolbar', but the form will automatically be on top (no api calls) and you'll have all the flexibility you'll need (for now)

Reply to
rocheey

you can create your own toolbars with sldworks::addtoolbar3 you can create your own toolbar command with sldworks::addtoolbarcommand2 you can turn off toolbars with modeldoc2::Toolbars

Reply to
Sean Phillips

Now we are headed in the right direction

Reply to
Corey Scheich

Well, like I said an add-in will get you closer to what you want but you'll still have to embed all your macros into the add-in DLL. There's no way to invoke a macro via the API.

"Corey Scheich" wrote in news:bhge5v$ftcp$ snipped-for-privacy@ID-200385.news.uni-berlin.de:

Reply to
Joel Moore

you can use FeatureManager::InsertMacroFeature then rebuild. then delete MacroFeature.

Reply to
Sean Phillips

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.