Get document's External References

<< Click to Display Table of Contents >>

Navigation:  Programming Mechworks PDM > DBWCommandShell > Examples >

Get document's External References

Description

This example shows how to retrieve Solidworks document's external references using the DBWJComp object.

Example

dim pathname

dim uid
dim str
sub main()
 call DBWShell("CurrentDocument")
 pathname = DBWInput("@DOCUMENT_PATHNAME")
 'dbwmsgbox "pathname=" & pathname
 SwAssembly=pathname
 set DBWJcompObj = createObject("DBWJComp.CodeObject")
 On error resume next
  Refarray = DBWJcompObj.getAllExternalReferences(SwAssembly)
 if err then
  dbwmsgbox err.description
 else
  str = "found " & ubound(Refarray) +1 & " references for document" & vbcrlf & pathname & vbcrlf & "________________________________"
  for i = 0 to ubound(Refarray)
    'dbwmsgbox swref
   str = str & vbcrlf & Refarray(i)
  next
  dbwmsgbox str
 end if
 set DBWJcompObj = nothing
end sub