Custom iproperties from excel to assembly

Custom iproperties from excel to assembly

berry.lejeune
Advocate Advocate
609 Views
4 Replies
Message 1 of 5

Custom iproperties from excel to assembly

berry.lejeune
Advocate
Advocate

Hello everybody,

 

I've got an excel file where I can enter some dimensions and select parts and then an assembly gets created.

In my assembly are some custom iproperties (which fill out the title block)

Is there a way that I can enter these properties in my excel and that they get transferred to my custom iproperties in my assembly?

 

Thanks

0 Likes
610 Views
4 Replies
Replies (4)
Message 2 of 5

dalton98
Collaborator
Collaborator

Yes this is possible. How are you going about getting the excel values to transfer at the moment? Are you using the 'Link' option in the parameters dialog tab? or is it a more complicated system? 

 

Can you provide the code & images?

0 Likes
Message 3 of 5

Cadkunde.nl
Collaborator
Collaborator

If its a linked or embedded excel.

The first sheet, first 4 columns are:

a) parameter name

b) value (double)

c) units

d) comments

 

If your iproperty is a integer or double, you can have value of parameter, then export parameter to iproperties

If the iproperty is text, you can use the comment field.

 

Dim oDoc As AssemblyDocument = ThisDoc.document
MsgBox(oDoc.ComponentDefinition.Parameters.DerivedParameterTables.Item(1).DerivedParameters.Item("Paramname").Comment)

 

If you are not using link or embedded, but an ilogic rule that opens an excel and read.

This is how you access iproperties:

https://modthemachine.typepad.com/my_weblog/2010/02/accessing-iproperties.html

 

Dim oDoc As Document = ThisDoc.Document
GoExcel.Open("filename.xls", "Sheet1")
oDoc.PropertySets.Item("Inventor User Defined Properties").Item("CustomName") = GoExcel.CellValue("filename.xls", "Sheet1", "A2")
GoExcel.Save
GoExcel.Close

 

0 Likes
Message 4 of 5

frederic.vandenplas
Collaborator
Collaborator

What i do is use the comment of the parameters.

I add all parameter names to custom properties. Then i loop through the iproperties and if it matches a parameter in Excel use the comment as value

If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"
0 Likes
Message 5 of 5

berry.lejeune
Advocate
Advocate

I've linked the excel file to my part. Ive got a part that gets it's dimensions from the excel file. This part is in an assembly. The part is actually just a sketch and this one drives the other parts in my assembly

Screenshot_543.png

Screenshot_544.png

 

The same excel file is also linked to the assembly for getting parts from our library. I've got 5 custom iproperties in my assembly. The same parameters I added to the excel file.

Screenshot_542.png

Now I just need to get them in the assembly

0 Likes