CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz]
Cesky English Deutsch
Login/Register:
 Visitors: 2085 

CAD tip CAD tip # 12815:

Question CAD 
 %  platform  category 
Q - question

How to fill iProperties into Inventor files from Excel?

A - answer How to bulk import iProperties, e.g. Checked by, Date checked, Design state, etc. to a whole list of drawings or Inventor model files?

You can mass-set iProperties using a simple VBA macro running in Excel. You will need the list of file names and the requested iProperty values prepared in a preset Excel table.

Run the following macro from the VBA environment in Excel. Start by adding a reference to the "Inventor Object Library" in the VBA module (see Tools > References), to be able to use the object Inventor.ApprenticeServer for writing data into iProperties in the individual Inventor files.

An example of a XLS table contents:

VBA macro code to handle the import:

Sub WriteData()
    Dim appServer As Inventor.ApprenticeServerComponent
    Set appServer = New ApprenticeServerComponent
    
    Dim oSheet As Worksheet
    Set oSheet = ThisWorkbook.ActiveSheet
    
    For i = 2 To 3 ' data in rows 2 and 3 - DO NOT FORGET TO UPDATE!
        
        Dim file As String
        Dim checkedBy As String
        Dim checkedDate As Date
        
        file = oSheet.Range("A" & i).Value ' columns A+B+C
        checkedBy = oSheet.Range("B" & i).Value
        checkedDate = oSheet.Range("C" & i).Value
        
        Dim invDoc As Inventor.ApprenticeServerDocument
        Set invDoc = appServer.Open(file)
        
        invDoc.PropertySets("{32853F0F-3444-11D1-9E93-0060B03C1CA6}")("Checked By").Value = checkedBy
        invDoc.PropertySets("{32853F0F-3444-11D1-9E93-0060B03C1CA6}")("Date Checked").Value = checkedDate
        
        invDoc.PropertySets.FlushToFile
        invDoc.Close
        
    Next
    
End Sub

An archive with sample .IPT files and a XLS table containing the VBA macro: InvXlsApp.zip (by M.Navara @CADstudio)

Inventor
100% *  CAD 
8.12.2020    682×  
applies to: Inventor ·

See also:
Tip 12451:How to fill a material or appearance name into part's iProperties?
Tip 9952:iLogic rule - check whether iProperties are overridden.
Tip 9477:Saving a DWG copy of an IDW drawing named by revision number.
Tip 9340:Using iLogic to parse IPT filename and populate iProperties.
Tip 8986:Material density as a custom iProperty in Inventor.


Back   All CAD Tips All CAD tips&tricks



Have we helped you? If you want to support the CAD Forum web service, consider buying one of our CAD applications, or our custom software development offerings, or donating via PayPal (see above). You may also add a link to your web - like this "fan" link: CAD Forum - tips, utilities, blocks for Autodesk products
CAD:    OS:    Categ: 
Text:  FAQ glossary   



Featuring:
Increase your productivity with our set of BIM add-on functions for Autodesk Revit
CADstudio Revit Tools More info


Please use these tips at your own risk.
CAD Studio is not responsible for possible problems that may occur as a result of using any of these tips.
TOPlist