09-22-2017
12:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
09-22-2017
12:29 AM
Hi,
To test is a file is an iPart I use:
SyntaxEditor Code Snippet
Dim partDoc As PartDocument = ThisApplication.ActiveDocument If partDoc.ComponentDefinition.IsiPartFactory Or partDoc.ComponentDefinition.IsiPartMember Then MessageBox.Show("This IS an iPart", "Title") Return 'do nothing Else MessageBox.Show("This is NOT an iPart", "Title") End If
But what do I need to check if it is an iPart or an iAssembly?
I like to run some iLogic on my files, but not on the iPart or iAssembly files.
Robert
If you find this reply helpful ? It would be nice if you use the Accept as Solution or Kudos button below.
If you find this reply helpful ? It would be nice if you use the Accept as Solution or Kudos button below.
Solved! Go to Solution.
09-22-2017
06:51 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
09-22-2017
06:51 AM
Hi,
Try this :
Dim partDoc As Document = ThisApplication.ActiveDocument
If oDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
'...Assembly document
If oDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
'...part document
Alain
09-24-2017
10:25 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
09-24-2017
10:25 PM
09-25-2017
04:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
09-25-2017
04:18 AM
Found it:
SyntaxEditor Code Snippet
'Part file If oDoc.DocumentType = Inventor.DocumentTypeEnum.kPartDocumentObject And oDoc.SubType <> "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then If oDoc.ComponentDefinition.IsiPartFactory Or oDoc.ComponentDefinition.IsiPartMember Then MessageBox.Show("This is a iPart", "iPart") Return End If MessageBox.Show("This ia a Part", "Part") 'Assembly file Else If oDoc.DocumentType = Inventor.DocumentTypeEnum.kAssemblyDocumentObject Then If oDoc.ComponentDefinition.IsiAssemblyFactory Or oDoc.ComponentDefinition.IsiAssemblyMember Then MessageBox.Show("Dit is een iAssembly", "Title") Return End If MessageBox.Show("Dit is een Assembly", "Title") End If