how shrink/compact macro file (.swb)

Discussion in 'SolidWorks' started by Johnny Geling, May 6, 2004.

  1. Hello,

    Is there a way to shrink the file size of macro files? (.swb) The get
    large or is that normal for simple macro's? With large I mean over 7Mb.

    Kind Regards.

    Johnny
     
    Johnny Geling, May 6, 2004
    #1
  2. I noticed adding the SWConst.BAS as a module will add 1MB to your file. In
    2004 you can reference the swConst.tlb instead, or you can pick only the
    ones you need. It also seemed that once I remove the swConst module I don't
    think I was able to get the file size down, but that was a while ago.

    Corey
     
    Corey Scheich, May 6, 2004
    #2
  3. Johnny Geling

    rocheey Guest

    Is there a way to shrink the file size of macro files? (.swb) The get
    Well, re-create it. Export all your modules, create a new, empty
    macro, and reimport your modules. It may shrink quite a bit, but first
    save with the new file will 'boost' the byte count back up, but not to
    the size before. This is normal, with VB 'tokenizing' the source code
    in the background.
     
    rocheey, May 6, 2004
    #3
  4. Johnny Geling

    TheTick Guest

    SW macros are bulky because they contain not only your script, but
    also the definitions and instances of various VB objects (forms,
    buttons, listboxes, etc.) This is analogous to the way SW files bloat
    due to their OLE data.

    In a standard VB project, forms and modules exist as individual files
    and are much smaller. Even an entire project tends to be
    significantly smaller than a comparable SW macro.

    There are many advantages to moving to using full VB. Programs work
    faster, more components are available, and you can compile .exe's and
    ..dll addins (which opens the door to adding menu items and toolbars
    and taking advantage of events). VB6 is outdated but works great and
    can be gotten for cheap via eBay.
     
    TheTick, May 6, 2004
    #4
  5. I've had good luck using the trusty "UNFRAG.EXE". You can obtain a copy from
    www.nhcad.com (thanks to Joe Jones).

    John
     
    John Picinich, May 6, 2004
    #5
  6. Johnny Geling

    TheTick Guest

    I never thought to apply defragmentation to macros. I just tried it
    with EcoSqueeze and it seemed to work. The file sizes are cut in half
    and the macros still work.

    Way cool.
     
    TheTick, May 7, 2004
    #6
  7. Johnny Geling

    Krister L Guest

    The unfrag works with a lot of different files, I tried and managed to
    shrink pagemaker files a while back.

    Krister L
     
    Krister L, May 7, 2004
    #7
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.