API VBA: Opening a Document

Discussion in 'SolidWorks' started by Corey Scheich, Jul 22, 2004.

  1. I was just adding ViewOnly and Lightweight to my custom Open dialogue and
    run into two issues.

    1) I don't see any option to open lightweight there at all do you have to
    handle this separately or is it just unavailable.

    2) I noticed that in OpenDoc6 two of the options are View Only and Read Only
    I always thought these were the same could anyone explain the difference.

    TIA

    Corey Scheich
     
    Corey Scheich, Jul 22, 2004
    #1
  2. Corey Scheich

    rocheey Guest

    2) I noticed that in OpenDoc6 two of the options are View Only and Read Only
    Read-Only: You can modify the thing but cant save it.
    View-Only: You cant modify it or save it (haa haa)

    View-Only basically opens just the model view window: there is no feature tree,
    no feature menus or toobars available.

    In Read Only, the user can chomp away at your model but has to 'saveas'....
     
    rocheey, Jul 23, 2004
    #2
  3. Ok I may have a round about way of doing this if there is no known solution.
    I thought I might beable to accomplish this by changing the Options for
    Large Assembly Mode to

    Threshhold = 1 part
    and Prompt = Never

    Then after opening the assembly or upon cancel flip them back to the
    origional settings.

    Does anyone know of any possible undesired affects by going this route.
    Essentially turning on Large Assembly Mode causing the model to
    automatically open Lightweight.

    Corey Scheich
     
    Corey Scheich, Jul 23, 2004
    #3
  4. Corey Scheich

    rocheey Guest

    You may wish to check out the following API commands/settings:

    AssemblyDoc.MakeLightWeight
    AssemblyDoc.ResolveAllLightWeightComponents

    swapp.SetUserPreferenceToggle (swAutoLoadPartsLightweight)
    swapp.SetUserPreferenceToggle (swLargeAsmModeAutoLoadLightweight)
    swapp.SetUserPreferenceToggle (swAutoLoadPartsLightweight)
     
    rocheey, Jul 26, 2004
    #4
  5. I think that is what I was looking for. Thanks. Is there a way to search
    the help for partial words.

    Corey
     
    Corey Scheich, Jul 26, 2004
    #5
  6. Corey Scheich

    rocheey Guest

    Is there a way to search the help for partial words.

    The help? No, it seems to fail on partial words.
    The Object browser? YES.

    What is the object browser? Well, if you are using early binding, you
    have access to it... if you're not sure if you are using early
    binding, then record a dummy SW macro, and open it for edit. (SW adds
    early binding references automagically.)


    In the VBA window. click "View", then "Object Browser". In the window
    that pops up, there is a drop down box in the upper left, and another
    directly underneath it.

    Click on the (2nd) drop downbox underneath and type in a partial
    search word.(say, "LightWeight")

    Now click the binoculars icon that is directly to the right of the
    drop down box

    The third window, underneath the second window, is the "Search
    Results" window, and it shows you the 'hits' that it found. The first
    'hit' I have from a search for "LightWeight" was :

    SldWorks AssemblyDoc GetLightWeightComponentCount

    when I click on this to highlight it, I can then look at the very
    bottom of the Object Browser window, and it gives me a syntax, and a
    definition:

    Function GetLightWeightComponentCount() As Long
    Member of SldWorks.AssemblyDoc
    Counts the lightweight components in the assembly


    This bottom portion MAY scroll down and have more information , so
    make sure
    to check the scrollbar to the right of this bottommost part of the
    Object Browser.

    You can then search the help for a more in-depth defintion now that
    you have the full command name.
     
    rocheey, Jul 26, 2004
    #6
  7. Funny I normaly think to do all that but I guess I expected it to be in
    close reference to the OpenDoc6.

    thank you for your help much appreciated.

    Corey Scheich.
     
    Corey Scheich, Jul 26, 2004
    #7
  8. OK I wrote that in the code and it works great. Thanks again.
    this was the only one I needed to open a document lightweight

    Corey
     
    Corey Scheich, Jul 29, 2004
    #8
  9. FYI when using view only you have to pass a Null string for the
    configuration or OpenDoc6 doesn't work, and it will only open a 3d graphic
    of the last saved config.
    'saveas'....
     
    Corey Scheich, Jul 29, 2004
    #9
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.