Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic that tells the difference between parts and assemblies?

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
jddickson
2545 Views, 2 Replies

iLogic that tells the difference between parts and assemblies?

Is it possible to make an iLogic if statement that can tell the difference between parts and assemblies? I want to add iLogic to our (part and assembly) templates so that when placed in the drawing level the parts list description will be different. I know that this is not the proper way to do it and there are better ways but I need to know if this way is possible. I would appreciate any help that you could give.

 

Example:

At assembly level I want the description (custom I property: Description 1) to populate the parts list.  

 

At part level I want the description (custom I property: Description 2) to populate the parts list.  

 

Thanks

JD

2 REPLIES 2
Message 2 of 3
cwhetten
in reply to: jddickson

The following should get you rolling:

 

DocType = ThisDoc.Document.DocumentType

If DocType  = DocumentTypeEnum.kAssemblyDocumentObject Then
    'it's an assembly file
Else If DocType = DocumentTypeEnum.kPartDocumentObject Then
    'it's a part file
Else If DocType = DocumentTypeEnum.kDrawingDocumentObject Then
    'it's a drawing file
End If

Cameron Whetten
Inventor 2016

Message 3 of 3
MechMachineMan
in reply to: cwhetten

Alternatively:

 

Select Case ThisDoc.Document.DocumentType

Case DocumentTypeEnum.kAssemblyDocumentObject
    'it's an assembly file
Case DocumentTypeEnum.kPartDocumentObject
    'it's a part file
Case DocumentTypeEnum.kDrawingDocumentObject
    'it's a drawing file
Case Else

End Select

OR:

Select Case True 

Case ThisDoc.Document.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject
    'it's an assembly file
Case ThisDoc.Document.DocumentType = DocumentTypeEnum.kPartDocumentObject
    'it's a part file
Case ThisDoc.Document.DocumentType =DocumentTypeEnum.kDrawingDocumentObject
    'it's a drawing file
Case Else

End Select


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report