Find Sheet Metal Part in Assembly

Find Sheet Metal Part in Assembly

donaldleigh
Advocate Advocate
547 Views
1 Reply
Message 1 of 2

Find Sheet Metal Part in Assembly

donaldleigh
Advocate
Advocate

Hi guys

I have the 1st rule that returns the type of file. this works great

 

but the 2nd rule can't find the sheet metal part. It only recognizes it as a part. I know its because of the line is looking at the Assembly doc and not the sheet metal part

"SyntaxEditor Code Snippet

If ThisApplication.ActiveDocument.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" = True Then

But I'm not sure how to change this. 

 

Donald

Inventor 2014

 

Rule 1

SyntaxEditor Code Snippet

Dim doc As Document = ThisDoc.Document

If doc.DocumentType = Inventor.DocumentTypeEnum.kDrawingDocumentObject  Then
'Drawing File
MessageBox.Show("Drawing", "Title")

Else If doc.DocumentType = Inventor.DocumentTypeEnum.kPartDocumentObject  Then
'Part & Sheet Metal File
    If ThisApplication.ActiveDocument.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" = True Then
        'Sheet Metal File
        MessageBox.Show("Sheet Metal", "Title")
    Else
        'Part File
        MessageBox.Show("Part", "Title")
    End If

Else If doc.DocumentType = Inventor.DocumentTypeEnum.kAssemblyDocumentObject  Then
'Assembly File
MessageBox.Show("Assembly", "Title")

End If

iLogicVb.UpdateWhenDone = True

Rule 2

SyntaxEditor Code Snippet

 Dim doc As Document = ThisDoc.Document

Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

'Iterate through all Of the occurrences
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences.AllReferencedOccurrences(oAsmCompDef) 

    If oOccurrence.DefinitionDocumentType = kDrawingDocumentObject Then
        MessageBox.Show("Drawing", "Title")

    Else If oOccurrence.DefinitionDocumentType = kPartDocumentObject Then
        If ThisApplication.ActiveDocument.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" = True Then
            MessageBox.Show("Sheet Metal", "Title")

        Else
            MessageBox.Show("Part", "Title")

        End If
        
    Else If oOccurrence.DefinitionDocumentType = kAssemblyDocumentObject Then

    End If

Next

InventorVb.DocumentUpdate()

 

0 Likes
548 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

Hi Try this,

SyntaxEditor Code Snippet

Dim openDoc As Inventor.Document

Dim docFile As Inventor.Document

Dim docFName As String

openDoc = ThisApplication.ActiveDocument

For Each docFile In openDoc.AllReferencedDocuments

    If docFile.DocumentType = kPartDocumentObject And docfile.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'sheet metal part'
  
        docFName = (docFile.FullFileName)
           
        MessageBox.Show(docFName & " is a sheet metal part", "Parts that are Sheet Metal")
    
    End If
    
    

Next

 

0 Likes