Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

How to add drawing iproperties from an excel?

shuaib_cad
Advocate

How to add drawing iproperties from an excel?

shuaib_cad
Advocate
Advocate

I have a requirement to add iproperties (checked by, checked date, design state, etc.) for a list of drawings.

I want to add these iproperties in Inventor from an excel using vba macros.

 

Please help me to create an excel vab macro to control Inventor and perform the above operations automatically.

 

 

Regards,

Mohammed Shuaib K

Reply
Accepted solutions (1)
897 Views
8 Replies
Replies (8)

Michael.Navara
Advisor
Advisor
Accepted solution

For this task is better to start from Excel VBA. You can add reference to "Inventor Object Library" and then you can use Inventor.ApprenticeServer for writing data to iProperties. Apprentice has the best performance for this tasks.

 

Excel VBA example:

 

Sub WriteData()
    Dim appServer As Inventor.ApprenticeServerComponent
    Set appServer = New ApprenticeServerComponent
    
    Dim oSheet As Worksheet
    Set oSheet = ThisWorkbook.ActiveSheet
    
    For i = 2 To 3
        
        Dim file As String
        Dim checkedBy As String
        Dim checkedDate As Date
        
        file = oSheet.Range("A" & i).Value
        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

 

Test data preview:

Test data previewTest data preview

Add reference to Inventor in Excel VBA

2020-12-05_11-34-13.png

 

 

 

shuaib_cad
Advocate
Advocate

shuaib_cad_0-1607201265021.png

 

0 Likes

shuaib_cad
Advocate
Advocate

Getting the above error while running the code?

Please help me fix this issue.

0 Likes

Michael.Navara
Advisor
Advisor

I don't know what error you get. My code works, but omits error handling for clarity.

  • You need registered Inventor correctly.
  • Opened file must exists.
  • Opened file can't be newer then registered Inventor
0 Likes

JonnyPot
Advocate
Advocate

hello @Michael.Navara 
could you tell me where is the VBA Project - References tab is located. thank you

0 Likes

Michael.Navara
Advisor
Advisor

Full example is in attachment. Extract files to C:\Temp\*.*

Open "Data.xlsm" and included VBA project.

References tab is located here:

2020-12-07_11-38-51.png

 

JonnyPot
Advocate
Advocate

Thank you :thumbs_up:

0 Likes

quangnguyen2FWX7
Participant
Participant

Hi Bro,

When i want to change from "checked by" to other one or use custome properties, how can i do?

Many thank

0 Likes