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: 

How to link iproperties to excel - parametrically?

8 REPLIES 8
Reply
Message 1 of 9
MF6685
4478 Views, 8 Replies

How to link iproperties to excel - parametrically?

Is there a way to link any inventor file iproperties to a excel spreadsheet - so that the excel spreadsheet updates parametrically with any inventor iproperty changes.

 

I know that inventor parameters can be linked to excel, but what about iproperties?

8 REPLIES 8
Message 2 of 9
bobvdd
in reply to: MF6685

I assume you are on 2011 as you did not give any indication of the version you are working with.

Attached is a sample 2011 part file and spreadsheet. The spreadsheet is populated with all the iproperties you normally find in a part file. You can change values in the second column of the spreadsheet, save and close the spreadsheet and then save your ipt file.

This will trigger an iLogic rule that will run the macro called Import_Properties_From_Excel . The macro updates the iProperties as they can be found in the spreadsheet. The spreadsheet is linked to the part file in order to make all this work.

 

I also included another macro called Export_Properties_CSV() which allows you to create an Excel sheet from scratch with the right property names in it. You can use this second macro to setup a spreadsheet from scratch.

 

Bob

 

 




Bob Van der Donck


Principal UX designer DMG group
Message 3 of 9
bobvdd
in reply to: bobvdd

Slightly misread your intentions. You want to go in the other direction obviously. No harm done.


If you want to update the part file by changing the spreadsheet, use this existing line in the macro:

If property.Name = oWorkSheet.Cells(iRow, 1) Then property.Value = oWorkSheet.Cells(iRow, 2)

 

 


If you want to update the spreadsheet after changing iprops in the part, change above line as follows:

If property.Name = oWorkSheet.Cells(iRow, 1) Then oWorkSheet.Cells(iRow, 2) = property.Value

 

 


Bob




Bob Van der Donck


Principal UX designer DMG group
Message 4 of 9
yelhalaby
in reply to: bobvdd

when i tried your solution i received the following error message, would you please help me, I am not advanced user:

 

microsoft visual basic

compile error:

can't find project or library

 

and in the visual basic editor the following is highlighed:

 

Dim oExcel As Excel.Application

 

 

Message 5 of 9
bobvdd
in reply to: yelhalaby

Looks like you are missing the hook to Excel. If you reuse the code in a different ipt file, you will have to make sure that you load the Excel Object Library via Tools > References ... menu in the VBA editor.

 

Here is a snapshot on how it looks like on my machine after adding the library. You might have a different library number on your machine but that does not matter.

 

excel object library.JPG

 

Cheers

Bob




Bob Van der Donck


Principal UX designer DMG group
Message 6 of 9
ravikmb5
in reply to: bobvdd

How to export iproperties of an all ipt files from the  assembly file

Please mark this response as Problem Solved if it answers your question.
----------------------------------------------------------------------------------------------
Ravi Kumar MB,
i7 860 Dell Studio XPS Win 7 64 bit 12 Gb RAM & HP Z220 SFF Workstation
Autodesk Inventor Certified professional 2016
Email: ravikmb5@gmail.com





Message 7 of 9
bobvdd
in reply to: ravikmb5

Not sure what your exact wiorkflow would be if you want to export all properties from all ipt.

Do you want to have these in seperate spreadsheets or in a single spreadsheet with multiple sheets?

 

As a start here is VBA code to export all iProperties from a single ipt into a CSV file:

 

Public Sub Export_Properties_CSV()
Dim opropsets As PropertySets
Dim opropset As PropertySet
Dim property As property
Dim OutputFile As String
OutputFile = Left(ThisApplication.ActiveDocument.FullFileName, _
Len(ThisApplication.ActiveDocument.FullFileName) - 4) + "_properties.csv"
Open OutputFile For Output As #1
Set opropsets = ThisApplication.ActiveDocument.PropertySets
For Each opropset In opropsets
For Each property In opropset
On Error Resume Next
Print #1, property.Name & "," & property.value
Next property
Next opropset
Close #1
MsgBox "Properties exported to " + OutputFile
End Sub

 Cheers

Bob




Bob Van der Donck


Principal UX designer DMG group
Message 8 of 9
seanodwyer
in reply to: MF6685

Can someone update the vba code so that if i imput the text into the excel file it updates the iproperties in the ipart? Also is there anyway of avoiding the macros route. It takes a significant time. All i want to do is update the basic information by an excel file. Any help would be great.


Sean

Message 9 of 9
bobvdd
in reply to: seanodwyer

If you have an iPart , why don't you use the "Edit via Spreadsheet" context menu on your table in the browser instead?

Bob




Bob Van der Donck


Principal UX designer DMG group

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

Post to forums  

Autodesk Design & Make Report