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?
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
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
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
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.
Cheers
Bob
How to export iproperties of an all ipt files from the assembly file
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
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
If you have an iPart , why don't you use the "Edit via Spreadsheet" context menu on your table in the browser instead?
Bob
Does this work on .iam files!
I get the following error
then after clicking debug
Hi, for assembly you have declare odoc as AssemblyDocument:
...
Dim odoc As Inventor.AssemblyDocument
...
Do you find the posts helpful? "LIKE" these posts! | Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням!
Have your question been answered successfully? Click "ACCEPT SOLUTION" button. | На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ"
.