Part or Assembly

Part or Assembly

Anonymous
Not applicable
239 Views
2 Replies
Message 1 of 3

Part or Assembly

Anonymous
Not applicable
Hi group!

Is there a property of a drawing document that would tell me if it's a
drawing of a part component or an assembly component?

Thanks in advance.

Tim Strandberg
0 Likes
240 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Tim:

Could you use this testing method to see the referenced file type?

If ThisApplication.ActiveDocument.ReferencedFiles.Count >= 1 Then
If LCase(Right$(ThisApplication.ActiveDocument.ReferencedFiles.Item(1).DisplayName, 3)) = "iam" Then
MsgBox "This drawing containes an Assembly Document."
ElseIf LCase(Right$(ThisApplication.ActiveDocument.ReferencedFiles.Item(1).DisplayName, 3)) = "ipt" Then
MsgBox "This drawing containes a Part Document."
End If
End If

Lian
0 Likes
Message 3 of 3

Anonymous
Not applicable
One thing to be aware of is that drawings can
reference multiple documents and they can be of different types.  So, you
can have a drawing that references parts and assemblies.

 

Assuming you have one reference in your drawing,
Lian's approach will work.  One slight change is to check the document type
directly using the DocumentType property.

 

If
ThisApplication.ActiveDocument.ReferencedFiles.Count >= 1
Then 

     If
ThisApplication.ActiveDocument.ReferencedFiles.Item(1).DocumentType =
kAssemblyDocumentObject
Then
        MsgBox "This drawing
containes an Assembly Document." 
     If
ThisApplication.ActiveDocument.ReferencedFiles.Item(1).DocumentType =
kPartDocumentObjectThen
        MsgBox
"This drawing containes a Part Document."
     End
If 
End If

 

-Brian


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Tim:

Could you use this testing method to see the referenced file type?

If ThisApplication.ActiveDocument.ReferencedFiles.Count >= 1 Then

     If
LCase(Right$(ThisApplication.ActiveDocument.ReferencedFiles.Item(1).DisplayName,
3)) = "iam" Then
        MsgBox
"This drawing containes an Assembly Document."

     ElseIf
LCase(Right$(ThisApplication.ActiveDocument.ReferencedFiles.Item(1).DisplayName,
3)) = "ipt" Then
        MsgBox
"This drawing containes a Part Document."

     End If
  End If

Lian

0 Likes