Inventor General Discussion

Inventor General Discussion

Reply
Active Contributor
MF6685
Posts: 37
Registered: ‎10-17-2009
Message 1 of 9 (2,110 Views)

How to link iproperties to excel - parametrically?

2110 Views, 8 Replies
10-28-2010 05:04 PM

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?

Product Support
bobvdd
Posts: 577
Registered: ‎11-23-2005
Message 2 of 9 (2,063 Views)

Re: How to link iproperties to excel - parametrically?

11-01-2010 11:00 AM 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

 

 

Product Support
bobvdd
Posts: 577
Registered: ‎11-23-2005
Message 3 of 9 (2,057 Views)

Re: How to link iproperties to excel - parametrically?

11-01-2010 11:10 AM 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

New Member
yelhalaby
Posts: 1
Registered: ‎05-02-2007
Message 4 of 9 (1,726 Views)

Re: How to link iproperties to excel - parametrically?

09-16-2011 07:12 AM 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

 

 

Product Support
bobvdd
Posts: 577
Registered: ‎11-23-2005
Message 5 of 9 (1,709 Views)

Re: How to link iproperties to excel - parametrically?

09-16-2011 09:08 AM 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

Valued Mentor
ravikmb5
Posts: 313
Registered: ‎05-30-2009
Message 6 of 9 (1,700 Views)

Re: How to link iproperties to excel - parametrically?

09-16-2011 09:18 AM 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
Autodesk Inventor Certified professional 2014
Email: ravikmb5@gmail.com
Product Support
bobvdd
Posts: 577
Registered: ‎11-23-2005
Message 7 of 9 (1,661 Views)

Re: How to link iproperties to excel - parametrically?

09-19-2011 11:41 AM 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

Member
seanodwyer
Posts: 3
Registered: ‎01-18-2012
Message 8 of 9 (1,510 Views)

Re: How to link iproperties to excel - parametrically?

01-18-2012 09:13 AM 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

Product Support
bobvdd
Posts: 577
Registered: ‎11-23-2005
Message 9 of 9 (1,498 Views)

Re: How to link iproperties to excel - parametrically?

01-18-2012 11:04 AM 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

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.