Add Iproperties from spreadsheet to parts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
Short version:
I need to import Iproperties from excel into ipt files.
I have a huge assembly full of parts that I want to change the iProperties of according to information I have on a spreadsheet. (e.g. Part1 should have a property1 value of "examplestring" and a property2 value of True).
The simplest method that I came to mind is importing these properties from a CSV file (because I have the data in excel).
After the changes, I would like to export another CSV with details about the operations that were done or omitted (e.g. a column with part name, old status of iprop(existed or not), old value of iprop, new value of iprop ). This is to have it in writing which iprops were successfully changed.
Alternatively, I could use a global rule
I've written some pseudo-code:
read data from csv, import as 2D array
open all relevant docs
for each doc
for each row in 2D array
if array(row,1) is the same as doc name
set1,set2,val1a,val1b,val2a,val2b = false
if iproperty array(1,2) doesnt exist
set iprop property1
set1=true
if iproperty array(1,3) doesn't exist
set iprop property2
set2=true
if value array(row,2) is not equal to property1.value
val1a=property1.value
val1b=array(row,2)
change property1.value
if value array(row,3) is not equal to property1.value
val2a=property2.value
val2b=array(row,3)
change property2.value
export to csv:set1,set2,val1a,val1b,val2a,val2b
Would you recon this to be an efficient way of tackling this, and would this code work the way I would like it to?