Access to iProperties in Assembly Files by VBA

Access to iProperties in Assembly Files by VBA

Anonymous
Not applicable
1,796 Views
4 Replies
Message 1 of 5

Access to iProperties in Assembly Files by VBA

Anonymous
Not applicable

Hi,

I would like read by VBA the "Part number" property in Assembly Files ("*.iam" files) in my project, but I can't find object, which give me

access to this property.

 

So far I know how to read the "Part number" in root of my project ("*.idw" file) :

 

Dim invDoc As Document
Set invDoc = ThisApplication.ActiveDocument
Dim invDesignInfo As PropertySet Set invDesignInfo = invDoc.PropertySets.Item("Design Tracking Properties") Dim invPartNumberProperty As Property Set invPartNumberProperty = invDesignInfo.Item("Part Number") MsgBox "The part number is: " & invPartNumberProperty.Value

Best regards,

Marek

 

0 Likes
Accepted solutions (1)
1,797 Views
4 Replies
Replies (4)
Message 2 of 5

MechMachineMan
Advisor
Advisor

What the code you've written actually does is get the Part Number for the ACTIVE DOCUMENT, whether it be an iam, an ipt, or an idw.

 

Regardless of what DOCUMENT you use, the code to get the properties is the same. What you are missing is telling it WHAT document that is.

 

How is the program supposed to know WHAT iam files to be pulling the iProperties from? Do you mean the iam referenced in the drawing (what if the drawing references an ipt)? Do you want it to iterate through all PROJECT locations and pull Part number information? Do you just want it to loop through one specific folder? Do you want it to go through all iams within an assembly?

 

 


--------------------------------------
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
0 Likes
Message 3 of 5

Anonymous
Not applicable
Accepted solution

 

I already know how to read "*.iam" file properties. There is my code, maybe it can be improved:

 

 Dim openDoc As Document
 Set openDoc = ThisApplication.ActiveDocument    
Dim docFile As Document Set docFile = openDoc.ReferencedDocuments(1) 'first found referenced file, it's "iam" file
MsgBox docFile.FullFileName ' show first found "iam" file path and name Set invDesignInfo = docFile.PropertySets.Item("Design Tracking Properties") 'get the part number property
Dim invProperty As Property
Set invProperty = invDesignInfo.Item("Part Number")
MsgBox "Part number: " & invProperty.Value 'show "Part Number" property of "iam" file

Best regards,

Marek

 

0 Likes
Message 4 of 5

MechMachineMan
Advisor
Advisor

Not really, looks pretty standard.

 

Was there anything else you needed, or did you answer your own question?


--------------------------------------
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
0 Likes
Message 5 of 5

Anonymous
Not applicable

If no one else offers a better solution, my code is enough for me.

0 Likes