List Parts

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

Reply to
fred
Loading thread data ...

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

Reply to
Andrew Troup

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

Reply to
Sean Phillips

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

Reply to
fred

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.