Custom Macro Buttons Unavailable?

Discussion in 'SolidWorks' started by Corey Scheich, Aug 12, 2003.

  1. 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
     
    Corey Scheich, Aug 12, 2003
    #1
  2. 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
     
    Wayne Tiffany, Aug 12, 2003
    #2
  3. Corey Scheich

    Ken Bolen Guest

    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
     
    Ken Bolen, Aug 13, 2003
    #3
  4. Corey Scheich

    rocheey Guest

    It sure would be nice to have 3 macro toolbars tho woudn't it? One
    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)
     
    rocheey, Aug 13, 2003
    #4
  5. 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
     
    Sean Phillips, Aug 14, 2003
    #5
  6. Now we are headed in the right direction
     
    Corey Scheich, Aug 14, 2003
    #6
  7. Corey Scheich

    Joel Moore Guest

    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.
     
    Joel Moore, Aug 15, 2003
    #7
  8. you can use FeatureManager::InsertMacroFeature
    then rebuild.
    then delete MacroFeature.
     
    Sean Phillips, Aug 16, 2003
    #8
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.