|
<< Click to Display Table of Contents >> Navigation: Programming Mechworks PDM > DBWCommandShell > Commands Reference > Document > IsDocumentUsedByInMemoryAsmOrDrw |
Checks if the passed document file name is already a component of an assembly or of a drawing loaded in memory.
call DBWShell("IsDocumentUsedByInMemoryAsmOrDrw DocFileName [getFullReferencingDocumentsList [onlyDrawings]]")
DocFileName |
the document file name |
|---|---|
getFullReferencingDocumentsList |
Optional. |
onlyDrawings |
Optional. |
@OK_USED |
0: not used |
|---|---|
@REFERENCING_DOCUMENT |
list of referencing document |
Sub main()
DBWinit(TRUE)
file = "c:\temp\my sw documents\part1.sldprt"
file = replace(file," ","|")
call DBWShell ("IsDocumentUsedByInMemoryAsmOrDrw " & file)
res = DBWResult("@OK_USED")
if res=1 then
DBWMsgBox "the referred document is used" & _
"by another document (assembly or drawing) loaded in memory"
else
DBWMsgBox "the referred document is not used" & _
"by any document loaded in memory"
end if
End Sub
another example:
sub main()
DBWInit(TRUE)
documentToBeQueried = "E:\test\gene\burn\27527.SLDASM"
DBWShell("IsDocumentUsedByInMemoryAsmOrDrw " & replace(documentToBeQueried," ","|") & " 1" )
okUsed = DBWResult("@OK_USED")
if okUsed then
msgString = "okUsed=" & okUsed & vbcrlf
Set fs = CreateObject("Scripting.FileSystemObject")
Set tfolder = fs.GetSpecialFolder(TemporaryFolder)
Set a = fs.OpenTextFile( tfolder & "\" & "dbwreslt.in", ForReading, True )
Dim tokens
Do While a.AtEndOfStream <> True
line = a.ReadLine
tokens = Split( line, "=", 2, 1)
if tokens(0) = "@REFERENCING_DOCUMENT" then
msgString = msgString + "Referencing document: " + tokens(1) + vbcrlf
end if
Loop
a.Close
DBWMsgBox msgString
else
DBWMsgBox "No other document is referencing the assign document"
end if
end sub