List Parts

Discussion in 'SolidWorks' started by fred, Nov 26, 2003.

  1. fred

    fred Guest

    When I open a solidWorks drawing SWExplorer, it lists all of the parts
    associated with that drawing including the parts in any assemblies used by
    the drawing. It obviously does this without requiring a solidworks license.

    I would like to be able to access this information from Excel using VBA. Is
    this possible without having to open solidworks and if so can someone please
    show me a VBA macro that will do this.

    Thanks
    Fred
     
    fred, Nov 26, 2003
    #1
  2. fred

    Andrew Troup Guest

    Fred

    Did you realise that from SW Explorer, from the list of which you talk, you
    can generate an Excel file directly simply by right clicking? I imagine you
    probably did, but I offer this in case you didn't
     
    Andrew Troup, Nov 26, 2003
    #2
  3. SldWorks::GetDocumentDependencies2

    Description

    This method gets all of the model dependencies for a document. The
    document does not have to be open unless traversal down into all
    dependent files is desired.

    Syntax (OLE Automation)

    retval = SldWorks.GetDocumentDependencies2 ( document, traverseFlag,
    searchFlag, addReadOnlyInfo )

    Input:
    (BSTR) document
    Name of the document

    Input:
    (VARIANT_BOOL) traverseflag
    TRUE if you want to traverse down into all dependent files, FALSE if
    you want only the highest level within the dependencies

    Input:
    (VARIANT_BOOL) SearchFlag
    Set this argument to TRUE if you want to use the search rules to find
    dependencies, FALSE looks where the documents were last saved

    Input:
    (VARIANT_BOOL) addReadOnlyInfo
    TRUE if you wish to have read-only information with the filenames;
    FALSE if not

    Return:
    (VARIANT) retval
    SafeArray of strings with two strings for each document returned in
    this list of dependent files:

    File name:
    Filename with the complete pathname; this combination repeats itself
    for each dependent file found for this document

    sub main()

    dim retval as variant
    dim swapp as sldworks.sldworks
    dim intCount as integer

    retval = swapp.GetDocumentDependencies2 (
    "c:\myfiles\mydrawing.slddrw", true, true, true)

    for intcount = 0 to ubound(retval)

    debug.print retval(intcount)

    next intcount

    end sub
     
    Sean Phillips, Nov 26, 2003
    #3
  4. fred

    fred Guest

    Sean, thanks for that info. The trouble is that this still requires the
    SldWorks object and so requires the solidworks license. SW Explorer does it
    without the need for a solidworks license on the PC running SW Explorer. So
    is there a way to do it without requiring a solidworks license?

    Thanks,
    Fred
     
    fred, Nov 27, 2003
    #4
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.